Exim 4.80
[exim-website.git] / docbook / 4.80 / 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>17 May 2012</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19   <revnumber>4.80</revnumber>
20   <date>17 May 2012</date>
21   <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2012</year><holder>University of Cambridge</holder></copyright>
24 </bookinfo>
25 <chapter id="CHID1">
26 <title>Introduction</title>
27
28 <indexterm role="variable">
29   <primary>$1, $2, etc.</primary>
30   <see><emphasis>numerical variables</emphasis></see>
31 </indexterm>
32 <indexterm role="concept">
33   <primary>address</primary>
34   <secondary>rewriting</secondary>
35   <see><emphasis>rewriting</emphasis></see>
36 </indexterm>
37 <indexterm role="concept">
38   <primary>Bounce Address Tag Validation</primary>
39   <see><emphasis>BATV</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Client SMTP Authorization</primary>
43   <see><emphasis>CSA</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>CR character</primary>
47   <see><emphasis>carriage return</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CRL</primary>
51   <see><emphasis>certificate revocation list</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>delivery</primary>
55   <secondary>failure report</secondary>
56   <see><emphasis>bounce message</emphasis></see>
57 </indexterm>
58 <indexterm role="concept">
59   <primary>dialup</primary>
60   <see><emphasis>intermittently connected hosts</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>exiscan</primary>
64   <see><emphasis>content scanning</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>failover</primary>
68   <see><emphasis>fallback</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>fallover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>filter</primary>
76   <secondary>Sieve</secondary>
77   <see><emphasis>Sieve filter</emphasis></see>
78 </indexterm>
79 <indexterm role="concept">
80   <primary>ident</primary>
81   <see><emphasis>RFC 1413</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>LF character</primary>
85   <see><emphasis>linefeed</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>maximum</primary>
89   <seealso><emphasis>limit</emphasis></seealso>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>monitor</primary>
93   <see><emphasis>Exim monitor</emphasis></see>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>no_<emphasis>xxx</emphasis></primary>
97   <see>entry for xxx</see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>NUL</primary>
101   <see><emphasis>binary zero</emphasis></see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>passwd file</primary>
105   <see><emphasis>/etc/passwd</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>process id</primary>
109   <see><emphasis>pid</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>RBL</primary>
113   <see><emphasis>DNS list</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>redirection</primary>
117   <see><emphasis>address redirection</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>return path</primary>
121   <seealso><emphasis>envelope sender</emphasis></seealso>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>scanning</primary>
125   <see><emphasis>content scanning</emphasis></see>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>SSL</primary>
129   <see><emphasis>TLS</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>string</primary>
133   <secondary>expansion</secondary>
134   <see><emphasis>expansion</emphasis></see>
135 </indexterm>
136 <indexterm role="concept">
137   <primary>top bit</primary>
138   <see><emphasis>8-bit characters</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>variables</primary>
142   <see><emphasis>expansion, variables</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>zero, binary</primary>
146   <see><emphasis>binary zero</emphasis></see>
147 </indexterm>
148
149 <para>
150 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
151 Unix-like operating systems. It was designed on the assumption that it would be
152 run on hosts that are permanently connected to the Internet. However, it can be
153 used on intermittently connected hosts with suitable configuration adjustments.
154 </para>
155 <para>
156 Configuration files currently exist for the following operating systems: AIX,
157 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
158 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
159 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
160 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
161 Some of these operating systems are no longer current and cannot easily be
162 tested, so the configuration files may no longer work in practice.
163 </para>
164 <para>
165 There are also configuration files for compiling Exim in the Cygwin environment
166 that can be installed on systems running Windows. However, this document does
167 not contain any information about running Exim in the Cygwin environment.
168 </para>
169 <para>
170 The terms and conditions for the use and distribution of Exim are contained in
171 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
172 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
173 </para>
174 <para>
175 The use, supply or promotion of Exim for the purpose of sending bulk,
176 unsolicited electronic mail is incompatible with the basic aims of the program,
177 which revolve around the free provision of a service that enhances the quality
178 of personal communications. The author of Exim regards indiscriminate
179 mass-mailing as an antisocial, irresponsible abuse of the Internet.
180 </para>
181 <para>
182 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
183 experience of running and working on the Smail 3 code, I could never have
184 contemplated starting to write a new MTA. Many of the ideas and user interfaces
185 were originally taken from Smail 3, though the actual code of Exim is entirely
186 new, and has developed far beyond the initial concept.
187 </para>
188 <para>
189 Many people, both in Cambridge and around the world, have contributed to the
190 development and the testing of Exim, and to porting it to various operating
191 systems. I am grateful to them all. The distribution now contains a file called
192 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
193 contributors.
194 </para>
195 <section id="SECID1">
196 <title>Exim documentation</title>
197 <para revisionflag="changed">
198 <indexterm role="concept">
199 <primary>documentation</primary>
200 </indexterm>
201 This edition of the Exim specification applies to version 4.80 of Exim.
202 Substantive changes from the 4.75 edition are marked in some
203 renditions of the document; this paragraph is so marked if the rendition is
204 capable of showing a change indicator.
205 </para>
206 <para>
207 This document is very much a reference manual; it is not a tutorial. The reader
208 is expected to have some familiarity with the SMTP mail transfer protocol and
209 with general Unix system administration. Although there are some discussions
210 and examples in places, the information is mostly organized in a way that makes
211 it easy to look up, rather than in a natural order for sequential reading.
212 Furthermore, the manual aims to cover every aspect of Exim in detail, including
213 a number of rarely-used, special-purpose features that are unlikely to be of
214 very wide interest.
215 </para>
216 <para>
217 <indexterm role="concept">
218 <primary>books about Exim</primary>
219 </indexterm>
220 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
221 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
222 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
223 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
224 </para>
225 <para>
226 This book also contains a chapter that gives a general introduction to SMTP and
227 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
228 with the latest release of Exim. (Note that the earlier book about Exim,
229 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
230 </para>
231 <para>
232 <indexterm role="concept">
233 <primary>Debian</primary>
234 <secondary>information sources</secondary>
235 </indexterm>
236 If you are using a Debian distribution of Exim, you will find information about
237 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
239 The command <command>man update-exim.conf</command> is another source of Debian-specific
240 information.
241 </para>
242 <para>
243 <indexterm role="concept">
244 <primary><filename>doc/NewStuff</filename></primary>
245 </indexterm>
246 <indexterm role="concept">
247 <primary><filename>doc/ChangeLog</filename></primary>
248 </indexterm>
249 <indexterm role="concept">
250 <primary>change log</primary>
251 </indexterm>
252 As the program develops, there may be features in newer versions that have not
253 yet made it into this document, which is updated only when the most significant
254 digit of the fractional part of the version number changes. Specifications of
255 new features that are not yet in this manual are placed in the file
256 <filename>doc/NewStuff</filename> in the Exim distribution.
257 </para>
258 <para>
259 Some features may be classified as <quote>experimental</quote>. These may change
260 incompatibly while they are developing, or even be withdrawn. For this reason,
261 they are not documented in this manual. Information about experimental features
262 can be found in the file <filename>doc/experimental.txt</filename>.
263 </para>
264 <para>
265 All changes to the program (whether new features, bug fixes, or other kinds of
266 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
267 </para>
268 <para>
269 <indexterm role="concept">
270 <primary><filename>doc/spec.txt</filename></primary>
271 </indexterm>
272 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
273 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
274 directory are:
275 </para>
276 <informaltable frame="none">
277 <tgroup cols="2" colsep="0" rowsep="0">
278 <colspec colwidth="100pt" align="left"/>
279 <colspec colwidth="254pt" align="left"/>
280 <tbody>
281 <row>
282 <entry><filename>OptionLists.txt</filename></entry>
283 <entry>list of all options in alphabetical order</entry>
284 </row>
285 <row>
286 <entry><filename>dbm.discuss.txt</filename></entry>
287 <entry>discussion about DBM libraries</entry>
288 </row>
289 <row>
290 <entry><filename>exim.8</filename></entry>
291 <entry>a man page of Exim&#x2019;s command line options</entry>
292 </row>
293 <row>
294 <entry><filename>experimental.txt</filename></entry>
295 <entry>documentation of experimental features</entry>
296 </row>
297 <row>
298 <entry><filename>filter.txt</filename></entry>
299 <entry>specification of the filter language</entry>
300 </row>
301 <row>
302 <entry><filename>Exim3.upgrade</filename></entry>
303 <entry>upgrade notes from release 2 to release 3</entry>
304 </row>
305 <row>
306 <entry><filename>Exim4.upgrade</filename></entry>
307 <entry>upgrade notes from release 3 to release 4</entry>
308 </row>
309 </tbody>
310 </tgroup>
311 </informaltable>
312 <para>
313 The main specification and the specification of the filtering language are also
314 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
315 <xref linkend="SECTavail"/> below tells you how to get hold of these.
316 </para>
317 </section>
318 <section id="SECID2">
319 <title>FTP and web sites</title>
320 <para>
321 <indexterm role="concept">
322 <primary>web site</primary>
323 </indexterm>
324 <indexterm role="concept">
325 <primary>FTP site</primary>
326 </indexterm>
327 The primary site for Exim source distributions is currently the University of
328 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
329 distribution</emphasis> below. In addition, there is a web site and an FTP site at
330 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
331 <option>exim.org</option> site was previously hosted for a number of years by Energis
332 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
333 </para>
334 <para>
335 <indexterm role="concept">
336 <primary>wiki</primary>
337 </indexterm>
338 <indexterm role="concept">
339 <primary>FAQ</primary>
340 </indexterm>
341 As well as Exim distribution tar files, the Exim web site contains a number of
342 differently formatted versions of the documentation. A recent addition to the
343 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
344 which contains what used to be a separate FAQ, as well as various other
345 examples, tips, and know-how that have been contributed by Exim users.
346 </para>
347 <para>
348 <indexterm role="concept">
349 <primary>Bugzilla</primary>
350 </indexterm>
351 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
352 this to report bugs, and also to add items to the wish list. Please search
353 first to check that you are not duplicating a previous entry.
354 </para>
355 </section>
356 <section id="SECID3">
357 <title>Mailing lists</title>
358 <para>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
362 </indexterm>
363 The following Exim mailing lists exist:
364 </para>
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
369 <tbody>
370 <row>
371 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
372 <entry>Moderated, low volume announcements list</entry>
373 </row>
374 <row>
375 <entry><emphasis>exim-users@exim.org</emphasis></entry>
376 <entry>General discussion list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
380 <entry>Discussion of bugs, enhancements, etc.</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
384 <entry>Automated commit messages from the VCS</entry>
385 </row>
386 </tbody>
387 </tgroup>
388 </informaltable>
389 <para>
390 You can subscribe to these lists, change your existing subscriptions, and view
391 or search the archives via the mailing lists link on the Exim home page.
392 <indexterm role="concept">
393 <primary>Debian</primary>
394 <secondary>mailing list for</secondary>
395 </indexterm>
396 If you are using a Debian distribution of Exim, you may wish to subscribe to
397 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
398 via this web page:
399 </para>
400 <literallayout>
401 <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>
402 </literallayout>
403 <para>
404 Please ask Debian-specific questions on this list and not on the general Exim
405 lists.
406 </para>
407 </section>
408 <section id="SECID4">
409 <title>Exim training</title>
410 <para>
411 <indexterm role="concept">
412 <primary>training courses</primary>
413 </indexterm>
414 Training courses in Cambridge (UK) used to be run annually by the author of
415 Exim, before he retired. At the time of writing, there are no plans to run
416 further Exim courses in Cambridge. However, if that changes, relevant
417 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>.
418 </para>
419 </section>
420 <section id="SECID5">
421 <title>Bug reports</title>
422 <para>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
425 </indexterm>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
428 </indexterm>
429 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
433 </para>
434 </section>
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
437 <para>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
440 </indexterm>
441 <indexterm role="concept">
442 <primary>distribution</primary>
443 <secondary>ftp site</secondary>
444 </indexterm>
445 The master ftp site for the Exim distribution is
446 </para>
447 <literallayout>
448 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
449 </literallayout>
450 <para>
451 This is mirrored by
452 </para>
453 <literallayout>
454 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
455 </literallayout>
456 <para>
457 The file references that follow are relative to the <filename>exim</filename> directories at
458 these sites. There are now quite a number of independent mirror sites around
459 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
460 </para>
461 <para>
462 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
463 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
464 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
465 subdirectory, the current release can always be found in files called
466 </para>
467 <literallayout>
468 <filename>exim-n.nn.tar.gz</filename>
469 <filename>exim-n.nn.tar.bz2</filename>
470 </literallayout>
471 <para>
472 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
473 files contain identical data; the only difference is the type of compression.
474 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
475 </para>
476 <para>
477 <indexterm role="concept">
478 <primary>distribution</primary>
479 <secondary>signing details</secondary>
480 </indexterm>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>public key</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>public key for signed distribution</primary>
487 </indexterm>
488 The distributions are currently signed with Nigel Metheringham&#x2019;s GPG key. The
489 corresponding public key is available from a number of keyservers, and there is
490 also a copy in the file <filename>nigel-pubkey.asc</filename>. The signatures for the tar bundles are
491 in:
492 </para>
493 <literallayout>
494 <filename>exim-n.nn.tar.gz.asc</filename>
495 <filename>exim-n.nn.tar.bz2.asc</filename>
496 </literallayout>
497 <para>
498 For each released version, the log of changes is made separately available in a
499 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
500 find out what has changed without having to download the entire distribution.
501 </para>
502 <para>
503 <indexterm role="concept">
504 <primary>documentation</primary>
505 <secondary>available formats</secondary>
506 </indexterm>
507 The main distribution contains ASCII versions of this specification and other
508 documentation; other formats of the documents are available in separate files
509 inside the <filename>exim4</filename> directory of the FTP site:
510 </para>
511 <literallayout>
512 <filename>exim-html-n.nn.tar.gz</filename>
513 <filename>exim-pdf-n.nn.tar.gz</filename>
514 <filename>exim-postscript-n.nn.tar.gz</filename>
515 <filename>exim-texinfo-n.nn.tar.gz</filename>
516 </literallayout>
517 <para>
518 These tar files contain only the <filename>doc</filename> directory, not the complete
519 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
520 </para>
521 </section>
522 <section id="SECID6">
523 <title>Limitations</title>
524 <itemizedlist>
525 <listitem>
526 <para>
527 <indexterm role="concept">
528 <primary>limitations of Exim</primary>
529 </indexterm>
530 <indexterm role="concept">
531 <primary>bang paths</primary>
532 <secondary>not handled by Exim</secondary>
533 </indexterm>
534 Exim is designed for use as an Internet MTA, and therefore handles addresses in
535 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
536 simple two-component bang paths can be converted by a straightforward rewriting
537 configuration. This restriction does not prevent Exim from being interfaced to
538 UUCP as a transport mechanism, provided that domain addresses are used.
539 </para>
540 </listitem>
541 <listitem>
542 <para>
543 <indexterm role="concept">
544 <primary>domainless addresses</primary>
545 </indexterm>
546 <indexterm role="concept">
547 <primary>address</primary>
548 <secondary>without domain</secondary>
549 </indexterm>
550 Exim insists that every address it handles has a domain attached. For incoming
551 local messages, domainless addresses are automatically qualified with a
552 configured domain value. Configuration options specify from which remote
553 systems unqualified addresses are acceptable. These are then qualified on
554 arrival.
555 </para>
556 </listitem>
557 <listitem>
558 <para>
559 <indexterm role="concept">
560 <primary>transport</primary>
561 <secondary>external</secondary>
562 </indexterm>
563 <indexterm role="concept">
564 <primary>external transports</primary>
565 </indexterm>
566 The only external transport mechanisms that are currently implemented are SMTP
567 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
568 transport is available, and there are facilities for writing messages to files
569 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
570 to send messages to other transport mechanisms such as UUCP, provided they can
571 handle domain-style addresses. Batched SMTP input is also catered for.
572 </para>
573 </listitem>
574 <listitem>
575 <para>
576 Exim is not designed for storing mail for dial-in hosts. When the volumes of
577 such mail are large, it is better to get the messages <quote>delivered</quote> into files
578 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
579 other means.
580 </para>
581 </listitem>
582 <listitem>
583 <para>
584 Although Exim does have basic facilities for scanning incoming messages, these
585 are not comprehensive enough to do full virus or spam scanning. Such operations
586 are best carried out using additional specialized software packages. If you
587 compile Exim with the content-scanning extension, straightforward interfaces to
588 a number of common scanners are provided.
589 </para>
590 </listitem>
591 </itemizedlist>
592 </section>
593 <section id="SECID7">
594 <title>Run time configuration</title>
595 <para>
596 Exim&#x2019;s run time configuration is held in a single text file that is divided
597 into a number of sections. The entries in this file consist of keywords and
598 values, in the style of Smail 3 configuration files. A default configuration
599 file which is suitable for simple online installations is provided in the
600 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
601 </para>
602 </section>
603 <section id="SECID8">
604 <title>Calling interface</title>
605 <para>
606 <indexterm role="concept">
607 <primary>Sendmail compatibility</primary>
608 <secondary>command line interface</secondary>
609 </indexterm>
610 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
611 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
612 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
613 about Sendmail in order to run Exim. For actions other than sending messages,
614 Sendmail-compatible options also exist, but those that produce output (for
615 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
616 format. There are also some additional options that are compatible with Smail
617 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
618 documents all Exim&#x2019;s command line options. This information is automatically
619 made into the man page that forms part of the Exim distribution.
620 </para>
621 <para>
622 Control of messages on the queue can be done via certain privileged command
623 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
624 which displays current information in an X window, and which contains a menu
625 interface to Exim&#x2019;s command line administration options.
626 </para>
627 </section>
628 <section id="SECID9">
629 <title>Terminology</title>
630 <para>
631 <indexterm role="concept">
632 <primary>terminology definitions</primary>
633 </indexterm>
634 <indexterm role="concept">
635 <primary>body of message</primary>
636 <secondary>definition of</secondary>
637 </indexterm>
638 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
639 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
640 below) by a blank line.
641 </para>
642 <para>
643 <indexterm role="concept">
644 <primary>bounce message</primary>
645 <secondary>definition of</secondary>
646 </indexterm>
647 When a message cannot be delivered, it is normally returned to the sender in a
648 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
649 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
650 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
651 failure error report</quote>. Such messages have an empty sender address in the
652 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
653 rise to further bounce messages.
654 </para>
655 <para>
656 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
657 value which is used in the absence of any setting in the configuration. It may
658 also qualify an action which is taken unless a configuration setting specifies
659 otherwise.
660 </para>
661 <para>
662 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
663 destination cannot immediately take place for some reason (a remote host may be
664 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
665 until a later time.
666 </para>
667 <para>
668 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
669 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
670 the part of an email address following the @ sign.
671 </para>
672 <para>
673 <indexterm role="concept">
674 <primary>envelope, definition of</primary>
675 </indexterm>
676 <indexterm role="concept">
677 <primary>sender</primary>
678 <secondary>definition of</secondary>
679 </indexterm>
680 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
681 body. The envelope contains a sender address (to which bounce messages should
682 be delivered), and any number of recipient addresses. References to the
683 sender or the recipients of a message usually mean the addresses in the
684 envelope. An MTA uses these addresses for delivery, and for returning bounce
685 messages, not the addresses that appear in the header lines.
686 </para>
687 <para>
688 <indexterm role="concept">
689 <primary>message</primary>
690 <secondary>header, definition of</secondary>
691 </indexterm>
692 <indexterm role="concept">
693 <primary>header section</primary>
694 <secondary>definition of</secondary>
695 </indexterm>
696 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
697 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
698 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
699 indenting the continuations. The header is separated from the body by a blank
700 line.
701 </para>
702 <para>
703 <indexterm role="concept">
704 <primary>local part</primary>
705 <secondary>definition of</secondary>
706 </indexterm>
707 <indexterm role="concept">
708 <primary>domain</primary>
709 <secondary>definition of</secondary>
710 </indexterm>
711 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
712 part of an email address that precedes the @ sign. The part that follows the
713 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
714 </para>
715 <para>
716 <indexterm role="concept">
717 <primary>local delivery</primary>
718 <secondary>definition of</secondary>
719 </indexterm>
720 <indexterm role="concept">
721 <primary>remote delivery, definition of</primary>
722 </indexterm>
723 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
724 delivery to a file or a pipe on the local host from delivery by SMTP over
725 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
726 host it is running on are <emphasis>remote</emphasis>.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>return path</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
734 message&#x2019;s envelope.
735 </para>
736 <para>
737 <indexterm role="concept">
738 <primary>queue</primary>
739 <secondary>definition of</secondary>
740 </indexterm>
741 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
742 because this term is in widespread use in the context of MTAs. However, in
743 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
744 normally no ordering of waiting messages.
745 </para>
746 <para>
747 <indexterm role="concept">
748 <primary>queue runner</primary>
749 <secondary>definition of</secondary>
750 </indexterm>
751 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
752 and attempts to deliver those messages whose retry times have come. This term
753 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
754 the waiting messages are normally processed in an unpredictable order.
755 </para>
756 <para>
757 <indexterm role="concept">
758 <primary>spool directory</primary>
759 <secondary>definition of</secondary>
760 </indexterm>
761 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
762 messages on its queue &ndash; that is, those that it is in the process of
763 delivering. This should not be confused with the directory in which local
764 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
765 the Exim documentation, <quote>spool</quote> is always used in the first sense.
766 </para>
767 </section>
768 </chapter>
769
770 <chapter id="CHID2">
771 <title>Incorporated code</title>
772 <para>
773 <indexterm role="concept">
774 <primary>incorporated code</primary>
775 </indexterm>
776 <indexterm role="concept">
777 <primary>regular expressions</primary>
778 <secondary>library</secondary>
779 </indexterm>
780 <indexterm role="concept">
781 <primary>PCRE</primary>
782 </indexterm>
783 A number of pieces of external code are included in the Exim distribution.
784 </para>
785 <itemizedlist>
786 <listitem>
787 <para>
788 Regular expressions are supported in the main Exim program and in the
789 Exim monitor using the freely-distributable PCRE library, copyright
790 &copy; University of Cambridge. The source to PCRE is no longer shipped with
791 Exim, so you will need to use the version of PCRE shipped with your system,
792 or obtain and install the full version of the library from
793 <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>.
794 </para>
795 </listitem>
796 <listitem>
797 <para>
798 <indexterm role="concept">
799 <primary>cdb</primary>
800 <secondary>acknowledgment</secondary>
801 </indexterm>
802 Support for the cdb (Constant DataBase) lookup method is provided by code
803 contributed by Nigel Metheringham of (at the time he contributed it) Planet
804 Online Ltd. The implementation is completely contained within the code of Exim.
805 It does not link against an external cdb library. The code contains the
806 following statements:
807 </para>
808 <blockquote>
809 <para>
810 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
811 </para>
812 <para>
813 This program is free software; you can redistribute it and/or modify it under
814 the terms of the GNU General Public License as published by the Free Software
815 Foundation; either version 2 of the License, or (at your option) any later
816 version.
817 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
818 the spec and sample code for cdb can be obtained from
819 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
820 some code from Dan Bernstein&#x2019;s implementation (which has no license
821 restrictions applied to it).
822 </para>
823 </blockquote>
824 </listitem>
825 <listitem>
826 <para>
827 <indexterm role="concept">
828 <primary>SPA authentication</primary>
829 </indexterm>
830 <indexterm role="concept">
831 <primary>Samba project</primary>
832 </indexterm>
833 <indexterm role="concept">
834 <primary>Microsoft Secure Password Authentication</primary>
835 </indexterm>
836 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
837 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
838 Tom Kistner. This includes code taken from the Samba project, which is released
839 under the Gnu GPL.
840 </para>
841 </listitem>
842 <listitem>
843 <para>
844 <indexterm role="concept">
845 <primary>Cyrus</primary>
846 </indexterm>
847 <indexterm role="concept">
848 <primary><emphasis>pwcheck</emphasis> daemon</primary>
849 </indexterm>
850 <indexterm role="concept">
851 <primary><emphasis>pwauthd</emphasis> daemon</primary>
852 </indexterm>
853 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
854 by code taken from the Cyrus-SASL library and adapted by Alexander S.
855 Sabourenkov. The permission notice appears below, in accordance with the
856 conditions expressed therein.
857 </para>
858 <blockquote>
859 <para>
860 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
861 </para>
862 <para>
863 Redistribution and use in source and binary forms, with or without
864 modification, are permitted provided that the following conditions
865 are met:
866 </para>
867 <orderedlist numeration="arabic">
868 <listitem>
869 <para>
870 Redistributions of source code must retain the above copyright
871 notice, this list of conditions and the following disclaimer.
872 </para>
873 </listitem>
874 <listitem>
875 <para>
876 Redistributions in binary form must reproduce the above copyright
877 notice, this list of conditions and the following disclaimer in
878 the documentation and/or other materials provided with the
879 distribution.
880 </para>
881 </listitem>
882 <listitem>
883 <para>
884 The name <quote>Carnegie Mellon University</quote> must not be used to
885 endorse or promote products derived from this software without
886 prior written permission. For permission or any other legal
887 details, please contact
888 </para>
889 <literallayout>
890               Office of Technology Transfer
891               Carnegie Mellon University
892               5000 Forbes Avenue
893               Pittsburgh, PA  15213-3890
894               (412) 268-4387, fax: (412) 268-7395
895               tech-transfer@andrew.cmu.edu
896 </literallayout>
897 </listitem>
898 <listitem>
899 <para>
900 Redistributions of any form whatsoever must retain the following
901 acknowledgment:
902 </para>
903 <para>
904 <quote>This product includes software developed by Computing Services
905 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
906 </para>
907 <para>
908 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
909 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
910 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
911 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
912 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
913 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
914 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
915 </para>
916 </listitem>
917 </orderedlist>
918 </blockquote>
919 </listitem>
920 <listitem>
921 <para>
922 <indexterm role="concept">
923 <primary>Exim monitor</primary>
924 <secondary>acknowledgment</secondary>
925 </indexterm>
926 <indexterm role="concept">
927 <primary>X-windows</primary>
928 </indexterm>
929 <indexterm role="concept">
930 <primary>Athena</primary>
931 </indexterm>
932 The Exim Monitor program, which is an X-Window application, includes
933 modified versions of the Athena StripChart and TextPop widgets.
934 This code is copyright by DEC and MIT, and their permission notice appears
935 below, in accordance with the conditions expressed therein.
936 </para>
937 <blockquote>
938 <para>
939 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
940 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
941 </para>
942 <para>
943 All Rights Reserved
944 </para>
945 <para>
946 Permission to use, copy, modify, and distribute this software and its
947 documentation for any purpose and without fee is hereby granted,
948 provided that the above copyright notice appear in all copies and that
949 both that copyright notice and this permission notice appear in
950 supporting documentation, and that the names of Digital or MIT not be
951 used in advertising or publicity pertaining to distribution of the
952 software without specific, written prior permission.
953 </para>
954 <para>
955 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
956 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
957 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
958 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
959 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
960 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
961 SOFTWARE.
962 </para>
963 </blockquote>
964 </listitem>
965 <listitem>
966 <para>
967 Many people have contributed code fragments, some large, some small, that were
968 not covered by any specific licence requirements. It is assumed that the
969 contributors are happy to see their code incorporated into Exim under the GPL.
970 </para>
971 </listitem>
972 </itemizedlist>
973 </chapter>
974
975 <chapter id="CHID11">
976 <title>How Exim receives and delivers mail</title>
977 <titleabbrev>Receiving and delivering mail</titleabbrev>
978 <section id="SECID10">
979 <title>Overall philosophy</title>
980 <para>
981 <indexterm role="concept">
982 <primary>design philosophy</primary>
983 </indexterm>
984 Exim is designed to work efficiently on systems that are permanently connected
985 to the Internet and are handling a general mix of mail. In such circumstances,
986 most messages can be delivered immediately. Consequently, Exim does not
987 maintain independent queues of messages for specific domains or hosts, though
988 it does try to send several messages in a single SMTP connection after a host
989 has been down, and it also maintains per-host retry information.
990 </para>
991 </section>
992 <section id="SECID11">
993 <title>Policy control</title>
994 <para>
995 <indexterm role="concept">
996 <primary>policy control</primary>
997 <secondary>overview</secondary>
998 </indexterm>
999 Policy controls are now an important feature of MTAs that are connected to the
1000 Internet. Perhaps their most important job is to stop MTAs being abused as
1001 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1002 unsolicited junk, and want to disguise its source. Exim provides flexible
1003 facilities for specifying policy controls on incoming mail:
1004 </para>
1005 <itemizedlist>
1006 <listitem>
1007 <para>
1008 <indexterm role="concept">
1009 <primary>access control lists (ACLs)</primary>
1010 <secondary>introduction</secondary>
1011 </indexterm>
1012 Exim 4 (unlike previous versions of Exim) implements policy controls on
1013 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1014 series of statements that may either grant or deny access. ACLs can be used at
1015 several places in the SMTP dialogue while receiving a message from a remote
1016 host. However, the most common places are after each RCPT command, and at the
1017 very end of the message. The sysadmin can specify conditions for accepting or
1018 rejecting individual recipients or the entire message, respectively, at these
1019 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1020 error code.
1021 </para>
1022 </listitem>
1023 <listitem>
1024 <para>
1025 An ACL is also available for locally generated, non-SMTP messages. In this
1026 case, the only available actions are to accept or deny the entire message.
1027 </para>
1028 </listitem>
1029 <listitem>
1030 <para>
1031 When Exim is compiled with the content-scanning extension, facilities are
1032 provided in the ACL mechanism for passing the message to external virus and/or
1033 spam scanning software. The result of such a scan is passed back to the ACL,
1034 which can then use it to decide what to do with the message.
1035 </para>
1036 </listitem>
1037 <listitem>
1038 <para>
1039 When a message has been received, either from a remote host or from the local
1040 host, but before the final acknowledgment has been sent, a locally supplied C
1041 function called <function>local_scan()</function> can be run to inspect the message and decide
1042 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1043 is accepted, the list of recipients can be modified by the function.
1044 </para>
1045 </listitem>
1046 <listitem>
1047 <para>
1048 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1049 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1050 Exim to be compiled with the content-scanning extension.
1051 </para>
1052 </listitem>
1053 <listitem>
1054 <para>
1055 After a message has been accepted, a further checking mechanism is available in
1056 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1057 runs at the start of every delivery process.
1058 </para>
1059 </listitem>
1060 </itemizedlist>
1061 </section>
1062 <section id="SECID12">
1063 <title>User filters</title>
1064 <para>
1065 <indexterm role="concept">
1066 <primary>filter</primary>
1067 <secondary>introduction</secondary>
1068 </indexterm>
1069 <indexterm role="concept">
1070 <primary>Sieve filter</primary>
1071 </indexterm>
1072 In a conventional Exim configuration, users are able to run private filters by
1073 setting up appropriate <filename>.forward</filename> files in their home directories. See
1074 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1075 configuration needed to support this, and the separate document entitled
1076 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1077 of filtering are available:
1078 </para>
1079 <itemizedlist>
1080 <listitem>
1081 <para>
1082 Sieve filters are written in the standard filtering language that is defined
1083 by RFC 3028.
1084 </para>
1085 </listitem>
1086 <listitem>
1087 <para>
1088 Exim filters are written in a syntax that is unique to Exim, but which is more
1089 powerful than Sieve, which it pre-dates.
1090 </para>
1091 </listitem>
1092 </itemizedlist>
1093 <para>
1094 User filters are run as part of the routing process, described below.
1095 </para>
1096 </section>
1097 <section id="SECTmessiden">
1098 <title>Message identification</title>
1099 <para>
1100 <indexterm role="concept">
1101 <primary>message ids</primary>
1102 <secondary>details of format</secondary>
1103 </indexterm>
1104 <indexterm role="concept">
1105 <primary>format</primary>
1106 <secondary>of message id</secondary>
1107 </indexterm>
1108 <indexterm role="concept">
1109 <primary>id of message</primary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>base62</primary>
1113 </indexterm>
1114 <indexterm role="concept">
1115 <primary>base36</primary>
1116 </indexterm>
1117 <indexterm role="concept">
1118 <primary>Darwin</primary>
1119 </indexterm>
1120 <indexterm role="concept">
1121 <primary>Cygwin</primary>
1122 </indexterm>
1123 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1124 characters long. It is divided into three parts, separated by hyphens, for
1125 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1126 normally encoding numbers in base 62. However, in the Darwin operating
1127 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1128 (avoiding the use of lower case letters) is used instead, because the message
1129 id is used to construct file names, and the names of files in those systems are
1130 not always case-sensitive.
1131 </para>
1132 <para>
1133 <indexterm role="concept">
1134 <primary>pid (process id)</primary>
1135 <secondary>re-use of</secondary>
1136 </indexterm>
1137 The detail of the contents of the message id have changed as Exim has evolved.
1138 Earlier versions relied on the operating system not re-using a process id (pid)
1139 within one second. On modern operating systems, this assumption can no longer
1140 be made, so the algorithm had to be changed. To retain backward compatibility,
1141 the format of the message id was retained, which is why the following rules are
1142 somewhat eccentric:
1143 </para>
1144 <itemizedlist>
1145 <listitem>
1146 <para>
1147 The first six characters of the message id are the time at which the message
1148 started to be received, to a granularity of one second. That is, this field
1149 contains the number of seconds since the start of the epoch (the normal Unix
1150 way of representing the date and time of day).
1151 </para>
1152 </listitem>
1153 <listitem>
1154 <para>
1155 After the first hyphen, the next six characters are the id of the process that
1156 received the message.
1157 </para>
1158 </listitem>
1159 <listitem>
1160 <para>
1161 There are two different possibilities for the final two characters:
1162 </para>
1163 <orderedlist numeration="arabic">
1164 <listitem>
1165 <para>
1166 <indexterm role="option">
1167 <primary><option>localhost_number</option></primary>
1168 </indexterm>
1169 If <option>localhost_number</option> is not set, this value is the fractional part of the
1170 time of reception, normally in units of 1/2000 of a second, but for systems
1171 that must use base 36 instead of base 62 (because of case-insensitive file
1172 systems), the units are 1/1000 of a second.
1173 </para>
1174 </listitem>
1175 <listitem>
1176 <para>
1177 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1178 the fractional part of the time, which in this case is in units of 1/200
1179 (1/100) of a second.
1180 </para>
1181 </listitem>
1182 </orderedlist>
1183 </listitem>
1184 </itemizedlist>
1185 <para>
1186 After a message has been received, Exim waits for the clock to tick at the
1187 appropriate resolution before proceeding, so that if another message is
1188 received by the same process, or by another process with the same (re-used)
1189 pid, it is guaranteed that the time will be different. In most cases, the clock
1190 will already have ticked while the message was being received.
1191 </para>
1192 </section>
1193 <section id="SECID13">
1194 <title>Receiving mail</title>
1195 <para>
1196 <indexterm role="concept">
1197 <primary>receiving mail</primary>
1198 </indexterm>
1199 <indexterm role="concept">
1200 <primary>message</primary>
1201 <secondary>reception</secondary>
1202 </indexterm>
1203 The only way Exim can receive mail from another host is using SMTP over
1204 TCP/IP, in which case the sender and recipient addresses are transferred using
1205 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1206 there are several possibilities:
1207 </para>
1208 <itemizedlist>
1209 <listitem>
1210 <para>
1211 If the process runs Exim with the <option>-bm</option> option, the message is read
1212 non-interactively (usually via a pipe), with the recipients taken from the
1213 command line, or from the body of the message if <option>-t</option> is also used.
1214 </para>
1215 </listitem>
1216 <listitem>
1217 <para>
1218 If the process runs Exim with the <option>-bS</option> option, the message is also read
1219 non-interactively, but in this case the recipients are listed at the start of
1220 the message in a series of SMTP RCPT commands, terminated by a DATA
1221 command. This is so-called <quote>batch SMTP</quote> format,
1222 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1223 envelope addresses in a non-interactive submission.
1224 </para>
1225 </listitem>
1226 <listitem>
1227 <para>
1228 If the process runs Exim with the <option>-bs</option> option, the message is read
1229 interactively, using the SMTP protocol. A two-way pipe is normally used for
1230 passing data between the local process and the Exim process.
1231 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1232 example, the ACLs for SMTP commands are used for this form of submission.
1233 </para>
1234 </listitem>
1235 <listitem>
1236 <para>
1237 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1238 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1239 does not treat the loopback address specially. It treats all such connections
1240 in the same way as connections from other hosts.
1241 </para>
1242 </listitem>
1243 </itemizedlist>
1244 <para>
1245 <indexterm role="concept">
1246 <primary>message sender, constructed by Exim</primary>
1247 </indexterm>
1248 <indexterm role="concept">
1249 <primary>sender</primary>
1250 <secondary>constructed by Exim</secondary>
1251 </indexterm>
1252 In the three cases that do not involve TCP/IP, the sender address is
1253 constructed from the login name of the user that called Exim and a default
1254 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1255 option). For local or batch SMTP, a sender address that is passed using the
1256 SMTP MAIL command is ignored. However, the system administrator may allow
1257 certain users (<quote>trusted users</quote>) to specify a different sender address
1258 unconditionally, or all users to specify certain forms of different sender
1259 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1260 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1261 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1262 users to change sender addresses.
1263 </para>
1264 <para>
1265 Messages received by either of the non-interactive mechanisms are subject to
1266 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1267 (either over TCP/IP, or interacting with a local process) can be checked by a
1268 number of ACLs that operate at different times during the SMTP session. Either
1269 individual recipients, or the entire message, can be rejected if local policy
1270 requirements are not met. The <function>local_scan()</function> function (see chapter
1271 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1272 </para>
1273 <para>
1274 Exim can be configured not to start a delivery process when a message is
1275 received; this can be unconditional, or depend on the number of incoming SMTP
1276 connections or the system load. In these situations, new messages wait on the
1277 queue until a queue runner process picks them up. However, in standard
1278 configurations under normal conditions, delivery is started as soon as a
1279 message is received.
1280 </para>
1281 </section>
1282 <section id="SECID14">
1283 <title>Handling an incoming message</title>
1284 <para>
1285 <indexterm role="concept">
1286 <primary>spool directory</primary>
1287 <secondary>files that hold a message</secondary>
1288 </indexterm>
1289 <indexterm role="concept">
1290 <primary>file</primary>
1291 <secondary>how a message is held</secondary>
1292 </indexterm>
1293 When Exim accepts a message, it writes two files in its spool directory. The
1294 first contains the envelope information, the current status of the message, and
1295 the header lines, and the second contains the body of the message. The names of
1296 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1297 file containing the envelope and header, and <literal>-D</literal> for the data file.
1298 </para>
1299 <para>
1300 <indexterm role="concept">
1301 <primary>spool directory</primary>
1302 <secondary><filename>input</filename> sub-directory</secondary>
1303 </indexterm>
1304 By default all these message files are held in a single directory called
1305 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1306 not perform very well if the number of files in a directory gets large; to
1307 improve performance in such cases, the <option>split_spool_directory</option> option can be
1308 used. This causes Exim to split up the input files into 62 sub-directories
1309 whose names are single letters or digits. When this is done, the queue is
1310 processed one sub-directory at a time instead of all at once, which can improve
1311 overall performance even when there are not enough files in each directory to
1312 affect file system performance.
1313 </para>
1314 <para>
1315 The envelope information consists of the address of the message&#x2019;s sender and
1316 the addresses of the recipients. This information is entirely separate from
1317 any addresses contained in the header lines. The status of the message includes
1318 a list of recipients who have already received the message. The format of the
1319 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1320 </para>
1321 <para>
1322 <indexterm role="concept">
1323 <primary>rewriting</primary>
1324 <secondary>addresses</secondary>
1325 </indexterm>
1326 Address rewriting that is specified in the rewrite section of the configuration
1327 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1328 both in the header lines and the envelope, at the time the message is accepted.
1329 If during the course of delivery additional addresses are generated (for
1330 example, via aliasing), these new addresses are rewritten as soon as they are
1331 generated. At the time a message is actually delivered (transported) further
1332 rewriting can take place; because this is a transport option, it can be
1333 different for different forms of delivery. It is also possible to specify the
1334 addition or removal of certain header lines at the time the message is
1335 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1336 <xref linkend="CHAPtransportgeneric"/>).
1337 </para>
1338 </section>
1339 <section id="SECID15">
1340 <title>Life of a message</title>
1341 <para>
1342 <indexterm role="concept">
1343 <primary>message</primary>
1344 <secondary>life of</secondary>
1345 </indexterm>
1346 <indexterm role="concept">
1347 <primary>message</primary>
1348 <secondary>frozen</secondary>
1349 </indexterm>
1350 A message remains in the spool directory until it is completely delivered to
1351 its recipients or to an error address, or until it is deleted by an
1352 administrator or by the user who originally created it. In cases when delivery
1353 cannot proceed &ndash; for example, when a message can neither be delivered to its
1354 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1355 spool, and no more deliveries are attempted.
1356 </para>
1357 <para>
1358 <indexterm role="concept">
1359 <primary>frozen messages</primary>
1360 <secondary>thawing</secondary>
1361 </indexterm>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>thawing frozen</secondary>
1365 </indexterm>
1366 An administrator can <quote>thaw</quote> such messages when the problem has been
1367 corrected, and can also freeze individual messages by hand if necessary. In
1368 addition, an administrator can force a delivery error, causing a bounce message
1369 to be sent.
1370 </para>
1371 <para>
1372 <indexterm role="option">
1373 <primary><option>timeout_frozen_after</option></primary>
1374 </indexterm>
1375 <indexterm role="option">
1376 <primary><option>ignore_bounce_errors_after</option></primary>
1377 </indexterm>
1378 There are options called <option>ignore_bounce_errors_after</option> and
1379 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1380 The first applies only to frozen bounces, the second to any frozen messages.
1381 </para>
1382 <para>
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>log file for</secondary>
1386 </indexterm>
1387 <indexterm role="concept">
1388 <primary>log</primary>
1389 <secondary>file for each message</secondary>
1390 </indexterm>
1391 While Exim is working on a message, it writes information about each delivery
1392 attempt to its main log file. This includes successful, unsuccessful, and
1393 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1394 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1395 These logs are solely for the benefit of the administrator, and are normally
1396 deleted along with the spool files when processing of a message is complete.
1397 The use of individual message logs can be disabled by setting
1398 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1399 systems.
1400 </para>
1401 <para>
1402 <indexterm role="concept">
1403 <primary>journal file</primary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>file</primary>
1407 <secondary>journal</secondary>
1408 </indexterm>
1409 All the information Exim itself needs to set up a delivery is kept in the first
1410 spool file, along with the header lines. When a successful delivery occurs, the
1411 address is immediately written at the end of a journal file, whose name is the
1412 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1413 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1414 is updated to indicate which these are, and the journal file is then deleted.
1415 Updating the spool file is done by writing a new file and renaming it, to
1416 minimize the possibility of data loss.
1417 </para>
1418 <para>
1419 Should the system or the program crash after a successful delivery but before
1420 the spool file has been updated, the journal is left lying around. The next
1421 time Exim attempts to deliver the message, it reads the journal file and
1422 updates the spool file before proceeding. This minimizes the chances of double
1423 deliveries caused by crashes.
1424 </para>
1425 </section>
1426 <section id="SECTprocaddress">
1427 <title>Processing an address for delivery</title>
1428 <para>
1429 <indexterm role="concept">
1430 <primary>drivers</primary>
1431 <secondary>definition of</secondary>
1432 </indexterm>
1433 <indexterm role="concept">
1434 <primary>router</primary>
1435 <secondary>definition of</secondary>
1436 </indexterm>
1437 <indexterm role="concept">
1438 <primary>transport</primary>
1439 <secondary>definition of</secondary>
1440 </indexterm>
1441 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1442 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1443 number of them is provided in the source distribution, and compile-time options
1444 specify which ones are included in the binary. Run time options specify which
1445 ones are actually used for delivering messages.
1446 </para>
1447 <para>
1448 <indexterm role="concept">
1449 <primary>drivers</primary>
1450 <secondary>instance definition</secondary>
1451 </indexterm>
1452 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1453 of that particular driver type. Multiple instances are allowed; for example,
1454 you can set up several different <command>smtp</command> transports, each with different
1455 option values that might specify different ports or different timeouts. Each
1456 instance has its own identifying name. In what follows we will normally use the
1457 instance name when discussing one particular instance (that is, one specific
1458 configuration of the driver), and the generic driver name when discussing
1459 the driver&#x2019;s features in general.
1460 </para>
1461 <para>
1462 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1463 its delivery should happen, by assigning it to a specific transport, or
1464 converting the address into one or more new addresses (for example, via an
1465 alias file). A router may also explicitly choose to fail an address, causing it
1466 to be bounced.
1467 </para>
1468 <para>
1469 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1470 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1471 transport, the destination is a file or a pipe on the local host, whereas for a
1472 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1473 to a specific transport as a result of successful routing. If a message has
1474 several recipients, it may be passed to a number of different transports.
1475 </para>
1476 <para>
1477 <indexterm role="concept">
1478 <primary>preconditions</primary>
1479 <secondary>definition of</secondary>
1480 </indexterm>
1481 An address is processed by passing it to each configured router instance in
1482 turn, subject to certain preconditions, until a router accepts the address or
1483 specifies that it should be bounced. We will describe this process in more
1484 detail shortly. First, as a simple example, we consider how each recipient
1485 address in a message is processed in a small configuration of three routers.
1486 </para>
1487 <para>
1488 To make this a more concrete example, it is described in terms of some actual
1489 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1490 routers in many different ways, and there may be any number of routers in a
1491 configuration.
1492 </para>
1493 <para>
1494 The first router that is specified in a configuration is often one that handles
1495 addresses in domains that are not recognized specially by the local host. These
1496 are typically addresses for arbitrary domains on the Internet. A precondition
1497 is set up which looks for the special domains known to the host (for example,
1498 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1499 match. Typically, this is a router that looks up domains in the DNS in order to
1500 find the hosts to which this address routes. If it succeeds, the address is
1501 assigned to a suitable SMTP transport; if it does not succeed, the router is
1502 configured to fail the address.
1503 </para>
1504 <para>
1505 The second router is reached only when the domain is recognized as one that
1506 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1507 aliasing and forwarding. When it generates one or more new addresses from the
1508 original, each of them is routed independently from the start. Otherwise, the
1509 router may cause an address to fail, or it may simply decline to handle the
1510 address, in which case the address is passed to the next router.
1511 </para>
1512 <para>
1513 The final router in many configurations is one that checks to see if the
1514 address belongs to a local mailbox. The precondition may involve a check to
1515 see if the local part is the name of a login account, or it may look up the
1516 local part in a file or a database. If its preconditions are not met, or if
1517 the router declines, we have reached the end of the routers. When this happens,
1518 the address is bounced.
1519 </para>
1520 </section>
1521 <section id="SECID16">
1522 <title>Processing an address for verification</title>
1523 <para>
1524 <indexterm role="concept">
1525 <primary>router</primary>
1526 <secondary>for verification</secondary>
1527 </indexterm>
1528 <indexterm role="concept">
1529 <primary>verifying address</primary>
1530 <secondary>overview</secondary>
1531 </indexterm>
1532 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1533 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1534 one of the checks to be performed in an ACL for incoming messages, on both
1535 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1536 <option>-bvs</option> command line options.
1537 </para>
1538 <para>
1539 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1540 does not affect the way the routers work, but it is a state that can be
1541 detected. By this means, a router can be skipped or made to behave differently
1542 when verifying. A common example is a configuration in which the first router
1543 sends all messages to a message-scanning program, unless they have been
1544 previously scanned. Thus, the first router accepts all addresses without any
1545 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1546 would be set for such a router, causing it to be skipped in verify mode.
1547 </para>
1548 </section>
1549 <section id="SECTrunindrou">
1550 <title>Running an individual router</title>
1551 <para>
1552 <indexterm role="concept">
1553 <primary>router</primary>
1554 <secondary>running details</secondary>
1555 </indexterm>
1556 <indexterm role="concept">
1557 <primary>preconditions</primary>
1558 <secondary>checking</secondary>
1559 </indexterm>
1560 <indexterm role="concept">
1561 <primary>router</primary>
1562 <secondary>result of running</secondary>
1563 </indexterm>
1564 As explained in the example above, a number of preconditions are checked before
1565 running a router. If any are not met, the router is skipped, and the address is
1566 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1567 the router is run. What happens next depends on the outcome, which is one of
1568 the following:
1569 </para>
1570 <itemizedlist>
1571 <listitem>
1572 <para>
1573 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1574 transport, or generates one or more <quote>child</quote> addresses. Processing the
1575 original address ceases,
1576 <indexterm role="option">
1577 <primary><option>unseen</option></primary>
1578 </indexterm>
1579 unless the <option>unseen</option> option is set on the router. This option
1580 can be used to set up multiple deliveries with different routing (for example,
1581 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1582 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1583 end of routing.
1584 </para>
1585 <para>
1586 Any child addresses generated by the router are processed independently,
1587 starting with the first router by default. It is possible to change this by
1588 setting the <option>redirect_router</option> option to specify which router to start at for
1589 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1590 <option>redirect_router</option> may be anywhere in the router configuration.
1591 </para>
1592 </listitem>
1593 <listitem>
1594 <para>
1595 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1596 requests that the address be passed to another router. By default the address
1597 is passed to the next router, but this can be changed by setting the
1598 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1599 must be below the current router (to avoid loops).
1600 </para>
1601 </listitem>
1602 <listitem>
1603 <para>
1604 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1605 recognize it at all. By default, the address is passed to the next router, but
1606 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1607 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1608 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1609 </para>
1610 </listitem>
1611 <listitem>
1612 <para>
1613 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1614 the generation of a bounce message. There is no further processing of the
1615 original address unless <option>unseen</option> is set on the router.
1616 </para>
1617 </listitem>
1618 <listitem>
1619 <para>
1620 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1621 database may be offline, or a DNS lookup may have timed out.) No further
1622 processing of the address happens in this delivery attempt. It is tried again
1623 next time the message is considered for delivery.
1624 </para>
1625 </listitem>
1626 <listitem>
1627 <para>
1628 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1629 its configuration). The action is as for defer.
1630 </para>
1631 </listitem>
1632 </itemizedlist>
1633 <para>
1634 If an address reaches the end of the routers without having been accepted by
1635 any of them, it is bounced as unrouteable. The default error message in this
1636 situation is <quote>unrouteable address</quote>, but you can set your own message by
1637 making use of the <option>cannot_route_message</option> option. This can be set for any
1638 router; the value from the last router that <quote>saw</quote> the address is used.
1639 </para>
1640 <para>
1641 Sometimes while routing you want to fail a delivery when some conditions are
1642 met but others are not, instead of passing the address on for further routing.
1643 You can do this by having a second router that explicitly fails the delivery
1644 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1645 facility for this purpose.
1646 </para>
1647 </section>
1648 <section id="SECID17">
1649 <title>Duplicate addresses</title>
1650 <para>
1651 <indexterm role="concept">
1652 <primary>case of local parts</primary>
1653 </indexterm>
1654 <indexterm role="concept">
1655 <primary>address duplicate, discarding</primary>
1656 </indexterm>
1657 <indexterm role="concept">
1658 <primary>duplicate addresses</primary>
1659 </indexterm>
1660 Once routing is complete, Exim scans the addresses that are assigned to local
1661 and remote transports, and discards any duplicates that it finds. During this
1662 check, local parts are treated as case-sensitive. This happens only when
1663 actually delivering a message; when testing routers with <option>-bt</option>, all the
1664 routed addresses are shown.
1665 </para>
1666 </section>
1667 <section id="SECTrouprecon">
1668 <title>Router preconditions</title>
1669 <para>
1670 <indexterm role="concept">
1671 <primary>router</primary>
1672 <secondary>preconditions, order of processing</secondary>
1673 </indexterm>
1674 <indexterm role="concept">
1675 <primary>preconditions</primary>
1676 <secondary>order of processing</secondary>
1677 </indexterm>
1678 The preconditions that are tested for each router are listed below, in the
1679 order in which they are tested. The individual configuration options are
1680 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1681 </para>
1682 <itemizedlist>
1683 <listitem>
1684 <para>
1685 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1686 the local parts handled by the router may or must have certain prefixes and/or
1687 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1688 skipped. These conditions are tested first. When an affix is present, it is
1689 removed from the local part before further processing, including the evaluation
1690 of any other conditions.
1691 </para>
1692 </listitem>
1693 <listitem>
1694 <para>
1695 Routers can be designated for use only when not verifying an address, that is,
1696 only when routing it for delivery (or testing its delivery routing). If the
1697 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1698 address.
1699 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1700 <option>verify_recipient</option>, which independently control the use of the router for
1701 sender and recipient verification. You can set these options directly if
1702 you want a router to be used for only one type of verification.
1703 </para>
1704 </listitem>
1705 <listitem>
1706 <para>
1707 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1708 run with the <option>-bt</option> option to test an address routing. This can be helpful
1709 when the first router sends all new messages to a scanner of some sort; it
1710 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1711 having to simulate the effect of the scanner.
1712 </para>
1713 </listitem>
1714 <listitem>
1715 <para>
1716 Routers can be designated for use only when verifying an address, as
1717 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1718 </para>
1719 </listitem>
1720 <listitem>
1721 <para>
1722 Individual routers can be explicitly skipped when running the routers to
1723 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1724 </para>
1725 </listitem>
1726 <listitem>
1727 <para>
1728 If the <option>domains</option> option is set, the domain of the address must be in the set
1729 of domains that it defines.
1730 </para>
1731 </listitem>
1732 <listitem>
1733 <para>
1734 <indexterm role="variable">
1735 <primary><varname>$local_part_prefix</varname></primary>
1736 </indexterm>
1737 <indexterm role="variable">
1738 <primary><varname>$local_part</varname></primary>
1739 </indexterm>
1740 <indexterm role="variable">
1741 <primary><varname>$local_part_suffix</varname></primary>
1742 </indexterm>
1743 If the <option>local_parts</option> option is set, the local part of the address must be in
1744 the set of local parts that it defines. If <option>local_part_prefix</option> or
1745 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1746 part before this check. If you want to do precondition tests on local parts
1747 that include affixes, you can do so by using a <option>condition</option> option (see below)
1748 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1749 <varname>$local_part_suffix</varname> as necessary.
1750 </para>
1751 </listitem>
1752 <listitem>
1753 <para>
1754 <indexterm role="variable">
1755 <primary><varname>$local_user_uid</varname></primary>
1756 </indexterm>
1757 <indexterm role="variable">
1758 <primary><varname>$local_user_gid</varname></primary>
1759 </indexterm>
1760 <indexterm role="variable">
1761 <primary><varname>$home</varname></primary>
1762 </indexterm>
1763 If the <option>check_local_user</option> option is set, the local part must be the name of
1764 an account on the local host. If this check succeeds, the uid and gid of the
1765 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1766 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1767 remaining preconditions.
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1773 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1774 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1775 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1776 could lead to confusion.
1777 </para>
1778 </listitem>
1779 <listitem>
1780 <para>
1781 If the <option>senders</option> option is set, the envelope sender address must be in the
1782 set of addresses that it defines.
1783 </para>
1784 </listitem>
1785 <listitem>
1786 <para>
1787 If the <option>require_files</option> option is set, the existence or non-existence of
1788 specified files is tested.
1789 </para>
1790 </listitem>
1791 <listitem>
1792 <para>
1793 <indexterm role="concept">
1794 <primary>customizing</primary>
1795 <secondary>precondition</secondary>
1796 </indexterm>
1797 If the <option>condition</option> option is set, it is evaluated and tested. This option
1798 uses an expanded string to allow you to set up your own custom preconditions.
1799 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1800 </para>
1801 </listitem>
1802 </itemizedlist>
1803 <para>
1804 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1805 it to check for the existence of a file in which to lookup up a domain, local
1806 part, or sender. However, as these options are all expanded, you can use the
1807 <option>exists</option> expansion condition to make such tests within each condition. The
1808 <option>require_files</option> option is intended for checking files that the router may be
1809 going to use internally, or which are needed by a specific transport (for
1810 example, <filename>.procmailrc</filename>).
1811 </para>
1812 </section>
1813 <section id="SECID18">
1814 <title>Delivery in detail</title>
1815 <para>
1816 <indexterm role="concept">
1817 <primary>delivery</primary>
1818 <secondary>in detail</secondary>
1819 </indexterm>
1820 When a message is to be delivered, the sequence of events is as follows:
1821 </para>
1822 <itemizedlist>
1823 <listitem>
1824 <para>
1825 If a system-wide filter file is specified, the message is passed to it. The
1826 filter may add recipients to the message, replace the recipients, discard the
1827 message, cause a new message to be generated, or cause the message delivery to
1828 fail. The format of the system filter file is the same as for Exim user filter
1829 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1830 filtering</emphasis>.
1831 <indexterm role="concept">
1832 <primary>Sieve filter</primary>
1833 <secondary>not available for system filter</secondary>
1834 </indexterm>
1835 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1836 </para>
1837 <para>
1838 Some additional features are available in system filters &ndash; see chapter
1839 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1840 filter only once per delivery attempt, however many recipients it has. However,
1841 if there are several delivery attempts because one or more addresses could not
1842 be immediately delivered, the system filter is run each time. The filter
1843 condition <option>first_delivery</option> can be used to detect the first run of the system
1844 filter.
1845 </para>
1846 </listitem>
1847 <listitem>
1848 <para>
1849 Each recipient address is offered to each configured router in turn, subject to
1850 its preconditions, until one is able to handle it. If no router can handle the
1851 address, that is, if they all decline, the address is failed. Because routers
1852 can be targeted at particular domains, several locally handled domains can be
1853 processed entirely independently of each other.
1854 </para>
1855 </listitem>
1856 <listitem>
1857 <para>
1858 <indexterm role="concept">
1859 <primary>routing</primary>
1860 <secondary>loops in</secondary>
1861 </indexterm>
1862 <indexterm role="concept">
1863 <primary>loop</primary>
1864 <secondary>while routing</secondary>
1865 </indexterm>
1866 A router that accepts an address may assign it to a local or a remote
1867 transport. However, the transport is not run at this time. Instead, the address
1868 is placed on a list for the particular transport, which will be run later.
1869 Alternatively, the router may generate one or more new addresses (typically
1870 from alias, forward, or filter files). New addresses are fed back into this
1871 process from the top, but in order to avoid loops, a router ignores any address
1872 which has an identically-named ancestor that was processed by itself.
1873 </para>
1874 </listitem>
1875 <listitem>
1876 <para>
1877 When all the routing has been done, addresses that have been successfully
1878 handled are passed to their assigned transports. When local transports are
1879 doing real local deliveries, they handle only one address at a time, but if a
1880 local transport is being used as a pseudo-remote transport (for example, to
1881 collect batched SMTP messages for transmission by some other means) multiple
1882 addresses can be handled. Remote transports can always handle more than one
1883 address at a time, but can be configured not to do so, or to restrict multiple
1884 addresses to the same domain.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each local delivery to a file or a pipe runs in a separate process under a
1890 non-privileged uid, and these deliveries are run one at a time. Remote
1891 deliveries also run in separate processes, normally under a uid that is private
1892 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1893 run in parallel. The maximum number of simultaneous remote deliveries for any
1894 one message is set by the <option>remote_max_parallel</option> option.
1895 The order in which deliveries are done is not defined, except that all local
1896 deliveries happen before any remote deliveries.
1897 </para>
1898 </listitem>
1899 <listitem>
1900 <para>
1901 <indexterm role="concept">
1902 <primary>queue runner</primary>
1903 </indexterm>
1904 When it encounters a local delivery during a queue run, Exim checks its retry
1905 database to see if there has been a previous temporary delivery failure for the
1906 address before running the local transport. If there was a previous failure,
1907 Exim does not attempt a new delivery until the retry time for the address is
1908 reached. However, this happens only for delivery attempts that are part of a
1909 queue run. Local deliveries are always attempted when delivery immediately
1910 follows message reception, even if retry times are set for them. This makes for
1911 better behaviour if one particular message is causing problems (for example,
1912 causing quota overflow, or provoking an error in a filter file).
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 <indexterm role="concept">
1918 <primary>delivery</primary>
1919 <secondary>retry in remote transports</secondary>
1920 </indexterm>
1921 Remote transports do their own retry handling, since an address may be
1922 deliverable to one of a number of hosts, each of which may have a different
1923 retry time. If there have been previous temporary failures and no host has
1924 reached its retry time, no delivery is attempted, whether in a queue run or
1925 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1926 </para>
1927 </listitem>
1928 <listitem>
1929 <para>
1930 If there were any permanent errors, a bounce message is returned to an
1931 appropriate address (the sender in the common case), with details of the error
1932 for each failing address. Exim can be configured to send copies of bounce
1933 messages to other addresses.
1934 </para>
1935 </listitem>
1936 <listitem>
1937 <para>
1938 <indexterm role="concept">
1939 <primary>delivery</primary>
1940 <secondary>deferral</secondary>
1941 </indexterm>
1942 If one or more addresses suffered a temporary failure, the message is left on
1943 the queue, to be tried again later. Delivery of these addresses is said to be
1944 <emphasis>deferred</emphasis>.
1945 </para>
1946 </listitem>
1947 <listitem>
1948 <para>
1949 When all the recipient addresses have either been delivered or bounced,
1950 handling of the message is complete. The spool files and message log are
1951 deleted, though the message log can optionally be preserved if required.
1952 </para>
1953 </listitem>
1954 </itemizedlist>
1955 </section>
1956 <section id="SECID19">
1957 <title>Retry mechanism</title>
1958 <para>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry mechanism</secondary>
1962 </indexterm>
1963 <indexterm role="concept">
1964 <primary>retry</primary>
1965 <secondary>description of mechanism</secondary>
1966 </indexterm>
1967 <indexterm role="concept">
1968 <primary>queue runner</primary>
1969 </indexterm>
1970 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1971 attempt is the queue runner process. You must either run an Exim daemon that
1972 uses the <option>-q</option> option with a time interval to start queue runners at regular
1973 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1974 not arrange for queue runners to be run, messages that fail temporarily at the
1975 first attempt will remain on your queue for ever. A queue runner process works
1976 its way through the queue, one message at a time, trying each delivery that has
1977 passed its retry time.
1978 You can run several queue runners at once.
1979 </para>
1980 <para>
1981 Exim uses a set of configured rules to determine when next to retry the failing
1982 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1983 should give up trying to deliver to the address, at which point it generates a
1984 bounce message. If no retry rules are set for a particular host, address, and
1985 error combination, no retries are attempted, and temporary errors are treated
1986 as permanent.
1987 </para>
1988 </section>
1989 <section id="SECID20">
1990 <title>Temporary delivery failure</title>
1991 <para>
1992 <indexterm role="concept">
1993 <primary>delivery</primary>
1994 <secondary>temporary failure</secondary>
1995 </indexterm>
1996 There are many reasons why a message may not be immediately deliverable to a
1997 particular address. Failure to connect to a remote machine (because it, or the
1998 connection to it, is down) is one of the most common. Temporary failures may be
1999 detected during routing as well as during the transport stage of delivery.
2000 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2001 is on a file system where the user is over quota. Exim can be configured to
2002 impose its own quotas on local mailboxes; where system quotas are set they will
2003 also apply.
2004 </para>
2005 <para>
2006 If a host is unreachable for a period of time, a number of messages may be
2007 waiting for it by the time it recovers, and sending them in a single SMTP
2008 connection is clearly beneficial. Whenever a delivery to a remote host is
2009 deferred,
2010 <indexterm role="concept">
2011 <primary>hints database</primary>
2012 </indexterm>
2013 Exim makes a note in its hints database, and whenever a successful
2014 SMTP delivery has happened, it looks to see if any other messages are waiting
2015 for the same host. If any are found, they are sent over the same SMTP
2016 connection, subject to a configuration limit as to the maximum number in any
2017 one connection.
2018 </para>
2019 </section>
2020 <section id="SECID21">
2021 <title>Permanent delivery failure</title>
2022 <para>
2023 <indexterm role="concept">
2024 <primary>delivery</primary>
2025 <secondary>permanent failure</secondary>
2026 </indexterm>
2027 <indexterm role="concept">
2028 <primary>bounce message</primary>
2029 <secondary>when generated</secondary>
2030 </indexterm>
2031 When a message cannot be delivered to some or all of its intended recipients, a
2032 bounce message is generated. Temporary delivery failures turn into permanent
2033 errors when their timeout expires. All the addresses that fail in a given
2034 delivery attempt are listed in a single message. If the original message has
2035 many recipients, it is possible for some addresses to fail in one delivery
2036 attempt and others to fail subsequently, giving rise to more than one bounce
2037 message. The wording of bounce messages can be customized by the administrator.
2038 See chapter <xref linkend="CHAPemsgcust"/> for details.
2039 </para>
2040 <para>
2041 <indexterm role="concept">
2042 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2043 </indexterm>
2044 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2045 failed addresses, for the benefit of programs that try to analyse such messages
2046 automatically.
2047 </para>
2048 <para>
2049 <indexterm role="concept">
2050 <primary>bounce message</primary>
2051 <secondary>recipient of</secondary>
2052 </indexterm>
2053 A bounce message is normally sent to the sender of the original message, as
2054 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2055 address given in the MAIL command. However, when an address is expanded via a
2056 forward or alias file, an alternative address can be specified for delivery
2057 failures of the generated addresses. For a mailing list expansion (see section
2058 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2059 of the list.
2060 </para>
2061 </section>
2062 <section id="SECID22">
2063 <title>Failures to deliver bounce messages</title>
2064 <para>
2065 <indexterm role="concept">
2066 <primary>bounce message</primary>
2067 <secondary>failure to deliver</secondary>
2068 </indexterm>
2069 If a bounce message (either locally generated or received from a remote host)
2070 itself suffers a permanent delivery failure, the message is left on the queue,
2071 but it is frozen, awaiting the attention of an administrator. There are options
2072 that can be used to make Exim discard such failed messages, or to keep them
2073 for only a short time (see <option>timeout_frozen_after</option> and
2074 <option>ignore_bounce_errors_after</option>).
2075 </para>
2076 </section>
2077 </chapter>
2078
2079 <chapter id="CHID3">
2080 <title>Building and installing Exim</title>
2081 <para>
2082 <indexterm role="concept" id="IIDbuex" class="startofrange">
2083 <primary>building Exim</primary>
2084 </indexterm>
2085 </para>
2086 <section id="SECID23">
2087 <title>Unpacking</title>
2088 <para>
2089 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2090 creates a directory with the name of the current release (for example,
2091 <filename>exim-4.80</filename>) into which the following files are placed:
2092 </para>
2093 <informaltable frame="none">
2094 <tgroup cols="2" colsep="0" rowsep="0">
2095 <colspec colwidth="140pt" align="left"/>
2096 <colspec colwidth="254pt" align="left"/>
2097 <tbody>
2098 <row>
2099 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2100 <entry>contains some acknowledgments</entry>
2101 </row>
2102 <row>
2103 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2104 <entry>contains a reference to where changes are documented</entry>
2105 </row>
2106 <row>
2107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2108 <entry>the GNU General Public Licence</entry>
2109 </row>
2110 <row>
2111 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2112 <entry>top-level make file</entry>
2113 </row>
2114 <row>
2115 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2116 <entry>conditions for the use of Exim</entry>
2117 </row>
2118 <row>
2119 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2120 <entry>list of files, directories and simple build instructions</entry>
2121 </row>
2122 </tbody>
2123 </tgroup>
2124 </informaltable>
2125 <para>
2126 Other files whose names begin with <filename>README</filename> may also be present. The
2127 following subdirectories are created:
2128 </para>
2129 <informaltable frame="none">
2130 <tgroup cols="2" colsep="0" rowsep="0">
2131 <colspec colwidth="140pt" align="left"/>
2132 <colspec colwidth="254pt" align="left"/>
2133 <tbody>
2134 <row>
2135 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2136 <entry>an empty directory for local configuration files</entry>
2137 </row>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2140 <entry>OS-specific files</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2144 <entry>documentation files</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2148 <entry>source files for the Exim monitor</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2152 <entry>scripts used in the build process</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2156 <entry>remaining source files</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2160 <entry>independent utilities</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 The main utility programs are contained in the <filename>src</filename> directory, and are built
2167 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2168 that may be useful to some sites.
2169 </para>
2170 </section>
2171 <section id="SECID24">
2172 <title>Multiple machine architectures and operating systems</title>
2173 <para>
2174 <indexterm role="concept">
2175 <primary>building Exim</primary>
2176 <secondary>multiple OS/architectures</secondary>
2177 </indexterm>
2178 The building process for Exim is arranged to make it easy to build binaries for
2179 a number of different architectures and operating systems from the same set of
2180 source files. Compilation does not take place in the <filename>src</filename> directory.
2181 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2182 system.
2183 <indexterm role="concept">
2184 <primary>symbolic link</primary>
2185 <secondary>to build directory</secondary>
2186 </indexterm>
2187 Symbolic links to the sources are installed in this directory, which is where
2188 the actual building takes place. In most cases, Exim can discover the machine
2189 architecture and operating system for itself, but the defaults can be
2190 overridden if necessary.
2191 </para>
2192 </section>
2193 <section id="SECTpcre" revisionflag="changed">
2194 <title>PCRE library</title>
2195 <para revisionflag="changed">
2196 <indexterm role="concept">
2197 <primary>PCRE library</primary>
2198 </indexterm>
2199 Exim no longer has an embedded PCRE library as the vast majority of
2200 modern systems include PCRE as a system library, although you may need
2201 to install the PCRE or PCRE development package for your operating
2202 system. If your system has a normal PCRE installation the Exim build
2203 process will need no further configuration. If the library or the
2204 headers are in an unusual location you will need to either set the PCRE_LIBS
2205 and INCLUDE directives appropriately,
2206 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2207 If your operating system has no
2208 PCRE support then you will need to obtain and build the current PCRE
2209 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>.
2210 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2211 </para>
2212 </section>
2213 <section id="SECTdb">
2214 <title>DBM libraries</title>
2215 <para>
2216 <indexterm role="concept">
2217 <primary>DBM libraries</primary>
2218 <secondary>discussion of</secondary>
2219 </indexterm>
2220 <indexterm role="concept">
2221 <primary>hints database</primary>
2222 <secondary>DBM files used for</secondary>
2223 </indexterm>
2224 Even if you do not use any DBM files in your configuration, Exim still needs a
2225 DBM library in order to operate, because it uses indexed files for its hints
2226 databases. Unfortunately, there are a number of DBM libraries in existence, and
2227 different operating systems often have different ones installed.
2228 </para>
2229 <para>
2230 <indexterm role="concept">
2231 <primary>Solaris</primary>
2232 <secondary>DBM library for</secondary>
2233 </indexterm>
2234 <indexterm role="concept">
2235 <primary>IRIX, DBM library for</primary>
2236 </indexterm>
2237 <indexterm role="concept">
2238 <primary>BSD, DBM library for</primary>
2239 </indexterm>
2240 <indexterm role="concept">
2241 <primary>Linux, DBM library for</primary>
2242 </indexterm>
2243 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2244 Linux distribution, the DBM configuration should happen automatically, and you
2245 may be able to ignore this section. Otherwise, you may have to learn more than
2246 you would like about DBM libraries from what follows.
2247 </para>
2248 <para>
2249 <indexterm role="concept">
2250 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2251 </indexterm>
2252 Licensed versions of Unix normally contain a library of DBM functions operating
2253 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2254 versions of Unix seem to vary in what they contain as standard. In particular,
2255 some early versions of Linux have no default DBM library, and different
2256 distributors have chosen to bundle different libraries with their packaged
2257 versions. However, the more recent releases seem to have standardized on the
2258 Berkeley DB library.
2259 </para>
2260 <para>
2261 Different DBM libraries have different conventions for naming the files they
2262 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2263 possibilities:
2264 </para>
2265 <orderedlist numeration="arabic">
2266 <listitem>
2267 <para>
2268 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2269 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2270 </para>
2271 </listitem>
2272 <listitem>
2273 <para>
2274 <indexterm role="concept">
2275 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2276 </indexterm>
2277 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2278 compatibility interface it makes two different hard links to it with names
2279 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2280 file name is used unmodified.
2281 </para>
2282 </listitem>
2283 <listitem>
2284 <para>
2285 <indexterm role="concept">
2286 <primary>Berkeley DB library</primary>
2287 </indexterm>
2288 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2289 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2290 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2291 </para>
2292 </listitem>
2293 <listitem>
2294 <para>
2295 If the Berkeley package is used in its native mode, it operates on a single
2296 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2297 the traditional <emphasis>ndbm</emphasis> interface.
2298 </para>
2299 </listitem>
2300 <listitem>
2301 <para>
2302 To complicate things further, there are several very different versions of the
2303 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2304 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2305 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2306 versions of Berkeley DB can be obtained from
2307 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2308 </para>
2309 </listitem>
2310 <listitem>
2311 <para>
2312 <indexterm role="concept">
2313 <primary><emphasis>tdb</emphasis> DBM library</primary>
2314 </indexterm>
2315 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2316 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2317 operates on a single file.
2318 </para>
2319 </listitem>
2320 </orderedlist>
2321 <para>
2322 <indexterm role="concept">
2323 <primary>USE_DB</primary>
2324 </indexterm>
2325 <indexterm role="concept">
2326 <primary>DBM libraries</primary>
2327 <secondary>configuration for building</secondary>
2328 </indexterm>
2329 Exim and its utilities can be compiled to use any of these interfaces. In order
2330 to use any version of the Berkeley DB package in native mode, you must set
2331 USE_DB in an appropriate configuration file (typically
2332 <filename>Local/Makefile</filename>). For example:
2333 </para>
2334 <literallayout class="monospaced">
2335 USE_DB=yes
2336 </literallayout>
2337 <para>
2338 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2339 error is diagnosed if you set more than one of these.
2340 </para>
2341 <para>
2342 At the lowest level, the build-time configuration sets none of these options,
2343 thereby assuming an interface of type (1). However, some operating system
2344 configuration files (for example, those for the BSD operating systems and
2345 Linux) assume type (4) by setting USE_DB as their default, and the
2346 configuration files for Cygwin set USE_GDBM. Anything you set in
2347 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2348 </para>
2349 <para>
2350 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2351 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2352 in one of these lines:
2353 </para>
2354 <literallayout class="monospaced">
2355 DBMLIB = -ldb
2356 DBMLIB = -ltdb
2357 </literallayout>
2358 <para>
2359 Settings like that will work if the DBM library is installed in the standard
2360 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2361 the default path. You may need to set INCLUDE to specify where the header
2362 file is, and to specify the path to the library more fully in DBMLIB, as in
2363 this example:
2364 </para>
2365 <literallayout class="monospaced">
2366 INCLUDE=-I/usr/local/include/db-4.1
2367 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2368 </literallayout>
2369 <para>
2370 There is further detailed discussion about the various DBM libraries in the
2371 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2372 </para>
2373 </section>
2374 <section id="SECID25">
2375 <title>Pre-building configuration</title>
2376 <para>
2377 <indexterm role="concept">
2378 <primary>building Exim</primary>
2379 <secondary>pre-building configuration</secondary>
2380 </indexterm>
2381 <indexterm role="concept">
2382 <primary>configuration for building Exim</primary>
2383 </indexterm>
2384 <indexterm role="concept">
2385 <primary><filename>Local/Makefile</filename></primary>
2386 </indexterm>
2387 <indexterm role="concept">
2388 <primary><filename>src/EDITME</filename></primary>
2389 </indexterm>
2390 Before building Exim, a local configuration file that specifies options
2391 independent of any operating system has to be created with the name
2392 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2393 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2394 therein. These descriptions are therefore not repeated here. If you are
2395 building Exim for the first time, the simplest thing to do is to copy
2396 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2397 </para>
2398 <para>
2399 There are three settings that you must supply, because Exim will not build
2400 without them. They are the location of the run time configuration file
2401 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2402 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2403 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2404 a colon-separated list of file names; Exim uses the first of them that exists.
2405 </para>
2406 <para>
2407 There are a few other parameters that can be specified either at build time or
2408 at run time, to enable the same binary to be used on a number of different
2409 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2410 directory (if not within the spool directory) are fixed, it is recommended that
2411 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2412 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2413 be logged.
2414 </para>
2415 <para>
2416 <indexterm role="concept">
2417 <primary>content scanning</primary>
2418 <secondary>specifying at build time</secondary>
2419 </indexterm>
2420 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2421 access control lists are not compiled by default. If you want to include these
2422 facilities, you need to set
2423 </para>
2424 <literallayout class="monospaced">
2425 WITH_CONTENT_SCAN=yes
2426 </literallayout>
2427 <para>
2428 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2429 chapter <xref linkend="CHAPexiscan"/>.
2430 </para>
2431 <para>
2432 <indexterm role="concept">
2433 <primary><filename>Local/eximon.conf</filename></primary>
2434 </indexterm>
2435 <indexterm role="concept">
2436 <primary><filename>exim_monitor/EDITME</filename></primary>
2437 </indexterm>
2438 If you are going to build the Exim monitor, a similar configuration process is
2439 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2440 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2441 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2442 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2443 </para>
2444 <para>
2445 This is all the configuration that is needed in straightforward cases for known
2446 operating systems. However, the building process is set up so that it is easy
2447 to override options that are set by default or by operating-system-specific
2448 configuration files, for example to change the name of the C compiler, which
2449 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2450 do this.
2451 </para>
2452 </section>
2453 <section id="SECID26">
2454 <title>Support for iconv()</title>
2455 <para>
2456 <indexterm role="concept">
2457 <primary><function>iconv()</function> support</primary>
2458 </indexterm>
2459 <indexterm role="concept">
2460 <primary>RFC 2047</primary>
2461 </indexterm>
2462 The contents of header lines in messages may be encoded according to the rules
2463 described RFC 2047. This makes it possible to transmit characters that are not
2464 in the ASCII character set, and to label them as being in a particular
2465 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2466 mechanism, it decodes them, and translates them into a specified character set
2467 (default ISO-8859-1). The translation is possible only if the operating system
2468 supports the <function>iconv()</function> function.
2469 </para>
2470 <para>
2471 However, some of the operating systems that supply <function>iconv()</function> do not support
2472 very many conversions. The GNU <option>libiconv</option> library (available from
2473 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2474 systems to remedy this deficiency, as well as on systems that do not supply
2475 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2476 </para>
2477 <literallayout class="monospaced">
2478 HAVE_ICONV=yes
2479 </literallayout>
2480 <para>
2481 to your <filename>Local/Makefile</filename> and rebuild Exim.
2482 </para>
2483 </section>
2484 <section id="SECTinctlsssl">
2485 <title>Including TLS/SSL encryption support</title>
2486 <para>
2487 <indexterm role="concept">
2488 <primary>TLS</primary>
2489 <secondary>including support for TLS</secondary>
2490 </indexterm>
2491 <indexterm role="concept">
2492 <primary>encryption</primary>
2493 <secondary>including support for</secondary>
2494 </indexterm>
2495 <indexterm role="concept">
2496 <primary>SUPPORT_TLS</primary>
2497 </indexterm>
2498 <indexterm role="concept">
2499 <primary>OpenSSL</primary>
2500 <secondary>building Exim with</secondary>
2501 </indexterm>
2502 <indexterm role="concept">
2503 <primary>GnuTLS</primary>
2504 <secondary>building Exim with</secondary>
2505 </indexterm>
2506 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2507 command as per RFC 2487. It can also support legacy clients that expect to
2508 start a TLS session immediately on connection to a non-standard port (see the
2509 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2510 line option).
2511 </para>
2512 <para>
2513 If you want to build Exim with TLS support, you must first install either the
2514 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2515 implementing SSL.
2516 </para>
2517 <para>
2518 If OpenSSL is installed, you should set
2519 </para>
2520 <literallayout class="monospaced">
2521 SUPPORT_TLS=yes
2522 TLS_LIBS=-lssl -lcrypto
2523 </literallayout>
2524 <para>
2525 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2526 OpenSSL library and include files. For example:
2527 </para>
2528 <literallayout class="monospaced">
2529 SUPPORT_TLS=yes
2530 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2531 TLS_INCLUDE=-I/usr/local/openssl/include/
2532 </literallayout>
2533 <para revisionflag="changed">
2534 <indexterm role="concept">
2535 <primary>pkg-config</primary>
2536 <secondary>OpenSSL</secondary>
2537 </indexterm>
2538 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2539 </para>
2540 <literallayout class="monospaced" revisionflag="changed">
2541 SUPPORT_TLS=yes
2542 USE_OPENSSL_PC=openssl
2543 </literallayout>
2544 <para>
2545 <indexterm role="concept">
2546 <primary>USE_GNUTLS</primary>
2547 </indexterm>
2548 If GnuTLS is installed, you should set
2549 </para>
2550 <literallayout class="monospaced">
2551 SUPPORT_TLS=yes
2552 USE_GNUTLS=yes
2553 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2554 </literallayout>
2555 <para>
2556 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2557 library and include files. For example:
2558 </para>
2559 <literallayout class="monospaced">
2560 SUPPORT_TLS=yes
2561 USE_GNUTLS=yes
2562 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2563 TLS_INCLUDE=-I/usr/gnu/include
2564 </literallayout>
2565 <para revisionflag="changed">
2566 <indexterm role="concept">
2567 <primary>pkg-config</primary>
2568 <secondary>GnuTLS</secondary>
2569 </indexterm>
2570 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2571 </para>
2572 <literallayout class="monospaced" revisionflag="changed">
2573 SUPPORT_TLS=yes
2574 USE_GNUTLS=yes
2575 USE_GNUTLS_PC=gnutls
2576 </literallayout>
2577 <para>
2578 You do not need to set TLS_INCLUDE if the relevant directory is already
2579 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2580 given in chapter <xref linkend="CHAPTLS"/>.
2581 </para>
2582 </section>
2583 <section id="SECID27">
2584 <title>Use of tcpwrappers</title>
2585 <para>
2586 <indexterm role="concept">
2587 <primary>tcpwrappers, building Exim to support</primary>
2588 </indexterm>
2589 <indexterm role="concept">
2590 <primary>USE_TCP_WRAPPERS</primary>
2591 </indexterm>
2592 <indexterm role="concept">
2593 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2594 </indexterm>
2595 <indexterm role="concept">
2596 <primary>tcp_wrappers_daemon_name</primary>
2597 </indexterm>
2598 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2599 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2600 alternative to Exim&#x2019;s own checking facilities for installations that are
2601 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2602 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2603 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2604 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2605 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2606 you might have
2607 </para>
2608 <literallayout class="monospaced">
2609 USE_TCP_WRAPPERS=yes
2610 CFLAGS=-O -I/usr/local/include
2611 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2612 </literallayout>
2613 <para>
2614 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2615 files is <quote>exim</quote>. For example, the line
2616 </para>
2617 <literallayout class="monospaced">
2618 exim : LOCAL  192.168.1.  .friendly.domain.example
2619 </literallayout>
2620 <para>
2621 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2622 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2623 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2624 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2625 in <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2626 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2627 further details.
2628 </para>
2629 </section>
2630 <section id="SECID28">
2631 <title>Including support for IPv6</title>
2632 <para>
2633 <indexterm role="concept">
2634 <primary>IPv6</primary>
2635 <secondary>including support for</secondary>
2636 </indexterm>
2637 Exim contains code for use on systems that have IPv6 support. Setting
2638 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2639 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2640 where the IPv6 support is not fully integrated into the normal include and
2641 library files.
2642 </para>
2643 <para>
2644 Two different types of DNS record for handling IPv6 addresses have been
2645 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2646 currently seen as the mainstream. Another record type called A6 was proposed
2647 as better than AAAA because it had more flexibility. However, it was felt to be
2648 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2649 if anyone is actually using A6 records. Exim has support for A6 records, but
2650 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2651 support has not been tested for some time.
2652 </para>
2653 </section>
2654 <section id="SECTdynamicmodules">
2655 <title>Dynamically loaded lookup module support</title>
2656 <para>
2657 <indexterm role="concept">
2658 <primary>lookup modules</primary>
2659 </indexterm>
2660 <indexterm role="concept">
2661 <primary>dynamic modules</primary>
2662 </indexterm>
2663 <indexterm role="concept">
2664 <primary>.so building</primary>
2665 </indexterm>
2666 On some platforms, Exim supports not compiling all lookup types directly into
2667 the main binary, instead putting some into external modules which can be loaded
2668 on demand.
2669 This permits packagers to build Exim with support for lookups with extensive
2670 library dependencies without requiring all users to install all of those
2671 dependencies.
2672 Most, but not all, lookup types can be built this way.
2673 </para>
2674 <para>
2675 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2676 installed; Exim will only load modules from that directory, as a security
2677 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2678 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2679 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2680 see <filename>src/EDITME</filename> for details.
2681 </para>
2682 <para>
2683 Then, for each module to be loaded dynamically, define the relevant
2684 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2685 For example, this will build in lsearch but load sqlite and mysql support
2686 on demand:
2687 </para>
2688 <literallayout class="monospaced">
2689 LOOKUP_LSEARCH=yes
2690 LOOKUP_SQLITE=2
2691 LOOKUP_MYSQL=2
2692 </literallayout>
2693 </section>
2694 <section id="SECID29">
2695 <title>The building process</title>
2696 <para>
2697 <indexterm role="concept">
2698 <primary>build directory</primary>
2699 </indexterm>
2700 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2701 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2702 operating system types, and creates a build directory if one does not exist.
2703 For example, on a Sun system running Solaris 8, the directory
2704 <filename>build-SunOS5-5.8-sparc</filename> is created.
2705 <indexterm role="concept">
2706 <primary>symbolic link</primary>
2707 <secondary>to source files</secondary>
2708 </indexterm>
2709 Symbolic links to relevant source files are installed in the build directory.
2710 </para>
2711 <para>
2712 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2713 building process fails if it is set.
2714 </para>
2715 <para>
2716 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2717 a make file inside the build directory, using the configuration files from the
2718 <filename>Local</filename> directory. The new make file is then passed to another instance of
2719 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2720 then compiling and linking the binaries for the Exim monitor (if configured), a
2721 number of utility programs, and finally Exim itself. The command <literal>make
2722 makefile</literal> can be used to force a rebuild of the make file in the build
2723 directory, should this ever be necessary.
2724 </para>
2725 <para>
2726 If you have problems building Exim, check for any comments there may be in the
2727 <filename>README</filename> file concerning your operating system, and also take a look at the
2728 FAQ, where some common problems are covered.
2729 </para>
2730 </section>
2731 <section id="SECID283">
2732 <title>Output from <quote>make</quote></title>
2733 <para>
2734 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2735 unreadable, because these lines can be very long. For this reason, the normal
2736 output is suppressed by default, and instead output similar to that which
2737 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2738 each module that is being compiled or linked. However, it is still possible to
2739 get the full output, by calling <emphasis>make</emphasis> like this:
2740 </para>
2741 <literallayout class="monospaced">
2742 FULLECHO='' make -e
2743 </literallayout>
2744 <para>
2745 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2746 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2747 given in addition to the short output.
2748 </para>
2749 </section>
2750 <section id="SECToverride">
2751 <title>Overriding build-time options for Exim</title>
2752 <para>
2753 <indexterm role="concept">
2754 <primary>build-time options, overriding</primary>
2755 </indexterm>
2756 The main make file that is created at the beginning of the building process
2757 consists of the concatenation of a number of files which set configuration
2758 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2759 more than once, the last setting overrides any previous ones. This provides a
2760 convenient way of overriding defaults. The files that are concatenated are, in
2761 order:
2762 </para>
2763 <literallayout>
2764 <filename>OS/Makefile-Default</filename>
2765 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2766 <filename>Local/Makefile</filename>
2767 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2768 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2769 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2770 <filename>OS/Makefile-Base</filename>
2771 </literallayout>
2772 <para>
2773 <indexterm role="concept">
2774 <primary><filename>Local/Makefile</filename></primary>
2775 </indexterm>
2776 <indexterm role="concept">
2777 <primary>building Exim</primary>
2778 <secondary>operating system type</secondary>
2779 </indexterm>
2780 <indexterm role="concept">
2781 <primary>building Exim</primary>
2782 <secondary>architecture type</secondary>
2783 </indexterm>
2784 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2785 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2786 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2787 and are often not needed.
2788 </para>
2789 <para>
2790 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2791 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2792 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2793 values are used, thereby providing a means of forcing particular settings.
2794 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2795 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2796 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2797 that Exim expects. You can run these scripts directly from the shell in order
2798 to find out what values are being used on your system.
2799 </para>
2800 <para>
2801 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2802 therein. Some (but not all) are mentioned below. If there is something that
2803 needs changing, review the contents of this file and the contents of the make
2804 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2805 default values are.
2806 </para>
2807 <para>
2808 <indexterm role="concept">
2809 <primary>building Exim</primary>
2810 <secondary>overriding default settings</secondary>
2811 </indexterm>
2812 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2813 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2814 need to change the original files. Instead, you should make the changes by
2815 putting the new values in an appropriate <filename>Local</filename> file. For example,
2816 <indexterm role="concept">
2817 <primary>Tru64-Unix build-time settings</primary>
2818 </indexterm>
2819 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2820 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2821 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2822 called with the option <option>-std1</option>, to make it recognize some of the features of
2823 Standard C that Exim uses. (Most other compilers recognize Standard C by
2824 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2825 containing the lines
2826 </para>
2827 <literallayout class="monospaced">
2828 CC=cc
2829 CFLAGS=-std1
2830 </literallayout>
2831 <para>
2832 If you are compiling for just one operating system, it may be easier to put
2833 these lines directly into <filename>Local/Makefile</filename>.
2834 </para>
2835 <para>
2836 Keeping all your local configuration settings separate from the distributed
2837 files makes it easy to transfer them to new versions of Exim simply by copying
2838 the contents of the <filename>Local</filename> directory.
2839 </para>
2840 <para>
2841 <indexterm role="concept">
2842 <primary>NIS lookup type</primary>
2843 <secondary>including support for</secondary>
2844 </indexterm>
2845 <indexterm role="concept">
2846 <primary>NIS+ lookup type</primary>
2847 <secondary>including support for</secondary>
2848 </indexterm>
2849 <indexterm role="concept">
2850 <primary>LDAP</primary>
2851 <secondary>including support for</secondary>
2852 </indexterm>
2853 <indexterm role="concept">
2854 <primary>lookup</primary>
2855 <secondary>inclusion in binary</secondary>
2856 </indexterm>
2857 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2858 lookup, but not all systems have these components installed, so the default is
2859 not to include the relevant code in the binary. All the different kinds of file
2860 and database lookup that Exim supports are implemented as separate code modules
2861 which are included only if the relevant compile-time options are set. In the
2862 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2863 </para>
2864 <literallayout class="monospaced">
2865 LOOKUP_LDAP=yes
2866 LOOKUP_NIS=yes
2867 LOOKUP_NISPLUS=yes
2868 </literallayout>
2869 <para>
2870 and similar settings apply to the other lookup types. They are all listed in
2871 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2872 libraries need to be installed before compiling Exim.
2873 <indexterm role="concept">
2874 <primary>cdb</primary>
2875 <secondary>including support for</secondary>
2876 </indexterm>
2877 However, there are some optional lookup types (such as cdb) for which
2878 the code is entirely contained within Exim, and no external include
2879 files or libraries are required. When a lookup type is not included in the
2880 binary, attempts to configure Exim to use it cause run time configuration
2881 errors.
2882 </para>
2883 <para revisionflag="changed">
2884 <indexterm role="concept">
2885 <primary>pkg-config</primary>
2886 <secondary>lookups</secondary>
2887 </indexterm>
2888 <indexterm role="concept">
2889 <primary>pkg-config</primary>
2890 <secondary>authenticators</secondary>
2891 </indexterm>
2892 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2893 about how to compile against a library; Exim has some initial support for
2894 being able to use pkg-config for lookups and authenticators.  For any given
2895 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2896 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2897 name of the package to be queried.  The results of querying via the
2898 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2899 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2900 syntax.  For instance:
2901 </para>
2902 <literallayout class="monospaced" revisionflag="changed">
2903 LOOKUP_SQLITE=yes
2904 LOOKUP_SQLITE_PC=sqlite3
2905 AUTH_GSASL=yes
2906 AUTH_GSASL_PC=libgsasl
2907 AUTH_HEIMDAL_GSSAPI=yes
2908 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2909 </literallayout>
2910 <para>
2911 <indexterm role="concept">
2912 <primary>Perl</primary>
2913 <secondary>including support for</secondary>
2914 </indexterm>
2915 Exim can be linked with an embedded Perl interpreter, allowing Perl
2916 subroutines to be called during string expansion. To enable this facility,
2917 </para>
2918 <literallayout class="monospaced">
2919 EXIM_PERL=perl.o
2920 </literallayout>
2921 <para>
2922 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2923 chapter <xref linkend="CHAPperl"/>.
2924 </para>
2925 <para>
2926 <indexterm role="concept">
2927 <primary>X11 libraries, location of</primary>
2928 </indexterm>
2929 The location of the X11 libraries is something that varies a lot between
2930 operating systems, and there may be different versions of X11 to cope
2931 with. Exim itself makes no use of X11, but if you are compiling the Exim
2932 monitor, the X11 libraries must be available.
2933 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2934 </para>
2935 <literallayout class="monospaced">
2936 X11=/usr/X11R6
2937 XINCLUDE=-I$(X11)/include
2938 XLFLAGS=-L$(X11)/lib
2939 </literallayout>
2940 <para>
2941 These are overridden in some of the operating-system configuration files. For
2942 example, in <filename>OS/Makefile-SunOS5</filename> there is
2943 </para>
2944 <literallayout class="monospaced">
2945 X11=/usr/openwin
2946 XINCLUDE=-I$(X11)/include
2947 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2948 </literallayout>
2949 <para>
2950 If you need to override the default setting for your operating system, place a
2951 definition of all three of these variables into your
2952 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2953 </para>
2954 <para>
2955 <indexterm role="concept">
2956 <primary>EXTRALIBS</primary>
2957 </indexterm>
2958 If you need to add any extra libraries to the link steps, these can be put in a
2959 variable called EXTRALIBS, which appears in all the link commands, but by
2960 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2961 command for linking the main Exim binary, and not for any associated utilities.
2962 </para>
2963 <para>
2964 <indexterm role="concept">
2965 <primary>DBM libraries</primary>
2966 <secondary>configuration for building</secondary>
2967 </indexterm>
2968 There is also DBMLIB, which appears in the link commands for binaries that
2969 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2970 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2971 binary, and which can be used, for example, to include additional X11
2972 libraries.
2973 </para>
2974 <para>
2975 <indexterm role="concept">
2976 <primary>configuration file</primary>
2977 <secondary>editing</secondary>
2978 </indexterm>
2979 The make file copes with rebuilding Exim correctly if any of the configuration
2980 files are edited. However, if an optional configuration file is deleted, it is
2981 necessary to touch the associated non-optional file (that is,
2982 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2983 </para>
2984 </section>
2985 <section id="SECID30">
2986 <title>OS-specific header files</title>
2987 <para>
2988 <indexterm role="concept">
2989 <primary><filename>os.h</filename></primary>
2990 </indexterm>
2991 <indexterm role="concept">
2992 <primary>building Exim</primary>
2993 <secondary>OS-specific C header files</secondary>
2994 </indexterm>
2995 The <filename>OS</filename> directory contains a number of files with names of the form
2996 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2997 normally need to be changed. There is a list of macro settings that are
2998 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2999 are porting Exim to a new operating system.
3000 </para>
3001 </section>
3002 <section id="SECID31">
3003 <title>Overriding build-time options for the monitor</title>
3004 <para>
3005 <indexterm role="concept">
3006 <primary>building Eximon</primary>
3007 </indexterm>
3008 A similar process is used for overriding things when building the Exim monitor,
3009 where the files that are involved are
3010 </para>
3011 <literallayout>
3012 <filename>OS/eximon.conf-Default</filename>
3013 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3014 <filename>Local/eximon.conf</filename>
3015 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3016 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3017 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3018 </literallayout>
3019 <para>
3020 <indexterm role="concept">
3021 <primary><filename>Local/eximon.conf</filename></primary>
3022 </indexterm>
3023 As with Exim itself, the final three files need not exist, and in this case the
3024 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3025 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3026 variables of the same name, preceded by EXIMON_. For example, setting
3027 EXIMON_LOG_DEPTH in the environment overrides the value of
3028 LOG_DEPTH at run time.
3029 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3030 </para>
3031 </section>
3032 <section id="SECID32">
3033 <title>Installing Exim binaries and scripts</title>
3034 <para>
3035 <indexterm role="concept">
3036 <primary>installing Exim</primary>
3037 </indexterm>
3038 <indexterm role="concept">
3039 <primary>BIN_DIRECTORY</primary>
3040 </indexterm>
3041 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3042 arguments. The script copies binaries and utility scripts into the directory
3043 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3044 <indexterm role="concept">
3045 <primary>setuid</primary>
3046 <secondary>installing Exim with</secondary>
3047 </indexterm>
3048 The install script copies files only if they are newer than the files they are
3049 going to replace. The Exim binary is required to be owned by root and have the
3050 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3051 install</literal> as root so that it can set up the Exim binary in this way. However, in
3052 some special situations (for example, if a host is doing no local deliveries)
3053 it may be possible to run Exim without making the binary setuid root (see
3054 chapter <xref linkend="CHAPsecurity"/> for details).
3055 </para>
3056 <para>
3057 <indexterm role="concept">
3058 <primary>CONFIGURE_FILE</primary>
3059 </indexterm>
3060 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3061 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3062 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3063 by the installation script. If a run time configuration file already exists, it
3064 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3065 alternative files, no default is installed.
3066 </para>
3067 <para>
3068 <indexterm role="concept">
3069 <primary>system aliases file</primary>
3070 </indexterm>
3071 <indexterm role="concept">
3072 <primary><filename>/etc/aliases</filename></primary>
3073 </indexterm>
3074 One change is made to the default configuration file when it is installed: the
3075 default configuration contains a router that references a system aliases file.
3076 The path to this file is set to the value specified by
3077 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3078 If the system aliases file does not exist, the installation script creates it,
3079 and outputs a comment to the user.
3080 </para>
3081 <para>
3082 The created file contains no aliases, but it does contain comments about the
3083 aliases a site should normally have. Mail aliases have traditionally been
3084 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3085 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3086 Exim&#x2019;s configuration if necessary.
3087 </para>
3088 <para>
3089 The default configuration uses the local host&#x2019;s name as the only local domain,
3090 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3091 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3092 directories are supported, but no NIS or NIS+ support is configured. Domains
3093 other than the name of the local host are routed using the DNS, with delivery
3094 over SMTP.
3095 </para>
3096 <para>
3097 It is possible to install Exim for special purposes (such as building a binary
3098 distribution) in a private part of the file system. You can do this by a
3099 command such as
3100 </para>
3101 <literallayout class="monospaced">
3102 make DESTDIR=/some/directory/ install
3103 </literallayout>
3104 <para>
3105 This has the effect of pre-pending the specified directory to all the file
3106 paths, except the name of the system aliases file that appears in the default
3107 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3108 For backwards compatibility, ROOT is used if DESTDIR is not set,
3109 but this usage is deprecated.
3110 </para>
3111 <para>
3112 <indexterm role="concept">
3113 <primary>installing Exim</primary>
3114 <secondary>what is not installed</secondary>
3115 </indexterm>
3116 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3117 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3118 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3119 directory are copied, except for the info files when you have set
3120 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3121 </para>
3122 <para>
3123 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3124 to their names. The Exim binary itself, however, is handled differently. It is
3125 installed under a name that includes the version number and the compile number,
3126 for example <filename>exim-4.80-1</filename>. The script then arranges for a symbolic link
3127 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3128 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3129 from the directory (as seen by other processes).
3130 </para>
3131 <para>
3132 <indexterm role="concept">
3133 <primary>installing Exim</primary>
3134 <secondary>testing the script</secondary>
3135 </indexterm>
3136 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3137 real, you can pass the <option>-n</option> option to the installation script by this
3138 command:
3139 </para>
3140 <literallayout class="monospaced">
3141 make INSTALL_ARG=-n install
3142 </literallayout>
3143 <para>
3144 The contents of the variable INSTALL_ARG are passed to the installation
3145 script. You do not need to be root to run this test. Alternatively, you can run
3146 the installation script directly, but this must be from within the build
3147 directory. For example, from the top-level Exim directory you could use this
3148 command:
3149 </para>
3150 <literallayout class="monospaced">
3151 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3152 </literallayout>
3153 <para>
3154 <indexterm role="concept">
3155 <primary>installing Exim</primary>
3156 <secondary>install script options</secondary>
3157 </indexterm>
3158 There are two other options that can be supplied to the installation script.
3159 </para>
3160 <itemizedlist>
3161 <listitem>
3162 <para>
3163 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3164 to root, and the call to make it a setuid binary.
3165 </para>
3166 </listitem>
3167 <listitem>
3168 <para>
3169 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3170 installed binary.
3171 </para>
3172 </listitem>
3173 </itemizedlist>
3174 <para>
3175 INSTALL_ARG can be used to pass these options to the script. For example:
3176 </para>
3177 <literallayout class="monospaced">
3178 make INSTALL_ARG=-no_symlink install
3179 </literallayout>
3180 <para>
3181 The installation script can also be given arguments specifying which files are
3182 to be copied. For example, to install just the Exim binary, and nothing else,
3183 without creating the symbolic link, you could use:
3184 </para>
3185 <literallayout class="monospaced">
3186 make INSTALL_ARG='-no_symlink exim' install
3187 </literallayout>
3188 </section>
3189 <section id="SECTinsinfdoc">
3190 <title>Installing info documentation</title>
3191 <para>
3192 <indexterm role="concept">
3193 <primary>installing Exim</primary>
3194 <secondary><emphasis>info</emphasis> documentation</secondary>
3195 </indexterm>
3196 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3197 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3198 distribution. Instead it is available separately from the ftp site (see section
3199 <xref linkend="SECTavail"/>).
3200 </para>
3201 <para>
3202 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3203 source of the documentation is found in the source tree, running <literal>make
3204 install</literal> automatically builds the info files and installs them.
3205 </para>
3206 </section>
3207 <section id="SECID33">
3208 <title>Setting up the spool directory</title>
3209 <para>
3210 <indexterm role="concept">
3211 <primary>spool directory</primary>
3212 <secondary>creating</secondary>
3213 </indexterm>
3214 When it starts up, Exim tries to create its spool directory if it does not
3215 exist. The Exim uid and gid are used for the owner and group of the spool
3216 directory. Sub-directories are automatically created in the spool directory as
3217 necessary.
3218 </para>
3219 </section>
3220 <section id="SECID34">
3221 <title>Testing</title>
3222 <para>
3223 <indexterm role="concept">
3224 <primary>testing</primary>
3225 <secondary>installation</secondary>
3226 </indexterm>
3227 Having installed Exim, you can check that the run time configuration file is
3228 syntactically valid by running the following command, which assumes that the
3229 Exim binary directory is within your PATH environment variable:
3230 </para>
3231 <literallayout class="monospaced">
3232 exim -bV
3233 </literallayout>
3234 <para>
3235 If there are any errors in the configuration file, Exim outputs error messages.
3236 Otherwise it outputs the version number and build date,
3237 the DBM library that is being used, and information about which drivers and
3238 other optional code modules are included in the binary.
3239 Some simple routing tests can be done by using the address testing option. For
3240 example,
3241 </para>
3242 <literallayout>
3243 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3244 </literallayout>
3245 <para>
3246 should verify that it recognizes a local mailbox, and
3247 </para>
3248 <literallayout>
3249 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3250 </literallayout>
3251 <para>
3252 a remote one. Then try getting it to deliver mail, both locally and remotely.
3253 This can be done by passing messages directly to Exim, without going through a
3254 user agent. For example:
3255 </para>
3256 <literallayout class="monospaced">
3257 exim -v postmaster@your.domain.example
3258 From: user@your.domain.example
3259 To: postmaster@your.domain.example
3260 Subject: Testing Exim
3261
3262 This is a test message.
3263 ^D
3264 </literallayout>
3265 <para>
3266 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3267 In this case you should see copies of three log lines, one for the message&#x2019;s
3268 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3269 </para>
3270 <para>
3271 <indexterm role="concept">
3272 <primary>delivery</primary>
3273 <secondary>problems with</secondary>
3274 </indexterm>
3275 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3276 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3277 of information is running Exim with debugging turned on, by specifying the
3278 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3279 with debugging turned on by a command of the form
3280 </para>
3281 <literallayout>
3282 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3283 </literallayout>
3284 <para>
3285 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3286 produces rather a lot of output, but you can cut this down to specific areas.
3287 For example, if you use <option>-d-all+route</option> only the debugging information
3288 relevant to routing is included. (See the <option>-d</option> option in chapter
3289 <xref linkend="CHAPcommandline"/> for more details.)
3290 </para>
3291 <para>
3292 <indexterm role="concept">
3293 <primary><quote>sticky</quote> bit</primary>
3294 </indexterm>
3295 <indexterm role="concept">
3296 <primary>lock files</primary>
3297 </indexterm>
3298 One specific problem that has shown up on some sites is the inability to do
3299 local deliveries into a shared mailbox directory, because it does not have the
3300 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3301 writing to a mailbox file, and if it cannot create the lock file, the delivery
3302 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3303 directory, or by setting a specific group for local deliveries and allowing
3304 that group to create files in the directory (see the comments above the
3305 <command>local_delivery</command> transport in the default configuration file). Another
3306 approach is to configure Exim not to use lock files, but just to rely on
3307 <function>fcntl()</function> locking instead. However, you should do this only if all user
3308 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3309 see chapter <xref linkend="CHAPappendfile"/>.
3310 </para>
3311 <para>
3312 One thing that cannot be tested on a system that is already running an MTA is
3313 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3314 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3315 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3316 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3317 incoming SMTP mail.
3318 </para>
3319 <para>
3320 Testing a new version on a system that is already running Exim can most easily
3321 be done by building a binary with a different CONFIGURE_FILE setting. From
3322 within the run time configuration, all other file and directory names
3323 that Exim uses can be altered, in order to keep it entirely clear of the
3324 production version.
3325 </para>
3326 </section>
3327 <section id="SECID35">
3328 <title>Replacing another MTA with Exim</title>
3329 <para>
3330 <indexterm role="concept">
3331 <primary>replacing another MTA</primary>
3332 </indexterm>
3333 Building and installing Exim for the first time does not of itself put it in
3334 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3335 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3336 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3337 binary in order to get the user agents to pass messages to Exim. This is
3338 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3339 or <filename>/usr/lib/sendmail</filename>
3340 <indexterm role="concept">
3341 <primary>symbolic link</primary>
3342 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3343 </indexterm>
3344 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3345 privilege and executable status from the old MTA. It is then necessary to stop
3346 and restart the mailer daemon, if one is running.
3347 </para>
3348 <para>
3349 <indexterm role="concept">
3350 <primary>FreeBSD, MTA indirection</primary>
3351 </indexterm>
3352 <indexterm role="concept">
3353 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3354 </indexterm>
3355 Some operating systems have introduced alternative ways of switching MTAs. For
3356 example, if you are running FreeBSD, you need to edit the file
3357 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3358 described. A typical example of the contents of this file for running Exim is
3359 as follows:
3360 </para>
3361 <literallayout class="monospaced">
3362 sendmail            /usr/exim/bin/exim
3363 send-mail           /usr/exim/bin/exim
3364 mailq               /usr/exim/bin/exim -bp
3365 newaliases          /usr/bin/true
3366 </literallayout>
3367 <para>
3368 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3369 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3370 favourite user agent.
3371 </para>
3372 <para>
3373 You should consider what to tell your users about the change of MTA. Exim may
3374 have different capabilities to what was previously running, and there are
3375 various operational differences such as the text of messages produced by
3376 command line options and in bounce messages. If you allow your users to make
3377 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3378 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3379 </para>
3380 </section>
3381 <section id="SECID36">
3382 <title>Upgrading Exim</title>
3383 <para>
3384 <indexterm role="concept">
3385 <primary>upgrading Exim</primary>
3386 </indexterm>
3387 If you are already running Exim on your host, building and installing a new
3388 version automatically makes it available to MUAs, or any other programs that
3389 call the MTA directly. However, if you are running an Exim daemon, you do need
3390 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3391 new binary. You do not need to stop processing mail in order to install a new
3392 version of Exim. The install script does not modify an existing runtime
3393 configuration file.
3394 </para>
3395 </section>
3396 <section id="SECID37">
3397 <title>Stopping the Exim daemon on Solaris</title>
3398 <para>
3399 <indexterm role="concept">
3400 <primary>Solaris</primary>
3401 <secondary>stopping Exim on</secondary>
3402 </indexterm>
3403 The standard command for stopping the mailer daemon on Solaris is
3404 </para>
3405 <literallayout class="monospaced">
3406 /etc/init.d/sendmail stop
3407 </literallayout>
3408 <para>
3409 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3410 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3411 for the text <quote>sendmail</quote>; this is not present because the actual program name
3412 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3413 solution is to replace the line that finds the process id with something like
3414 </para>
3415 <literallayout class="monospaced">
3416 pid=`cat /var/spool/exim/exim-daemon.pid`
3417 </literallayout>
3418 <para>
3419 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3420 </para>
3421 <para>
3422 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3423 still be received from local processes, and if automatic delivery is configured
3424 (the normal case), deliveries will still occur.
3425 </para>
3426 </section>
3427 </chapter>
3428
3429 <chapter id="CHAPcommandline">
3430 <title>The Exim command line</title>
3431 <para>
3432 <indexterm role="concept" id="IIDclo1" class="startofrange">
3433 <primary>command line</primary>
3434 <secondary>options</secondary>
3435 </indexterm>
3436 <indexterm role="concept" id="IIDclo2" class="startofrange">
3437 <primary>options</primary>
3438 <secondary>command line</secondary>
3439 </indexterm>
3440 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3441 each starting with a hyphen character, followed by a number of arguments. The
3442 options are compatible with the main options of Sendmail, and there are also
3443 some additional options, some of which are compatible with Smail 3. Certain
3444 combinations of options do not make sense, and provoke an error if used.
3445 The form of the arguments depends on which options are set.
3446 </para>
3447 <section id="SECID38">
3448 <title>Setting options by program name</title>
3449 <para>
3450 <indexterm role="concept">
3451 <primary><emphasis>mailq</emphasis></primary>
3452 </indexterm>
3453 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3454 were present before any other options.
3455 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3456 standard output.
3457 This feature is for compatibility with some systems that contain a command of
3458 that name in one of the standard libraries, symbolically linked to
3459 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3460 </para>
3461 <para>
3462 <indexterm role="concept">
3463 <primary><emphasis>rsmtp</emphasis></primary>
3464 </indexterm>
3465 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3466 were present before any other options, for compatibility with Smail. The
3467 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3468 format.
3469 </para>
3470 <para>
3471 <indexterm role="concept">
3472 <primary><emphasis>rmail</emphasis></primary>
3473 </indexterm>
3474 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3475 <option>-oee</option> options were present before any other options, for compatibility with
3476 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3477 </para>
3478 <para>
3479 <indexterm role="concept">
3480 <primary><emphasis>runq</emphasis></primary>
3481 </indexterm>
3482 <indexterm role="concept">
3483 <primary>queue runner</primary>
3484 </indexterm>
3485 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3486 were present before any other options, for compatibility with Smail. The <option>-q</option>
3487 option causes a single queue runner process to be started.
3488 </para>
3489 <para>
3490 <indexterm role="concept">
3491 <primary><emphasis>newaliases</emphasis></primary>
3492 </indexterm>
3493 <indexterm role="concept">
3494 <primary>alias file</primary>
3495 <secondary>building</secondary>
3496 </indexterm>
3497 <indexterm role="concept">
3498 <primary>Sendmail compatibility</primary>
3499 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3500 </indexterm>
3501 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3502 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3503 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3504 the concept of a single alias file, but can be configured to run a given
3505 command if called with the <option>-bi</option> option.
3506 </para>
3507 </section>
3508 <section id="SECTtrustedadmin">
3509 <title>Trusted and admin users</title>
3510 <para>
3511 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3512 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3513 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3514 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3515 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3516 </para>
3517 <itemizedlist>
3518 <listitem>
3519 <para>
3520 <indexterm role="concept">
3521 <primary>trusted users</primary>
3522 <secondary>definition of</secondary>
3523 </indexterm>
3524 <indexterm role="concept">
3525 <primary>user</primary>
3526 <secondary>trusted definition of</secondary>
3527 </indexterm>
3528 The trusted users are root, the Exim user, any user listed in the
3529 <option>trusted_users</option> configuration option, and any user whose current group or any
3530 supplementary group is one of those listed in the <option>trusted_groups</option>
3531 configuration option. Note that the Exim group is not automatically trusted.
3532 </para>
3533 <para>
3534 <indexterm role="concept">
3535 <primary><quote>From</quote> line</primary>
3536 </indexterm>
3537 <indexterm role="concept">
3538 <primary>envelope sender</primary>
3539 </indexterm>
3540 Trusted users are always permitted to use the <option>-f</option> option or a leading
3541 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3542 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3543 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3544 users to set envelope senders.
3545 </para>
3546 <para>
3547 <indexterm role="concept">
3548 <primary><emphasis>From:</emphasis> header line</primary>
3549 </indexterm>
3550 <indexterm role="concept">
3551 <primary><emphasis>Sender:</emphasis> header line</primary>
3552 </indexterm>
3553 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3554 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3555 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3556 </para>
3557 <para>
3558 Trusted users may also specify a host name, host address, interface address,
3559 protocol name, ident value, and authentication data when submitting a message
3560 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3561 have the characteristics of messages received from a remote host. Untrusted
3562 users may in some circumstances use <option>-f</option>, but can never set the other values
3563 that are available to trusted users.
3564 </para>
3565 </listitem>
3566 <listitem>
3567 <para>
3568 <indexterm role="concept">
3569 <primary>user</primary>
3570 <secondary>admin definition of</secondary>
3571 </indexterm>
3572 <indexterm role="concept">
3573 <primary>admin user</primary>
3574 <secondary>definition of</secondary>
3575 </indexterm>
3576 The admin users are root, the Exim user, and any user that is a member of the
3577 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3578 The current group does not have to be one of these groups.
3579 </para>
3580 <para>
3581 Admin users are permitted to list the queue, and to carry out certain
3582 operations on messages, for example, to force delivery failures. It is also
3583 necessary to be an admin user in order to see the full information provided by
3584 the Exim monitor, and full debugging output.
3585 </para>
3586 <para>
3587 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3588 Exim to attempt delivery of messages on its queue is restricted to admin users.
3589 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3590 option false (that is, specifying <option>no_prod_requires_admin</option>).
3591 </para>
3592 <para>
3593 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3594 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3595 false.
3596 </para>
3597 </listitem>
3598 </itemizedlist>
3599 <para>
3600 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3601 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3602 getting root. There is further discussion of this issue at the start of chapter
3603 <xref linkend="CHAPconf"/>.
3604 </para>
3605 </section>
3606 <section id="SECID39">
3607 <title>Command line options</title>
3608 <para>
3609 Exim&#x2019;s command line options are described in alphabetical order below. If none
3610 of the options that specifies a specific action (such as starting the daemon or
3611 a queue runner, or testing an address, or receiving a message in a specific
3612 format, or listing the queue) are present, and there is at least one argument
3613 on the command line, <option>-bm</option> (accept a local message on the standard input,
3614 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3615 outputs a brief message about itself and exits.
3616 </para>
3617 <!-- === Start of command line options === -->
3618 <variablelist>
3619 <varlistentry>
3620 <term><option>--</option></term>
3621 <listitem>
3622 <para>
3623 <indexterm role="option">
3624 <primary>--</primary>
3625 </indexterm>
3626 <indexterm role="concept">
3627 <primary>options</primary>
3628 <secondary>command line; terminating</secondary>
3629 </indexterm>
3630 This is a pseudo-option whose only purpose is to terminate the options and
3631 therefore to cause subsequent command line items to be treated as arguments
3632 rather than options, even if they begin with hyphens.
3633 </para>
3634 </listitem></varlistentry>
3635 <varlistentry>
3636 <term><option>--help</option></term>
3637 <listitem>
3638 <para>
3639 <indexterm role="option">
3640 <primary><option>--help</option></primary>
3641 </indexterm>
3642 This option causes Exim to output a few sentences stating what it is.
3643 The same output is generated if the Exim binary is called with no options and
3644 no arguments.
3645 </para>
3646 </listitem></varlistentry>
3647 <varlistentry>
3648 <term><option>--version</option></term>
3649 <listitem>
3650 <para>
3651 <indexterm role="option">
3652 <primary><option>--version</option></primary>
3653 </indexterm>
3654 This option is an alias for <option>-bV</option> and causes version information to be
3655 displayed.
3656 </para>
3657 </listitem></varlistentry>
3658 <varlistentry>
3659 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3660 <listitem>
3661 <para>
3662 <indexterm role="option">
3663 <primary><option>-B</option></primary>
3664 </indexterm>
3665 <indexterm role="concept">
3666 <primary>8-bit characters</primary>
3667 </indexterm>
3668 <indexterm role="concept">
3669 <primary>Sendmail compatibility</primary>
3670 <secondary>8-bit characters</secondary>
3671 </indexterm>
3672 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3673 clean; it ignores this option.
3674 </para>
3675 </listitem></varlistentry>
3676 <varlistentry>
3677 <term><option>-bd</option></term>
3678 <listitem>
3679 <para>
3680 <indexterm role="option">
3681 <primary><option>-bd</option></primary>
3682 </indexterm>
3683 <indexterm role="concept">
3684 <primary>daemon</primary>
3685 </indexterm>
3686 <indexterm role="concept">
3687 <primary>SMTP</primary>
3688 <secondary>listener</secondary>
3689 </indexterm>
3690 <indexterm role="concept">
3691 <primary>queue runner</primary>
3692 </indexterm>
3693 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3694 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3695 that the daemon should also initiate periodic queue runs.
3696 </para>
3697 <para>
3698 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3699 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3700 disconnect from the controlling terminal. When running this way, it can be
3701 stopped by pressing ctrl-C.
3702 </para>
3703 <para>
3704 By default, Exim listens for incoming connections to the standard SMTP port on
3705 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3706 ports, on multiple ports, and only on specific interfaces. Chapter
3707 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3708 </para>
3709 <para>
3710 When a listening daemon
3711 <indexterm role="concept">
3712 <primary>daemon</primary>
3713 <secondary>process id (pid)</secondary>
3714 </indexterm>
3715 <indexterm role="concept">
3716 <primary>pid (process id)</primary>
3717 <secondary>of daemon</secondary>
3718 </indexterm>
3719 is started without the use of <option>-oX</option> (that is, without overriding the normal
3720 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3721 in Exim&#x2019;s spool directory. This location can be overridden by setting
3722 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3723 running as root.
3724 </para>
3725 <para>
3726 When <option>-oX</option> is used on the command line to start a listening daemon, the
3727 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3728 used to specify a path on the command line if a pid file is required.
3729 </para>
3730 <para>
3731 The SIGHUP signal
3732 <indexterm role="concept">
3733 <primary>SIGHUP</primary>
3734 </indexterm>
3735 <indexterm role="concept">
3736 <primary>daemon</primary>
3737 <secondary>restarting</secondary>
3738 </indexterm>
3739 can be used to cause the daemon to re-execute itself. This should be done
3740 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3741 means of the <option>.include</option> facility, is changed, and also whenever a new version
3742 of Exim is installed. It is not necessary to do this when other files that are
3743 referenced from the configuration (for example, alias files) are changed,
3744 because these are reread each time they are used.
3745 </para>
3746 </listitem></varlistentry>
3747 <varlistentry>
3748 <term><option>-bdf</option></term>
3749 <listitem>
3750 <para>
3751 <indexterm role="option">
3752 <primary><option>-bdf</option></primary>
3753 </indexterm>
3754 This option has the same effect as <option>-bd</option> except that it never disconnects
3755 from the controlling terminal, even when no debugging is specified.
3756 </para>
3757 </listitem></varlistentry>
3758 <varlistentry>
3759 <term><option>-be</option></term>
3760 <listitem>
3761 <para>
3762 <indexterm role="option">
3763 <primary><option>-be</option></primary>
3764 </indexterm>
3765 <indexterm role="concept">
3766 <primary>testing</primary>
3767 <secondary>string expansion</secondary>
3768 </indexterm>
3769 <indexterm role="concept">
3770 <primary>expansion</primary>
3771 <secondary>testing</secondary>
3772 </indexterm>
3773 Run Exim in expansion testing mode. Exim discards its root privilege, to
3774 prevent ordinary users from using this mode to read otherwise inaccessible
3775 files. If no arguments are given, Exim runs interactively, prompting for lines
3776 of data. Otherwise, it processes each argument in turn.
3777 </para>
3778 <para>
3779 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3780 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3781 used without command line arguments. If successful, it uses the <function>readline()</function>
3782 function, which provides extensive line-editing facilities, for reading the
3783 test data. A line history is supported.
3784 </para>
3785 <para>
3786 Long expansion expressions can be split over several lines by using backslash
3787 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3788 continuation lines is ignored. Each argument or data line is passed through the
3789 string expansion mechanism, and the result is output. Variable values from the
3790 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3791 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3792 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3793 </para>
3794 <para>
3795 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3796 files or databases you are using, you must exit and restart Exim before trying
3797 the same lookup again. Otherwise, because each Exim process caches the results
3798 of lookups, you will just get the same result as before.
3799 </para>
3800 </listitem></varlistentry>
3801 <varlistentry>
3802 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3803 <listitem>
3804 <para>
3805 <indexterm role="option">
3806 <primary><option>-bem</option></primary>
3807 </indexterm>
3808 <indexterm role="concept">
3809 <primary>testing</primary>
3810 <secondary>string expansion</secondary>
3811 </indexterm>
3812 <indexterm role="concept">
3813 <primary>expansion</primary>
3814 <secondary>testing</secondary>
3815 </indexterm>
3816 This option operates like <option>-be</option> except that it must be followed by the name
3817 of a file. For example:
3818 </para>
3819 <literallayout class="monospaced">
3820 exim -bem /tmp/testmessage
3821 </literallayout>
3822 <para>
3823 The file is read as a message (as if receiving a locally-submitted non-SMTP
3824 message) before any of the test expansions are done. Thus, message-specific
3825 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3826 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3827 recipients are read from the headers in the normal way, and are shown in the
3828 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3829 line, because further arguments are taken as strings to expand (just like
3830 <option>-be</option>).
3831 </para>
3832 </listitem></varlistentry>
3833 <varlistentry>
3834 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3835 <listitem>
3836 <para>
3837 <indexterm role="option">
3838 <primary><option>-bF</option></primary>
3839 </indexterm>
3840 <indexterm role="concept">
3841 <primary>system filter</primary>
3842 <secondary>testing</secondary>
3843 </indexterm>
3844 <indexterm role="concept">
3845 <primary>testing</primary>
3846 <secondary>system filter</secondary>
3847 </indexterm>
3848 This option is the same as <option>-bf</option> except that it assumes that the filter being
3849 tested is a system filter. The additional commands that are available only in
3850 system filters are recognized.
3851 </para>
3852 </listitem></varlistentry>
3853 <varlistentry>
3854 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3855 <listitem>
3856 <para>
3857 <indexterm role="option">
3858 <primary><option>-bf</option></primary>
3859 </indexterm>
3860 <indexterm role="concept">
3861 <primary>filter</primary>
3862 <secondary>testing</secondary>
3863 </indexterm>
3864 <indexterm role="concept">
3865 <primary>testing</primary>
3866 <secondary>filter file</secondary>
3867 </indexterm>
3868 <indexterm role="concept">
3869 <primary>forward file</primary>
3870 <secondary>testing</secondary>
3871 </indexterm>
3872 <indexterm role="concept">
3873 <primary>testing</primary>
3874 <secondary>forward file</secondary>
3875 </indexterm>
3876 <indexterm role="concept">
3877 <primary>Sieve filter</primary>
3878 <secondary>testing</secondary>
3879 </indexterm>
3880 This option runs Exim in user filter testing mode; the file is the filter file
3881 to be tested, and a test message must be supplied on the standard input. If
3882 there are no message-dependent tests in the filter, an empty file can be
3883 supplied.
3884 </para>
3885 <para>
3886 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3887 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3888 filter and a user filter in the same run. For example:
3889 </para>
3890 <literallayout class="monospaced">
3891 exim -bF /system/filter -bf /user/filter &lt;/test/message
3892 </literallayout>
3893 <para>
3894 This is helpful when the system filter adds header lines or sets filter
3895 variables that are used by the user filter.
3896 </para>
3897 <para>
3898 If the test filter file does not begin with one of the special lines
3899 </para>
3900 <literallayout class="monospaced">
3901 # Exim filter
3902 # Sieve filter
3903 </literallayout>
3904 <para>
3905 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3906 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3907 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3908 redirection lists.
3909 </para>
3910 <para>
3911 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3912 detected, is a list of the actions that Exim would try to take if presented
3913 with the message for real. More details of filter testing are given in the
3914 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3915 </para>
3916 <para>
3917 When testing a filter file,
3918 <indexterm role="concept">
3919 <primary><quote>From</quote> line</primary>
3920 </indexterm>
3921 <indexterm role="concept">
3922 <primary>envelope sender</primary>
3923 </indexterm>
3924 <indexterm role="option">
3925 <primary><option>-f</option></primary>
3926 <secondary>for filter testing</secondary>
3927 </indexterm>
3928 the envelope sender can be set by the <option>-f</option> option,
3929 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3930 that would normally be taken from the envelope recipient address of the message
3931 can be set by means of additional command line options (see the next four
3932 options).
3933 </para>
3934 </listitem></varlistentry>
3935 <varlistentry>
3936 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3937 <listitem>
3938 <para>
3939 <indexterm role="option">
3940 <primary><option>-bfd</option></primary>
3941 </indexterm>
3942 <indexterm role="variable">
3943 <primary><varname>$qualify_domain</varname></primary>
3944 </indexterm>
3945 This sets the domain of the recipient address when a filter file is being
3946 tested by means of the <option>-bf</option> option. The default is the value of
3947 <varname>$qualify_domain</varname>.
3948 </para>
3949 </listitem></varlistentry>
3950 <varlistentry>
3951 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3952 <listitem>
3953 <para>
3954 <indexterm role="option">
3955 <primary><option>-bfl</option></primary>
3956 </indexterm>
3957 This sets the local part of the recipient address when a filter file is being
3958 tested by means of the <option>-bf</option> option. The default is the username of the
3959 process that calls Exim. A local part should be specified with any prefix or
3960 suffix stripped, because that is how it appears to the filter when a message is
3961 actually being delivered.
3962 </para>
3963 </listitem></varlistentry>
3964 <varlistentry>
3965 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3966 <listitem>
3967 <para>
3968 <indexterm role="option">
3969 <primary><option>-bfp</option></primary>
3970 </indexterm>
3971 This sets the prefix of the local part of the recipient address when a filter
3972 file is being tested by means of the <option>-bf</option> option. The default is an empty
3973 prefix.
3974 </para>
3975 </listitem></varlistentry>
3976 <varlistentry>
3977 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3978 <listitem>
3979 <para>
3980 <indexterm role="option">
3981 <primary><option>-bfs</option></primary>
3982 </indexterm>
3983 This sets the suffix of the local part of the recipient address when a filter
3984 file is being tested by means of the <option>-bf</option> option. The default is an empty
3985 suffix.
3986 </para>
3987 </listitem></varlistentry>
3988 <varlistentry>
3989 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3990 <listitem>
3991 <para>
3992 <indexterm role="option">
3993 <primary><option>-bh</option></primary>
3994 </indexterm>
3995 <indexterm role="concept">
3996 <primary>testing</primary>
3997 <secondary>incoming SMTP</secondary>
3998 </indexterm>
3999 <indexterm role="concept">
4000 <primary>SMTP</primary>
4001 <secondary>testing incoming</secondary>
4002 </indexterm>
4003 <indexterm role="concept">
4004 <primary>testing</primary>
4005 <secondary>relay control</secondary>
4006 </indexterm>
4007 <indexterm role="concept">
4008 <primary>relaying</primary>
4009 <secondary>testing configuration</secondary>
4010 </indexterm>
4011 <indexterm role="concept">
4012 <primary>policy control</primary>
4013 <secondary>testing</secondary>
4014 </indexterm>
4015 <indexterm role="concept">
4016 <primary>debugging</primary>
4017 <secondary><option>-bh</option> option</secondary>
4018 </indexterm>
4019 This option runs a fake SMTP session as if from the given IP address, using the
4020 standard input and output. The IP address may include a port number at the end,
4021 after a full stop. For example:
4022 </para>
4023 <literallayout class="monospaced">
4024 exim -bh 10.9.8.7.1234
4025 exim -bh fe80::a00:20ff:fe86:a061.5678
4026 </literallayout>
4027 <para>
4028 When an IPv6 address is given, it is converted into canonical form. In the case
4029 of the second example above, the value of <varname>$sender_host_address</varname> after
4030 conversion to the canonical form is
4031 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4032 </para>
4033 <para>
4034 Comments as to what is going on are written to the standard error file. These
4035 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4036 This facility is provided for testing configuration options for incoming
4037 messages, to make sure they implement the required policy. For example, you can
4038 test your relay controls using <option>-bh</option>.
4039 </para>
4040 <para>
4041 <emphasis role="bold">Warning 1</emphasis>:
4042 <indexterm role="concept">
4043 <primary>RFC 1413</primary>
4044 </indexterm>
4045 You can test features of the configuration that rely on ident (RFC 1413)
4046 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4047 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4048 connection.
4049 </para>
4050 <para>
4051 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4052 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4053 occur, use <option>-bhc</option> instead.
4054 </para>
4055 <para>
4056 Messages supplied during the testing session are discarded, and nothing is
4057 written to any of the real log files. There may be pauses when DNS (and other)
4058 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4059 can be used to specify a specific IP interface and port if this is important,
4060 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4061 session were authenticated.
4062 </para>
4063 <para>
4064 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4065 output just states whether a given recipient address from a given host is
4066 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4067 </para>
4068 <para>
4069 Features such as authentication and encryption, where the client input is not
4070 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4071 specialized SMTP test program such as
4072 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4073 </para>
4074 </listitem></varlistentry>
4075 <varlistentry>
4076 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4077 <listitem>
4078 <para>
4079 <indexterm role="option">
4080 <primary><option>-bhc</option></primary>
4081 </indexterm>
4082 This option operates in the same way as <option>-bh</option>, except that address
4083 verification callouts are performed if required. This includes consulting and
4084 updating the callout cache database.
4085 </para>
4086 </listitem></varlistentry>
4087 <varlistentry>
4088 <term><option>-bi</option></term>
4089 <listitem>
4090 <para>
4091 <indexterm role="option">
4092 <primary><option>-bi</option></primary>
4093 </indexterm>
4094 <indexterm role="concept">
4095 <primary>alias file</primary>
4096 <secondary>building</secondary>
4097 </indexterm>
4098 <indexterm role="concept">
4099 <primary>building alias file</primary>
4100 </indexterm>
4101 <indexterm role="concept">
4102 <primary>Sendmail compatibility</primary>
4103 <secondary><option>-bi</option> option</secondary>
4104 </indexterm>
4105 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4106 Exim does not have the concept of a single alias file, and so it cannot mimic
4107 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4108 tend to appear in various scripts such as NIS make files, so the option must be
4109 recognized.
4110 </para>
4111 <para>
4112 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4113 configuration option is run, under the uid and gid of the caller of Exim. If
4114 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4115 The command set by <option>bi_command</option> may not contain arguments. The command can
4116 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4117 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4118 <option>-bi</option> is a no-op.
4119 </para>
4120 </listitem></varlistentry>
4121 <varlistentry>
4122 <term><option>-bm</option></term>
4123 <listitem>
4124 <para>
4125 <indexterm role="option">
4126 <primary><option>-bm</option></primary>
4127 </indexterm>
4128 <indexterm role="concept">
4129 <primary>local message reception</primary>
4130 </indexterm>
4131 This option runs an Exim receiving process that accepts an incoming,
4132 locally-generated message on the current input. The recipients are given as the
4133 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4134 argument can be a comma-separated list of RFC 2822 addresses. This is the
4135 default option for selecting the overall action of an Exim call; it is assumed
4136 if no other conflicting option is present.
4137 </para>
4138 <para>
4139 If any addresses in the message are unqualified (have no domain), they are
4140 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4141 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4142 suppressing this for special cases.
4143 </para>
4144 <para>
4145 Policy checks on the contents of local messages can be enforced by means of
4146 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4147 </para>
4148 <para>
4149 <indexterm role="concept">
4150 <primary>return code</primary>
4151 <secondary>for <option>-bm</option></secondary>
4152 </indexterm>
4153 The return code is zero if the message is successfully accepted. Otherwise, the
4154 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4155 </para>
4156 <para>
4157 The format
4158 <indexterm role="concept">
4159 <primary>message</primary>
4160 <secondary>format</secondary>
4161 </indexterm>
4162 <indexterm role="concept">
4163 <primary>format</primary>
4164 <secondary>message</secondary>
4165 </indexterm>
4166 <indexterm role="concept">
4167 <primary><quote>From</quote> line</primary>
4168 </indexterm>
4169 <indexterm role="concept">
4170 <primary>UUCP</primary>
4171 <secondary><quote>From</quote> line</secondary>
4172 </indexterm>
4173 <indexterm role="concept">
4174 <primary>Sendmail compatibility</primary>
4175 <secondary><quote>From</quote> line</secondary>
4176 </indexterm>
4177 of the message must be as defined in RFC 2822, except that, for
4178 compatibility with Sendmail and Smail, a line in one of the forms
4179 </para>
4180 <literallayout class="monospaced">
4181 From sender Fri Jan  5 12:55 GMT 1997
4182 From sender Fri, 5 Jan 97 12:55:01
4183 </literallayout>
4184 <para>
4185 (with the weekday optional, and possibly with additional text after the date)
4186 is permitted to appear at the start of the message. There appears to be no
4187 authoritative specification of the format of this line. Exim recognizes it by
4188 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4189 option, which can be changed if necessary.
4190 </para>
4191 <para>
4192 <indexterm role="option">
4193 <primary><option>-f</option></primary>
4194 <secondary>overriding <quote>From</quote> line</secondary>
4195 </indexterm>
4196 The specified sender is treated as if it were given as the argument to the
4197 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4198 preference to the address taken from the message. The caller of Exim must be a
4199 trusted user for the sender of a message to be set in this way.
4200 </para>
4201 </listitem></varlistentry>
4202 <varlistentry>
4203 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4204 <listitem>
4205 <para>
4206 <indexterm role="option">
4207 <primary><option>-bmalware</option></primary>
4208 </indexterm>
4209 <indexterm role="concept">
4210 <primary>testing</primary>
4211 <secondary>,</secondary>
4212 </indexterm>
4213 <indexterm role="concept">
4214 <primary>malware scan test</primary>
4215 </indexterm>
4216 This debugging option causes Exim to scan the given file,
4217 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4218 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4219 the expansion should have defaults which apply to this invocation.  ACLs are
4220 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4221 will never be populated and <option>-bmalware</option> will fail.
4222 </para>
4223 <para>
4224 Exim will have changed working directory before resolving the filename, so
4225 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4226 user when it tries to open the file, rather than as the invoking user.
4227 This option requires admin privileges.
4228 </para>
4229 <para>
4230 The <option>-bmalware</option> option will not be extended to be more generally useful,
4231 there are better tools for file-scanning.  This option exists to help
4232 administrators verify their Exim and AV scanner configuration.
4233 </para>
4234 </listitem></varlistentry>
4235 <varlistentry>
4236 <term><option>-bnq</option></term>
4237 <listitem>
4238 <para>
4239 <indexterm role="option">
4240 <primary><option>-bnq</option></primary>
4241 </indexterm>
4242 <indexterm role="concept">
4243 <primary>address qualification, suppressing</primary>
4244 </indexterm>
4245 By default, Exim automatically qualifies unqualified addresses (those
4246 without domains) that appear in messages that are submitted locally (that
4247 is, not over TCP/IP). This qualification applies both to addresses in
4248 envelopes, and addresses in header lines. Sender addresses are qualified using
4249 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4250 defaults to the value of <option>qualify_domain</option>).
4251 </para>
4252 <para>
4253 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4254 being used to re-submit messages that originally came from remote hosts after
4255 content scanning, you probably do not want to qualify unqualified addresses in
4256 header lines. (Such lines will be present only if you have not enabled a header
4257 syntax check in the appropriate ACL.)
4258 </para>
4259 <para>
4260 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4261 messages that originate on the local host. When this is used, unqualified
4262 addresses in the envelope provoke errors (causing message rejection) and
4263 unqualified addresses in header lines are left alone.
4264 </para>
4265 </listitem></varlistentry>
4266 <varlistentry>
4267 <term><option>-bP</option></term>
4268 <listitem>
4269 <para>
4270 <indexterm role="option">
4271 <primary><option>-bP</option></primary>
4272 </indexterm>
4273 <indexterm role="concept">
4274 <primary>configuration options</primary>
4275 <secondary>extracting</secondary>
4276 </indexterm>
4277 <indexterm role="concept">
4278 <primary>options</primary>
4279 <secondary>configuration &ndash; extracting</secondary>
4280 </indexterm>
4281 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4282 main configuration options to be written to the standard output. The values
4283 of one or more specific options can be requested by giving their names as
4284 arguments, for example:
4285 </para>
4286 <literallayout class="monospaced">
4287 exim -bP qualify_domain hold_domains
4288 </literallayout>
4289 <para>
4290 <indexterm role="concept">
4291 <primary>hiding configuration option values</primary>
4292 </indexterm>
4293 <indexterm role="concept">
4294 <primary>configuration options</primary>
4295 <secondary>hiding value of</secondary>
4296 </indexterm>
4297 <indexterm role="concept">
4298 <primary>options</primary>
4299 <secondary>hiding value of</secondary>
4300 </indexterm>
4301 However, any option setting that is preceded by the word <quote>hide</quote> in the
4302 configuration file is not shown in full, except to an admin user. For other
4303 users, the output is as in this example:
4304 </para>
4305 <literallayout class="monospaced">
4306 mysql_servers = &lt;value not displayable&gt;
4307 </literallayout>
4308 <para>
4309 If <option>configure_file</option> is given as an argument, the name of the run time
4310 configuration file is output.
4311 If a list of configuration files was supplied, the value that is output here
4312 is the name of the file that was actually used.
4313 </para>
4314 <para>
4315 <indexterm role="concept">
4316 <primary>daemon</primary>
4317 <secondary>process id (pid)</secondary>
4318 </indexterm>
4319 <indexterm role="concept">
4320 <primary>pid (process id)</primary>
4321 <secondary>of daemon</secondary>
4322 </indexterm>
4323 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4324 directories where log files and daemon pid files are written are output,
4325 respectively. If these values are unset, log files are written in a
4326 sub-directory of the spool directory called <option>log</option>, and the pid file is
4327 written directly into the spool directory.
4328 </para>
4329 <para>
4330 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4331 </para>
4332 <literallayout class="monospaced">
4333 exim -bP +local_domains
4334 </literallayout>
4335 <para>
4336 it searches for a matching named list of any type (domain, host, address, or
4337 local part) and outputs what it finds.
4338 </para>
4339 <para>
4340 <indexterm role="concept">
4341 <primary>options</primary>
4342 <secondary>router &ndash; extracting</secondary>
4343 </indexterm>
4344 <indexterm role="concept">
4345 <primary>options</primary>
4346 <secondary>transport &ndash; extracting</secondary>
4347 </indexterm>
4348 <indexterm role="concept">
4349 <primary>options</primary>
4350 <secondary>authenticator &ndash; extracting</secondary>
4351 </indexterm>
4352 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4353 followed by the name of an appropriate driver instance, the option settings for
4354 that driver are output. For example:
4355 </para>
4356 <literallayout class="monospaced">
4357 exim -bP transport local_delivery
4358 </literallayout>
4359 <para>
4360 The generic driver options are output first, followed by the driver&#x2019;s private
4361 options. A list of the names of drivers of a particular type can be obtained by
4362 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4363 <option>authenticator_list</option>, and a complete list of all drivers with their option
4364 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4365 <option>authenticators</option>.
4366 </para>
4367 <para>
4368 <indexterm role="concept">
4369 <primary>options</primary>
4370 <secondary>macro &ndash; extracting</secondary>
4371 </indexterm>
4372 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4373 are available, similarly to the drivers.  Because macros are sometimes used
4374 for storing passwords, this option is restricted.
4375 The output format is one item per line.
4376 </para>
4377 </listitem></varlistentry>
4378 <varlistentry>
4379 <term><option>-bp</option></term>
4380 <listitem>
4381 <para>
4382 <indexterm role="option">
4383 <primary><option>-bp</option></primary>
4384 </indexterm>
4385 <indexterm role="concept">
4386 <primary>queue</primary>
4387 <secondary>listing messages on</secondary>
4388 </indexterm>
4389 <indexterm role="concept">
4390 <primary>listing</primary>
4391 <secondary>messages on the queue</secondary>
4392 </indexterm>
4393 This option requests a listing of the contents of the mail queue on the
4394 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4395 just those messages are listed. By default, this option can be used only by an
4396 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4397 to allow any user to see the queue.
4398 </para>
4399 <para>
4400 Each message on the queue is displayed as in the following example:
4401 </para>
4402 <literallayout class="monospaced">
4403 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4404           red.king@looking-glass.fict.example
4405           &lt;other addresses&gt;
4406 </literallayout>
4407 <para>
4408 <indexterm role="concept">
4409 <primary>message</primary>
4410 <secondary>size in queue listing</secondary>
4411 </indexterm>
4412 <indexterm role="concept">
4413 <primary>size</primary>
4414 <secondary>of message</secondary>
4415 </indexterm>
4416 The first line contains the length of time the message has been on the queue
4417 (in this case 25 minutes), the size of the message (2.9K), the unique local
4418 identifier for the message, and the message sender, as contained in the
4419 envelope. For bounce messages, the sender address is empty, and appears as
4420 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4421 the default sender address, the user&#x2019;s login name is shown in parentheses
4422 before the sender address.
4423 </para>
4424 <para>
4425 <indexterm role="concept">
4426 <primary>frozen messages</primary>
4427 <secondary>in queue listing</secondary>
4428 </indexterm>
4429 If the message is frozen (attempts to deliver it are suspended) then the text
4430 <quote>*** frozen ***</quote> is displayed at the end of this line.
4431 </para>
4432 <para>
4433 The recipients of the message (taken from the envelope, not the headers) are
4434 displayed on subsequent lines. Those addresses to which the message has already
4435 been delivered are marked with the letter D. If an original address gets
4436 expanded into several addresses via an alias or forward file, the original is
4437 displayed with a D only when deliveries for all of its child addresses are
4438 complete.
4439 </para>
4440 </listitem></varlistentry>
4441 <varlistentry>
4442 <term><option>-bpa</option></term>
4443 <listitem>
4444 <para>
4445 <indexterm role="option">
4446 <primary><option>-bpa</option></primary>
4447 </indexterm>
4448 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4449 that were generated from the original top level address(es) in each message by
4450 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4451 of just <quote>D</quote>.
4452 </para>
4453 </listitem></varlistentry>
4454 <varlistentry>
4455 <term><option>-bpc</option></term>
4456 <listitem>
4457 <para>
4458 <indexterm role="option">
4459 <primary><option>-bpc</option></primary>
4460 </indexterm>
4461 <indexterm role="concept">
4462 <primary>queue</primary>
4463 <secondary>count of messages on</secondary>
4464 </indexterm>
4465 This option counts the number of messages on the queue, and writes the total
4466 to the standard output. It is restricted to admin users, unless
4467 <option>queue_list_requires_admin</option> is set false.
4468 </para>
4469 </listitem></varlistentry>
4470 <varlistentry>
4471 <term><option>-bpr</option></term>
4472 <listitem>
4473 <para>
4474 <indexterm role="option">
4475 <primary><option>-bpr</option></primary>
4476 </indexterm>
4477 This option operates like <option>-bp</option>, but the output is not sorted into
4478 chronological order of message arrival. This can speed it up when there are
4479 lots of messages on the queue, and is particularly useful if the output is
4480 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4481 </para>
4482 </listitem></varlistentry>
4483 <varlistentry>
4484 <term><option>-bpra</option></term>
4485 <listitem>
4486 <para>
4487 <indexterm role="option">
4488 <primary><option>-bpra</option></primary>
4489 </indexterm>
4490 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4491 </para>
4492 </listitem></varlistentry>
4493 <varlistentry>
4494 <term><option>-bpru</option></term>
4495 <listitem>
4496 <para>
4497 <indexterm role="option">
4498 <primary><option>-bpru</option></primary>
4499 </indexterm>
4500 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4501 </para>
4502 </listitem></varlistentry>
4503 <varlistentry>
4504 <term><option>-bpu</option></term>
4505 <listitem>
4506 <para>
4507 <indexterm role="option">
4508 <primary><option>-bpu</option></primary>
4509 </indexterm>
4510 This option operates like <option>-bp</option> but shows only undelivered top-level
4511 addresses for each message displayed. Addresses generated by aliasing or
4512 forwarding are not shown, unless the message was deferred after processing by a
4513 router with the <option>one_time</option> option set.
4514 </para>
4515 </listitem></varlistentry>
4516 <varlistentry>
4517 <term><option>-brt</option></term>
4518 <listitem>
4519 <para>
4520 <indexterm role="option">
4521 <primary><option>-brt</option></primary>
4522 </indexterm>
4523 <indexterm role="concept">
4524 <primary>testing</primary>
4525 <secondary>retry configuration</secondary>
4526 </indexterm>
4527 <indexterm role="concept">
4528 <primary>retry</primary>
4529 <secondary>configuration testing</secondary>
4530 </indexterm>
4531 This option is for testing retry rules, and it must be followed by up to three
4532 arguments. It causes Exim to look for a retry rule that matches the values
4533 and to write it to the standard output. For example:
4534 </para>
4535 <literallayout class="monospaced">
4536 exim -brt bach.comp.mus.example
4537 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4538 </literallayout>
4539 <para>
4540 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4541 argument, which is required, can be a complete address in the form
4542 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4543 contains a dot, it is interpreted as an optional second domain name; if no
4544 retry rule is found for the first argument, the second is tried. This ties in
4545 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4546 rule is found that matches the host, one that matches the mail domain is
4547 sought. Finally, an argument that is the name of a specific delivery error, as
4548 used in setting up retry rules, can be given. For example:
4549 </para>
4550 <literallayout class="monospaced">
4551 exim -brt haydn.comp.mus.example quota_3d
4552 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4553 </literallayout>
4554 </listitem></varlistentry>
4555 <varlistentry>
4556 <term><option>-brw</option></term>
4557 <listitem>
4558 <para>
4559 <indexterm role="option">
4560 <primary><option>-brw</option></primary>
4561 </indexterm>
4562 <indexterm role="concept">
4563 <primary>testing</primary>
4564 <secondary>rewriting</secondary>
4565 </indexterm>
4566 <indexterm role="concept">
4567 <primary>rewriting</primary>
4568 <secondary>testing</secondary>
4569 </indexterm>
4570 This option is for testing address rewriting rules, and it must be followed by
4571 a single argument, consisting of either a local part without a domain, or a
4572 complete address with a fully qualified domain. Exim outputs how this address
4573 would be rewritten for each possible place it might appear. See chapter
4574 <xref linkend="CHAPrewrite"/> for further details.
4575 </para>
4576 </listitem></varlistentry>
4577 <varlistentry>
4578 <term><option>-bS</option></term>
4579 <listitem>
4580 <para>
4581 <indexterm role="option">
4582 <primary><option>-bS</option></primary>
4583 </indexterm>
4584 <indexterm role="concept">
4585 <primary>SMTP</primary>
4586 <secondary>batched incoming</secondary>
4587 </indexterm>
4588 <indexterm role="concept">
4589 <primary>batched SMTP input</primary>
4590 </indexterm>
4591 This option is used for batched SMTP input, which is an alternative interface
4592 for non-interactive local message submission. A number of messages can be
4593 submitted in a single run. However, despite its name, this is not really SMTP
4594 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4595 input, but generates no responses. If the caller is trusted, or
4596 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4597 believed; otherwise the sender is always the caller of Exim.
4598 </para>
4599 <para>
4600 The message itself is read from the standard input, in SMTP format (leading
4601 dots doubled), terminated by a line containing just a single dot. An error is
4602 provoked if the terminating dot is missing. A further message may then follow.
4603 </para>
4604 <para>
4605 As for other local message submissions, the contents of incoming batch SMTP
4606 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4607 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4608 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4609 </para>
4610 <para>
4611 Some other SMTP commands are recognized in the input. HELO and EHLO act
4612 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4613 QUIT quits, ignoring the rest of the standard input.
4614 </para>
4615 <para>
4616 <indexterm role="concept">
4617 <primary>return code</primary>
4618 <secondary>for <option>-bS</option></secondary>
4619 </indexterm>
4620 If any error is encountered, reports are written to the standard output and
4621 error streams, and Exim gives up immediately. The return code is 0 if no error
4622 was detected; it is 1 if one or more messages were accepted before the error
4623 was detected; otherwise it is 2.
4624 </para>
4625 <para>
4626 More details of input using batched SMTP are given in section
4627 <xref linkend="SECTincomingbatchedSMTP"/>.
4628 </para>
4629 </listitem></varlistentry>
4630 <varlistentry>
4631 <term><option>-bs</option></term>
4632 <listitem>
4633 <para>
4634 <indexterm role="option">
4635 <primary><option>-bs</option></primary>
4636 </indexterm>
4637 <indexterm role="concept">
4638 <primary>SMTP</primary>
4639 <secondary>local input</secondary>
4640 </indexterm>
4641 <indexterm role="concept">
4642 <primary>local SMTP input</primary>
4643 </indexterm>
4644 This option causes Exim to accept one or more messages by reading SMTP commands
4645 on the standard input, and producing SMTP replies on the standard output. SMTP
4646 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4647 Some user agents use this interface as a way of passing locally-generated
4648 messages to the MTA.
4649 </para>
4650 <para>
4651 In
4652 <indexterm role="concept">
4653 <primary>sender</primary>
4654 <secondary>source of</secondary>
4655 </indexterm>
4656 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4657 set, the senders of messages are taken from the SMTP MAIL commands.
4658 Otherwise the content of these commands is ignored and the sender is set up as
4659 the calling user. Unqualified addresses are automatically qualified using
4660 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4661 <option>-bnq</option> option is used.
4662 </para>
4663 <para>
4664 <indexterm role="concept">
4665 <primary>inetd</primary>
4666 </indexterm>
4667 The
4668 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4669 using a listening daemon. Exim can distinguish the two cases by checking
4670 whether the standard input is a TCP/IP socket. When Exim is called from
4671 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4672 above concerning senders and qualification do not apply. In this situation,
4673 Exim behaves in exactly the same way as it does when receiving a message via
4674 the listening daemon.
4675 </para>
4676 </listitem></varlistentry>
4677 <varlistentry>
4678 <term><option>-bt</option></term>
4679 <listitem>
4680 <para>
4681 <indexterm role="option">
4682 <primary><option>-bt</option></primary>
4683 </indexterm>
4684 <indexterm role="concept">
4685 <primary>testing</primary>
4686 <secondary>addresses</secondary>
4687 </indexterm>
4688 <indexterm role="concept">
4689 <primary>address</primary>
4690 <secondary>testing</secondary>
4691 </indexterm>
4692 This option runs Exim in address testing mode, in which each argument is taken
4693 as a recipient address to be tested for deliverability. The results are
4694 written to the standard output. If a test fails, and the caller is not an admin
4695 user, no details of the failure are output, because these might contain
4696 sensitive information such as usernames and passwords for database lookups.
4697 </para>
4698 <para>
4699 If no arguments are given, Exim runs in an interactive manner, prompting with a
4700 right angle bracket for addresses to be tested.
4701 </para>
4702 <para>
4703 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4704 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4705 security issues.
4706 </para>
4707 <para>
4708 Each address is handled as if it were the recipient address of a message
4709 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4710 written to the standard output. However, any router that has
4711 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4712 genuine routing tests if your first router passes everything to a scanner
4713 program.
4714 </para>
4715 <para>
4716 <indexterm role="concept">
4717 <primary>return code</primary>
4718 <secondary>for <option>-bt</option></secondary>
4719 </indexterm>
4720 The return code is 2 if any address failed outright; it is 1 if no address
4721 failed outright but at least one could not be resolved for some reason. Return
4722 code 0 is given only when all addresses succeed.
4723 </para>
4724 <para>
4725 <indexterm role="concept">
4726 <primary>duplicate addresses</primary>
4727 </indexterm>
4728 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4729 addresses after routing is complete, so that only one delivery takes place.
4730 This does not happen when testing with <option>-bt</option>; the full results of routing are
4731 always shown.
4732 </para>
4733 <para>
4734 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4735 routers in the configuration makes any tests on the sender address of a
4736 message,
4737 <indexterm role="option">
4738 <primary><option>-f</option></primary>
4739 <secondary>for address testing</secondary>
4740 </indexterm>
4741 you can use the <option>-f</option> option to set an appropriate sender when running
4742 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4743 default qualifying domain. However, if you have set up (for example) routers
4744 whose behaviour depends on the contents of an incoming message, you cannot test
4745 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4746 doing such tests.
4747 </para>
4748 </listitem></varlistentry>
4749 <varlistentry>
4750 <term><option>-bV</option></term>
4751 <listitem>
4752 <para>
4753 <indexterm role="option">
4754 <primary><option>-bV</option></primary>
4755 </indexterm>
4756 <indexterm role="concept">
4757 <primary>version number of Exim</primary>
4758 </indexterm>
4759 This option causes Exim to write the current version number, compilation
4760 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4761 It also lists the DBM library that is being used, the optional modules (such as
4762 specific lookup types), the drivers that are included in the binary, and the
4763 name of the run time configuration file that is in use.
4764 </para>
4765 <para>
4766 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4767 configuration file. However, this is a static check only. It cannot check
4768 values that are to be expanded. For example, although a misspelt ACL verb is
4769 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4770 alone to discover (for example) all the typos in the configuration; some
4771 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4772 dynamic testing facilities.
4773 </para>
4774 </listitem></varlistentry>
4775 <varlistentry>
4776 <term><option>-bv</option></term>
4777 <listitem>
4778 <para>
4779 <indexterm role="option">
4780 <primary><option>-bv</option></primary>
4781 </indexterm>
4782 <indexterm role="concept">
4783 <primary>verifying address</primary>
4784 <secondary>using <option>-bv</option></secondary>
4785 </indexterm>
4786 <indexterm role="concept">
4787 <primary>address</primary>
4788 <secondary>verification</secondary>
4789 </indexterm>
4790 This option runs Exim in address verification mode, in which each argument is
4791 taken as a recipient address to be verified by the routers. (This does
4792 not involve any verification callouts). During normal operation, verification
4793 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4794 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4795 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4796 </para>
4797 <para>
4798 If verification fails, and the caller is not an admin user, no details of the
4799 failure are output, because these might contain sensitive information such as
4800 usernames and passwords for database lookups.
4801 </para>
4802 <para>
4803 If no arguments are given, Exim runs in an interactive manner, prompting with a
4804 right angle bracket for addresses to be verified.
4805 </para>
4806 <para>
4807 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4808 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4809 security issues.
4810 </para>
4811 <para>
4812 Verification differs from address testing (the <option>-bt</option> option) in that routers
4813 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4814 router that has <option>fail_verify</option> set, verification fails. The address is
4815 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4816 address, <option>-bvs</option> should be used.
4817 </para>
4818 <para>
4819 If the <option>-v</option> option is not set, the output consists of a single line for each
4820 address, stating whether it was verified or not, and giving a reason in the
4821 latter case. Without <option>-v</option>, generating more than one address by redirection
4822 causes verification to end successfully, without considering the generated
4823 addresses. However, if just one address is generated, processing continues,
4824 and the generated address must verify successfully for the overall verification
4825 to succeed.
4826 </para>
4827 <para>
4828 When <option>-v</option> is set, more details are given of how the address has been handled,
4829 and in the case of address redirection, all the generated addresses are also
4830 considered. Verification may succeed for some and fail for others.
4831 </para>
4832 <para>
4833 The
4834 <indexterm role="concept">
4835 <primary>return code</primary>
4836 <secondary>for <option>-bv</option></secondary>
4837 </indexterm>
4838 return code is 2 if any address failed outright; it is 1 if no address
4839 failed outright but at least one could not be resolved for some reason. Return
4840 code 0 is given only when all addresses succeed.
4841 </para>
4842 <para>
4843 If any of the routers in the configuration makes any tests on the sender
4844 address of a message, you should use the <option>-f</option> option to set an appropriate
4845 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4846 calling user at the default qualifying domain.
4847 </para>
4848 </listitem></varlistentry>
4849 <varlistentry>
4850 <term><option>-bvs</option></term>
4851 <listitem>
4852 <para>
4853 <indexterm role="option">
4854 <primary><option>-bvs</option></primary>
4855 </indexterm>
4856 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4857 than a recipient address. This affects any rewriting and qualification that
4858 might happen.
4859 </para>
4860 </listitem></varlistentry>
4861 <varlistentry>
4862 <term><option>-bw</option></term>
4863 <listitem>
4864 <para>
4865 <indexterm role="option">
4866 <primary><option>-bw</option></primary>
4867 </indexterm>
4868 <indexterm role="concept">
4869 <primary>daemon</primary>
4870 </indexterm>
4871 <indexterm role="concept">
4872 <primary>inetd</primary>
4873 </indexterm>
4874 <indexterm role="concept">
4875 <primary>inetd</primary>
4876 <secondary>wait mode</secondary>
4877 </indexterm>
4878 This option runs Exim as a daemon, awaiting incoming SMTP connections,
4879 similarly to the <option>-bd</option> option.  All port specifications on the command-line
4880 and in the configuration file are ignored.  Queue-running may not be specified.
4881 </para>
4882 <para>
4883 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
4884 listening for connections.  This permits the system to start up and have
4885 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
4886 each port only when the first connection is received.
4887 </para>
4888 <para>
4889 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
4890 which the daemon will exit, which should cause inetd to listen once more.
4891 </para>
4892 </listitem></varlistentry>
4893 <varlistentry>
4894 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4895 <listitem>
4896 <para>
4897 <indexterm role="option">
4898 <primary><option>-C</option></primary>
4899 </indexterm>
4900 <indexterm role="concept">
4901 <primary>configuration file</primary>
4902 <secondary>alternate</secondary>
4903 </indexterm>
4904 <indexterm role="concept">
4905 <primary>CONFIGURE_FILE</primary>
4906 </indexterm>
4907 <indexterm role="concept">
4908 <primary>alternate configuration file</primary>
4909 </indexterm>
4910 This option causes Exim to find the run time configuration file from the given
4911 list instead of from the list specified by the CONFIGURE_FILE
4912 compile-time setting. Usually, the list will consist of just a single file
4913 name, but it can be a colon-separated list of names. In this case, the first
4914 file that exists is used. Failure to open an existing file stops Exim from
4915 proceeding any further along the list, and an error is generated.
4916 </para>
4917 <para>
4918 When this option is used by a caller other than root, and the list is different
4919 from the compiled-in list, Exim gives up its root privilege immediately, and
4920 runs with the real and effective uid and gid set to those of the caller.
4921 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
4922 file contains a list of full pathnames, one per line, for configuration files
4923 which are trusted. Root privilege is retained for any configuration file so
4924 listed, as long as the caller is the Exim user (or the user specified in the
4925 CONFIGURE_OWNER option, if any), and as long as the configuration file is
4926 not writeable by inappropriate users or groups.
4927 </para>
4928 <para>
4929 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
4930 configuration using <option>-C</option> right through message reception and delivery,
4931 even if the caller is root. The reception works, but by that time, Exim is
4932 running as the Exim user, so when it re-executes to regain privilege for the
4933 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
4934 test reception and delivery using two separate commands (one to put a message
4935 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4936 </para>
4937 <para>
4938 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4939 prefix string with which any file named in a <option>-C</option> command line option
4940 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4941 However, if the value of the <option>-C</option> option is identical to the value of
4942 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4943 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4944 unset, any file name can be used with <option>-C</option>.
4945 </para>
4946 <para>
4947 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4948 to a directory to which only root has access. This prevents someone who has
4949 broken into the Exim account from running a privileged Exim with an arbitrary
4950 configuration file.
4951 </para>
4952 <para>
4953 The <option>-C</option> facility is useful for ensuring that configuration files are
4954 syntactically correct, but cannot be used for test deliveries, unless the
4955 caller is privileged, or unless it is an exotic configuration that does not
4956 require privilege. No check is made on the owner or group of the files
4957 specified by this option.
4958 </para>
4959 </listitem></varlistentry>
4960 <varlistentry>
4961 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4962 <listitem>
4963 <para>
4964 <indexterm role="option">
4965 <primary><option>-D</option></primary>
4966 </indexterm>
4967 <indexterm role="concept">
4968 <primary>macro</primary>
4969 <secondary>setting on command line</secondary>
4970 </indexterm>
4971 This option can be used to override macro definitions in the configuration file
4972 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4973 unprivileged caller, it causes Exim to give up its root privilege.
4974 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4975 completely disabled, and its use causes an immediate error exit.
4976 </para>
4977 <para>
4978 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
4979 colon-separated list of macros which are considered safe and, if <option>-D</option> only
4980 supplies macros from this list, and the values are acceptable, then Exim will
4981 not give up root privilege if the caller is root, the Exim run-time user, or
4982 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
4983 to be removed in the future.  Acceptable values for the macros satisfy the
4984 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
4985 </para>
4986 <para>
4987 The entire option (including equals sign if present) must all be within one
4988 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4989 string, in which case the equals sign is optional. These two commands are
4990 synonymous:
4991 </para>
4992 <literallayout class="monospaced">
4993 exim -DABC  ...
4994 exim -DABC= ...
4995 </literallayout>
4996 <para>
4997 To include spaces in a macro definition item, quotes must be used. If you use
4998 quotes, spaces are permitted around the macro name and the equals sign. For
4999 example:
5000 </para>
5001 <literallayout class="monospaced">
5002 exim '-D ABC = something' ...
5003 </literallayout>
5004 <para>
5005 <option>-D</option> may be repeated up to 10 times on a command line.
5006 </para>
5007 </listitem></varlistentry>
5008 <varlistentry>
5009 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5010 <listitem>
5011 <para>
5012 <indexterm role="option">
5013 <primary><option>-d</option></primary>
5014 </indexterm>
5015 <indexterm role="concept">
5016 <primary>debugging</primary>
5017 <secondary>list of selectors</secondary>
5018 </indexterm>
5019 <indexterm role="concept">
5020 <primary>debugging</primary>
5021 <secondary><option>-d</option> option</secondary>
5022 </indexterm>
5023 This option causes debugging information to be written to the standard
5024 error stream. It is restricted to admin users because debugging output may show
5025 database queries that contain password information. Also, the details of users&#x2019;
5026 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5027 writes an error message to the standard error stream and exits with a non-zero
5028 return code.
5029 </para>
5030 <para>
5031 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5032 standard debugging data is output. This can be reduced, or increased to include
5033 some more rarely needed information, by directly following <option>-d</option> with a string
5034 made up of names preceded by plus or minus characters. These add or remove sets
5035 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5036 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5037 no spaces are allowed in the debug setting. The available debugging categories
5038 are:
5039 </para>
5040 <literallayout>
5041 <literal>acl            </literal> ACL interpretation
5042 <literal>auth           </literal> authenticators
5043 <literal>deliver        </literal> general delivery logic
5044 <literal>dns            </literal> DNS lookups (see also resolver)
5045 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5046 <literal>exec           </literal> arguments for <function>execv()</function> calls
5047 <literal>expand         </literal> detailed debugging for string expansions
5048 <literal>filter         </literal> filter handling
5049 <literal>hints_lookup   </literal> hints data lookups
5050 <literal>host_lookup    </literal> all types of name-to-IP address handling
5051 <literal>ident          </literal> ident lookup
5052 <literal>interface      </literal> lists of local interfaces
5053 <literal>lists          </literal> matching things in lists
5054 <literal>load           </literal> system load checks
5055 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5056 <literal>lookup         </literal> general lookup code and all lookups
5057 <literal>memory         </literal> memory handling
5058 <literal>pid            </literal> add pid to debug output lines
5059 <literal>process_info   </literal> setting info for the process log
5060 <literal>queue_run      </literal> queue runs
5061 <literal>receive        </literal> general message reception logic
5062 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5063 <literal>retry          </literal> retry handling
5064 <literal>rewrite        </literal> address rewriting
5065 <literal>route          </literal> address routing
5066 <literal>timestamp      </literal> add timestamp to debug output lines
5067 <literal>tls            </literal> TLS logic
5068 <literal>transport      </literal> transports
5069 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5070 <literal>verify         </literal> address verification logic
5071 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5072 </literallayout>
5073 <para>
5074 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5075 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5076 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5077 is included, an awful lot of output that is very rarely of interest is
5078 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5079 turn everything off.
5080 </para>
5081 <para>
5082 <indexterm role="concept">
5083 <primary>resolver, debugging output</primary>
5084 </indexterm>
5085 <indexterm role="concept">
5086 <primary>DNS resolver, debugging output</primary>
5087 </indexterm>
5088 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5089 with DEBUG enabled. This is not the case in some operating systems. Also,
5090 unfortunately, debugging output from the DNS resolver is written to stdout
5091 rather than stderr.
5092 </para>
5093 <para>
5094 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5095 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5096 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5097 daemon, which then passes it on to any re-executed Exims. Exim also
5098 automatically adds the pid to debug lines when several remote deliveries are
5099 run in parallel.
5100 </para>
5101 <para>
5102 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5103 of all debug output lines. This can be useful when trying to track down delays
5104 in processing.
5105 </para>
5106 <para>
5107 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5108 any debugging is selected, or if <option>-v</option> is used.
5109 </para>
5110 </listitem></varlistentry>
5111 <varlistentry>
5112 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5113 <listitem>
5114 <para>
5115 <indexterm role="option">
5116 <primary><option>-dd</option></primary>
5117 </indexterm>
5118 This option behaves exactly like <option>-d</option> except when used on a command that
5119 starts a daemon process. In that case, debugging is turned off for the
5120 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5121 behaviour of the daemon without creating as much output as full debugging does.
5122 </para>
5123 </listitem></varlistentry>
5124 <varlistentry>
5125 <term><option>-dropcr</option></term>
5126 <listitem>
5127 <para>
5128 <indexterm role="option">
5129 <primary><option>-dropcr</option></primary>
5130 </indexterm>
5131 This is an obsolete option that is now a no-op. It used to affect the way Exim
5132 handled CR and LF characters in incoming messages. What happens now is
5133 described in section <xref linkend="SECTlineendings"/>.
5134 </para>
5135 </listitem></varlistentry>
5136 <varlistentry>
5137 <term><option>-E</option></term>
5138 <listitem>
5139 <para>
5140 <indexterm role="option">
5141 <primary><option>-E</option></primary>
5142 </indexterm>
5143 <indexterm role="concept">
5144 <primary>bounce message</primary>
5145 <secondary>generating</secondary>
5146 </indexterm>
5147 This option specifies that an incoming message is a locally-generated delivery
5148 failure report. It is used internally by Exim when handling delivery failures
5149 and is not intended for external use. Its only effect is to stop Exim
5150 generating certain messages to the postmaster, as otherwise message cascades
5151 could occur in some situations. As part of the same option, a message id may
5152 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5153 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5154 </para>
5155 </listitem></varlistentry>
5156 <varlistentry>
5157 <term><option>-e</option><emphasis>x</emphasis></term>
5158 <listitem>
5159 <para>
5160 <indexterm role="option">
5161 <primary><option>-e</option><emphasis>x</emphasis></primary>
5162 </indexterm>
5163 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5164 called by various programs without the leading <option>o</option> in the option. For
5165 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5166 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5167 </para>
5168 </listitem></varlistentry>
5169 <varlistentry>
5170 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5171 <listitem>
5172 <para>
5173 <indexterm role="option">
5174 <primary><option>-F</option></primary>
5175 </indexterm>
5176 <indexterm role="concept">
5177 <primary>sender</primary>
5178 <secondary>name</secondary>
5179 </indexterm>
5180 <indexterm role="concept">
5181 <primary>name</primary>
5182 <secondary>of sender</secondary>
5183 </indexterm>
5184 This option sets the sender&#x2019;s full name for use when a locally-generated
5185 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5186 entry from the password data is used. As users are generally permitted to alter
5187 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5188 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5189 </para>
5190 </listitem></varlistentry>
5191 <varlistentry>
5192 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5193 <listitem>
5194 <para>
5195 <indexterm role="option">
5196 <primary><option>-f</option></primary>
5197 </indexterm>
5198 <indexterm role="concept">
5199 <primary>sender</primary>
5200 <secondary>address</secondary>
5201 </indexterm>
5202 <indexterm role="concept">
5203 <primary>address</primary>
5204 <secondary>sender</secondary>
5205 </indexterm>
5206 <indexterm role="concept">
5207 <primary>trusted users</primary>
5208 </indexterm>
5209 <indexterm role="concept">
5210 <primary>envelope sender</primary>
5211 </indexterm>
5212 <indexterm role="concept">
5213 <primary>user</primary>
5214 <secondary>trusted</secondary>
5215 </indexterm>
5216 This option sets the address of the envelope sender of a locally-generated
5217 message (also known as the return path). The option can normally be used only
5218 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5219 users to use it.
5220 </para>
5221 <para>
5222 Processes running as root or the Exim user are always trusted. Other
5223 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5224 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5225 of a local message is set to the caller&#x2019;s login name at the default qualify
5226 domain.
5227 </para>
5228 <para>
5229 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5230 can be specified by any user, trusted or not, to create a message that can
5231 never provoke a bounce. An empty sender can be specified either as an empty
5232 string, or as a pair of angle brackets with nothing between them, as in these
5233 examples of shell commands:
5234 </para>
5235 <literallayout class="monospaced">
5236 exim -f '&lt;&gt;' user@domain
5237 exim -f "" user@domain
5238 </literallayout>
5239 <para>
5240 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5241 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5242 <option>-bv</option> options.
5243 </para>
5244 <para>
5245 Allowing untrusted users to change the sender address does not of itself make
5246 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5247 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5248 though this can be overridden by setting <option>no_local_from_check</option>.
5249 </para>
5250 <para>
5251 White
5252 <indexterm role="concept">
5253 <primary><quote>From</quote> line</primary>
5254 </indexterm>
5255 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5256 given as two arguments or one combined argument). The sender of a
5257 locally-generated message can also be set (when permitted) by an initial
5258 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5259 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5260 </para>
5261 </listitem></varlistentry>
5262 <varlistentry>
5263 <term><option>-G</option></term>
5264 <listitem>
5265 <para>
5266 <indexterm role="option">
5267 <primary><option>-G</option></primary>
5268 </indexterm>
5269 <indexterm role="concept">
5270 <primary>Sendmail compatibility</primary>
5271 <secondary><option>-G</option> option ignored</secondary>
5272 </indexterm>
5273 This is a Sendmail option which is ignored by Exim.
5274 </para>
5275 </listitem></varlistentry>
5276 <varlistentry>
5277 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5278 <listitem>
5279 <para>
5280 <indexterm role="option">
5281 <primary><option>-h</option></primary>
5282 </indexterm>
5283 <indexterm role="concept">
5284 <primary>Sendmail compatibility</primary>
5285 <secondary><option>-h</option> option ignored</secondary>
5286 </indexterm>
5287 This option is accepted for compatibility with Sendmail, but has no effect. (In
5288 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5289 headers.)
5290 </para>
5291 </listitem></varlistentry>
5292 <varlistentry>
5293 <term><option>-i</option></term>
5294 <listitem>
5295 <para>
5296 <indexterm role="option">
5297 <primary><option>-i</option></primary>
5298 </indexterm>
5299 <indexterm role="concept">
5300 <primary>Solaris</primary>
5301 <secondary><emphasis>mail</emphasis> command</secondary>
5302 </indexterm>
5303 <indexterm role="concept">
5304 <primary>dot</primary>
5305 <secondary>in incoming non-SMTP message</secondary>
5306 </indexterm>
5307 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5308 line by itself should not terminate an incoming, non-SMTP message. I can find
5309 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5310 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5311 </para>
5312 </listitem></varlistentry>
5313 <varlistentry>
5314 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5315 <listitem>
5316 <para>
5317 <indexterm role="option">
5318 <primary><option>-M</option></primary>
5319 </indexterm>
5320 <indexterm role="concept">
5321 <primary>forcing delivery</primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>delivery</primary>
5325 <secondary>forcing attempt</secondary>
5326 </indexterm>
5327 <indexterm role="concept">
5328 <primary>frozen messages</primary>
5329 <secondary>forcing delivery</secondary>
5330 </indexterm>
5331 This option requests Exim to run a delivery attempt on each message in turn. If
5332 any of the messages are frozen, they are automatically thawed before the
5333 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5334 and <option>hold_domains</option> are ignored.
5335 </para>
5336 <para>
5337 Retry
5338 <indexterm role="concept">
5339 <primary>hints database</primary>
5340 <secondary>overriding retry hints</secondary>
5341 </indexterm>
5342 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5343 the normal retry time has not yet been reached. This option requires the caller
5344 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5345 which can be set false to relax this restriction (and also the same requirement
5346 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5347 </para>
5348 <para>
5349 The deliveries happen synchronously, that is, the original Exim process does
5350 not terminate until all the delivery attempts have finished. No output is
5351 produced unless there is a serious error. If you want to see what is happening,
5352 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5353 </para>
5354 </listitem></varlistentry>
5355 <varlistentry>
5356 <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>
5357 <listitem>
5358 <para>
5359 <indexterm role="option">
5360 <primary><option>-Mar</option></primary>
5361 </indexterm>
5362 <indexterm role="concept">
5363 <primary>message</primary>
5364 <secondary>adding recipients</secondary>
5365 </indexterm>
5366 <indexterm role="concept">
5367 <primary>recipient</primary>
5368 <secondary>adding</secondary>
5369 </indexterm>
5370 This option requests Exim to add the addresses to the list of recipients of the
5371 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5372 id, and the remaining ones must be email addresses. However, if the message is
5373 active (in the middle of a delivery attempt), it is not altered. This option
5374 can be used only by an admin user.
5375 </para>
5376 </listitem></varlistentry>
5377 <varlistentry>
5378 <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>
5379 <listitem>
5380 <para>
5381 <indexterm role="option">
5382 <primary><option>-MC</option></primary>
5383 </indexterm>
5384 <indexterm role="concept">
5385 <primary>SMTP</primary>
5386 <secondary>passed connection</secondary>
5387 </indexterm>
5388 <indexterm role="concept">
5389 <primary>SMTP</primary>
5390 <secondary>multiple deliveries</secondary>
5391 </indexterm>
5392 <indexterm role="concept">
5393 <primary>multiple SMTP deliveries</primary>
5394 </indexterm>
5395 This option is not intended for use by external callers. It is used internally
5396 by Exim to invoke another instance of itself to deliver a waiting message using
5397 an existing SMTP connection, which is passed as the standard input. Details are
5398 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5399 must be root or the Exim user in order to use it.
5400 </para>
5401 </listitem></varlistentry>
5402 <varlistentry>
5403 <term><option>-MCA</option></term>
5404 <listitem>
5405 <para>
5406 <indexterm role="option">
5407 <primary><option>-MCA</option></primary>
5408 </indexterm>
5409 This option is not intended for use by external callers. It is used internally
5410 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5411 connection to the remote host has been authenticated.
5412 </para>
5413 </listitem></varlistentry>
5414 <varlistentry>
5415 <term><option>-MCP</option></term>
5416 <listitem>
5417 <para>
5418 <indexterm role="option">
5419 <primary><option>-MCP</option></primary>
5420 </indexterm>
5421 This option is not intended for use by external callers. It is used internally
5422 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5423 which Exim is connected supports pipelining.
5424 </para>
5425 </listitem></varlistentry>
5426 <varlistentry>
5427 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5428 <listitem>
5429 <para>
5430 <indexterm role="option">
5431 <primary><option>-MCQ</option></primary>
5432 </indexterm>
5433 This option is not intended for use by external callers. It is used internally
5434 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5435 started by a queue runner. It passes on the process id of the queue runner,
5436 together with the file descriptor number of an open pipe. Closure of the pipe
5437 signals the final completion of the sequence of processes that are passing
5438 messages through the same SMTP connection.
5439 </para>
5440 </listitem></varlistentry>
5441 <varlistentry>
5442 <term><option>-MCS</option></term>
5443 <listitem>
5444 <para>
5445 <indexterm role="option">
5446 <primary><option>-MCS</option></primary>
5447 </indexterm>
5448 This option is not intended for use by external callers. It is used internally
5449 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5450 SMTP SIZE option should be used on messages delivered down the existing
5451 connection.
5452 </para>
5453 </listitem></varlistentry>
5454 <varlistentry>
5455 <term><option>-MCT</option></term>
5456 <listitem>
5457 <para>
5458 <indexterm role="option">
5459 <primary><option>-MCT</option></primary>
5460 </indexterm>
5461 This option is not intended for use by external callers. It is used internally
5462 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5463 host to which Exim is connected supports TLS encryption.
5464 </para>
5465 </listitem></varlistentry>
5466 <varlistentry>
5467 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5468 <listitem>
5469 <para>
5470 <indexterm role="option">
5471 <primary><option>-Mc</option></primary>
5472 </indexterm>
5473 <indexterm role="concept">
5474 <primary>hints database</primary>
5475 <secondary>not overridden by <option>-Mc</option></secondary>
5476 </indexterm>
5477 <indexterm role="concept">
5478 <primary>delivery</primary>
5479 <secondary>manually started &ndash; not forced</secondary>
5480 </indexterm>
5481 This option requests Exim to run a delivery attempt on each message in turn,
5482 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5483 that are found. This option is not very useful to external callers. It is
5484 provided mainly for internal use by Exim when it needs to re-invoke itself in
5485 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5486 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5487 respects retry times and other options such as <option>hold_domains</option> that are
5488 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5489 If you want to run a specific delivery as if in a queue run, you should use
5490 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5491 and other deliveries is made in one or two places.
5492 </para>
5493 </listitem></varlistentry>
5494 <varlistentry>
5495 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5496 <listitem>
5497 <para>
5498 <indexterm role="option">
5499 <primary><option>-Mes</option></primary>
5500 </indexterm>
5501 <indexterm role="concept">
5502 <primary>message</primary>
5503 <secondary>changing sender</secondary>
5504 </indexterm>
5505 <indexterm role="concept">
5506 <primary>sender</primary>
5507 <secondary>changing</secondary>
5508 </indexterm>
5509 This option requests Exim to change the sender address in the message to the
5510 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5511 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5512 be a message id, and the second one an email address. However, if the message
5513 is active (in the middle of a delivery attempt), its status is not altered.
5514 This option can be used only by an admin user.
5515 </para>
5516 </listitem></varlistentry>
5517 <varlistentry>
5518 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5519 <listitem>
5520 <para>
5521 <indexterm role="option">
5522 <primary><option>-Mf</option></primary>
5523 </indexterm>
5524 <indexterm role="concept">
5525 <primary>freezing messages</primary>
5526 </indexterm>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>manually freezing</secondary>
5530 </indexterm>
5531 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5532 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5533 either manually or as a result of the <option>auto_thaw</option> configuration option.
5534 However, if any of the messages are active (in the middle of a delivery
5535 attempt), their status is not altered. This option can be used only by an admin
5536 user.
5537 </para>
5538 </listitem></varlistentry>
5539 <varlistentry>
5540 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5541 <listitem>
5542 <para>
5543 <indexterm role="option">
5544 <primary><option>-Mg</option></primary>
5545 </indexterm>
5546 <indexterm role="concept">
5547 <primary>giving up on messages</primary>
5548 </indexterm>
5549 <indexterm role="concept">
5550 <primary>message</primary>
5551 <secondary>abandoning delivery attempts</secondary>
5552 </indexterm>
5553 <indexterm role="concept">
5554 <primary>delivery</primary>
5555 <secondary>abandoning further attempts</secondary>
5556 </indexterm>
5557 This option requests Exim to give up trying to deliver the listed messages,
5558 including any that are frozen. However, if any of the messages are active,
5559 their status is not altered. For non-bounce messages, a delivery error message
5560 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5561 Bounce messages are just discarded. This option can be used only by an admin
5562 user.
5563 </para>
5564 </listitem></varlistentry>
5565 <varlistentry>
5566 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5567 <listitem>
5568 <para>
5569 <indexterm role="option">
5570 <primary><option>-Mmad</option></primary>
5571 </indexterm>
5572 <indexterm role="concept">
5573 <primary>delivery</primary>
5574 <secondary>cancelling all</secondary>
5575 </indexterm>
5576 This option requests Exim to mark all the recipient addresses in the messages
5577 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5578 message is active (in the middle of a delivery attempt), its status is not
5579 altered. This option can be used only by an admin user.
5580 </para>
5581 </listitem></varlistentry>
5582 <varlistentry>
5583 <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>
5584 <listitem>
5585 <para>
5586 <indexterm role="option">
5587 <primary><option>-Mmd</option></primary>
5588 </indexterm>
5589 <indexterm role="concept">
5590 <primary>delivery</primary>
5591 <secondary>cancelling by address</secondary>
5592 </indexterm>
5593 <indexterm role="concept">
5594 <primary>recipient</primary>
5595 <secondary>removing</secondary>
5596 </indexterm>
5597 <indexterm role="concept">
5598 <primary>removing recipients</primary>
5599 </indexterm>
5600 This option requests Exim to mark the given addresses as already delivered
5601 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5602 the remaining ones must be email addresses. These are matched to recipient
5603 addresses in the message in a case-sensitive manner. If the message is active
5604 (in the middle of a delivery attempt), its status is not altered. This option
5605 can be used only by an admin user.
5606 </para>
5607 </listitem></varlistentry>
5608 <varlistentry>
5609 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5610 <listitem>
5611 <para>
5612 <indexterm role="option">
5613 <primary><option>-Mrm</option></primary>
5614 </indexterm>
5615 <indexterm role="concept">
5616 <primary>removing messages</primary>
5617 </indexterm>
5618 <indexterm role="concept">
5619 <primary>abandoning mail</primary>
5620 </indexterm>
5621 <indexterm role="concept">
5622 <primary>message</primary>
5623 <secondary>manually discarding</secondary>
5624 </indexterm>
5625 This option requests Exim to remove the given messages from the queue. No
5626 bounce messages are sent; each message is simply forgotten. However, if any of
5627 the messages are active, their status is not altered. This option can be used
5628 only by an admin user or by the user who originally caused the message to be
5629 placed on the queue.
5630 </para>
5631 </listitem></varlistentry>
5632 <varlistentry>
5633 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5634 <listitem>
5635 <para>
5636 <indexterm role="option">
5637 <primary><option>-Mset</option></primary>
5638 </indexterm>
5639 <indexterm role="concept">
5640 <primary>testing</primary>
5641 <secondary>string expansion</secondary>
5642 </indexterm>
5643 <indexterm role="concept">
5644 <primary>expansion</primary>
5645 <secondary>testing</secondary>
5646 </indexterm>
5647 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5648 string expansions). Exim loads the given message from its spool before doing
5649 the test expansions, thus setting message-specific variables such as
5650 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5651 available. This feature is provided to make it easier to test expansions that
5652 make use of these variables. However, this option can be used only by an admin
5653 user. See also <option>-bem</option>.
5654 </para>
5655 </listitem></varlistentry>
5656 <varlistentry>
5657 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5658 <listitem>
5659 <para>
5660 <indexterm role="option">
5661 <primary><option>-Mt</option></primary>
5662 </indexterm>
5663 <indexterm role="concept">
5664 <primary>thawing messages</primary>
5665 </indexterm>
5666 <indexterm role="concept">
5667 <primary>unfreezing messages</primary>
5668 </indexterm>
5669 <indexterm role="concept">
5670 <primary>frozen messages</primary>
5671 <secondary>thawing</secondary>
5672 </indexterm>
5673 <indexterm role="concept">
5674 <primary>message</primary>
5675 <secondary>thawing frozen</secondary>
5676 </indexterm>
5677 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5678 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5679 messages are active, their status is not altered. This option can be used only
5680 by an admin user.
5681 </para>
5682 </listitem></varlistentry>
5683 <varlistentry>
5684 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5685 <listitem>
5686 <para>
5687 <indexterm role="option">
5688 <primary><option>-Mvb</option></primary>
5689 </indexterm>
5690 <indexterm role="concept">
5691 <primary>listing</primary>
5692 <secondary>message body</secondary>
5693 </indexterm>
5694 <indexterm role="concept">
5695 <primary>message</primary>
5696 <secondary>listing body of</secondary>
5697 </indexterm>
5698 This option causes the contents of the message body (-D) spool file to be
5699 written to the standard output. This option can be used only by an admin user.
5700 </para>
5701 </listitem></varlistentry>
5702 <varlistentry>
5703 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5704 <listitem>
5705 <para>
5706 <indexterm role="option">
5707 <primary><option>-Mvc</option></primary>
5708 </indexterm>
5709 <indexterm role="concept">
5710 <primary>message</primary>
5711 <secondary>listing in RFC 2822 format</secondary>
5712 </indexterm>
5713 <indexterm role="concept">
5714 <primary>listing</primary>
5715 <secondary>message in RFC 2822 format</secondary>
5716 </indexterm>
5717 This option causes a copy of the complete message (header lines plus body) to
5718 be written to the standard output in RFC 2822 format. This option can be used
5719 only by an admin user.
5720 </para>
5721 </listitem></varlistentry>
5722 <varlistentry>
5723 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5724 <listitem>
5725 <para>
5726 <indexterm role="option">
5727 <primary><option>-Mvh</option></primary>
5728 </indexterm>
5729 <indexterm role="concept">
5730 <primary>listing</primary>
5731 <secondary>message headers</secondary>
5732 </indexterm>
5733 <indexterm role="concept">
5734 <primary>header lines</primary>
5735 <secondary>listing</secondary>
5736 </indexterm>
5737 <indexterm role="concept">
5738 <primary>message</primary>
5739 <secondary>listing header lines</secondary>
5740 </indexterm>
5741 This option causes the contents of the message headers (-H) spool file to be
5742 written to the standard output. This option can be used only by an admin user.
5743 </para>
5744 </listitem></varlistentry>
5745 <varlistentry>
5746 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5747 <listitem>
5748 <para>
5749 <indexterm role="option">
5750 <primary><option>-Mvl</option></primary>
5751 </indexterm>
5752 <indexterm role="concept">
5753 <primary>listing</primary>
5754 <secondary>message log</secondary>
5755 </indexterm>
5756 <indexterm role="concept">
5757 <primary>message</primary>
5758 <secondary>listing message log</secondary>
5759 </indexterm>
5760 This option causes the contents of the message log spool file to be written to
5761 the standard output. This option can be used only by an admin user.
5762 </para>
5763 </listitem></varlistentry>
5764 <varlistentry>
5765 <term><option>-m</option></term>
5766 <listitem>
5767 <para>
5768 <indexterm role="option">
5769 <primary><option>-m</option></primary>
5770 </indexterm>
5771 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5772 treats it that way too.
5773 </para>
5774 </listitem></varlistentry>
5775 <varlistentry>
5776 <term><option>-N</option></term>
5777 <listitem>
5778 <para>
5779 <indexterm role="option">
5780 <primary><option>-N</option></primary>
5781 </indexterm>
5782 <indexterm role="concept">
5783 <primary>debugging</primary>
5784 <secondary><option>-N</option> option</secondary>
5785 </indexterm>
5786 <indexterm role="concept">
5787 <primary>debugging</primary>
5788 <secondary>suppressing delivery</secondary>
5789 </indexterm>
5790 This is a debugging option that inhibits delivery of a message at the transport
5791 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5792 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5793 had successfully done so. However, it does not make any updates to the retry
5794 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5795 than <quote>=&gt;</quote>.
5796 </para>
5797 <para>
5798 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5799 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5800 words, an ordinary user can use it only when supplying an incoming message to
5801 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5802 address may be deferred because of a configuration problem on a transport, or a
5803 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5804 the message, and applies to any subsequent delivery attempts that may happen
5805 for that message.
5806 </para>
5807 </listitem></varlistentry>
5808 <varlistentry>
5809 <term><option>-n</option></term>
5810 <listitem>
5811 <para>
5812 <indexterm role="option">
5813 <primary><option>-n</option></primary>
5814 </indexterm>
5815 <indexterm role="concept">
5816 <primary>Sendmail compatibility</primary>
5817 <secondary><option>-n</option> option ignored</secondary>
5818 </indexterm>
5819 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5820 by Exim.
5821 </para>
5822 </listitem></varlistentry>
5823 <varlistentry>
5824 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5825 <listitem>
5826 <para>
5827 <indexterm role="option">
5828 <primary><option>-O</option></primary>
5829 </indexterm>
5830 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5831 Exim.
5832 </para>
5833 </listitem></varlistentry>
5834 <varlistentry>
5835 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5836 <listitem>
5837 <para>
5838 <indexterm role="option">
5839 <primary><option>-oA</option></primary>
5840 </indexterm>
5841 <indexterm role="concept">
5842 <primary>Sendmail compatibility</primary>
5843 <secondary><option>-oA</option> option</secondary>
5844 </indexterm>
5845 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5846 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5847 description above.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-oB</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>SMTP</primary>
5859 <secondary>passed connection</secondary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>SMTP</primary>
5863 <secondary>multiple deliveries</secondary>
5864 </indexterm>
5865 <indexterm role="concept">
5866 <primary>multiple SMTP deliveries</primary>
5867 </indexterm>
5868 This is a debugging option which limits the maximum number of messages that can
5869 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5870 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5871 </para>
5872 </listitem></varlistentry>
5873 <varlistentry>
5874 <term><option>-odb</option></term>
5875 <listitem>
5876 <para>
5877 <indexterm role="option">
5878 <primary><option>-odb</option></primary>
5879 </indexterm>
5880 <indexterm role="concept">
5881 <primary>background delivery</primary>
5882 </indexterm>
5883 <indexterm role="concept">
5884 <primary>delivery</primary>
5885 <secondary>in the background</secondary>
5886 </indexterm>
5887 This option applies to all modes in which Exim accepts incoming messages,
5888 including the listening daemon. It requests <quote>background</quote> delivery of such
5889 messages, which means that the accepting process automatically starts a
5890 delivery process for each message received, but does not wait for the delivery
5891 processes to finish.
5892 </para>
5893 <para>
5894 When all the messages have been received, the reception process exits,
5895 leaving the delivery processes to finish in their own time. The standard output
5896 and error streams are closed at the start of each delivery process.
5897 This is the default action if none of the <option>-od</option> options are present.
5898 </para>
5899 <para>
5900 If one of the queueing options in the configuration file
5901 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5902 overrides it if <option>queue_only_override</option> is set true, which is the default
5903 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5904 </para>
5905 </listitem></varlistentry>
5906 <varlistentry>
5907 <term><option>-odf</option></term>
5908 <listitem>
5909 <para>
5910 <indexterm role="option">
5911 <primary><option>-odf</option></primary>
5912 </indexterm>
5913 <indexterm role="concept">
5914 <primary>foreground delivery</primary>
5915 </indexterm>
5916 <indexterm role="concept">
5917 <primary>delivery</primary>
5918 <secondary>in the foreground</secondary>
5919 </indexterm>
5920 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5921 accepted a locally-generated message. (For the daemon it is exactly the same as
5922 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5923 and Exim waits for it to complete before proceeding.
5924 </para>
5925 <para>
5926 The original Exim reception process does not finish until the delivery
5927 process for the final message has ended. The standard error stream is left open
5928 during deliveries.
5929 </para>
5930 <para>
5931 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5932 false and one of the queueing options in the configuration file is in effect.
5933 </para>
5934 <para>
5935 If there is a temporary delivery error during foreground delivery, the
5936 message is left on the queue for later delivery, and the original reception
5937 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5938 restricted configuration that never queues messages.
5939 </para>
5940 </listitem></varlistentry>
5941 <varlistentry>
5942 <term><option>-odi</option></term>
5943 <listitem>
5944 <para>
5945 <indexterm role="option">
5946 <primary><option>-odi</option></primary>
5947 </indexterm>
5948 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5949 Sendmail.
5950 </para>
5951 </listitem></varlistentry>
5952 <varlistentry>
5953 <term><option>-odq</option></term>
5954 <listitem>
5955 <para>
5956 <indexterm role="option">
5957 <primary><option>-odq</option></primary>
5958 </indexterm>
5959 <indexterm role="concept">
5960 <primary>non-immediate delivery</primary>
5961 </indexterm>
5962 <indexterm role="concept">
5963 <primary>delivery</primary>
5964 <secondary>suppressing immediate</secondary>
5965 </indexterm>
5966 <indexterm role="concept">
5967 <primary>queueing incoming messages</primary>
5968 </indexterm>
5969 This option applies to all modes in which Exim accepts incoming messages,
5970 including the listening daemon. It specifies that the accepting process should
5971 not automatically start a delivery process for each message received. Messages
5972 are placed on the queue, and remain there until a subsequent queue runner
5973 process encounters them. There are several configuration options (such as
5974 <option>queue_only</option>) that can be used to queue incoming messages under certain
5975 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5976 forces queueing.
5977 </para>
5978 </listitem></varlistentry>
5979 <varlistentry>
5980 <term><option>-odqs</option></term>
5981 <listitem>
5982 <para>
5983 <indexterm role="option">
5984 <primary><option>-odqs</option></primary>
5985 </indexterm>
5986 <indexterm role="concept">
5987 <primary>SMTP</primary>
5988 <secondary>delaying delivery</secondary>
5989 </indexterm>
5990 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5991 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5992 <option>queue_only_override</option> is false and one of the queueing options in the
5993 configuration file is in effect.
5994 </para>
5995 <para>
5996 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5997 message, in the background by default, but in the foreground if <option>-odi</option> is
5998 also present. The recipient addresses are routed, and local deliveries are done
5999 in the normal way. However, if any SMTP deliveries are required, they are not
6000 done at this time, so the message remains on the queue until a subsequent queue
6001 runner process encounters it. Because routing was done, Exim knows which
6002 messages are waiting for which hosts, and so a number of messages for the same
6003 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6004 configuration option has the same effect for specific domains. See also the
6005 <option>-qq</option> option.
6006 </para>
6007 </listitem></varlistentry>
6008 <varlistentry>
6009 <term><option>-oee</option></term>
6010 <listitem>
6011 <para>
6012 <indexterm role="option">
6013 <primary><option>-oee</option></primary>
6014 </indexterm>
6015 <indexterm role="concept">
6016 <primary>error</primary>
6017 <secondary>reporting</secondary>
6018 </indexterm>
6019 If an error is detected while a non-SMTP message is being received (for
6020 example, a malformed address), the error is reported to the sender in a mail
6021 message.
6022 </para>
6023 <para>
6024 <indexterm role="concept">
6025 <primary>return code</primary>
6026 <secondary>for <option>-oee</option></secondary>
6027 </indexterm>
6028 Provided
6029 this error message is successfully sent, the Exim receiving process
6030 exits with a return code of zero. If not, the return code is 2 if the problem
6031 is that the original message has no recipients, or 1 any other error. This is
6032 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6033 </para>
6034 </listitem></varlistentry>
6035 <varlistentry>
6036 <term><option>-oem</option></term>
6037 <listitem>
6038 <para>
6039 <indexterm role="option">
6040 <primary><option>-oem</option></primary>
6041 </indexterm>
6042 <indexterm role="concept">
6043 <primary>error</primary>
6044 <secondary>reporting</secondary>
6045 </indexterm>
6046 <indexterm role="concept">
6047 <primary>return code</primary>
6048 <secondary>for <option>-oem</option></secondary>
6049 </indexterm>
6050 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6051 return code, whether or not the error message was successfully sent.
6052 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6053 </para>
6054 </listitem></varlistentry>
6055 <varlistentry>
6056 <term><option>-oep</option></term>
6057 <listitem>
6058 <para>
6059 <indexterm role="option">
6060 <primary><option>-oep</option></primary>
6061 </indexterm>
6062 <indexterm role="concept">
6063 <primary>error</primary>
6064 <secondary>reporting</secondary>
6065 </indexterm>
6066 If an error is detected while a non-SMTP message is being received, the
6067 error is reported by writing a message to the standard error file (stderr).
6068 <indexterm role="concept">
6069 <primary>return code</primary>
6070 <secondary>for <option>-oep</option></secondary>
6071 </indexterm>
6072 The return code is 1 for all errors.
6073 </para>
6074 </listitem></varlistentry>
6075 <varlistentry>
6076 <term><option>-oeq</option></term>
6077 <listitem>
6078 <para>
6079 <indexterm role="option">
6080 <primary><option>-oeq</option></primary>
6081 </indexterm>
6082 <indexterm role="concept">
6083 <primary>error</primary>
6084 <secondary>reporting</secondary>
6085 </indexterm>
6086 This option is supported for compatibility with Sendmail, but has the same
6087 effect as <option>-oep</option>.
6088 </para>
6089 </listitem></varlistentry>
6090 <varlistentry>
6091 <term><option>-oew</option></term>
6092 <listitem>
6093 <para>
6094 <indexterm role="option">
6095 <primary><option>-oew</option></primary>
6096 </indexterm>
6097 <indexterm role="concept">
6098 <primary>error</primary>
6099 <secondary>reporting</secondary>
6100 </indexterm>
6101 This option is supported for compatibility with Sendmail, but has the same
6102 effect as <option>-oem</option>.
6103 </para>
6104 </listitem></varlistentry>
6105 <varlistentry>
6106 <term><option>-oi</option></term>
6107 <listitem>
6108 <para>
6109 <indexterm role="option">
6110 <primary><option>-oi</option></primary>
6111 </indexterm>
6112 <indexterm role="concept">
6113 <primary>dot</primary>
6114 <secondary>in incoming non-SMTP message</secondary>
6115 </indexterm>
6116 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6117 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6118 single dot does terminate, though Exim does no special processing for other
6119 lines that start with a dot. This option is set by default if Exim is called as
6120 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6121 </para>
6122 </listitem></varlistentry>
6123 <varlistentry>
6124 <term><option>-oitrue</option></term>
6125 <listitem>
6126 <para>
6127 <indexterm role="option">
6128 <primary><option>-oitrue</option></primary>
6129 </indexterm>
6130 This option is treated as synonymous with <option>-oi</option>.
6131 </para>
6132 </listitem></varlistentry>
6133 <varlistentry>
6134 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6135 <listitem>
6136 <para>
6137 <indexterm role="option">
6138 <primary><option>-oMa</option></primary>
6139 </indexterm>
6140 <indexterm role="concept">
6141 <primary>sender</primary>
6142 <secondary>host address, specifying for local message</secondary>
6143 </indexterm>
6144 A number of options starting with <option>-oM</option> can be used to set values associated
6145 with remote hosts on locally-submitted messages (that is, messages not received
6146 over TCP/IP). These options can be used by any caller in conjunction with the
6147 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6148 other circumstances, they are ignored unless the caller is trusted.
6149 </para>
6150 <para>
6151 The <option>-oMa</option> option sets the sender host address. This may include a port
6152 number at the end, after a full stop (period). For example:
6153 </para>
6154 <literallayout class="monospaced">
6155 exim -bs -oMa 10.9.8.7.1234
6156 </literallayout>
6157 <para>
6158 An alternative syntax is to enclose the IP address in square brackets,
6159 followed by a colon and the port number:
6160 </para>
6161 <literallayout class="monospaced">
6162 exim -bs -oMa [10.9.8.7]:1234
6163 </literallayout>
6164 <para>
6165 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6166 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6167 are present on the command line, the sender host IP address is taken from
6168 whichever one is last.
6169 </para>
6170 </listitem></varlistentry>
6171 <varlistentry>
6172 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6173 <listitem>
6174 <para>
6175 <indexterm role="option">
6176 <primary><option>-oMaa</option></primary>
6177 </indexterm>
6178 <indexterm role="concept">
6179 <primary>authentication</primary>
6180 <secondary>name, specifying for local message</secondary>
6181 </indexterm>
6182 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6183 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6184 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6185 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6186 authenticated SMTP session without actually using the SMTP AUTH command.
6187 </para>
6188 </listitem></varlistentry>
6189 <varlistentry>
6190 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6191 <listitem>
6192 <para>
6193 <indexterm role="option">
6194 <primary><option>-oMai</option></primary>
6195 </indexterm>
6196 <indexterm role="concept">
6197 <primary>authentication</primary>
6198 <secondary>id, specifying for local message</secondary>
6199 </indexterm>
6200 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6201 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6202 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6203 where there is no default) for messages from local sources. See chapter
6204 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6205 </para>
6206 </listitem></varlistentry>
6207 <varlistentry>
6208 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6209 <listitem>
6210 <para>
6211 <indexterm role="option">
6212 <primary><option>-oMas</option></primary>
6213 </indexterm>
6214 <indexterm role="concept">
6215 <primary>authentication</primary>
6216 <secondary>sender, specifying for local message</secondary>
6217 </indexterm>
6218 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6219 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6220 overrides the sender address that is created from the caller&#x2019;s login id for
6221 messages from local sources, except when <option>-bh</option> is used, when there is no
6222 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6223 specified on a MAIL command overrides this value. See chapter
6224 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6225 </para>
6226 </listitem></varlistentry>
6227 <varlistentry>
6228 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6229 <listitem>
6230 <para>
6231 <indexterm role="option">
6232 <primary><option>-oMi</option></primary>
6233 </indexterm>
6234 <indexterm role="concept">
6235 <primary>interface</primary>
6236 <secondary>address, specifying for local message</secondary>
6237 </indexterm>
6238 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6239 option sets the IP interface address value. A port number may be included,
6240 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6241 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6242 </para>
6243 </listitem></varlistentry>
6244 <varlistentry>
6245 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6246 <listitem>
6247 <para>
6248 <indexterm role="option">
6249 <primary><option>-oMr</option></primary>
6250 </indexterm>
6251 <indexterm role="concept">
6252 <primary>protocol, specifying for local message</primary>
6253 </indexterm>
6254 <indexterm role="variable">
6255 <primary><varname>$received_protocol</varname></primary>
6256 </indexterm>
6257 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6258 option sets the received protocol value that is stored in
6259 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6260 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6261 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6262 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6263 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6264 be set by <option>-oMr</option>.
6265 </para>
6266 </listitem></varlistentry>
6267 <varlistentry>
6268 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6269 <listitem>
6270 <para>
6271 <indexterm role="option">
6272 <primary><option>-oMs</option></primary>
6273 </indexterm>
6274 <indexterm role="concept">
6275 <primary>sender</primary>
6276 <secondary>host name, specifying for local message</secondary>
6277 </indexterm>
6278 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6279 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6280 present, Exim does not attempt to look up a host name from an IP address; it
6281 uses the name it is given.
6282 </para>
6283 </listitem></varlistentry>
6284 <varlistentry>
6285 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6286 <listitem>
6287 <para>
6288 <indexterm role="option">
6289 <primary><option>-oMt</option></primary>
6290 </indexterm>
6291 <indexterm role="concept">
6292 <primary>sender</primary>
6293 <secondary>ident string, specifying for local message</secondary>
6294 </indexterm>
6295 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6296 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6297 local callers is the login id of the calling process, except when <option>-bh</option> is
6298 used, when there is no default.
6299 </para>
6300 </listitem></varlistentry>
6301 <varlistentry>
6302 <term><option>-om</option></term>
6303 <listitem>
6304 <para>
6305 <indexterm role="option">
6306 <primary><option>-om</option></primary>
6307 </indexterm>
6308 <indexterm role="concept">
6309 <primary>Sendmail compatibility</primary>
6310 <secondary><option>-om</option> option ignored</secondary>
6311 </indexterm>
6312 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6313 message should receive a copy of the message if the sender appears in an alias
6314 expansion. Exim always does this, so the option does nothing.
6315 </para>
6316 </listitem></varlistentry>
6317 <varlistentry>
6318 <term><option>-oo</option></term>
6319 <listitem>
6320 <para>
6321 <indexterm role="option">
6322 <primary><option>-oo</option></primary>
6323 </indexterm>
6324 <indexterm role="concept">
6325 <primary>Sendmail compatibility</primary>
6326 <secondary><option>-oo</option> option ignored</secondary>
6327 </indexterm>
6328 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6329 whatever that means.
6330 </para>
6331 </listitem></varlistentry>
6332 <varlistentry>
6333 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6334 <listitem>
6335 <para>
6336 <indexterm role="option">
6337 <primary><option>-oP</option></primary>
6338 </indexterm>
6339 <indexterm role="concept">
6340 <primary>pid (process id)</primary>
6341 <secondary>of daemon</secondary>
6342 </indexterm>
6343 <indexterm role="concept">
6344 <primary>daemon</primary>
6345 <secondary>process id (pid)</secondary>
6346 </indexterm>
6347 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6348 value. The option specifies the file to which the process id of the daemon is
6349 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6350 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6351 because in those cases, the normal pid file is not used.
6352 </para>
6353 </listitem></varlistentry>
6354 <varlistentry>
6355 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6356 <listitem>
6357 <para>
6358 <indexterm role="option">
6359 <primary><option>-or</option></primary>
6360 </indexterm>
6361 <indexterm role="concept">
6362 <primary>timeout</primary>
6363 <secondary>for non-SMTP input</secondary>
6364 </indexterm>
6365 This option sets a timeout value for incoming non-SMTP messages. If it is not
6366 set, Exim will wait forever for the standard input. The value can also be set
6367 by the <option>receive_timeout</option> option. The format used for specifying times is
6368 described in section <xref linkend="SECTtimeformat"/>.
6369 </para>
6370 </listitem></varlistentry>
6371 <varlistentry>
6372 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6373 <listitem>
6374 <para>
6375 <indexterm role="option">
6376 <primary><option>-os</option></primary>
6377 </indexterm>
6378 <indexterm role="concept">
6379 <primary>timeout</primary>
6380 <secondary>for SMTP input</secondary>
6381 </indexterm>
6382 <indexterm role="concept">
6383 <primary>SMTP</primary>
6384 <secondary>input timeout</secondary>
6385 </indexterm>
6386 This option sets a timeout value for incoming SMTP messages. The timeout
6387 applies to each SMTP command and block of data. The value can also be set by
6388 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6389 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6390 </para>
6391 </listitem></varlistentry>
6392 <varlistentry>
6393 <term><option>-ov</option></term>
6394 <listitem>
6395 <para>
6396 <indexterm role="option">
6397 <primary><option>-ov</option></primary>
6398 </indexterm>
6399 This option has exactly the same effect as <option>-v</option>.
6400 </para>
6401 </listitem></varlistentry>
6402 <varlistentry>
6403 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6404 <listitem>
6405 <para>
6406 <indexterm role="option">
6407 <primary><option>-oX</option></primary>
6408 </indexterm>
6409 <indexterm role="concept">
6410 <primary>TCP/IP</primary>
6411 <secondary>setting listening ports</secondary>
6412 </indexterm>
6413 <indexterm role="concept">
6414 <primary>TCP/IP</primary>
6415 <secondary>setting listening interfaces</secondary>
6416 </indexterm>
6417 <indexterm role="concept">
6418 <primary>port</primary>
6419 <secondary>receiving TCP/IP</secondary>
6420 </indexterm>
6421 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6422 is also given. It controls which ports and interfaces the daemon uses. Details
6423 of the syntax, and how it interacts with configuration file options, are given
6424 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6425 file is written unless <option>-oP</option> is also present to specify a pid file name.
6426 </para>
6427 </listitem></varlistentry>
6428 <varlistentry>
6429 <term><option>-pd</option></term>
6430 <listitem>
6431 <para>
6432 <indexterm role="option">
6433 <primary><option>-pd</option></primary>
6434 </indexterm>
6435 <indexterm role="concept">
6436 <primary>Perl</primary>
6437 <secondary>starting the interpreter</secondary>
6438 </indexterm>
6439 This option applies when an embedded Perl interpreter is linked with Exim (see
6440 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6441 option, forcing the starting of the interpreter to be delayed until it is
6442 needed.
6443 </para>
6444 </listitem></varlistentry>
6445 <varlistentry>
6446 <term><option>-ps</option></term>
6447 <listitem>
6448 <para>
6449 <indexterm role="option">
6450 <primary><option>-ps</option></primary>
6451 </indexterm>
6452 <indexterm role="concept">
6453 <primary>Perl</primary>
6454 <secondary>starting the interpreter</secondary>
6455 </indexterm>
6456 This option applies when an embedded Perl interpreter is linked with Exim (see
6457 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6458 option, forcing the starting of the interpreter to occur as soon as Exim is
6459 started.
6460 </para>
6461 </listitem></varlistentry>
6462 <varlistentry>
6463 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6464 <listitem>
6465 <para>
6466 <indexterm role="option">
6467 <primary><option>-p</option></primary>
6468 </indexterm>
6469 For compatibility with Sendmail, this option is equivalent to
6470 </para>
6471 <literallayout>
6472 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6473 </literallayout>
6474 <para>
6475 It sets the incoming protocol and host name (for trusted callers). The
6476 host name and its colon can be omitted when only the protocol is to be set.
6477 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6478 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6479 or <literal>s</literal> using this option (but that does not seem a real limitation).
6480 </para>
6481 </listitem></varlistentry>
6482 <varlistentry>
6483 <term><option>-q</option></term>
6484 <listitem>
6485 <para>
6486 <indexterm role="option">
6487 <primary><option>-q</option></primary>
6488 </indexterm>
6489 <indexterm role="concept">
6490 <primary>queue runner</primary>
6491 <secondary>starting manually</secondary>
6492 </indexterm>
6493 This option is normally restricted to admin users. However, there is a
6494 configuration option called <option>prod_requires_admin</option> which can be set false to
6495 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6496 and <option>-S</option> options).
6497 </para>
6498 <para>
6499 <indexterm role="concept">
6500 <primary>queue runner</primary>
6501 <secondary>description of operation</secondary>
6502 </indexterm>
6503 The <option>-q</option> option starts one queue runner process. This scans the queue of
6504 waiting messages, and runs a delivery process for each one in turn. It waits
6505 for each delivery process to finish before starting the next one. A delivery
6506 process may not actually do any deliveries if the retry times for the addresses
6507 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6508 </para>
6509 <para>
6510 If
6511 <indexterm role="concept">
6512 <primary>SMTP</primary>
6513 <secondary>passed connection</secondary>
6514 </indexterm>
6515 <indexterm role="concept">
6516 <primary>SMTP</primary>
6517 <secondary>multiple deliveries</secondary>
6518 </indexterm>
6519 <indexterm role="concept">
6520 <primary>multiple SMTP deliveries</primary>
6521 </indexterm>
6522 the delivery process spawns other processes to deliver other messages down
6523 passed SMTP connections, the queue runner waits for these to finish before
6524 proceeding.
6525 </para>
6526 <para>
6527 When all the queued messages have been considered, the original queue runner
6528 process terminates. In other words, a single pass is made over the waiting
6529 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6530 this to be repeated periodically.
6531 </para>
6532 <para>
6533 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6534 random, but it is likely to be different each time, which is all that matters.
6535 If one particular message screws up a remote MTA, other messages to the same
6536 MTA have a chance of getting through if they get tried first.
6537 </para>
6538 <para>
6539 It is possible to cause the messages to be processed in lexical message id
6540 order, which is essentially the order in which they arrived, by setting the
6541 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6542 </para>
6543 </listitem></varlistentry>
6544 <varlistentry>
6545 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6546 <listitem>
6547 <para>
6548 The <option>-q</option> option may be followed by one or more flag letters that change its
6549 behaviour. They are all optional, but if more than one is present, they must
6550 appear in the correct order. Each flag is described in a separate item below.
6551 </para>
6552 </listitem></varlistentry>
6553 <varlistentry>
6554 <term><option>-qq...</option></term>
6555 <listitem>
6556 <para>
6557 <indexterm role="option">
6558 <primary><option>-qq</option></primary>
6559 </indexterm>
6560 <indexterm role="concept">
6561 <primary>queue</primary>
6562 <secondary>double scanning</secondary>
6563 </indexterm>
6564 <indexterm role="concept">
6565 <primary>queue</primary>
6566 <secondary>routing</secondary>
6567 </indexterm>
6568 <indexterm role="concept">
6569 <primary>routing</primary>
6570 <secondary>whole queue before delivery</secondary>
6571 </indexterm>
6572 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6573 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6574 every domain. Addresses are routed, local deliveries happen, but no remote
6575 transports are run.
6576 </para>
6577 <para>
6578 <indexterm role="concept">
6579 <primary>hints database</primary>
6580 <secondary>remembering routing</secondary>
6581 </indexterm>
6582 The hints database that remembers which messages are waiting for specific hosts
6583 is updated, as if delivery to those hosts had been deferred. After this is
6584 complete, a second, normal queue scan happens, with routing and delivery taking
6585 place as normal. Messages that are routed to the same host should mostly be
6586 delivered down a single SMTP
6587 <indexterm role="concept">
6588 <primary>SMTP</primary>
6589 <secondary>passed connection</secondary>
6590 </indexterm>
6591 <indexterm role="concept">
6592 <primary>SMTP</primary>
6593 <secondary>multiple deliveries</secondary>
6594 </indexterm>
6595 <indexterm role="concept">
6596 <primary>multiple SMTP deliveries</primary>
6597 </indexterm>
6598 connection because of the hints that were set up during the first queue scan.
6599 This option may be useful for hosts that are connected to the Internet
6600 intermittently.
6601 </para>
6602 </listitem></varlistentry>
6603 <varlistentry>
6604 <term><option>-q[q]i...</option></term>
6605 <listitem>
6606 <para>
6607 <indexterm role="option">
6608 <primary><option>-qi</option></primary>
6609 </indexterm>
6610 <indexterm role="concept">
6611 <primary>queue</primary>
6612 <secondary>initial delivery</secondary>
6613 </indexterm>
6614 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6615 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6616 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6617 <option>-odq</option> and want a queue runner just to process the new messages.
6618 </para>
6619 </listitem></varlistentry>
6620 <varlistentry>
6621 <term><option>-q[q][i]f...</option></term>
6622 <listitem>
6623 <para>
6624 <indexterm role="option">
6625 <primary><option>-qf</option></primary>
6626 </indexterm>
6627 <indexterm role="concept">
6628 <primary>queue</primary>
6629 <secondary>forcing delivery</secondary>
6630 </indexterm>
6631 <indexterm role="concept">
6632 <primary>delivery</primary>
6633 <secondary>forcing in queue run</secondary>
6634 </indexterm>
6635 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6636 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6637 their retry times are tried.
6638 </para>
6639 </listitem></varlistentry>
6640 <varlistentry>
6641 <term><option>-q[q][i]ff...</option></term>
6642 <listitem>
6643 <para>
6644 <indexterm role="option">
6645 <primary><option>-qff</option></primary>
6646 </indexterm>
6647 <indexterm role="concept">
6648 <primary>frozen messages</primary>
6649 <secondary>forcing delivery</secondary>
6650 </indexterm>
6651 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6652 frozen or not.
6653 </para>
6654 </listitem></varlistentry>
6655 <varlistentry>
6656 <term><option>-q[q][i][f[f]]l</option></term>
6657 <listitem>
6658 <para>
6659 <indexterm role="option">
6660 <primary><option>-ql</option></primary>
6661 </indexterm>
6662 <indexterm role="concept">
6663 <primary>queue</primary>
6664 <secondary>local deliveries only</secondary>
6665 </indexterm>
6666 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6667 be done. If a message requires any remote deliveries, it remains on the queue
6668 for later delivery.
6669 </para>
6670 </listitem></varlistentry>
6671 <varlistentry>
6672 <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>
6673 <listitem>
6674 <para>
6675 <indexterm role="concept">
6676 <primary>queue</primary>
6677 <secondary>delivering specific messages</secondary>
6678 </indexterm>
6679 When scanning the queue, Exim can be made to skip over messages whose ids are
6680 lexically less than a given value by following the <option>-q</option> option with a
6681 starting message id. For example:
6682 </para>
6683 <literallayout class="monospaced">
6684 exim -q 0t5C6f-0000c8-00
6685 </literallayout>
6686 <para>
6687 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6688 second message id is given, messages whose ids are lexically greater than it
6689 are also skipped. If the same id is given twice, for example,
6690 </para>
6691 <literallayout class="monospaced">
6692 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6693 </literallayout>
6694 <para>
6695 just one delivery process is started, for that message. This differs from
6696 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6697 that it counts as a delivery from a queue run. Note that the selection
6698 mechanism does not affect the order in which the messages are scanned. There
6699 are also other ways of selecting specific sets of messages for delivery in a
6700 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6701 </para>
6702 </listitem></varlistentry>
6703 <varlistentry>
6704 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6705 <listitem>
6706 <para>
6707 <indexterm role="concept">
6708 <primary>queue runner</primary>
6709 <secondary>starting periodically</secondary>
6710 </indexterm>
6711 <indexterm role="concept">
6712 <primary>periodic queue running</primary>
6713 </indexterm>
6714 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6715 starting a queue runner process at intervals specified by the given time value
6716 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6717 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6718 single daemon process handles both functions. A common way of starting up a
6719 combined daemon at system boot time is to use a command such as
6720 </para>
6721 <literallayout class="monospaced">
6722 /usr/exim/bin/exim -bd -q30m
6723 </literallayout>
6724 <para>
6725 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6726 process every 30 minutes.
6727 </para>
6728 <para>
6729 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6730 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6731 </para>
6732 </listitem></varlistentry>
6733 <varlistentry>
6734 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6735 <listitem>
6736 <para>
6737 <indexterm role="option">
6738 <primary><option>-qR</option></primary>
6739 </indexterm>
6740 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6741 compatibility.
6742 </para>
6743 </listitem></varlistentry>
6744 <varlistentry>
6745 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6746 <listitem>
6747 <para>
6748 <indexterm role="option">
6749 <primary><option>-qS</option></primary>
6750 </indexterm>
6751 This option is synonymous with <option>-S</option>.
6752 </para>
6753 </listitem></varlistentry>
6754 <varlistentry>
6755 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6756 <listitem>
6757 <para>
6758 <indexterm role="option">
6759 <primary><option>-R</option></primary>
6760 </indexterm>
6761 <indexterm role="concept">
6762 <primary>queue runner</primary>
6763 <secondary>for specific recipients</secondary>
6764 </indexterm>
6765 <indexterm role="concept">
6766 <primary>delivery</primary>
6767 <secondary>to given domain</secondary>
6768 </indexterm>
6769 <indexterm role="concept">
6770 <primary>domain</primary>
6771 <secondary>delivery to</secondary>
6772 </indexterm>
6773 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6774 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6775 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6776 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6777 </para>
6778 <para>
6779 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6780 perform a single queue run, except that, when scanning the messages on the
6781 queue, Exim processes only those that have at least one undelivered recipient
6782 address containing the given string, which is checked in a case-independent
6783 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6784 regular expression; otherwise it is a literal string.
6785 </para>
6786 <para>
6787 If you want to do periodic queue runs for messages with specific recipients,
6788 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6789 </para>
6790 <literallayout class="monospaced">
6791 exim -q25m -R @special.domain.example
6792 </literallayout>
6793 <para>
6794 This example does a queue run for messages with recipients in the given domain
6795 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6796 applied to each queue run.
6797 </para>
6798 <para>
6799 Once a message is selected for delivery by this mechanism, all its addresses
6800 are processed. For the first selected message, Exim overrides any retry
6801 information and forces a delivery attempt for each undelivered address. This
6802 means that if delivery of any address in the first message is successful, any
6803 existing retry information is deleted, and so delivery attempts for that
6804 address in subsequently selected messages (which are processed without forcing)
6805 will run. However, if delivery of any address does not succeed, the retry
6806 information is updated, and in subsequently selected messages, the failing
6807 address will be skipped.
6808 </para>
6809 <para>
6810 <indexterm role="concept">
6811 <primary>frozen messages</primary>
6812 <secondary>forcing delivery</secondary>
6813 </indexterm>
6814 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6815 all selected messages, not just the first; frozen messages are included when
6816 <emphasis>ff</emphasis> is present.
6817 </para>
6818 <para>
6819 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6820 to a given domain after a host has been down for some time. When the SMTP
6821 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6822 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6823 an arbitrary command instead.
6824 </para>
6825 </listitem></varlistentry>
6826 <varlistentry>
6827 <term><option>-r</option></term>
6828 <listitem>
6829 <para>
6830 <indexterm role="option">
6831 <primary><option>-r</option></primary>
6832 </indexterm>
6833 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6834 </para>
6835 </listitem></varlistentry>
6836 <varlistentry>
6837 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6838 <listitem>
6839 <para>
6840 <indexterm role="option">
6841 <primary><option>-S</option></primary>
6842 </indexterm>
6843 <indexterm role="concept">
6844 <primary>delivery</primary>
6845 <secondary>from given sender</secondary>
6846 </indexterm>
6847 <indexterm role="concept">
6848 <primary>queue runner</primary>
6849 <secondary>for specific senders</secondary>
6850 </indexterm>
6851 This option acts like <option>-R</option> except that it checks the string against each
6852 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6853 conditions must be met for a message to be selected. If either of the options
6854 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6855 </para>
6856 </listitem></varlistentry>
6857 <varlistentry>
6858 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6859 <listitem>
6860 <para>
6861 <indexterm role="option">
6862 <primary><option>-Tqt</option></primary>
6863 </indexterm>
6864 This an option that is exclusively for use by the Exim testing suite. It is not
6865 recognized when Exim is run normally. It allows for the setting up of explicit
6866 <quote>queue times</quote> so that various warning/retry features can be tested.
6867 </para>
6868 </listitem></varlistentry>
6869 <varlistentry>
6870 <term><option>-t</option></term>
6871 <listitem>
6872 <para>
6873 <indexterm role="option">
6874 <primary><option>-t</option></primary>
6875 </indexterm>
6876 <indexterm role="concept">
6877 <primary>recipient</primary>
6878 <secondary>extracting from header lines</secondary>
6879 </indexterm>
6880 <indexterm role="concept">
6881 <primary><emphasis>Bcc:</emphasis> header line</primary>
6882 </indexterm>
6883 <indexterm role="concept">
6884 <primary><emphasis>Cc:</emphasis> header line</primary>
6885 </indexterm>
6886 <indexterm role="concept">
6887 <primary><emphasis>To:</emphasis> header line</primary>
6888 </indexterm>
6889 When Exim is receiving a locally-generated, non-SMTP message on its standard
6890 input, the <option>-t</option> option causes the recipients of the message to be obtained
6891 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6892 from the command arguments. The addresses are extracted before any rewriting
6893 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6894 </para>
6895 <para>
6896 <indexterm role="concept">
6897 <primary>Sendmail compatibility</primary>
6898 <secondary><option>-t</option> option</secondary>
6899 </indexterm>
6900 If the command has any arguments, they specify addresses to which the message
6901 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6902 the recipients list obtained from the headers. This is compatible with Smail 3
6903 and in accordance with the documented behaviour of several versions of
6904 Sendmail, as described in man pages on a number of operating systems (e.g.
6905 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6906 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6907 Sendmail book documents it that way. Exim can be made to add argument addresses
6908 instead of subtracting them by setting the option
6909 <option>extract_addresses_remove_arguments</option> false.
6910 </para>
6911 <para>
6912 <indexterm role="concept">
6913 <primary><option>Resent-</option> header lines</primary>
6914 <secondary>with <option>-t</option></secondary>
6915 </indexterm>
6916 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6917 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6918 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6919 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6920 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6921 </para>
6922 <para>
6923 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6924 message is resent several times). The RFC also specifies that they should be
6925 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6926 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6927 nor indeed exactly what constitutes a <quote>set</quote>.
6928 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6929 are often added at the end of the header, and if a message is resent more than
6930 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6931 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6932 </para>
6933 </listitem></varlistentry>
6934 <varlistentry>
6935 <term><option>-ti</option></term>
6936 <listitem>
6937 <para>
6938 <indexterm role="option">
6939 <primary><option>-ti</option></primary>
6940 </indexterm>
6941 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6942 compatibility with Sendmail.
6943 </para>
6944 </listitem></varlistentry>
6945 <varlistentry>
6946 <term><option>-tls-on-connect</option></term>
6947 <listitem>
6948 <para>
6949 <indexterm role="option">
6950 <primary><option>-tls-on-connect</option></primary>
6951 </indexterm>
6952 <indexterm role="concept">
6953 <primary>TLS</primary>
6954 <secondary>use without STARTTLS</secondary>
6955 </indexterm>
6956 <indexterm role="concept">
6957 <primary>TLS</primary>
6958 <secondary>automatic start</secondary>
6959 </indexterm>
6960 This option is available when Exim is compiled with TLS support. It forces all
6961 incoming SMTP connections to behave as if the incoming port is listed in the
6962 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6963 <xref linkend="CHAPTLS"/> for further details.
6964 </para>
6965 </listitem></varlistentry>
6966 <varlistentry>
6967 <term><option>-U</option></term>
6968 <listitem>
6969 <para>
6970 <indexterm role="option">
6971 <primary><option>-U</option></primary>
6972 </indexterm>
6973 <indexterm role="concept">
6974 <primary>Sendmail compatibility</primary>
6975 <secondary><option>-U</option> option ignored</secondary>
6976 </indexterm>
6977 Sendmail uses this option for <quote>initial message submission</quote>, and its
6978 documentation states that in future releases, it may complain about
6979 syntactically invalid messages rather than fixing them when this flag is not
6980 set. Exim ignores this option.
6981 </para>
6982 </listitem></varlistentry>
6983 <varlistentry>
6984 <term><option>-v</option></term>
6985 <listitem>
6986 <para>
6987 <indexterm role="option">
6988 <primary><option>-v</option></primary>
6989 </indexterm>
6990 This option causes Exim to write information to the standard error stream,
6991 describing what it is doing. In particular, it shows the log lines for
6992 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6993 dialogue is shown. Some of the log lines shown may not actually be written to
6994 the log if the setting of <option>log_selector</option> discards them. Any relevant
6995 selectors are shown with each log line. If none are shown, the logging is
6996 unconditional.
6997 </para>
6998 </listitem></varlistentry>
6999 <varlistentry>
7000 <term><option>-x</option></term>
7001 <listitem>
7002 <para>
7003 <indexterm role="option">
7004 <primary><option>-x</option></primary>
7005 </indexterm>
7006 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7007 National Language Support extended characters in the body of the mail item</quote>).
7008 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7009 this option.
7010 </para>
7011 </listitem></varlistentry>
7012 </variablelist>
7013 <para>
7014 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7015 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7016 </para>
7017 <!-- === End of command line options === -->
7018 </section>
7019 </chapter>
7020
7021 <chapter id="CHAPconf">
7022 <title>The Exim run time configuration file</title>
7023 <titleabbrev>The runtime configuration file</titleabbrev>
7024 <para>
7025 <indexterm role="concept">
7026 <primary>run time configuration</primary>
7027 </indexterm>
7028 <indexterm role="concept">
7029 <primary>configuration file</primary>
7030 <secondary>general description</secondary>
7031 </indexterm>
7032 <indexterm role="concept">
7033 <primary>CONFIGURE_FILE</primary>
7034 </indexterm>
7035 <indexterm role="concept">
7036 <primary>configuration file</primary>
7037 <secondary>errors in</secondary>
7038 </indexterm>
7039 <indexterm role="concept">
7040 <primary>error</primary>
7041 <secondary>in configuration file</secondary>
7042 </indexterm>
7043 <indexterm role="concept">
7044 <primary>return code</primary>
7045 <secondary>for bad configuration</secondary>
7046 </indexterm>
7047 Exim uses a single run time configuration file that is read whenever an Exim
7048 binary is executed. Note that in normal operation, this happens frequently,
7049 because Exim is designed to operate in a distributed manner, without central
7050 control.
7051 </para>
7052 <para>
7053 If a syntax error is detected while reading the configuration file, Exim
7054 writes a message on the standard error, and exits with a non-zero return code.
7055 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7056 errors can be detected at this time. The values of any expanded options are
7057 not checked until the expansion happens, even when the expansion does not
7058 actually alter the string.
7059 </para>
7060 <para>
7061 The name of the configuration file is compiled into the binary for security
7062 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7063 most configurations, this specifies a single file. However, it is permitted to
7064 give a colon-separated list of file names, in which case Exim uses the first
7065 existing file in the list.
7066 </para>
7067 <para>
7068 <indexterm role="concept">
7069 <primary>EXIM_USER</primary>
7070 </indexterm>
7071 <indexterm role="concept">
7072 <primary>EXIM_GROUP</primary>
7073 </indexterm>
7074 <indexterm role="concept">
7075 <primary>CONFIGURE_OWNER</primary>
7076 </indexterm>
7077 <indexterm role="concept">
7078 <primary>CONFIGURE_GROUP</primary>
7079 </indexterm>
7080 <indexterm role="concept">
7081 <primary>configuration file</primary>
7082 <secondary>ownership</secondary>
7083 </indexterm>
7084 <indexterm role="concept">
7085 <primary>ownership</primary>
7086 <secondary>configuration file</secondary>
7087 </indexterm>
7088 The run time configuration file must be owned by root or by the user that is
7089 specified at compile time by the CONFIGURE_OWNER option (if set). The
7090 configuration file must not be world-writeable, or group-writeable unless its
7091 group is the root group or the one specified at compile time by the
7092 CONFIGURE_GROUP option.
7093 </para>
7094 <para>
7095 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7096 to root, anybody who is able to edit the run time configuration file has an
7097 easy way to run commands as root. If you specify a user or group in the
7098 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7099 who are members of that group will trivially be able to obtain root privileges.
7100 </para>
7101 <para>
7102 Up to Exim version 4.72, the run time configuration file was also permitted to
7103 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7104 since it offered a simple privilege escalation for any attacker who managed to
7105 compromise the Exim user account.
7106 </para>
7107 <para>
7108 A default configuration file, which will work correctly in simple situations,
7109 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7110 defines just one file name, the installation process copies the default
7111 configuration to a new file of that name if it did not previously exist. If
7112 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7113 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7114 configuration.
7115 </para>
7116 <section id="SECID40">
7117 <title>Using a different configuration file</title>
7118 <para>
7119 <indexterm role="concept">
7120 <primary>configuration file</primary>
7121 <secondary>alternate</secondary>
7122 </indexterm>
7123 A one-off alternate configuration can be specified by the <option>-C</option> command line
7124 option, which may specify a single file or a list of files. However, when
7125 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7126 unless the argument for <option>-C</option> is identical to the built-in value from
7127 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7128 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7129 is useful mainly for checking the syntax of configuration files before
7130 installing them. No owner or group checks are done on a configuration file
7131 specified by <option>-C</option>, if root privilege has been dropped.
7132 </para>
7133 <para>
7134 Even the Exim user is not trusted to specify an arbitrary configuration file
7135 with the <option>-C</option> option to be used with root privileges, unless that file is
7136 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7137 testing a configuration using <option>-C</option> right through message reception and
7138 delivery, even if the caller is root. The reception works, but by that time,
7139 Exim is running as the Exim user, so when it re-execs to regain privilege for
7140 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7141 can test reception and delivery using two separate commands (one to put a
7142 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7143 <option>-M</option>).
7144 </para>
7145 <para>
7146 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7147 prefix string with which any file named in a <option>-C</option> command line option must
7148 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7149 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7150 name can be used with <option>-C</option>.
7151 </para>
7152 <para>
7153 One-off changes to a configuration can be specified by the <option>-D</option> command line
7154 option, which defines and overrides values for macros used inside the
7155 configuration file. However, like <option>-C</option>, the use of this option by a
7156 non-privileged user causes Exim to discard its root privilege.
7157 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7158 completely disabled, and its use causes an immediate error exit.
7159 </para>
7160 <para>
7161 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7162 to declare certain macro names trusted, such that root privilege will not
7163 necessarily be discarded.
7164 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7165 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7166 values are acceptable, then Exim will not give up root privilege if the caller
7167 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7168 transition mechanism and is expected to be removed in the future.  Acceptable
7169 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7170 </para>
7171 <para>
7172 Some sites may wish to use the same Exim binary on different machines that
7173 share a file system, but to use different configuration files on each machine.
7174 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7175 looks for a file whose name is the configuration file name followed by a dot
7176 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7177 file does not exist, the standard name is tried. This processing occurs for
7178 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7179 </para>
7180 <para>
7181 In some esoteric situations different versions of Exim may be run under
7182 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7183 help with this. See the comments in <filename>src/EDITME</filename> for details.
7184 </para>
7185 </section>
7186 <section id="SECTconffilfor">
7187 <title>Configuration file format</title>
7188 <para>
7189 <indexterm role="concept">
7190 <primary>configuration file</primary>
7191 <secondary>format of</secondary>
7192 </indexterm>
7193 <indexterm role="concept">
7194 <primary>format</primary>
7195 <secondary>configuration file</secondary>
7196 </indexterm>
7197 Exim&#x2019;s configuration file is divided into a number of different parts. General
7198 option settings must always appear at the start of the file. The other parts
7199 are all optional, and may appear in any order. Each part other than the first
7200 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7201 optional parts are:
7202 </para>
7203 <itemizedlist>
7204 <listitem>
7205 <para>
7206 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7207 <xref linkend="CHAPACL"/>).
7208 </para>
7209 </listitem>
7210 <listitem>
7211 <para>
7212 <indexterm role="concept">
7213 <primary>AUTH</primary>
7214 <secondary>configuration</secondary>
7215 </indexterm>
7216 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7217 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7218 </para>
7219 </listitem>
7220 <listitem>
7221 <para>
7222 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7223 addresses and determine how the message is to be delivered (see chapters
7224 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7225 </para>
7226 </listitem>
7227 <listitem>
7228 <para>
7229 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7230 define mechanisms for copying messages to destinations (see chapters
7231 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7232 </para>
7233 </listitem>
7234 <listitem>
7235 <para>
7236 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7237 If there is no retry section, or if it is empty (that is, no retry rules are
7238 defined), Exim will not retry deliveries. In this situation, temporary errors
7239 are treated the same as permanent errors. Retry rules are discussed in chapter
7240 <xref linkend="CHAPretry"/>.
7241 </para>
7242 </listitem>
7243 <listitem>
7244 <para>
7245 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7246 when new addresses are generated during delivery. Rewriting is discussed in
7247 chapter <xref linkend="CHAPrewrite"/>.
7248 </para>
7249 </listitem>
7250 <listitem>
7251 <para>
7252 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7253 want to use this feature, you must set
7254 </para>
7255 <literallayout class="monospaced">
7256 LOCAL_SCAN_HAS_OPTIONS=yes
7257 </literallayout>
7258 <para>
7259 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7260 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7261 </para>
7262 </listitem>
7263 </itemizedlist>
7264 <para>
7265 <indexterm role="concept">
7266 <primary>configuration file</primary>
7267 <secondary>leading white space in</secondary>
7268 </indexterm>
7269 <indexterm role="concept">
7270 <primary>configuration file</primary>
7271 <secondary>trailing white space in</secondary>
7272 </indexterm>
7273 <indexterm role="concept">
7274 <primary>white space</primary>
7275 <secondary>in configuration file</secondary>
7276 </indexterm>
7277 Leading and trailing white space in configuration lines is always ignored.
7278 </para>
7279 <para>
7280 Blank lines in the file, and lines starting with a # character (ignoring
7281 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7282 # character other than at the beginning of a line is not treated specially,
7283 and does not introduce a comment.
7284 </para>
7285 <para>
7286 Any non-comment line can be continued by ending it with a backslash. Note that
7287 the general rule for white space means that trailing white space after the
7288 backslash and leading white space at the start of continuation
7289 lines is ignored. Comment lines beginning with # (but not empty lines) may
7290 appear in the middle of a sequence of continuation lines.
7291 </para>
7292 <para>
7293 A convenient way to create a configuration file is to start from the
7294 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7295 change settings as required.
7296 </para>
7297 <para>
7298 The ACLs, retry rules, and rewriting rules have their own syntax which is
7299 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7300 respectively. The other parts of the configuration file have some syntactic
7301 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7302 onwards. Before that, the inclusion, macro, and conditional facilities are
7303 described.
7304 </para>
7305 </section>
7306 <section id="SECID41">
7307 <title>File inclusions in the configuration file</title>
7308 <para>
7309 <indexterm role="concept">
7310 <primary>inclusions in configuration file</primary>
7311 </indexterm>
7312 <indexterm role="concept">
7313 <primary>configuration file</primary>
7314 <secondary>including other files</secondary>
7315 </indexterm>
7316 <indexterm role="concept">
7317 <primary><literal>.include</literal> in configuration file</primary>
7318 </indexterm>
7319 <indexterm role="concept">
7320 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7321 </indexterm>
7322 You can include other files inside Exim&#x2019;s run time configuration file by
7323 using this syntax:
7324 </para>
7325 <literallayout>
7326 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7327 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7328 </literallayout>
7329 <para>
7330 on a line by itself. Double quotes round the file name are optional. If you use
7331 the first form, a configuration error occurs if the file does not exist; the
7332 second form does nothing for non-existent files. In all cases, an absolute file
7333 name is required.
7334 </para>
7335 <para>
7336 Includes may be nested to any depth, but remember that Exim reads its
7337 configuration file often, so it is a good idea to keep them to a minimum.
7338 If you change the contents of an included file, you must HUP the daemon,
7339 because an included file is read only when the configuration itself is read.
7340 </para>
7341 <para>
7342 The processing of inclusions happens early, at a physical line level, so, like
7343 comment lines, an inclusion can be used in the middle of an option setting,
7344 for example:
7345 </para>
7346 <literallayout class="monospaced">
7347 hosts_lookup = a.b.c \
7348                .include /some/file
7349 </literallayout>
7350 <para>
7351 Include processing happens after macro processing (see below). Its effect is to
7352 process the lines of the included file as if they occurred inline where the
7353 inclusion appears.
7354 </para>
7355 </section>
7356 <section id="SECTmacrodefs">
7357 <title>Macros in the configuration file</title>
7358 <para>
7359 <indexterm role="concept">
7360 <primary>macro</primary>
7361 <secondary>description of</secondary>
7362 </indexterm>
7363 <indexterm role="concept">
7364 <primary>configuration file</primary>
7365 <secondary>macros</secondary>
7366 </indexterm>
7367 If a line in the main part of the configuration (that is, before the first
7368 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7369 definition, and must be of the form
7370 </para>
7371 <literallayout>
7372 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7373 </literallayout>
7374 <para>
7375 The name must consist of letters, digits, and underscores, and need not all be
7376 in upper case, though that is recommended. The rest of the line, including any
7377 continuations, is the replacement text, and has leading and trailing white
7378 space removed. Quotes are not removed. The replacement text can never end with
7379 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7380 </para>
7381 <para>
7382 Macros may also be defined between router, transport, authenticator, or ACL
7383 definitions. They may not, however, be defined within an individual driver or
7384 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7385 </para>
7386 </section>
7387 <section id="SECID42">
7388 <title>Macro substitution</title>
7389 <para>
7390 Once a macro is defined, all subsequent lines in the file (and any included
7391 files) are scanned for the macro name; if there are several macros, the line is
7392 scanned for each in turn, in the order in which the macros are defined. The
7393 replacement text is not re-scanned for the current macro, though it is scanned
7394 for subsequently defined macros. For this reason, a macro name may not contain
7395 the name of a previously defined macro as a substring. You could, for example,
7396 define
7397 </para>
7398 <literallayout>
7399 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7400 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7401 </literallayout>
7402 <para>
7403 but putting the definitions in the opposite order would provoke a configuration
7404 error. Macro expansion is applied to individual physical lines from the file,
7405 before checking for line continuation or file inclusion (see above). If a line
7406 consists solely of a macro name, and the expansion of the macro is empty, the
7407 line is ignored. A macro at the start of a line may turn the line into a
7408 comment line or a <literal>.include</literal> line.
7409 </para>
7410 </section>
7411 <section id="SECID43">
7412 <title>Redefining macros</title>
7413 <para>
7414 Once defined, the value of a macro can be redefined later in the configuration
7415 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7416 <emphasis>=</emphasis>. For example:
7417 </para>
7418 <literallayout class="monospaced">
7419 MAC =  initial value
7420 ...
7421 MAC == updated value
7422 </literallayout>
7423 <para>
7424 Redefinition does not alter the order in which the macros are applied to the
7425 subsequent lines of the configuration file. It is still the same order in which
7426 the macros were originally defined. All that changes is the macro&#x2019;s value.
7427 Redefinition makes it possible to accumulate values. For example:
7428 </para>
7429 <literallayout class="monospaced">
7430 MAC =  initial value
7431 ...
7432 MAC == MAC and something added
7433 </literallayout>
7434 <para>
7435 This can be helpful in situations where the configuration file is built
7436 from a number of other files.
7437 </para>
7438 </section>
7439 <section id="SECID44">
7440 <title>Overriding macro values</title>
7441 <para>
7442 The values set for macros in the configuration file can be overridden by the
7443 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7444 used, unless called by root or the Exim user. A definition on the command line
7445 using the <option>-D</option> option causes all definitions and redefinitions within the
7446 file to be ignored.
7447 </para>
7448 </section>
7449 <section id="SECID45">
7450 <title>Example of macro usage</title>
7451 <para>
7452 As an example of macro usage, consider a configuration where aliases are looked
7453 up in a MySQL database. It helps to keep the file less cluttered if long
7454 strings such as SQL statements are defined separately as macros, for example:
7455 </para>
7456 <literallayout class="monospaced">
7457 ALIAS_QUERY = select mailbox from user where \
7458               login='${quote_mysql:$local_part}';
7459 </literallayout>
7460 <para>
7461 This can then be used in a <command>redirect</command> router setting like this:
7462 </para>
7463 <literallayout class="monospaced">
7464 data = ${lookup mysql{ALIAS_QUERY}}
7465 </literallayout>
7466 <para>
7467 In earlier versions of Exim macros were sometimes used for domain, host, or
7468 address lists. In Exim 4 these are handled better by named lists &ndash; see
7469 section <xref linkend="SECTnamedlists"/>.
7470 </para>
7471 </section>
7472 <section id="SECID46">
7473 <title>Conditional skips in the configuration file</title>
7474 <para>
7475 <indexterm role="concept">
7476 <primary>configuration file</primary>
7477 <secondary>conditional skips</secondary>
7478 </indexterm>
7479 <indexterm role="concept">
7480 <primary><literal>.ifdef</literal></primary>
7481 </indexterm>
7482 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7483 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7484 portions of the configuration file. The processing happens whenever the file is
7485 read (that is, when an Exim binary starts to run).
7486 </para>
7487 <para>
7488 The implementation is very simple. Instances of the first four directives must
7489 be followed by text that includes the names of one or macros. The condition
7490 that is tested is whether or not any macro substitution has taken place in the
7491 line. Thus:
7492 </para>
7493 <literallayout class="monospaced">
7494 .ifdef AAA
7495 message_size_limit = 50M
7496 .else
7497 message_size_limit = 100M
7498 .endif
7499 </literallayout>
7500 <para>
7501 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7502 otherwise. If there is more than one macro named on the line, the condition
7503 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7504 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7505 </para>
7506 <para>
7507 Although you can use a macro expansion to generate one of these directives,
7508 it is not very useful, because the condition <quote>there was a macro substitution
7509 in this line</quote> will always be true.
7510 </para>
7511 <para>
7512 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7513 to clarify complicated nestings.
7514 </para>
7515 </section>
7516 <section id="SECTcos">
7517 <title>Common option syntax</title>
7518 <para>
7519 <indexterm role="concept">
7520 <primary>common option syntax</primary>
7521 </indexterm>
7522 <indexterm role="concept">
7523 <primary>syntax of common options</primary>
7524 </indexterm>
7525 <indexterm role="concept">
7526 <primary>configuration file</primary>
7527 <secondary>common option syntax</secondary>
7528 </indexterm>
7529 For the main set of options, driver options, and <function>local_scan()</function> options,
7530 each setting is on a line by itself, and starts with a name consisting of
7531 lower-case letters and underscores. Many options require a data value, and in
7532 these cases the name must be followed by an equals sign (with optional white
7533 space) and then the value. For example:
7534 </para>
7535 <literallayout class="monospaced">
7536 qualify_domain = mydomain.example.com
7537 </literallayout>
7538 <para>
7539 <indexterm role="concept">
7540 <primary>hiding configuration option values</primary>
7541 </indexterm>
7542 <indexterm role="concept">
7543 <primary>configuration options</primary>
7544 <secondary>hiding value of</secondary>
7545 </indexterm>
7546 <indexterm role="concept">
7547 <primary>options</primary>
7548 <secondary>hiding value of</secondary>
7549 </indexterm>
7550 Some option settings may contain sensitive data, for example, passwords for
7551 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7552 line option to read these values, you can precede the option settings with the
7553 word <quote>hide</quote>. For example:
7554 </para>
7555 <literallayout class="monospaced">
7556 hide mysql_servers = localhost/users/admin/secret-password
7557 </literallayout>
7558 <para>
7559 For non-admin users, such options are displayed like this:
7560 </para>
7561 <literallayout class="monospaced">
7562 mysql_servers = &lt;value not displayable&gt;
7563 </literallayout>
7564 <para>
7565 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7566 all instances of the same driver.
7567 </para>
7568 <para>
7569 The following sections describe the syntax used for the different data types
7570 that are found in option settings.
7571 </para>
7572 </section>
7573 <section id="SECID47">
7574 <title>Boolean options</title>
7575 <para>
7576 <indexterm role="concept">
7577 <primary>format</primary>
7578 <secondary>boolean</secondary>
7579 </indexterm>
7580 <indexterm role="concept">
7581 <primary>boolean configuration values</primary>
7582 </indexterm>
7583 <indexterm role="option">
7584 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7585 </indexterm>
7586 <indexterm role="option">
7587 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7588 </indexterm>
7589 Options whose type is given as boolean are on/off switches. There are two
7590 different ways of specifying such options: with and without a data value. If
7591 the option name is specified on its own without data, the switch is turned on;
7592 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7593 boolean options may be followed by an equals sign and one of the words
7594 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7595 the following two settings have exactly the same effect:
7596 </para>
7597 <literallayout class="monospaced">
7598 queue_only
7599 queue_only = true
7600 </literallayout>
7601 <para>
7602 The following two lines also have the same (opposite) effect:
7603 </para>
7604 <literallayout class="monospaced">
7605 no_queue_only
7606 queue_only = false
7607 </literallayout>
7608 <para>
7609 You can use whichever syntax you prefer.
7610 </para>
7611 </section>
7612 <section id="SECID48">
7613 <title>Integer values</title>
7614 <para>
7615 <indexterm role="concept">
7616 <primary>integer configuration values</primary>
7617 </indexterm>
7618 <indexterm role="concept">
7619 <primary>format</primary>
7620 <secondary>integer</secondary>
7621 </indexterm>
7622 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7623 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7624 number is assumed. Otherwise, it is treated as an octal number unless it starts
7625 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7626 hexadecimal number.
7627 </para>
7628 <para>
7629 If an integer value is followed by the letter K, it is multiplied by 1024; if
7630 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7631 of integer option settings are output, values which are an exact multiple of
7632 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7633 and M. The printing style is independent of the actual input format that was
7634 used.
7635 </para>
7636 </section>
7637 <section id="SECID49">
7638 <title>Octal integer values</title>
7639 <para>
7640 <indexterm role="concept">
7641 <primary>integer format</primary>
7642 </indexterm>
7643 <indexterm role="concept">
7644 <primary>format</primary>
7645 <secondary>octal integer</secondary>
7646 </indexterm>
7647 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7648 interpreted as an octal number, whether or not it starts with the digit zero.
7649 Such options are always output in octal.
7650 </para>
7651 </section>
7652 <section id="SECID50">
7653 <title>Fixed point numbers</title>
7654 <para>
7655 <indexterm role="concept">
7656 <primary>fixed point configuration values</primary>
7657 </indexterm>
7658 <indexterm role="concept">
7659 <primary>format</primary>
7660 <secondary>fixed point</secondary>
7661 </indexterm>
7662 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7663 integer, optionally followed by a decimal point and up to three further digits.
7664 </para>
7665 </section>
7666 <section id="SECTtimeformat">
7667 <title>Time intervals</title>
7668 <para>
7669 <indexterm role="concept">
7670 <primary>time interval</primary>
7671 <secondary>specifying in configuration</secondary>
7672 </indexterm>
7673 <indexterm role="concept">
7674 <primary>format</primary>
7675 <secondary>time interval</secondary>
7676 </indexterm>
7677 A time interval is specified as a sequence of numbers, each followed by one of
7678 the following letters, with no intervening white space:
7679 </para>
7680 <informaltable frame="none">
7681 <tgroup cols="2" colsep="0" rowsep="0">
7682 <colspec colwidth="30pt" align="left"/>
7683 <colspec colwidth="254pt" align="left"/>
7684 <tbody>
7685 <row>
7686 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7687 <entry>seconds</entry>
7688 </row>
7689 <row>
7690 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7691 <entry>minutes</entry>
7692 </row>
7693 <row>
7694 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7695 <entry>hours</entry>
7696 </row>
7697 <row>
7698 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7699 <entry>days</entry>
7700 </row>
7701 <row>
7702 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7703 <entry>weeks</entry>
7704 </row>
7705 </tbody>
7706 </tgroup>
7707 </informaltable>
7708 <para>
7709 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7710 intervals are output in the same format. Exim does not restrict the values; it
7711 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7712 </para>
7713 </section>
7714 <section id="SECTstrings">
7715 <title>String values</title>
7716 <para>
7717 <indexterm role="concept">
7718 <primary>string</primary>
7719 <secondary>format of configuration values</secondary>
7720 </indexterm>
7721 <indexterm role="concept">
7722 <primary>format</primary>
7723 <secondary>string</secondary>
7724 </indexterm>
7725 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7726 or without double-quotes. If it does not start with a double-quote, the value
7727 consists of the remainder of the line plus any continuation lines, starting at
7728 the first character after any leading white space, with trailing white space
7729 removed, and with no interpretation of the characters in the string. Because
7730 Exim removes comment lines (those beginning with #) at an early stage, they can
7731 appear in the middle of a multi-line string. The following two settings are
7732 therefore equivalent:
7733 </para>
7734 <literallayout class="monospaced">
7735 trusted_users = uucp:mail
7736 trusted_users = uucp:\
7737                 # This comment line is ignored
7738                 mail
7739 </literallayout>
7740 <para>
7741 <indexterm role="concept">
7742 <primary>string</primary>
7743 <secondary>quoted</secondary>
7744 </indexterm>
7745 <indexterm role="concept">
7746 <primary>escape characters in quoted strings</primary>
7747 </indexterm>
7748 If a string does start with a double-quote, it must end with a closing
7749 double-quote, and any backslash characters other than those used for line
7750 continuation are interpreted as escape characters, as follows:
7751 </para>
7752 <informaltable frame="none">
7753 <tgroup cols="2" colsep="0" rowsep="0">
7754 <colspec colwidth="100pt" align="left"/>
7755 <colspec colwidth="254pt" align="left"/>
7756 <tbody>
7757 <row>
7758 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7759 <entry>single backslash</entry>
7760 </row>
7761 <row>
7762 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7763 <entry>newline</entry>
7764 </row>
7765 <row>
7766 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7767 <entry>carriage return</entry>
7768 </row>
7769 <row>
7770 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7771 <entry>tab</entry>
7772 </row>
7773 <row>
7774 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7775 <entry>up to 3 octal digits specify one character</entry>
7776 </row>
7777 <row>
7778 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7779 <entry>up to 2 hexadecimal digits specify one character</entry>
7780 </row>
7781 </tbody>
7782 </tgroup>
7783 </informaltable>
7784 <para>
7785 If a backslash is followed by some other character, including a double-quote
7786 character, that character replaces the pair.
7787 </para>
7788 <para>
7789 Quoting is necessary only if you want to make use of the backslash escapes to
7790 insert special characters, or if you need to specify a value with leading or
7791 trailing spaces. These cases are rare, so quoting is almost never needed in
7792 current versions of Exim. In versions of Exim before 3.14, quoting was required
7793 in order to continue lines, so you may come across older configuration files
7794 and examples that apparently quote unnecessarily.
7795 </para>
7796 </section>
7797 <section id="SECID51">
7798 <title>Expanded strings</title>
7799 <para>
7800 <indexterm role="concept">
7801 <primary>expansion</primary>
7802 <secondary>definition of</secondary>
7803 </indexterm>
7804 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7805 by which means various parts of the string may be changed according to the
7806 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7807 is as just described; in particular, the handling of backslashes in quoted
7808 strings is done as part of the input process, before expansion takes place.
7809 However, backslash is also an escape character for the expander, so any
7810 backslashes that are required for that reason must be doubled if they are
7811 within a quoted configuration string.
7812 </para>
7813 </section>
7814 <section id="SECID52">
7815 <title>User and group names</title>
7816 <para>
7817 <indexterm role="concept">
7818 <primary>user name</primary>
7819 <secondary>format of</secondary>
7820 </indexterm>
7821 <indexterm role="concept">
7822 <primary>format</primary>
7823 <secondary>user name</secondary>
7824 </indexterm>
7825 <indexterm role="concept">
7826 <primary>groups</primary>
7827 <secondary>name format</secondary>
7828 </indexterm>
7829 <indexterm role="concept">
7830 <primary>format</primary>
7831 <secondary>group name</secondary>
7832 </indexterm>
7833 User and group names are specified as strings, using the syntax described
7834 above, but the strings are interpreted specially. A user or group name must
7835 either consist entirely of digits, or be a name that can be looked up using the
7836 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7837 </para>
7838 </section>
7839 <section id="SECTlistconstruct">
7840 <title>List construction</title>
7841 <para>
7842 <indexterm role="concept">
7843 <primary>list</primary>
7844 <secondary>syntax of in configuration</secondary>
7845 </indexterm>
7846 <indexterm role="concept">
7847 <primary>format</primary>
7848 <secondary>list item in configuration</secondary>
7849 </indexterm>
7850 <indexterm role="concept">
7851 <primary>string</primary>
7852 <secondary>list, definition of</secondary>
7853 </indexterm>
7854 The data for some configuration options is a list of items, with colon as the
7855 default separator. Many of these options are shown with type <quote>string list</quote> in
7856 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7857 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7858 are all the same; however, those other than <quote>string list</quote> are subject to
7859 particular kinds of interpretation, as described in chapter
7860 <xref linkend="CHAPdomhosaddlists"/>.
7861 </para>
7862 <para>
7863 In all these cases, the entire list is treated as a single string as far as the
7864 input syntax is concerned. The <option>trusted_users</option> setting in section
7865 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7866 in a list, it must be entered as two colons. Leading and trailing white space
7867 on each item in a list is ignored. This makes it possible to include items that
7868 start with a colon, and in particular, certain forms of IPv6 address. For
7869 example, the list
7870 </para>
7871 <literallayout class="monospaced">
7872 local_interfaces = 127.0.0.1 : ::::1
7873 </literallayout>
7874 <para>
7875 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7876 </para>
7877 <para>
7878 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7879 list items, it is not ignored when parsing the list. The space after the first
7880 colon in the example above is necessary. If it were not there, the list would
7881 be interpreted as the two items 127.0.0.1:: and 1.
7882 </para>
7883 </section>
7884 <section id="SECID53">
7885 <title>Changing list separators</title>
7886 <para>
7887 <indexterm role="concept">
7888 <primary>list separator</primary>
7889 <secondary>changing</secondary>
7890 </indexterm>
7891 <indexterm role="concept">
7892 <primary>IPv6</primary>
7893 <secondary>addresses in lists</secondary>
7894 </indexterm>
7895 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7896 introduced to allow the separator character to be changed. If a list begins
7897 with a left angle bracket, followed by any punctuation character, that
7898 character is used instead of colon as the list separator. For example, the list
7899 above can be rewritten to use a semicolon separator like this:
7900 </para>
7901 <literallayout class="monospaced">
7902 local_interfaces = &lt;; 127.0.0.1 ; ::1
7903 </literallayout>
7904 <para>
7905 This facility applies to all lists, with the exception of the list in
7906 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7907 confined to circumstances where they really are needed.
7908 </para>
7909 <para>
7910 <indexterm role="concept">
7911 <primary>list separator</primary>
7912 <secondary>newline as</secondary>
7913 </indexterm>
7914 <indexterm role="concept">
7915 <primary>newline</primary>
7916 <secondary>as list separator</secondary>
7917 </indexterm>
7918 It is also possible to use newline and other control characters (those with
7919 code values less than 32, plus DEL) as separators in lists. Such separators
7920 must be provided literally at the time the list is processed. For options that
7921 are string-expanded, you can write the separator using a normal escape
7922 sequence. This will be processed by the expander before the string is
7923 interpreted as a list. For example, if a newline-separated list of domains is
7924 generated by a lookup, you can process it directly by a line such as this:
7925 </para>
7926 <literallayout class="monospaced">
7927 domains = &lt;\n ${lookup mysql{.....}}
7928 </literallayout>
7929 <para>
7930 This avoids having to change the list separator in such data. You are unlikely
7931 to want to use a control character as a separator in an option that is not
7932 expanded, because the value is literal text. However, it can be done by giving
7933 the value in quotes. For example:
7934 </para>
7935 <literallayout class="monospaced">
7936 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7937 </literallayout>
7938 <para>
7939 Unlike printing character separators, which can be included in list items by
7940 doubling, it is not possible to include a control character as data when it is
7941 set as the separator. Two such characters in succession are interpreted as
7942 enclosing an empty list item.
7943 </para>
7944 </section>
7945 <section id="SECTempitelis">
7946 <title>Empty items in lists</title>
7947 <para>
7948 <indexterm role="concept">
7949 <primary>list</primary>
7950 <secondary>empty item in</secondary>
7951 </indexterm>
7952 An empty item at the end of a list is always ignored. In other words, trailing
7953 separator characters are ignored. Thus, the list in
7954 </para>
7955 <literallayout class="monospaced">
7956 senders = user@domain :
7957 </literallayout>
7958 <para>
7959 contains only a single item. If you want to include an empty string as one item
7960 in a list, it must not be the last item. For example, this list contains three
7961 items, the second of which is empty:
7962 </para>
7963 <literallayout class="monospaced">
7964 senders = user1@domain : : user2@domain
7965 </literallayout>
7966 <para>
7967 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7968 are interpreted as representing a single colon data character (and the list
7969 would then contain just one item). If you want to specify a list that contains
7970 just one, empty item, you can do it as in this example:
7971 </para>
7972 <literallayout class="monospaced">
7973 senders = :
7974 </literallayout>
7975 <para>
7976 In this case, the first item is empty, and the second is discarded because it
7977 is at the end of the list.
7978 </para>
7979 </section>
7980 <section id="SECTfordricon">
7981 <title>Format of driver configurations</title>
7982 <para>
7983 <indexterm role="concept">
7984 <primary>drivers</primary>
7985 <secondary>configuration format</secondary>
7986 </indexterm>
7987 There are separate parts in the configuration for defining routers, transports,
7988 and authenticators. In each part, you are defining a number of driver
7989 instances, each with its own set of options. Each driver instance is defined by
7990 a sequence of lines like this:
7991 </para>
7992 <literallayout>
7993 &lt;<emphasis>instance name</emphasis>&gt;:
7994   &lt;<emphasis>option</emphasis>&gt;
7995   ...
7996   &lt;<emphasis>option</emphasis>&gt;
7997 </literallayout>
7998 <para>
7999 In the following example, the instance name is <command>localuser</command>, and it is
8000 followed by three options settings:
8001 </para>
8002 <literallayout class="monospaced">
8003 localuser:
8004   driver = accept
8005   check_local_user
8006   transport = local_delivery
8007 </literallayout>
8008 <para>
8009 For each driver instance, you specify which Exim code module it uses &ndash; by the
8010 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8011 settings. For example, in the case of transports, if you want a transport to
8012 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8013 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8014 described in detail in its own separate chapter later in this manual.
8015 </para>
8016 <para>
8017 You can have several routers, transports, or authenticators that are based on
8018 the same underlying driver (each must have a different instance name).
8019 </para>
8020 <para>
8021 The order in which routers are defined is important, because addresses are
8022 passed to individual routers one by one, in order. The order in which
8023 transports are defined does not matter at all. The order in which
8024 authenticators are defined is used only when Exim, as a client, is searching
8025 them to find one that matches an authentication mechanism offered by the
8026 server.
8027 </para>
8028 <para>
8029 <indexterm role="concept">
8030 <primary>generic options</primary>
8031 </indexterm>
8032 <indexterm role="concept">
8033 <primary>options</primary>
8034 <secondary>generic &ndash; definition of</secondary>
8035 </indexterm>
8036 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8037 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8038 same type (that is, all routers, all transports or all authenticators). The
8039 <option>driver</option> option is a generic option that must appear in every definition.
8040 <indexterm role="concept">
8041 <primary>private options</primary>
8042 </indexterm>
8043 The private options are special for each driver, and none need appear, because
8044 they all have default values.
8045 </para>
8046 <para>
8047 The options may appear in any order, except that the <option>driver</option> option must
8048 precede any private options, since these depend on the particular driver. For
8049 this reason, it is recommended that <option>driver</option> always be the first option.
8050 </para>
8051 <para>
8052 Driver instance names, which are used for reference in log entries and
8053 elsewhere, can be any sequence of letters, digits, and underscores (starting
8054 with a letter) and must be unique among drivers of the same type. A router and
8055 a transport (for example) can each have the same name, but no two router
8056 instances can have the same name. The name of a driver instance should not be
8057 confused with the name of the underlying driver module. For example, the
8058 configuration lines:
8059 </para>
8060 <literallayout class="monospaced">
8061 remote_smtp:
8062   driver = smtp
8063 </literallayout>
8064 <para>
8065 create an instance of the <command>smtp</command> transport driver whose name is
8066 <command>remote_smtp</command>. The same driver code can be used more than once, with
8067 different instance names and different option settings each time. A second
8068 instance of the <command>smtp</command> transport, with different options, might be defined
8069 thus:
8070 </para>
8071 <literallayout class="monospaced">
8072 special_smtp:
8073   driver = smtp
8074   port = 1234
8075   command_timeout = 10s
8076 </literallayout>
8077 <para>
8078 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8079 these transport instances from routers, and these names would appear in log
8080 lines.
8081 </para>
8082 <para>
8083 Comment lines may be present in the middle of driver specifications. The full
8084 list of option settings for any particular driver instance, including all the
8085 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8086 option.
8087 </para>
8088 </section>
8089 </chapter>
8090
8091 <chapter id="CHAPdefconfil">
8092 <title>The default configuration file</title>
8093 <para>
8094 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8095 <primary>configuration file</primary>
8096 <secondary>default <quote>walk through</quote></secondary>
8097 </indexterm>
8098 <indexterm role="concept">
8099 <primary>default</primary>
8100 <secondary>configuration file <quote>walk through</quote></secondary>
8101 </indexterm>
8102 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8103 is sufficient for a host with simple mail requirements. As an introduction to
8104 the way Exim is configured, this chapter <quote>walks through</quote> the default
8105 configuration, giving brief explanations of the settings. Detailed descriptions
8106 of the options are given in subsequent chapters. The default configuration file
8107 itself contains extensive comments about ways you might want to modify the
8108 initial settings. However, note that there are many options that are not
8109 mentioned at all in the default configuration.
8110 </para>
8111 <section id="SECTdefconfmain">
8112 <title>Main configuration settings</title>
8113 <para>
8114 The main (global) configuration option settings must always come first in the
8115 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8116 the line
8117 </para>
8118 <literallayout class="monospaced">
8119 # primary_hostname =
8120 </literallayout>
8121 <para>
8122 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8123 to know the official, fully qualified name of your host, and this is where you
8124 can specify it. However, in most cases you do not need to set this option. When
8125 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8126 </para>
8127 <para>
8128 The first three non-comment configuration lines are as follows:
8129 </para>
8130 <literallayout class="monospaced">
8131 domainlist local_domains = @
8132 domainlist relay_to_domains =
8133 hostlist   relay_from_hosts = 127.0.0.1
8134 </literallayout>
8135 <para>
8136 These are not, in fact, option settings. They are definitions of two named
8137 domain lists and one named host list. Exim allows you to give names to lists of
8138 domains, hosts, and email addresses, in order to make it easier to manage the
8139 configuration file (see section <xref linkend="SECTnamedlists"/>).
8140 </para>
8141 <para>
8142 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8143 later in the configuration to identify domains that are to be delivered
8144 on the local host.
8145 </para>
8146 <para>
8147 <indexterm role="concept">
8148 <primary>@ in a domain list</primary>
8149 </indexterm>
8150 There is just one item in this list, the string <quote>@</quote>. This is a special form
8151 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8152 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8153 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8154 the same configuration file can be used on different hosts.
8155 </para>
8156 <para>
8157 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8158 list itself is empty. Later in the configuration we will come to the part that
8159 controls mail relaying through the local host; it allows relaying to any
8160 domains in this list. By default, therefore, no relaying on the basis of a mail
8161 domain is permitted.
8162 </para>
8163 <para>
8164 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8165 used later in the configuration to permit relaying from any host or IP address
8166 that matches the list. The default contains just the IP address of the IPv4
8167 loopback interface, which means that processes on the local host are able to
8168 submit mail for relaying by sending it over TCP/IP to that interface. No other
8169 hosts are permitted to submit messages for relaying.
8170 </para>
8171 <para>
8172 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8173 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8174 and hosts that will be used in the controls that are specified later.
8175 </para>
8176 <para>
8177 The next two configuration lines are genuine option settings:
8178 </para>
8179 <literallayout class="monospaced">
8180 acl_smtp_rcpt = acl_check_rcpt
8181 acl_smtp_data = acl_check_data
8182 </literallayout>
8183 <para>
8184 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8185 during an incoming SMTP session for every recipient of a message (every RCPT
8186 command), and after the contents of the message have been received,
8187 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8188 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8189 section of the configuration. The RCPT ACL controls which recipients are
8190 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8191 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8192 contents of a message to be checked.
8193 </para>
8194 <para>
8195 Two commented-out option settings are next:
8196 </para>
8197 <literallayout class="monospaced">
8198 # av_scanner = clamd:/tmp/clamd
8199 # spamd_address = 127.0.0.1 783
8200 </literallayout>
8201 <para>
8202 These are example settings that can be used when Exim is compiled with the
8203 content-scanning extension. The first specifies the interface to the virus
8204 scanner, and the second specifies the interface to SpamAssassin. Further
8205 details are given in chapter <xref linkend="CHAPexiscan"/>.
8206 </para>
8207 <para>
8208 Three more commented-out option settings follow:
8209 </para>
8210 <literallayout class="monospaced">
8211 # tls_advertise_hosts = *
8212 # tls_certificate = /etc/ssl/exim.crt
8213 # tls_privatekey = /etc/ssl/exim.pem
8214 </literallayout>
8215 <para>
8216 These are example settings that can be used when Exim is compiled with
8217 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8218 first one specifies the list of clients that are allowed to use TLS when
8219 connecting to this server; in this case the wildcard means all clients. The
8220 other options specify where Exim should find its TLS certificate and private
8221 key, which together prove the server&#x2019;s identity to any clients that connect.
8222 More details are given in chapter <xref linkend="CHAPTLS"/>.
8223 </para>
8224 <para>
8225 Another two commented-out option settings follow:
8226 </para>
8227 <literallayout class="monospaced">
8228 # daemon_smtp_ports = 25 : 465 : 587
8229 # tls_on_connect_ports = 465
8230 </literallayout>
8231 <para>
8232 <indexterm role="concept">
8233 <primary>port</primary>
8234 <secondary>465 and 587</secondary>
8235 </indexterm>
8236 <indexterm role="concept">
8237 <primary>port</primary>
8238 <secondary>for message submission</secondary>
8239 </indexterm>
8240 <indexterm role="concept">
8241 <primary>message</primary>
8242 <secondary>submission, ports for</secondary>
8243 </indexterm>
8244 <indexterm role="concept">
8245 <primary>ssmtp protocol</primary>
8246 </indexterm>
8247 <indexterm role="concept">
8248 <primary>smtps protocol</primary>
8249 </indexterm>
8250 <indexterm role="concept">
8251 <primary>SMTP</primary>
8252 <secondary>ssmtp protocol</secondary>
8253 </indexterm>
8254 <indexterm role="concept">
8255 <primary>SMTP</primary>
8256 <secondary>smtps protocol</secondary>
8257 </indexterm>
8258 These options provide better support for roaming users who wish to use this
8259 server for message submission. They are not much use unless you have turned on
8260 TLS (as described in the previous paragraph) and authentication (about which
8261 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8262 on end-user networks, so RFC 4409 specifies that message submission should use
8263 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8264 configured to use port 587 correctly, so these settings also enable the
8265 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8266 <xref linkend="SECTsupobssmt"/>).
8267 </para>
8268 <para>
8269 Two more commented-out options settings follow:
8270 </para>
8271 <literallayout class="monospaced">
8272 # qualify_domain =
8273 # qualify_recipient =
8274 </literallayout>
8275 <para>
8276 The first of these specifies a domain that Exim uses when it constructs a
8277 complete email address from a local login name. This is often needed when Exim
8278 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8279 the value of <option>primary_hostname</option> is used. If you set both of these options,
8280 you can have different qualification domains for sender and recipient
8281 addresses. If you set only the first one, its value is used in both cases.
8282 </para>
8283 <para>
8284 <indexterm role="concept">
8285 <primary>domain literal</primary>
8286 <secondary>recognizing format</secondary>
8287 </indexterm>
8288 The following line must be uncommented if you want Exim to recognize
8289 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8290 (an IP address within square brackets) instead of a named domain.
8291 </para>
8292 <literallayout class="monospaced">
8293 # allow_domain_literals
8294 </literallayout>
8295 <para>
8296 The RFCs still require this form, but many people think that in the modern
8297 Internet it makes little sense to permit mail to be sent to specific hosts by
8298 quoting their IP addresses. This ancient format has been used by people who
8299 try to abuse hosts by using them for unwanted relaying. However, some
8300 people believe there are circumstances (for example, messages addressed to
8301 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8302 </para>
8303 <para>
8304 The next configuration line is a kind of trigger guard:
8305 </para>
8306 <literallayout class="monospaced">
8307 never_users = root
8308 </literallayout>
8309 <para>
8310 It specifies that no delivery must ever be run as the root user. The normal
8311 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8312 setting is a guard against slips in the configuration.
8313 The list of users specified by <option>never_users</option> is not, however, the complete
8314 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8315 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8316 contents of <option>never_users</option> are added to this list. By default
8317 FIXED_NEVER_USERS also specifies root.
8318 </para>
8319 <para>
8320 When a remote host connects to Exim in order to send mail, the only information
8321 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8322 line,
8323 </para>
8324 <literallayout class="monospaced">
8325 host_lookup = *
8326 </literallayout>
8327 <para>
8328 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8329 in order to get a host name. This improves the quality of the logging
8330 information, but if you feel it is too expensive, you can remove it entirely,
8331 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8332 Note that it is not always possible to find a host name from an IP address,
8333 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8334 unreachable.
8335 </para>
8336 <para>
8337 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8338 1413 (hence their names):
8339 </para>
8340 <literallayout class="monospaced">
8341 rfc1413_hosts = *
8342 rfc1413_query_timeout = 5s
8343 </literallayout>
8344 <para>
8345 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8346 You can limit the hosts to which these calls are made, or change the timeout
8347 that is used. If you set the timeout to zero, all ident calls are disabled.
8348 Although they are cheap and can provide useful information for tracing problem
8349 messages, some hosts and firewalls have problems with ident calls. This can
8350 result in a timeout instead of an immediate refused connection, leading to
8351 delays on starting up an incoming SMTP session.
8352 </para>
8353 <para>
8354 When Exim receives messages over SMTP connections, it expects all addresses to
8355 be fully qualified with a domain, as required by the SMTP definition. However,
8356 if you are running a server to which simple clients submit messages, you may
8357 find that they send unqualified addresses. The two commented-out options:
8358 </para>
8359 <literallayout class="monospaced">
8360 # sender_unqualified_hosts =
8361 # recipient_unqualified_hosts =
8362 </literallayout>
8363 <para>
8364 show how you can specify hosts that are permitted to send unqualified sender
8365 and recipient addresses, respectively.
8366 </para>
8367 <para>
8368 The <option>percent_hack_domains</option> option is also commented out:
8369 </para>
8370 <literallayout class="monospaced">
8371 # percent_hack_domains =
8372 </literallayout>
8373 <para>
8374 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8375 This is an almost obsolete form of explicit email routing. If you do not know
8376 anything about it, you can safely ignore this topic.
8377 </para>
8378 <para>
8379 The last two settings in the main part of the default configuration are
8380 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8381 message is frozen, Exim no longer continues to try to deliver it. Freezing
8382 occurs when a bounce message encounters a permanent failure because the sender
8383 address of the original message that caused the bounce is invalid, so the
8384 bounce cannot be delivered. This is probably the most common case, but there
8385 are also other conditions that cause freezing, and frozen messages are not
8386 always bounce messages.
8387 </para>
8388 <literallayout class="monospaced">
8389 ignore_bounce_errors_after = 2d
8390 timeout_frozen_after = 7d
8391 </literallayout>
8392 <para>
8393 The first of these options specifies that failing bounce messages are to be
8394 discarded after 2 days on the queue. The second specifies that any frozen
8395 message (whether a bounce message or not) is to be timed out (and discarded)
8396 after a week. In this configuration, the first setting ensures that no failing
8397 bounce message ever lasts a week.
8398 </para>
8399 </section>
8400 <section id="SECID54">
8401 <title>ACL configuration</title>
8402 <para>
8403 <indexterm role="concept">
8404 <primary>default</primary>
8405 <secondary>ACLs</secondary>
8406 </indexterm>
8407 <indexterm role="concept">
8408 <primary>access control lists (ACLs)</primary>
8409 <secondary>default configuration</secondary>
8410 </indexterm>
8411 In the default configuration, the ACL section follows the main configuration.
8412 It starts with the line
8413 </para>
8414 <literallayout class="monospaced">
8415 begin acl
8416 </literallayout>
8417 <para>
8418 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8419 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8420 and <option>acl_smtp_data</option> above.
8421 </para>
8422 <para>
8423 <indexterm role="concept">
8424 <primary>RCPT</primary>
8425 <secondary>ACL for</secondary>
8426 </indexterm>
8427 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8428 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8429 are considered in order, until the recipient address is either accepted or
8430 rejected. The RCPT command is then accepted or rejected, according to the
8431 result of the ACL processing.
8432 </para>
8433 <literallayout class="monospaced">
8434 acl_check_rcpt:
8435 </literallayout>
8436 <para>
8437 This line, consisting of a name terminated by a colon, marks the start of the
8438 ACL, and names it.
8439 </para>
8440 <literallayout class="monospaced">
8441 accept  hosts = :
8442 </literallayout>
8443 <para>
8444 This ACL statement accepts the recipient if the sending host matches the list.
8445 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8446 names or IP addresses. The presence of the colon puts an empty item in the
8447 list; Exim matches this only if the incoming message did not come from a remote
8448 host, because in that case, the remote hostname is empty. The colon is
8449 important. Without it, the list itself is empty, and can never match anything.
8450 </para>
8451 <para>
8452 What this statement is doing is to accept unconditionally all recipients in
8453 messages that are submitted by SMTP from local processes using the standard
8454 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8455 manner.
8456 </para>
8457 <literallayout class="monospaced">
8458 deny    message       = Restricted characters in address
8459         domains       = +local_domains
8460         local_parts   = ^[.] : ^.*[@%!/|]
8461
8462 deny    message       = Restricted characters in address
8463         domains       = !+local_domains
8464         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8465 </literallayout>
8466 <para>
8467 These statements are concerned with local parts that contain any of the
8468 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8469 Although these characters are entirely legal in local parts (in the case of
8470 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8471 in Internet mail addresses.
8472 </para>
8473 <para>
8474 The first three have in the past been associated with explicitly routed
8475 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8476 option). Addresses containing these characters are regularly tried by spammers
8477 in an attempt to bypass relaying restrictions, and also by open relay testing
8478 programs. Unless you really need them it is safest to reject these characters
8479 at this early stage. This configuration is heavy-handed in rejecting these
8480 characters for all messages it accepts from remote hosts. This is a deliberate
8481 policy of being as safe as possible.
8482 </para>
8483 <para>
8484 The first rule above is stricter, and is applied to messages that are addressed
8485 to one of the local domains handled by this host. This is implemented by the
8486 first condition, which restricts it to domains that are listed in the
8487 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8488 reference to a named list. In this configuration, there is just one domain in
8489 <emphasis>local_domains</emphasis>, but in general there may be many.
8490 </para>
8491 <para>
8492 The second condition on the first statement uses two regular expressions to
8493 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8494 or <quote>|</quote>. If you have local accounts that include these characters, you will
8495 have to modify this rule.
8496 </para>
8497 <para>
8498 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8499 allows them because they have been encountered in practice. (Consider the
8500 common convention of local parts constructed as
8501 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8502 the author of Exim, who has no second initial.) However, a local part starting
8503 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8504 file name (for example, for a mailing list). This is also true for local parts
8505 that contain slashes. A pipe symbol can also be troublesome if the local part
8506 is incorporated unthinkingly into a shell command line.
8507 </para>
8508 <para>
8509 The second rule above applies to all other domains, and is less strict. This
8510 allows your own users to send outgoing messages to sites that use slashes
8511 and vertical bars in their local parts. It blocks local parts that begin
8512 with a dot, slash, or vertical bar, but allows these characters within the
8513 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8514 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8515 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8516 </para>
8517 <literallayout class="monospaced">
8518 accept  local_parts   = postmaster
8519         domains       = +local_domains
8520 </literallayout>
8521 <para>
8522 This statement, which has two conditions, accepts an incoming address if the
8523 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8524 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8525 reference to a named list. In this configuration, there is just one domain in
8526 <emphasis>local_domains</emphasis>, but in general there may be many.
8527 </para>
8528 <para>
8529 The presence of this statement means that mail to postmaster is never blocked
8530 by any of the subsequent tests. This can be helpful while sorting out problems
8531 in cases where the subsequent tests are incorrectly denying access.
8532 </para>
8533 <literallayout class="monospaced">
8534 require verify        = sender
8535 </literallayout>
8536 <para>
8537 This statement requires the sender address to be verified before any subsequent
8538 ACL statement can be used. If verification fails, the incoming recipient
8539 address is refused. Verification consists of trying to route the address, to
8540 see if a bounce message could be delivered to it. In the case of remote
8541 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8542 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8543 discusses the details of address verification.
8544 </para>
8545 <literallayout class="monospaced">
8546 accept  hosts         = +relay_from_hosts
8547         control       = submission
8548 </literallayout>
8549 <para>
8550 This statement accepts the address if the message is coming from one of the
8551 hosts that are defined as being allowed to relay through this host. Recipient
8552 verification is omitted here, because in many cases the clients are dumb MUAs
8553 that do not cope well with SMTP error responses. For the same reason, the
8554 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8555 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8556 messages that are deficient in some way, for example, because they lack a
8557 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8558 probably add recipient verification here, and disable submission mode.
8559 </para>
8560 <literallayout class="monospaced">
8561 accept  authenticated = *
8562         control       = submission
8563 </literallayout>
8564 <para>
8565 This statement accepts the address if the client host has authenticated itself.
8566 Submission mode is again specified, on the grounds that such messages are most
8567 likely to come from MUAs. The default configuration does not define any
8568 authenticators, though it does include some nearly complete commented-out
8569 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8570 fact authenticate until you complete the authenticator definitions.
8571 </para>
8572 <literallayout class="monospaced">
8573 require message = relay not permitted
8574         domains = +local_domains : +relay_domains
8575 </literallayout>
8576 <para>
8577 This statement rejects the address if its domain is neither a local domain nor
8578 one of the domains for which this host is a relay.
8579 </para>
8580 <literallayout class="monospaced">
8581 require verify = recipient
8582 </literallayout>
8583 <para>
8584 This statement requires the recipient address to be verified; if verification
8585 fails, the address is rejected.
8586 </para>
8587 <literallayout class="monospaced">
8588 # deny    message     = rejected because $sender_host_address \
8589 #                       is in a black list at $dnslist_domain\n\
8590 #                       $dnslist_text
8591 #         dnslists    = black.list.example
8592 #
8593 # warn    dnslists    = black.list.example
8594 #         add_header  = X-Warning: $sender_host_address is in \
8595 #                       a black list at $dnslist_domain
8596 #         log_message = found in $dnslist_domain
8597 </literallayout>
8598 <para>
8599 These commented-out lines are examples of how you could configure Exim to check
8600 sending hosts against a DNS black list. The first statement rejects messages
8601 from blacklisted hosts, whereas the second just inserts a warning header
8602 line.
8603 </para>
8604 <literallayout class="monospaced">
8605 # require verify = csa
8606 </literallayout>
8607 <para>
8608 This commented-out line is an example of how you could turn on client SMTP
8609 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8610 records.
8611 </para>
8612 <literallayout class="monospaced">
8613 accept
8614 </literallayout>
8615 <para>
8616 The final statement in the first ACL unconditionally accepts any recipient
8617 address that has successfully passed all the previous tests.
8618 </para>
8619 <literallayout class="monospaced">
8620 acl_check_data:
8621 </literallayout>
8622 <para>
8623 This line marks the start of the second ACL, and names it. Most of the contents
8624 of this ACL are commented out:
8625 </para>
8626 <literallayout class="monospaced">
8627 # deny    malware   = *
8628 #         message   = This message contains a virus \
8629 #                     ($malware_name).
8630 </literallayout>
8631 <para>
8632 These lines are examples of how to arrange for messages to be scanned for
8633 viruses when Exim has been compiled with the content-scanning extension, and a
8634 suitable virus scanner is installed. If the message is found to contain a
8635 virus, it is rejected with the given custom error message.
8636 </para>
8637 <literallayout class="monospaced">
8638 # warn    spam      = nobody
8639 #         message   = X-Spam_score: $spam_score\n\
8640 #                     X-Spam_score_int: $spam_score_int\n\
8641 #                     X-Spam_bar: $spam_bar\n\
8642 #                     X-Spam_report: $spam_report
8643 </literallayout>
8644 <para>
8645 These lines are an example of how to arrange for messages to be scanned by
8646 SpamAssassin when Exim has been compiled with the content-scanning extension,
8647 and SpamAssassin has been installed. The SpamAssassin check is run with
8648 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8649 series of extra header line. In this case, the message is not rejected,
8650 whatever the spam score.
8651 </para>
8652 <literallayout class="monospaced">
8653 accept
8654 </literallayout>
8655 <para>
8656 This final line in the DATA ACL accepts the message unconditionally.
8657 </para>
8658 </section>
8659 <section id="SECID55">
8660 <title>Router configuration</title>
8661 <para>
8662 <indexterm role="concept">
8663 <primary>default</primary>
8664 <secondary>routers</secondary>
8665 </indexterm>
8666 <indexterm role="concept">
8667 <primary>routers</primary>
8668 <secondary>default</secondary>
8669 </indexterm>
8670 The router configuration comes next in the default configuration, introduced
8671 by the line
8672 </para>
8673 <literallayout class="monospaced">
8674 begin routers
8675 </literallayout>
8676 <para>
8677 Routers are the modules in Exim that make decisions about where to send
8678 messages. An address is passed to each router in turn, until it is either
8679 accepted, or failed. This means that the order in which you define the routers
8680 matters. Each router is fully described in its own chapter later in this
8681 manual. Here we give only brief overviews.
8682 </para>
8683 <literallayout class="monospaced">
8684 # domain_literal:
8685 #   driver = ipliteral
8686 #   domains = !+local_domains
8687 #   transport = remote_smtp
8688 </literallayout>
8689 <para>
8690 <indexterm role="concept">
8691 <primary>domain literal</primary>
8692 <secondary>default router</secondary>
8693 </indexterm>
8694 This router is commented out because the majority of sites do not want to
8695 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8696 you uncomment this router, you also need to uncomment the setting of
8697 <option>allow_domain_literals</option> in the main part of the configuration.
8698 </para>
8699 <literallayout class="monospaced">
8700 dnslookup:
8701   driver = dnslookup
8702   domains = ! +local_domains
8703   transport = remote_smtp
8704   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8705   no_more
8706 </literallayout>
8707 <para>
8708 The first uncommented router handles addresses that do not involve any local
8709 domains. This is specified by the line
8710 </para>
8711 <literallayout class="monospaced">
8712 domains = ! +local_domains
8713 </literallayout>
8714 <para>
8715 The <option>domains</option> option lists the domains to which this router applies, but the
8716 exclamation mark is a negation sign, so the router is used only for domains
8717 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8718 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8719 indicates that it is referring to a named list. Addresses in other domains are
8720 passed on to the following routers.
8721 </para>
8722 <para>
8723 The name of the router driver is <command>dnslookup</command>,
8724 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8725 the name of this router instance is the same as the name of the driver. The
8726 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8727 one of the driver modules that is in the Exim binary.
8728 </para>
8729 <para>
8730 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8731 DNS in order to obtain a list of hosts to which the address is routed. If the
8732 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8733 specified by the <option>transport</option> option. If the router does not find the domain
8734 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8735 the address fails and is bounced.
8736 </para>
8737 <para>
8738 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8739 be entirely ignored. This option is present because a number of cases have been
8740 encountered where MX records in the DNS point to host names
8741 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8742 Completely ignoring these IP addresses causes Exim to fail to route the
8743 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8744 continue to try to deliver the message periodically until the address timed
8745 out.
8746 </para>
8747 <literallayout class="monospaced">
8748 system_aliases:
8749   driver = redirect
8750   allow_fail
8751   allow_defer
8752   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8753 # user = exim
8754   file_transport = address_file
8755   pipe_transport = address_pipe
8756 </literallayout>
8757 <para>
8758 Control reaches this and subsequent routers only for addresses in the local
8759 domains. This router checks to see whether the local part is defined as an
8760 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8761 data that it looks up from that file. If no data is found for the local part,
8762 the value of the <option>data</option> option is empty, causing the address to be passed to
8763 the next router.
8764 </para>
8765 <para>
8766 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8767 often used. That is why it is referenced by from the default configuration
8768 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8769 <filename>Local/Makefile</filename> before building Exim.
8770 </para>
8771 <literallayout class="monospaced">
8772 userforward:
8773   driver = redirect
8774   check_local_user
8775 # local_part_suffix = +* : -*
8776 # local_part_suffix_optional
8777   file = $home/.forward
8778 # allow_filter
8779   no_verify
8780   no_expn
8781   check_ancestor
8782   file_transport = address_file
8783   pipe_transport = address_pipe
8784   reply_transport = address_reply
8785 </literallayout>
8786 <para>
8787 This is the most complicated router in the default configuration. It is another
8788 redirection router, but this time it is looking for forwarding data set up by
8789 individual users. The <option>check_local_user</option> setting specifies a check that the
8790 local part of the address is the login name of a local user. If it is not, the
8791 router is skipped. The two commented options that follow <option>check_local_user</option>,
8792 namely:
8793 </para>
8794 <literallayout class="monospaced">
8795 # local_part_suffix = +* : -*
8796 # local_part_suffix_optional
8797 </literallayout>
8798 <para>
8799 <indexterm role="variable">
8800 <primary><varname>$local_part_suffix</varname></primary>
8801 </indexterm>
8802 show how you can specify the recognition of local part suffixes. If the first
8803 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8804 by any sequence of characters, is removed from the local part and placed in the
8805 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8806 presence of a suffix in the local part is optional. When a suffix is present,
8807 the check for a local login uses the local part with the suffix removed.
8808 </para>
8809 <para>
8810 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8811 home directory is consulted. If it does not exist, or is empty, the router
8812 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8813 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8814 </para>
8815 <para>
8816 <indexterm role="concept">
8817 <primary>Sieve filter</primary>
8818 <secondary>enabling in default router</secondary>
8819 </indexterm>
8820 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8821 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8822 is commented out by default), the contents of the file are interpreted as a set
8823 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8824 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8825 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8826 </para>
8827 <para>
8828 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8829 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8830 There are two reasons for doing this:
8831 </para>
8832 <orderedlist numeration="arabic">
8833 <listitem>
8834 <para>
8835 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8836 checking an address for validity; it makes sense not to waste resources doing
8837 unnecessary work.
8838 </para>
8839 </listitem>
8840 <listitem>
8841 <para>
8842 More importantly, when Exim is verifying addresses or handling an EXPN
8843 command during an SMTP session, it is running as the Exim user, not as root.
8844 The group is the Exim group, and no additional groups are set up.
8845 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8846 this time.
8847 </para>
8848 </listitem>
8849 </orderedlist>
8850 <para>
8851 The setting of <option>check_ancestor</option> prevents the router from generating a new
8852 address that is the same as any previous address that was redirected. (This
8853 works round a problem concerning a bad interaction between aliasing and
8854 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8855 </para>
8856 <para>
8857 The final three option settings specify the transports that are to be used when
8858 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8859 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8860 </para>
8861 <literallayout class="monospaced">
8862 a.nother@elsewhere.example, /home/spqr/archive
8863 </literallayout>
8864 <para>
8865 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8866 transport.
8867 </para>
8868 <literallayout class="monospaced">
8869 localuser:
8870   driver = accept
8871   check_local_user
8872 # local_part_suffix = +* : -*
8873 # local_part_suffix_optional
8874   transport = local_delivery
8875 </literallayout>
8876 <para>
8877 The final router sets up delivery into local mailboxes, provided that the local
8878 part is the name of a local login, by accepting the address and assigning it to
8879 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8880 routers, so the address is bounced. The commented suffix settings fulfil the
8881 same purpose as they do for the <command>userforward</command> router.
8882 </para>
8883 </section>
8884 <section id="SECID56">
8885 <title>Transport configuration</title>
8886 <para>
8887 <indexterm role="concept">
8888 <primary>default</primary>
8889 <secondary>transports</secondary>
8890 </indexterm>
8891 <indexterm role="concept">
8892 <primary>transports</primary>
8893 <secondary>default</secondary>
8894 </indexterm>
8895 Transports define mechanisms for actually delivering messages. They operate
8896 only when referenced from routers, so the order in which they are defined does
8897 not matter. The transports section of the configuration starts with
8898 </para>
8899 <literallayout class="monospaced">
8900 begin transports
8901 </literallayout>
8902 <para>
8903 One remote transport and four local transports are defined.
8904 </para>
8905 <literallayout class="monospaced">
8906 remote_smtp:
8907   driver = smtp
8908 </literallayout>
8909 <para>
8910 This transport is used for delivering messages over SMTP connections. All its
8911 options are defaulted. The list of remote hosts comes from the router.
8912 </para>
8913 <literallayout class="monospaced">
8914 local_delivery:
8915   driver = appendfile
8916   file = /var/mail/$local_part
8917   delivery_date_add
8918   envelope_to_add
8919   return_path_add
8920 # group = mail
8921 # mode = 0660
8922 </literallayout>
8923 <para>
8924 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8925 traditional BSD mailbox format. By default it runs under the uid and gid of the
8926 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8927 directory. Some systems use the alternative approach of running mail deliveries
8928 under a particular group instead of using the sticky bit. The commented options
8929 show how this can be done.
8930 </para>
8931 <para>
8932 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8933 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8934 similarly-named options above.
8935 </para>
8936 <literallayout class="monospaced">
8937 address_pipe:
8938   driver = pipe
8939   return_output
8940 </literallayout>
8941 <para>
8942 This transport is used for handling deliveries to pipes that are generated by
8943 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8944 option specifies that any output generated by the pipe is to be returned to the
8945 sender.
8946 </para>
8947 <literallayout class="monospaced">
8948 address_file:
8949   driver = appendfile
8950   delivery_date_add
8951   envelope_to_add
8952   return_path_add
8953 </literallayout>
8954 <para>
8955 This transport is used for handling deliveries to files that are generated by
8956 redirection. The name of the file is not specified in this instance of
8957 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8958 </para>
8959 <literallayout class="monospaced">
8960 address_reply:
8961   driver = autoreply
8962 </literallayout>
8963 <para>
8964 This transport is used for handling automatic replies generated by users&#x2019;
8965 filter files.
8966 </para>
8967 </section>
8968 <section id="SECID57">
8969 <title>Default retry rule</title>
8970 <para>
8971 <indexterm role="concept">
8972 <primary>retry</primary>
8973 <secondary>default rule</secondary>
8974 </indexterm>
8975 <indexterm role="concept">
8976 <primary>default</primary>
8977 <secondary>retry rule</secondary>
8978 </indexterm>
8979 The retry section of the configuration file contains rules which affect the way
8980 Exim retries deliveries that cannot be completed at the first attempt. It is
8981 introduced by the line
8982 </para>
8983 <literallayout class="monospaced">
8984 begin retry
8985 </literallayout>
8986 <para>
8987 In the default configuration, there is just one rule, which applies to all
8988 errors:
8989 </para>
8990 <literallayout class="monospaced">
8991 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8992 </literallayout>
8993 <para>
8994 This causes any temporarily failing address to be retried every 15 minutes for
8995 2 hours, then at intervals starting at one hour and increasing by a factor of
8996 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8997 is not delivered after 4 days of temporary failure, it is bounced.
8998 </para>
8999 <para>
9000 If the retry section is removed from the configuration, or is empty (that is,
9001 if no retry rules are defined), Exim will not retry deliveries. This turns
9002 temporary errors into permanent errors.
9003 </para>
9004 </section>
9005 <section id="SECID58">
9006 <title>Rewriting configuration</title>
9007 <para>
9008 The rewriting section of the configuration, introduced by
9009 </para>
9010 <literallayout class="monospaced">
9011 begin rewrite
9012 </literallayout>
9013 <para>
9014 contains rules for rewriting addresses in messages as they arrive. There are no
9015 rewriting rules in the default configuration file.
9016 </para>
9017 </section>
9018 <section id="SECTdefconfauth">
9019 <title>Authenticators configuration</title>
9020 <para>
9021 <indexterm role="concept">
9022 <primary>AUTH</primary>
9023 <secondary>configuration</secondary>
9024 </indexterm>
9025 The authenticators section of the configuration, introduced by
9026 </para>
9027 <literallayout class="monospaced">
9028 begin authenticators
9029 </literallayout>
9030 <para>
9031 defines mechanisms for the use of the SMTP AUTH command. The default
9032 configuration file contains two commented-out example authenticators
9033 which support plaintext username/password authentication using the
9034 standard PLAIN mechanism and the traditional but non-standard LOGIN
9035 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9036 to support most MUA software.
9037 </para>
9038 <para>
9039 The example PLAIN authenticator looks like this:
9040 </para>
9041 <literallayout class="monospaced">
9042 #PLAIN:
9043 #  driver                  = plaintext
9044 #  server_set_id           = $auth2
9045 #  server_prompts          = :
9046 #  server_condition        = Authentication is not yet configured
9047 #  server_advertise_condition = ${if def:tls_cipher }
9048 </literallayout>
9049 <para>
9050 And the example LOGIN authenticator looks like this:
9051 </para>
9052 <literallayout class="monospaced">
9053 #LOGIN:
9054 #  driver                  = plaintext
9055 #  server_set_id           = $auth1
9056 #  server_prompts          = &lt;| Username: | Password:
9057 #  server_condition        = Authentication is not yet configured
9058 #  server_advertise_condition = ${if def:tls_cipher }
9059 </literallayout>
9060 <para>
9061 The <option>server_set_id</option> option makes Exim remember the authenticated username
9062 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9063 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9064 that it implements the details of the specific authentication mechanism,
9065 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9066 when Exim offers authentication to clients; in the examples, this is only
9067 when TLS or SSL has been started, so to enable the authenticators you also
9068 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9069 </para>
9070 <para>
9071 The <option>server_condition</option> setting defines how to verify that the username and
9072 password are correct. In the examples it just produces an error message.
9073 To make the authenticators work, you can use a string expansion
9074 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9075 </para>
9076 <para>
9077 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9078 usercode and password are in different positions.
9079 Chapter <xref linkend="CHAPplaintext"/> covers both.
9080 </para>
9081 <para>
9082 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9083 </para>
9084 </section>
9085 </chapter>
9086
9087 <chapter id="CHAPregexp">
9088 <title>Regular expressions</title>
9089 <para>
9090 <indexterm role="concept">
9091 <primary>regular expressions</primary>
9092 <secondary>library</secondary>
9093 </indexterm>
9094 <indexterm role="concept">
9095 <primary>PCRE</primary>
9096 </indexterm>
9097 Exim supports the use of regular expressions in many of its options. It
9098 uses the PCRE regular expression library; this provides regular expression
9099 matching that is compatible with Perl 5. The syntax and semantics of
9100 regular expressions is discussed in many Perl reference books, and also in
9101 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9102 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9103 </para>
9104 <para>
9105 The documentation for the syntax and semantics of the regular expressions that
9106 are supported by PCRE is included in the PCRE distribution, and no further
9107 description is included here. The PCRE functions are called from Exim using
9108 the default option settings (that is, with no PCRE options set), except that
9109 the PCRE_CASELESS option is set when the matching is required to be
9110 case-insensitive.
9111 </para>
9112 <para>
9113 In most cases, when a regular expression is required in an Exim configuration,
9114 it has to start with a circumflex, in order to distinguish it from plain text
9115 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9116 second item in the colon-separated list is a regular expression.
9117 </para>
9118 <literallayout class="monospaced">
9119 domains = a.b.c : ^\\d{3} : *.y.z : ...
9120 </literallayout>
9121 <para>
9122 The doubling of the backslash is required because of string expansion that
9123 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9124 of this issue, and a way of avoiding the need for doubling backslashes. The
9125 regular expression that is eventually used in this example contains just one
9126 backslash. The circumflex is included in the regular expression, and has the
9127 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9128 matched.
9129 </para>
9130 <para>
9131 There are, however, two cases where a circumflex is not required for the
9132 recognition of a regular expression: these are the <option>match</option> condition in a
9133 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9134 these cases, the relevant string is always treated as a regular expression; if
9135 it does not start with a circumflex, the expression is not anchored, and can
9136 match anywhere in the subject string.
9137 </para>
9138 <para>
9139 In all cases, if you want a regular expression to match at the end of a string,
9140 you must code the $ metacharacter to indicate this. For example:
9141 </para>
9142 <literallayout class="monospaced">
9143 domains = ^\\d{3}\\.example
9144 </literallayout>
9145 <para>
9146 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9147 You need to use:
9148 </para>
9149 <literallayout class="monospaced">
9150 domains = ^\\d{3}\\.example\$
9151 </literallayout>
9152 <para>
9153 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9154 $ is needed because string expansion also interprets dollar characters.
9155 </para>
9156 </chapter>
9157
9158 <chapter id="CHAPfdlookup">
9159 <title>File and database lookups</title>
9160 <para>
9161 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9162 <primary>file</primary>
9163 <secondary>lookups</secondary>
9164 </indexterm>
9165 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9166 <primary>database</primary>
9167 <secondary>lookups</secondary>
9168 </indexterm>
9169 <indexterm role="concept">
9170 <primary>lookup</primary>
9171 <secondary>description of</secondary>
9172 </indexterm>
9173 Exim can be configured to look up data in files or databases as it processes
9174 messages. Two different kinds of syntax are used:
9175 </para>
9176 <orderedlist numeration="arabic">
9177 <listitem>
9178 <para>
9179 A string that is to be expanded may contain explicit lookup requests. These
9180 cause parts of the string to be replaced by data that is obtained from the
9181 lookup. Lookups of this type are conditional expansion items. Different results
9182 can be defined for the cases of lookup success and failure. See chapter
9183 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9184 </para>
9185 </listitem>
9186 <listitem>
9187 <para>
9188 Lists of domains, hosts, and email addresses can contain lookup requests as a
9189 way of avoiding excessively long linear lists. In this case, the data that is
9190 returned by the lookup is often (but not always) discarded; whether the lookup
9191 succeeds or fails is what really counts. These kinds of list are described in
9192 chapter <xref linkend="CHAPdomhosaddlists"/>.
9193 </para>
9194 </listitem>
9195 </orderedlist>
9196 <para>
9197 String expansions, lists, and lookups interact with each other in such a way
9198 that there is no order in which to describe any one of them that does not
9199 involve references to the others. Each of these three chapters makes more sense
9200 if you have read the other two first. If you are reading this for the first
9201 time, be aware that some of it will make a lot more sense after you have read
9202 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9203 </para>
9204 <section id="SECID60">
9205 <title>Examples of different lookup syntax</title>
9206 <para>
9207 It is easy to confuse the two different kinds of lookup, especially as the
9208 lists that may contain the second kind are always expanded before being
9209 processed as lists. Therefore, they may also contain lookups of the first kind.
9210 Be careful to distinguish between the following two examples:
9211 </para>
9212 <literallayout class="monospaced">
9213 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9214 domains = lsearch;/some/file
9215 </literallayout>
9216 <para>
9217 The first uses a string expansion, the result of which must be a domain list.
9218 No strings have been specified for a successful or a failing lookup; the
9219 defaults in this case are the looked-up data and an empty string, respectively.
9220 The expansion takes place before the string is processed as a list, and the
9221 file that is searched could contain lines like this:
9222 </para>
9223 <literallayout class="monospaced">
9224 192.168.3.4: domain1:domain2:...
9225 192.168.1.9: domain3:domain4:...
9226 </literallayout>
9227 <para>
9228 When the lookup succeeds, the result of the expansion is a list of domains (and
9229 possibly other types of item that are allowed in domain lists).
9230 </para>
9231 <para>
9232 In the second example, the lookup is a single item in a domain list. It causes
9233 Exim to use a lookup to see if the domain that is being processed can be found
9234 in the file. The file could contains lines like this:
9235 </para>
9236 <literallayout class="monospaced">
9237 domain1:
9238 domain2:
9239 </literallayout>
9240 <para>
9241 Any data that follows the keys is not relevant when checking that the domain
9242 matches the list item.
9243 </para>
9244 <para>
9245 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9246 Consider a file containing lines like this:
9247 </para>
9248 <literallayout class="monospaced">
9249 192.168.5.6: lsearch;/another/file
9250 </literallayout>
9251 <para>
9252 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9253 first <option>domains</option> setting above generates the second setting, which therefore
9254 causes a second lookup to occur.
9255 </para>
9256 <para>
9257 The rest of this chapter describes the different lookup types that are
9258 available. Any of them can be used in any part of the configuration where a
9259 lookup is permitted.
9260 </para>
9261 </section>
9262 <section id="SECID61">
9263 <title>Lookup types</title>
9264 <para>
9265 <indexterm role="concept">
9266 <primary>lookup</primary>
9267 <secondary>types of</secondary>
9268 </indexterm>
9269 <indexterm role="concept">
9270 <primary>single-key lookup</primary>
9271 <secondary>definition of</secondary>
9272 </indexterm>
9273 Two different types of data lookup are implemented:
9274 </para>
9275 <itemizedlist>
9276 <listitem>
9277 <para>
9278 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9279 and a single key to search for. The key must be a non-empty string for the
9280 lookup to succeed. The lookup type determines how the file is searched.
9281 </para>
9282 </listitem>
9283 <listitem>
9284 <para>
9285 <indexterm role="concept">
9286 <primary>query-style lookup</primary>
9287 <secondary>definition of</secondary>
9288 </indexterm>
9289 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9290 key value is assumed by Exim for query-style lookups. You can use whichever
9291 Exim variables you need to construct the database query.
9292 </para>
9293 </listitem>
9294 </itemizedlist>
9295 <para>
9296 The code for each lookup type is in a separate source file that is included in
9297 the binary of Exim only if the corresponding compile-time option is set. The
9298 default settings in <filename>src/EDITME</filename> are:
9299 </para>
9300 <literallayout class="monospaced">
9301 LOOKUP_DBM=yes
9302 LOOKUP_LSEARCH=yes
9303 </literallayout>
9304 <para>
9305 which means that only linear searching and DBM lookups are included by default.
9306 For some types of lookup (e.g. SQL databases), you need to install appropriate
9307 libraries and header files before building Exim.
9308 </para>
9309 </section>
9310 <section id="SECTsinglekeylookups">
9311 <title>Single-key lookup types</title>
9312 <para>
9313 <indexterm role="concept">
9314 <primary>lookup</primary>
9315 <secondary>single-key types</secondary>
9316 </indexterm>
9317 <indexterm role="concept">
9318 <primary>single-key lookup</primary>
9319 <secondary>list of types</secondary>
9320 </indexterm>
9321 The following single-key lookup types are implemented:
9322 </para>
9323 <itemizedlist>
9324 <listitem>
9325 <para>
9326 <indexterm role="concept">
9327 <primary>cdb</primary>
9328 <secondary>description of</secondary>
9329 </indexterm>
9330 <indexterm role="concept">
9331 <primary>lookup</primary>
9332 <secondary>cdb</secondary>
9333 </indexterm>
9334 <indexterm role="concept">
9335 <primary>binary zero</primary>
9336 <secondary>in lookup key</secondary>
9337 </indexterm>
9338 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9339 string without a terminating binary zero. The cdb format is designed for
9340 indexed files that are read frequently and never updated, except by total
9341 re-creation. As such, it is particularly suitable for large files containing
9342 aliases or other indexed data referenced by an MTA. Information about cdb can
9343 be found in several places:
9344 </para>
9345 <literallayout>
9346 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9347 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9348 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9349 </literallayout>
9350 <para>
9351 A cdb distribution is not needed in order to build Exim with cdb support,
9352 because the code for reading cdb files is included directly in Exim itself.
9353 However, no means of building or testing cdb files is provided with Exim, so
9354 you need to obtain a cdb distribution in order to do this.
9355 </para>
9356 </listitem>
9357 <listitem>
9358 <para>
9359 <indexterm role="concept">
9360 <primary>DBM</primary>
9361 <secondary>lookup type</secondary>
9362 </indexterm>
9363 <indexterm role="concept">
9364 <primary>lookup</primary>
9365 <secondary>dbm</secondary>
9366 </indexterm>
9367 <indexterm role="concept">
9368 <primary>binary zero</primary>
9369 <secondary>in lookup key</secondary>
9370 </indexterm>
9371 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9372 DBM file by looking up the record with the given key. A terminating binary
9373 zero is included in the key that is passed to the DBM library. See section
9374 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9375 </para>
9376 <para>
9377 <indexterm role="concept">
9378 <primary>Berkeley DB library</primary>
9379 <secondary>file format</secondary>
9380 </indexterm>
9381 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9382 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9383 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9384 the DB_UNKNOWN option. This enables it to handle any of the types of database
9385 that the library supports, and can be useful for accessing DBM files created by
9386 other applications. (For earlier DB versions, DB_HASH is always used.)
9387 </para>
9388 </listitem>
9389 <listitem>
9390 <para revisionflag="changed">
9391 <indexterm role="concept">
9392 <primary>lookup</primary>
9393 <secondary>dbmjz</secondary>
9394 </indexterm>
9395 <indexterm role="concept">
9396 <primary>lookup</primary>
9397 <secondary>dbm &ndash; embedded NULs</secondary>
9398 </indexterm>
9399 <indexterm role="concept">
9400 <primary>sasldb2</primary>
9401 </indexterm>
9402 <indexterm role="concept">
9403 <primary>dbmjz lookup type</primary>
9404 </indexterm>
9405 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9406 interpreted as an Exim list; the elements of the list are joined together with
9407 ASCII NUL characters to form the lookup key.  An example usage would be to
9408 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9409 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9410 <command>cram_md5</command> authenticator.
9411 </para>
9412 </listitem>
9413 <listitem>
9414 <para>
9415 <indexterm role="concept">
9416 <primary>lookup</primary>
9417 <secondary>dbmnz</secondary>
9418 </indexterm>
9419 <indexterm role="concept">
9420 <primary>lookup</primary>
9421 <secondary>dbm &ndash; terminating zero</secondary>
9422 </indexterm>
9423 <indexterm role="concept">
9424 <primary>binary zero</primary>
9425 <secondary>in lookup key</secondary>
9426 </indexterm>
9427 <indexterm role="concept">
9428 <primary>Courier</primary>
9429 </indexterm>
9430 <indexterm role="concept">
9431 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9432 </indexterm>
9433 <indexterm role="concept">
9434 <primary>dbmnz lookup type</primary>
9435 </indexterm>
9436 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9437 is not included in the key that is passed to the DBM library. You may need this
9438 if you want to look up data in files that are created by or shared with some
9439 other application that does not use terminating zeros. For example, you need to
9440 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9441 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9442 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9443 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9444 </para>
9445 </listitem>
9446 <listitem>
9447 <para>
9448 <indexterm role="concept">
9449 <primary>lookup</primary>
9450 <secondary>dsearch</secondary>
9451 </indexterm>
9452 <indexterm role="concept">
9453 <primary>dsearch lookup type</primary>
9454 </indexterm>
9455 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9456 whose name is the key by calling the <function>lstat()</function> function. The key may not
9457 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9458 the lookup is the name of the entry, which may be a file, directory,
9459 symbolic link, or any other kind of directory entry. An example of how this
9460 lookup can be used to support virtual domains is given in section
9461 <xref linkend="SECTvirtualdomains"/>.
9462 </para>
9463 </listitem>
9464 <listitem>
9465 <para>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>iplsearch</secondary>
9469 </indexterm>
9470 <indexterm role="concept">
9471 <primary>iplsearch lookup type</primary>
9472 </indexterm>
9473 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9474 terminated by a colon or white space or the end of the line. The keys in the
9475 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9476 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9477 being interpreted as a key terminator. For example:
9478 </para>
9479 <literallayout class="monospaced">
9480 1.2.3.4:           data for 1.2.3.4
9481 192.168.0.0/16:    data for 192.168.0.0/16
9482 "abcd::cdab":      data for abcd::cdab
9483 "abcd:abcd::/32"   data for abcd:abcd::/32
9484 </literallayout>
9485 <para>
9486 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9487 file is searched linearly, using the CIDR masks where present, until a matching
9488 key is found. The first key that matches is used; there is no attempt to find a
9489 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9490 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9491 </para>
9492 <para>
9493 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9494 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9495 lookup types support only literal keys.
9496 </para>
9497 <para>
9498 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9499 the implicit key is the host&#x2019;s IP address rather than its name (see section
9500 <xref linkend="SECThoslispatsikey"/>).
9501 </para>
9502 </listitem>
9503 <listitem>
9504 <para>
9505 <indexterm role="concept">
9506 <primary>linear search</primary>
9507 </indexterm>
9508 <indexterm role="concept">
9509 <primary>lookup</primary>
9510 <secondary>lsearch</secondary>
9511 </indexterm>
9512 <indexterm role="concept">
9513 <primary>lsearch lookup type</primary>
9514 </indexterm>
9515 <indexterm role="concept">
9516 <primary>case sensitivity</primary>
9517 <secondary>in lsearch lookup</secondary>
9518 </indexterm>
9519 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9520 line beginning with the search key, terminated by a colon or white space or the
9521 end of the line. The search is case-insensitive; that is, upper and lower case
9522 letters are treated as the same. The first occurrence of the key that is found
9523 in the file is used.
9524 </para>
9525 <para>
9526 White space between the key and the colon is permitted. The remainder of the
9527 line, with leading and trailing white space removed, is the data. This can be
9528 continued onto subsequent lines by starting them with any amount of white
9529 space, but only a single space character is included in the data at such a
9530 junction. If the data begins with a colon, the key must be terminated by a
9531 colon, for example:
9532 </para>
9533 <literallayout class="monospaced">
9534 baduser:  :fail:
9535 </literallayout>
9536 <para>
9537 Empty lines and lines beginning with # are ignored, even if they occur in the
9538 middle of an item. This is the traditional textual format of alias files. Note
9539 that the keys in an <command>lsearch</command> file are literal strings. There is no
9540 wildcarding of any kind.
9541 </para>
9542 <para>
9543 <indexterm role="concept">
9544 <primary>lookup</primary>
9545 <secondary>lsearch &ndash; colons in keys</secondary>
9546 </indexterm>
9547 <indexterm role="concept">
9548 <primary>white space</primary>
9549 <secondary>in lsearch key</secondary>
9550 </indexterm>
9551 In most <command>lsearch</command> files, keys are not required to contain colons or #
9552 characters, or white space. However, if you need this feature, it is available.
9553 If a key begins with a doublequote character, it is terminated only by a
9554 matching quote (or end of line), and the normal escaping rules apply to its
9555 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9556 quoted keys (exactly as for unquoted keys). There is no special handling of
9557 quotes for the data part of an <command>lsearch</command> line.
9558 </para>
9559 </listitem>
9560 <listitem>
9561 <para>
9562 <indexterm role="concept">
9563 <primary>NIS lookup type</primary>
9564 </indexterm>
9565 <indexterm role="concept">
9566 <primary>lookup</primary>
9567 <secondary>NIS</secondary>
9568 </indexterm>
9569 <indexterm role="concept">
9570 <primary>binary zero</primary>
9571 <secondary>in lookup key</secondary>
9572 </indexterm>
9573 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9574 the given key, without a terminating binary zero. There is a variant called
9575 <command>nis0</command> which does include the terminating binary zero in the key. This is
9576 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9577 aliases; the full map names must be used.
9578 </para>
9579 </listitem>
9580 <listitem>
9581 <para>
9582 <indexterm role="concept">
9583 <primary>wildlsearch lookup type</primary>
9584 </indexterm>
9585 <indexterm role="concept">
9586 <primary>lookup</primary>
9587 <secondary>wildlsearch</secondary>
9588 </indexterm>
9589 <indexterm role="concept">
9590 <primary>nwildlsearch lookup type</primary>
9591 </indexterm>
9592 <indexterm role="concept">
9593 <primary>lookup</primary>
9594 <secondary>nwildlsearch</secondary>
9595 </indexterm>
9596 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9597 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9598 the file may be wildcarded. The difference between these two lookup types is
9599 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9600 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9601 </para>
9602 <para>
9603 <indexterm role="concept">
9604 <primary>case sensitivity</primary>
9605 <secondary>in (n)wildlsearch lookup</secondary>
9606 </indexterm>
9607 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9608 file that are regular expressions can be made case-sensitive by the use of
9609 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9610 </para>
9611 <orderedlist numeration="arabic">
9612 <listitem>
9613 <para>
9614 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9615 </para>
9616 <literallayout class="monospaced">
9617     *.a.b.c       data for anything.a.b.c
9618     *fish         data for anythingfish
9619 </literallayout>
9620 </listitem>
9621 <listitem>
9622 <para>
9623 The string may begin with a circumflex to indicate a regular expression. For
9624 example, for <command>wildlsearch</command>:
9625 </para>
9626 <literallayout class="monospaced">
9627     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9628 </literallayout>
9629 <para>
9630 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9631 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9632 string-expanded, the equivalent entry is:
9633 </para>
9634 <literallayout class="monospaced">
9635     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9636 </literallayout>
9637 <para>
9638 The case-insensitive flag is set at the start of compiling the regular
9639 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9640 For example, to make the entire pattern case-sensitive:
9641 </para>
9642 <literallayout class="monospaced">
9643     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9644 </literallayout>
9645 <para>
9646 If the regular expression contains white space or colon characters, you must
9647 either quote it (see <command>lsearch</command> above), or represent these characters in other
9648 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9649 colon. This may be easier than quoting, because if you quote, you have to
9650 escape all the backslashes inside the quotes.
9651 </para>
9652 <para>
9653 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9654 match for later use, because the results of all lookups are cached. If a lookup
9655 is repeated, the result is taken from the cache, and no actual pattern matching
9656 takes place. The values of all the numeric variables are unset after a
9657 <command>(n)wildlsearch</command> match.
9658 </para>
9659 </listitem>
9660 <listitem>
9661 <para>
9662 Although I cannot see it being of much use, the general matching function that
9663 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9664 lookup name terminated by a semicolon, and followed by lookup data. For
9665 example:
9666 </para>
9667 <literallayout class="monospaced">
9668     cdb;/some/file  data for keys that match the file
9669 </literallayout>
9670 <para>
9671 The data that is obtained from the nested lookup is discarded.
9672 </para>
9673 </listitem>
9674 </orderedlist>
9675 <para>
9676 Keys that do not match any of these patterns are interpreted literally. The
9677 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9678 be followed by optional colons.
9679 </para>
9680 <para>
9681 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9682 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9683 lookup types support only literal keys.
9684 </para>
9685 </listitem>
9686 </itemizedlist>
9687 </section>
9688 <section id="SECID62">
9689 <title>Query-style lookup types</title>
9690 <para>
9691 <indexterm role="concept">
9692 <primary>lookup</primary>
9693 <secondary>query-style types</secondary>
9694 </indexterm>
9695 <indexterm role="concept">
9696 <primary>query-style lookup</primary>
9697 <secondary>list of types</secondary>
9698 </indexterm>
9699 The supported query-style lookup types are listed below. Further details about
9700 many of them are given in later sections.
9701 </para>
9702 <itemizedlist>
9703 <listitem>
9704 <para>
9705 <indexterm role="concept">
9706 <primary>DNS</primary>
9707 <secondary>as a lookup type</secondary>
9708 </indexterm>
9709 <indexterm role="concept">
9710 <primary>lookup</primary>
9711 <secondary>DNS</secondary>
9712 </indexterm>
9713 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9714 are given in the supplied query. The resulting data is the contents of the
9715 records. See section <xref linkend="SECTdnsdb"/>.
9716 </para>
9717 </listitem>
9718 <listitem>
9719 <para>
9720 <indexterm role="concept">
9721 <primary>InterBase lookup type</primary>
9722 </indexterm>
9723 <indexterm role="concept">
9724 <primary>lookup</primary>
9725 <secondary>InterBase</secondary>
9726 </indexterm>
9727 <command>ibase</command>: This does a lookup in an InterBase database.
9728 </para>
9729 </listitem>
9730 <listitem>
9731 <para>
9732 <indexterm role="concept">
9733 <primary>LDAP</primary>
9734 <secondary>lookup type</secondary>
9735 </indexterm>
9736 <indexterm role="concept">
9737 <primary>lookup</primary>
9738 <secondary>LDAP</secondary>
9739 </indexterm>
9740 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9741 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9742 that permits values from multiple entries to be returned. A third variant
9743 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9744 any attribute values. See section <xref linkend="SECTldap"/>.
9745 </para>
9746 </listitem>
9747 <listitem>
9748 <para>
9749 <indexterm role="concept">
9750 <primary>MySQL</primary>
9751 <secondary>lookup type</secondary>
9752 </indexterm>
9753 <indexterm role="concept">
9754 <primary>lookup</primary>
9755 <secondary>MySQL</secondary>
9756 </indexterm>
9757 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9758 MySQL database. See section <xref linkend="SECTsql"/>.
9759 </para>
9760 </listitem>
9761 <listitem>
9762 <para>
9763 <indexterm role="concept">
9764 <primary>NIS+ lookup type</primary>
9765 </indexterm>
9766 <indexterm role="concept">
9767 <primary>lookup</primary>
9768 <secondary>NIS+</secondary>
9769 </indexterm>
9770 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9771 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9772 </para>
9773 </listitem>
9774 <listitem>
9775 <para>
9776 <indexterm role="concept">
9777 <primary>Oracle</primary>
9778 <secondary>lookup type</secondary>
9779 </indexterm>
9780 <indexterm role="concept">
9781 <primary>lookup</primary>
9782 <secondary>Oracle</secondary>
9783 </indexterm>
9784 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9785 Oracle database. See section <xref linkend="SECTsql"/>.
9786 </para>
9787 </listitem>
9788 <listitem>
9789 <para>
9790 <indexterm role="concept">
9791 <primary>lookup</primary>
9792 <secondary>passwd</secondary>
9793 </indexterm>
9794 <indexterm role="concept">
9795 <primary>passwd lookup type</primary>
9796 </indexterm>
9797 <indexterm role="concept">
9798 <primary><filename>/etc/passwd</filename></primary>
9799 </indexterm>
9800 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9801 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9802 success, the result string is the same as you would get from an <command>lsearch</command>
9803 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9804 password value. For example:
9805 </para>
9806 <literallayout class="monospaced">
9807 *:42:42:King Rat:/home/kr:/bin/bash
9808 </literallayout>
9809 </listitem>
9810 <listitem>
9811 <para>
9812 <indexterm role="concept">
9813 <primary>PostgreSQL lookup type</primary>
9814 </indexterm>
9815 <indexterm role="concept">
9816 <primary>lookup</primary>
9817 <secondary>PostgreSQL</secondary>
9818 </indexterm>
9819 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9820 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9821 </para>
9822 </listitem>
9823 <listitem>
9824 <para>
9825 <indexterm role="concept">
9826 <primary>sqlite lookup type</primary>
9827 </indexterm>
9828 <indexterm role="concept">
9829 <primary>lookup</primary>
9830 <secondary>sqlite</secondary>
9831 </indexterm>
9832 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9833 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9834 </para>
9835 </listitem>
9836 <listitem>
9837 <para>
9838 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9839 not likely to be useful in normal operation.
9840 </para>
9841 </listitem>
9842 <listitem>
9843 <para>
9844 <indexterm role="concept">
9845 <primary>whoson lookup type</primary>
9846 </indexterm>
9847 <indexterm role="concept">
9848 <primary>lookup</primary>
9849 <secondary>whoson</secondary>
9850 </indexterm>
9851 <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
9852 allows a server to check whether a particular (dynamically allocated) IP
9853 address is currently allocated to a known (trusted) user and, optionally, to
9854 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9855 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9856 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9857 <quote>POP before SMTP</quote> checking using ACL statements such as
9858 </para>
9859 <literallayout class="monospaced">
9860 require condition = \
9861   ${lookup whoson {$sender_host_address}{yes}{no}}
9862 </literallayout>
9863 <para>
9864 The query consists of a single IP address. The value returned is the name of
9865 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9866 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9867 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9868 </para>
9869 </listitem>
9870 </itemizedlist>
9871 </section>
9872 <section id="SECID63">
9873 <title>Temporary errors in lookups</title>
9874 <para>
9875 <indexterm role="concept">
9876 <primary>lookup</primary>
9877 <secondary>temporary error in</secondary>
9878 </indexterm>
9879 Lookup functions can return temporary error codes if the lookup cannot be
9880 completed. For example, an SQL or LDAP database might be unavailable. For this
9881 reason, it is not advisable to use a lookup that might do this for critical
9882 options such as a list of local domains.
9883 </para>
9884 <para>
9885 When a lookup cannot be completed in a router or transport, delivery
9886 of the message (to the relevant address) is deferred, as for any other
9887 temporary error. In other circumstances Exim may assume the lookup has failed,
9888 or may give up altogether.
9889 </para>
9890 </section>
9891 <section id="SECTdefaultvaluelookups">
9892 <title>Default values in single-key lookups</title>
9893 <para>
9894 <indexterm role="concept">
9895 <primary>wildcard lookups</primary>
9896 </indexterm>
9897 <indexterm role="concept">
9898 <primary>lookup</primary>
9899 <secondary>default values</secondary>
9900 </indexterm>
9901 <indexterm role="concept">
9902 <primary>lookup</primary>
9903 <secondary>wildcard</secondary>
9904 </indexterm>
9905 <indexterm role="concept">
9906 <primary>lookup</primary>
9907 <secondary>* added to type</secondary>
9908 </indexterm>
9909 <indexterm role="concept">
9910 <primary>default</primary>
9911 <secondary>in single-key lookups</secondary>
9912 </indexterm>
9913 In this context, a <quote>default value</quote> is a value specified by the administrator
9914 that is to be used if a lookup fails.
9915 </para>
9916 <para>
9917 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9918 lookups, the facilities of the query language must be used. An attempt to
9919 specify a default for a query-style lookup provokes an error.
9920 </para>
9921 <para>
9922 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9923 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9924 provide a default value. See also the section on partial matching below.
9925 </para>
9926 <para>
9927 <indexterm role="concept">
9928 <primary>*@ with single-key lookup</primary>
9929 </indexterm>
9930 <indexterm role="concept">
9931 <primary>lookup</primary>
9932 <secondary>*@ added to type</secondary>
9933 </indexterm>
9934 <indexterm role="concept">
9935 <primary>alias file</primary>
9936 <secondary>per-domain default</secondary>
9937 </indexterm>
9938 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9939 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9940 character, a second lookup is done with everything before the last @ replaced
9941 by *. This makes it possible to provide per-domain defaults in alias files
9942 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9943 take place because there is no @ in the key), <quote>*</quote> is looked up.
9944 For example, a <command>redirect</command> router might contain:
9945 </para>
9946 <literallayout class="monospaced">
9947 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9948 </literallayout>
9949 <para>
9950 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9951 looks up these keys, in this order:
9952 </para>
9953 <literallayout class="monospaced">
9954 jane@eyre.example
9955 *@eyre.example
9956 *
9957 </literallayout>
9958 <para>
9959 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9960 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9961 complete scan is done for each key, and only if it is not found at all does
9962 Exim move on to try the next key.
9963 </para>
9964 </section>
9965 <section id="SECTpartiallookup">
9966 <title>Partial matching in single-key lookups</title>
9967 <para>
9968 <indexterm role="concept">
9969 <primary>partial matching</primary>
9970 </indexterm>
9971 <indexterm role="concept">
9972 <primary>wildcard lookups</primary>
9973 </indexterm>
9974 <indexterm role="concept">
9975 <primary>lookup</primary>
9976 <secondary>partial matching</secondary>
9977 </indexterm>
9978 <indexterm role="concept">
9979 <primary>lookup</primary>
9980 <secondary>wildcard</secondary>
9981 </indexterm>
9982 <indexterm role="concept">
9983 <primary>asterisk</primary>
9984 <secondary>in search type</secondary>
9985 </indexterm>
9986 The normal operation of a single-key lookup is to search the file for an exact
9987 match with the given key. However, in a number of situations where domains are
9988 being looked up, it is useful to be able to do partial matching. In this case,
9989 information in the file that has a key starting with <quote>*.</quote> is matched by any
9990 domain that ends with the components that follow the full stop. For example, if
9991 a key in a DBM file is
9992 </para>
9993 <literallayout class="monospaced">
9994 *.dates.fict.example
9995 </literallayout>
9996 <para>
9997 then when partial matching is enabled this is matched by (amongst others)
9998 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9999 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10000 file.
10001 </para>
10002 <para>
10003 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10004 also not available for any lookup items in address lists (see section
10005 <xref linkend="SECTaddresslist"/>).
10006 </para>
10007 <para>
10008 Partial matching is implemented by doing a series of separate lookups using
10009 keys constructed by modifying the original subject key. This means that it can
10010 be used with any of the single-key lookup types, provided that
10011 partial matching keys
10012 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10013 Keys in the file that do not begin with the prefix are matched only by
10014 unmodified subject keys when partial matching is in use.
10015 </para>
10016 <para>
10017 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10018 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10019 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10020 is added at the start of the subject key, and it is looked up again. If that
10021 fails, further lookups are tried with dot-separated components removed from the
10022 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10023 remains.
10024 </para>
10025 <para>
10026 A minimum number of two non-* components are required. This can be adjusted
10027 by including a number before the hyphen in the search type. For example,
10028 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10029 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10030 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10031 up when the minimum number of non-* components is two:
10032 </para>
10033 <literallayout class="monospaced">
10034 2250.dates.fict.example
10035 *.2250.dates.fict.example
10036 *.dates.fict.example
10037 *.fict.example
10038 </literallayout>
10039 <para>
10040 As soon as one key in the sequence is successfully looked up, the lookup
10041 finishes.
10042 </para>
10043 <para>
10044 <indexterm role="concept">
10045 <primary>lookup</primary>
10046 <secondary>partial matching &ndash; changing prefix</secondary>
10047 </indexterm>
10048 <indexterm role="concept">
10049 <primary>prefix</primary>
10050 <secondary>for partial matching</secondary>
10051 </indexterm>
10052 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10053 changed. The motivation for this feature is to allow Exim to operate with file
10054 formats that are used by other MTAs. A different prefix can be supplied in
10055 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10056 </para>
10057 <literallayout class="monospaced">
10058 domains = partial(.)lsearch;/some/file
10059 </literallayout>
10060 <para>
10061 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10062 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10063 components is unchanged). The prefix may consist of any punctuation characters
10064 other than a closing parenthesis. It may be empty, for example:
10065 </para>
10066 <literallayout class="monospaced">
10067 domains = partial1()cdb;/some/file
10068 </literallayout>
10069 <para>
10070 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10071 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10072 </para>
10073 <para>
10074 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10075 just one non-wild component has failed, and the original key is shortened right
10076 down to the null string) depends on the prefix:
10077 </para>
10078 <itemizedlist>
10079 <listitem>
10080 <para>
10081 If the prefix has zero length, the whole lookup fails.
10082 </para>
10083 </listitem>
10084 <listitem>
10085 <para>
10086 If the prefix has length 1, a lookup for just the prefix is done. For
10087 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10088 </para>
10089 </listitem>
10090 <listitem>
10091 <para>
10092 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10093 remainder is looked up. With the default prefix, therefore, the final lookup is
10094 for <quote>*</quote> on its own.
10095 </para>
10096 </listitem>
10097 <listitem>
10098 <para>
10099 Otherwise, the whole prefix is looked up.
10100 </para>
10101 </listitem>
10102 </itemizedlist>
10103 <para>
10104 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10105 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10106 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10107 specified, adding <quote>*</quote> to the search type has no effect with the default
10108 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10109 lookups. However, there might be a use for lookup types such as
10110 <quote>partial0(.)lsearch*</quote>.
10111 </para>
10112 <para>
10113 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10114 in domain lists and the like. Partial matching works only in terms of
10115 dot-separated components; a key such as <literal>*fict.example</literal>
10116 in a database file is useless, because the asterisk in a partial matching
10117 subject key is always followed by a dot.
10118 </para>
10119 </section>
10120 <section id="SECID64">
10121 <title>Lookup caching</title>
10122 <para>
10123 <indexterm role="concept">
10124 <primary>lookup</primary>
10125 <secondary>caching</secondary>
10126 </indexterm>
10127 <indexterm role="concept">
10128 <primary>caching</primary>
10129 <secondary>lookup data</secondary>
10130 </indexterm>
10131 Exim caches all lookup results in order to avoid needless repetition of
10132 lookups. However, because (apart from the daemon) Exim operates as a collection
10133 of independent, short-lived processes, this caching applies only within a
10134 single Exim process. There is no inter-process lookup caching facility.
10135 </para>
10136 <para>
10137 For single-key lookups, Exim keeps the relevant files open in case there is
10138 another lookup that needs them. In some types of configuration this can lead to
10139 many files being kept open for messages with many recipients. To avoid hitting
10140 the operating system limit on the number of simultaneously open files, Exim
10141 closes the least recently used file when it needs to open more files than its
10142 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10143 </para>
10144 <para>
10145 The single-key lookup files are closed and the lookup caches are flushed at
10146 strategic points during delivery &ndash; for example, after all routing is
10147 complete.
10148 </para>
10149 </section>
10150 <section id="SECID65">
10151 <title>Quoting lookup data</title>
10152 <para>
10153 <indexterm role="concept">
10154 <primary>lookup</primary>
10155 <secondary>quoting</secondary>
10156 </indexterm>
10157 <indexterm role="concept">
10158 <primary>quoting</primary>
10159 <secondary>in lookups</secondary>
10160 </indexterm>
10161 When data from an incoming message is included in a query-style lookup, there
10162 is the possibility of special characters in the data messing up the syntax of
10163 the query. For example, a NIS+ query that contains
10164 </para>
10165 <literallayout class="monospaced">
10166 [name=$local_part]
10167 </literallayout>
10168 <para>
10169 will be broken if the local part happens to contain a closing square bracket.
10170 For NIS+, data can be enclosed in double quotes like this:
10171 </para>
10172 <literallayout class="monospaced">
10173 [name="$local_part"]
10174 </literallayout>
10175 <para>
10176 but this still leaves the problem of a double quote in the data. The rule for
10177 NIS+ is that double quotes must be doubled. Other lookup types have different
10178 rules, and to cope with the differing requirements, an expansion operator
10179 of the following form is provided:
10180 </para>
10181 <literallayout class="monospaced">
10182 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10183 </literallayout>
10184 <para>
10185 For example, the safest way to write the NIS+ query is
10186 </para>
10187 <literallayout class="monospaced">
10188 [name="${quote_nisplus:$local_part}"]
10189 </literallayout>
10190 <para>
10191 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10192 operator can be used for all lookup types, but has no effect for single-key
10193 lookups, since no quoting is ever needed in their key strings.
10194 </para>
10195 </section>
10196 <section id="SECTdnsdb">
10197 <title>More about dnsdb</title>
10198 <para>
10199 <indexterm role="concept">
10200 <primary>dnsdb lookup</primary>
10201 </indexterm>
10202 <indexterm role="concept">
10203 <primary>lookup</primary>
10204 <secondary>dnsdb</secondary>
10205 </indexterm>
10206 <indexterm role="concept">
10207 <primary>DNS</primary>
10208 <secondary>as a lookup type</secondary>
10209 </indexterm>
10210 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10211 of a record type and a domain name, separated by an equals sign. For example,
10212 an expansion string could contain:
10213 </para>
10214 <literallayout class="monospaced">
10215 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10216 </literallayout>
10217 <para>
10218 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10219 is used on its own as the result. If the lookup does not succeed, the
10220 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10221 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10222 </para>
10223 <para revisionflag="changed">
10224 The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, and TXT,
10225 and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10226 configured). If no type is given, TXT is assumed. When the type is PTR,
10227 the data can be an IP address, written as normal; inversion and the addition of
10228 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10229 </para>
10230 <literallayout class="monospaced">
10231 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10232 </literallayout>
10233 <para>
10234 If the data for a PTR record is not a syntactically valid IP address, it is not
10235 altered and nothing is added.
10236 </para>
10237 <para>
10238 <indexterm role="concept">
10239 <primary>MX record</primary>
10240 <secondary>in <command>dnsdb</command> lookup</secondary>
10241 </indexterm>
10242 <indexterm role="concept">
10243 <primary>SRV record</primary>
10244 <secondary>in <command>dnsdb</command> lookup</secondary>
10245 </indexterm>
10246 For an MX lookup, both the preference value and the host name are returned for
10247 each record, separated by a space. For an SRV lookup, the priority, weight,
10248 port, and host name are returned for each record, separated by spaces.
10249 </para>
10250 <para>
10251 For any record type, if multiple records are found (or, for A6 lookups, if a
10252 single record leads to multiple addresses), the data is returned as a
10253 concatenation, with newline as the default separator. The order, of course,
10254 depends on the DNS resolver. You can specify a different separator character
10255 between multiple records by putting a right angle-bracket followed immediately
10256 by the new separator at the start of the query. For example:
10257 </para>
10258 <literallayout class="monospaced">
10259 ${lookup dnsdb{&gt;: a=host1.example}}
10260 </literallayout>
10261 <para>
10262 It is permitted to specify a space as the separator character. Further
10263 white space is ignored.
10264 </para>
10265 <para>
10266 <indexterm role="concept">
10267 <primary>TXT record</primary>
10268 <secondary>in <command>dnsdb</command> lookup</secondary>
10269 </indexterm>
10270 <indexterm role="concept">
10271 <primary>SPF record</primary>
10272 <secondary>in <command>dnsdb</command> lookup</secondary>
10273 </indexterm>
10274 </para>
10275 <para revisionflag="changed">
10276 For TXT records with multiple items of data, only the first item is returned,
10277 unless a separator for them is specified using a comma after the separator
10278 character followed immediately by the TXT record item separator. To concatenate
10279 items without a separator, use a semicolon instead. For SPF records the
10280 default behaviour is to concatenate multiple items without using a separator.
10281 </para>
10282 <literallayout class="monospaced">
10283 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10284 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10285 ${lookup dnsdb{spf=example.org}}
10286 </literallayout>
10287 <para>
10288 It is permitted to specify a space as the separator character. Further
10289 white space is ignored.
10290 </para>
10291 </section>
10292 <section id="SECID66">
10293 <title>Pseudo dnsdb record types</title>
10294 <para>
10295 <indexterm role="concept">
10296 <primary>MX record</primary>
10297 <secondary>in <command>dnsdb</command> lookup</secondary>
10298 </indexterm>
10299 By default, both the preference value and the host name are returned for
10300 each MX record, separated by a space. If you want only host names, you can use
10301 the pseudo-type MXH:
10302 </para>
10303 <literallayout class="monospaced">
10304 ${lookup dnsdb{mxh=a.b.example}}
10305 </literallayout>
10306 <para>
10307 In this case, the preference values are omitted, and just the host names are
10308 returned.
10309 </para>
10310 <para>
10311 <indexterm role="concept">
10312 <primary>name server for enclosing domain</primary>
10313 </indexterm>
10314 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10315 records on the given domain, but if none are found, it removes the first
10316 component of the domain name, and tries again. This process continues until NS
10317 records are found or there are no more components left (or there is a DNS
10318 error). In other words, it may return the name servers for a top-level domain,
10319 but it never returns the root name servers. If there are no NS records for the
10320 top-level domain, the lookup fails. Consider these examples:
10321 </para>
10322 <literallayout class="monospaced">
10323 ${lookup dnsdb{zns=xxx.quercite.com}}
10324 ${lookup dnsdb{zns=xxx.edu}}
10325 </literallayout>
10326 <para>
10327 Assuming that in each case there are no NS records for the full domain name,
10328 the first returns the name servers for <option>quercite.com</option>, and the second returns
10329 the name servers for <option>edu</option>.
10330 </para>
10331 <para>
10332 You should be careful about how you use this lookup because, unless the
10333 top-level domain does not exist, the lookup always returns some host names. The
10334 sort of use to which this might be put is for seeing if the name servers for a
10335 given domain are on a blacklist. You can probably assume that the name servers
10336 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10337 such a list.
10338 </para>
10339 <para>
10340 <indexterm role="concept">
10341 <primary>CSA</primary>
10342 <secondary>in <command>dnsdb</command> lookup</secondary>
10343 </indexterm>
10344 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10345 records according to the CSA rules, which are described in section
10346 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10347 not sufficient because of the extra parent domain search behaviour of CSA. The
10348 result of a successful lookup such as:
10349 </para>
10350 <literallayout class="monospaced">
10351 ${lookup dnsdb {csa=$sender_helo_name}}
10352 </literallayout>
10353 <para>
10354 has two space-separated fields: an authorization code and a target host name.
10355 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10356 authorization required but absent, or <quote>?</quote> for unknown.
10357 </para>
10358 </section>
10359 <section id="SECID67">
10360 <title>Multiple dnsdb lookups</title>
10361 <para>
10362 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10363 However, you can specify a list of domains or IP addresses in a single
10364 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10365 the default separator, but with the ability to change this. For example:
10366 </para>
10367 <literallayout class="monospaced">
10368 ${lookup dnsdb{one.domain.com:two.domain.com}}
10369 ${lookup dnsdb{a=one.host.com:two.host.com}}
10370 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10371 </literallayout>
10372 <para>
10373 In order to retain backwards compatibility, there is one special case: if
10374 the lookup type is PTR and no change of separator is specified, Exim looks
10375 to see if the rest of the string is precisely one IPv6 address. In this
10376 case, it does not treat it as a list.
10377 </para>
10378 <para>
10379 The data from each lookup is concatenated, with newline separators by default,
10380 in the same way that multiple DNS records for a single item are handled. A
10381 different separator can be specified, as described above.
10382 </para>
10383 <para>
10384 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10385 temporary DNS error for any of them, the behaviour is controlled by
10386 an optional keyword followed by a comma that may appear before the record
10387 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10388 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10389 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10390 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10391 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10392 error causes the whole lookup to defer only if none of the other lookups
10393 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10394 </para>
10395 <literallayout class="monospaced">
10396 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10397 ${lookup dnsdb{a=one.host.com:two.host.com}}
10398 </literallayout>
10399 <para>
10400 Thus, in the default case, as long as at least one of the DNS lookups
10401 yields some data, the lookup succeeds.
10402 </para>
10403 </section>
10404 <section id="SECTldap">
10405 <title>More about LDAP</title>
10406 <para>
10407 <indexterm role="concept">
10408 <primary>LDAP</primary>
10409 <secondary>lookup, more about</secondary>
10410 </indexterm>
10411 <indexterm role="concept">
10412 <primary>lookup</primary>
10413 <secondary>LDAP</secondary>
10414 </indexterm>
10415 <indexterm role="concept">
10416 <primary>Solaris</primary>
10417 <secondary>LDAP</secondary>
10418 </indexterm>
10419 The original LDAP implementation came from the University of Michigan; this has
10420 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10421 implementation comes from Netscape, and Solaris 7 and subsequent releases
10422 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10423 the lookup function level, their error handling is different. For this reason
10424 it is necessary to set a compile-time variable when building Exim with LDAP, to
10425 indicate which LDAP library is in use. One of the following should appear in
10426 your <filename>Local/Makefile</filename>:
10427 </para>
10428 <literallayout class="monospaced">
10429 LDAP_LIB_TYPE=UMICHIGAN
10430 LDAP_LIB_TYPE=OPENLDAP1
10431 LDAP_LIB_TYPE=OPENLDAP2
10432 LDAP_LIB_TYPE=NETSCAPE
10433 LDAP_LIB_TYPE=SOLARIS
10434 </literallayout>
10435 <para>
10436 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10437 same interface as the University of Michigan version.
10438 </para>
10439 <para>
10440 There are three LDAP lookup types in Exim. These behave slightly differently in
10441 the way they handle the results of a query:
10442 </para>
10443 <itemizedlist>
10444 <listitem>
10445 <para>
10446 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10447 gives an error.
10448 </para>
10449 </listitem>
10450 <listitem>
10451 <para>
10452 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10453 Distinguished Name that is returned rather than any attribute values.
10454 </para>
10455 </listitem>
10456 <listitem>
10457 <para>
10458 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10459 from all of them are returned.
10460 </para>
10461 </listitem>
10462 </itemizedlist>
10463 <para>
10464 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10465 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10466 the data returned by a successful lookup is described in the next section.
10467 First we explain how LDAP queries are coded.
10468 </para>
10469 </section>
10470 <section id="SECTforldaque">
10471 <title>Format of LDAP queries</title>
10472 <para>
10473 <indexterm role="concept">
10474 <primary>LDAP</primary>
10475 <secondary>query format</secondary>
10476 </indexterm>
10477 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10478 the configuration of a <command>redirect</command> router one might have this setting:
10479 </para>
10480 <literallayout class="monospaced">
10481 data = ${lookup ldap \
10482   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10483   c=UK?mailbox?base?}}
10484 </literallayout>
10485 <para>
10486 <indexterm role="concept">
10487 <primary>LDAP</primary>
10488 <secondary>with TLS</secondary>
10489 </indexterm>
10490 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10491 secure (encrypted) LDAP connections. The second of these ensures that an
10492 encrypted TLS connection is used.
10493 </para>
10494 <para>
10495 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10496 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10497 See the <option>ldap_start_tls</option> option.
10498 </para>
10499 </section>
10500 <section id="SECID68">
10501 <title>LDAP quoting</title>
10502 <para>
10503 <indexterm role="concept">
10504 <primary>LDAP</primary>
10505 <secondary>quoting</secondary>
10506 </indexterm>
10507 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10508 and the second because the LDAP query is represented as a URL. Furthermore,
10509 within an LDAP query, two different kinds of quoting are required. For this
10510 reason, there are two different LDAP-specific quoting operators.
10511 </para>
10512 <para>
10513 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10514 filter specifications. Conceptually, it first does the following conversions on
10515 the string:
10516 </para>
10517 <literallayout class="monospaced">
10518 *   =&gt;   \2A
10519 (   =&gt;   \28
10520 )   =&gt;   \29
10521 \   =&gt;   \5C
10522 </literallayout>
10523 <para>
10524 in accordance with RFC 2254. The resulting string is then quoted according
10525 to the rules for URLs, that is, all non-alphanumeric characters except
10526 </para>
10527 <literallayout class="monospaced">
10528 ! $ ' - . _ ( ) * +
10529 </literallayout>
10530 <para>
10531 are converted to their hex values, preceded by a percent sign. For example:
10532 </para>
10533 <literallayout class="monospaced">
10534 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10535 </literallayout>
10536 <para>
10537 yields
10538 </para>
10539 <literallayout class="monospaced">
10540 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10541 </literallayout>
10542 <para>
10543 Removing the URL quoting, this is (with a leading and a trailing space):
10544 </para>
10545 <literallayout class="monospaced">
10546 a\28bc\29\2A, a&lt;yz&gt;;
10547 </literallayout>
10548 <para>
10549 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10550 base DN specifications in queries. Conceptually, it first converts the string
10551 by inserting a backslash in front of any of the following characters:
10552 </para>
10553 <literallayout class="monospaced">
10554 , + " \ &lt; &gt; ;
10555 </literallayout>
10556 <para>
10557 It also inserts a backslash before any leading spaces or # characters, and
10558 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10559 is then quoted according to the rules for URLs. For example:
10560 </para>
10561 <literallayout class="monospaced">
10562 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10563 </literallayout>
10564 <para>
10565 yields
10566 </para>
10567 <literallayout class="monospaced">
10568 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10569 </literallayout>
10570 <para>
10571 Removing the URL quoting, this is (with a trailing space):
10572 </para>
10573 <literallayout class="monospaced">
10574 \ a(bc)*\, a\&lt;yz\&gt;\;\
10575 </literallayout>
10576 <para>
10577 There are some further comments about quoting in the section on LDAP
10578 authentication below.
10579 </para>
10580 </section>
10581 <section id="SECID69">
10582 <title>LDAP connections</title>
10583 <para>
10584 <indexterm role="concept">
10585 <primary>LDAP</primary>
10586 <secondary>connections</secondary>
10587 </indexterm>
10588 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10589 is in use, via a Unix domain socket. The example given above does not specify
10590 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10591 by starting it with
10592 </para>
10593 <literallayout class="monospaced">
10594 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10595 </literallayout>
10596 <para>
10597 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10598 used. When no server is specified in a query, a list of default servers is
10599 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10600 colon-separated list of servers which are tried in turn until one successfully
10601 handles a query, or there is a serious error. Successful handling either
10602 returns the requested data, or indicates that it does not exist. Serious errors
10603 are syntactical, or multiple values when only a single value is expected.
10604 Errors which cause the next server to be tried are connection failures, bind
10605 failures, and timeouts.
10606 </para>
10607 <para>
10608 For each server name in the list, a port number can be given. The standard way
10609 of specifying a host and port is to use a colon separator (RFC 1738). Because
10610 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10611 doubled. For example
10612 </para>
10613 <literallayout class="monospaced">
10614 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10615 </literallayout>
10616 <para>
10617 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10618 to the LDAP library with no server name, and the library&#x2019;s default (normally
10619 the local host) is used.
10620 </para>
10621 <para>
10622 If you are using the OpenLDAP library, you can connect to an LDAP server using
10623 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10624 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10625 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10626 not available.
10627 </para>
10628 <para>
10629 For this type of connection, instead of a host name for the server, a pathname
10630 for the socket is required, and the port number is not relevant. The pathname
10631 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10632 the query. In the former case, you can have settings such as
10633 </para>
10634 <literallayout class="monospaced">
10635 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10636 </literallayout>
10637 <para>
10638 When the pathname is given in the query, you have to escape the slashes as
10639 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10640 </para>
10641 <literallayout class="monospaced">
10642 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10643 </literallayout>
10644 <para>
10645 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10646 a pathname, it uses the Unix domain socket code, even if the query actually
10647 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10648 socket connection. This behaviour means that you can use a setting of
10649 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10650 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10651 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10652 backup host.
10653 </para>
10654 <para>
10655 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10656 specified, an error is diagnosed. However, if there are more items in
10657 <option>ldap_default_servers</option>, they are tried. In other words:
10658 </para>
10659 <itemizedlist>
10660 <listitem>
10661 <para>
10662 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10663 interface.
10664 </para>
10665 </listitem>
10666 <listitem>
10667 <para>
10668 Using <literal>ldapi</literal> with a host name causes an error.
10669 </para>
10670 </listitem>
10671 </itemizedlist>
10672 <para>
10673 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10674 <option>ldap_default_servers</option>, does whatever the library does by default.
10675 </para>
10676 </section>
10677 <section id="SECID70">
10678 <title>LDAP authentication and control information</title>
10679 <para>
10680 <indexterm role="concept">
10681 <primary>LDAP</primary>
10682 <secondary>authentication</secondary>
10683 </indexterm>
10684 The LDAP URL syntax provides no way of passing authentication and other control
10685 information to the server. To make this possible, the URL in an LDAP query may
10686 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10687 spaces. If a value contains spaces it must be enclosed in double quotes, and
10688 when double quotes are used, backslash is interpreted in the usual way inside
10689 them. The following names are recognized:
10690 </para>
10691 <literallayout>
10692 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10693 <literal>NETTIME    </literal>  set a timeout for a network operation
10694 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10695 <literal>PASS       </literal>  set the password, likewise
10696 <literal>REFERRALS  </literal>  set the referrals parameter
10697 <literal>SIZE       </literal>  set the limit for the number of entries returned
10698 <literal>TIME       </literal>  set the maximum waiting time for a query
10699 </literallayout>
10700 <para>
10701 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10702 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10703 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10704 library from trying to follow referrals issued by the LDAP server.
10705 </para>
10706 <para>
10707 The name CONNECT is an obsolete name for NETTIME, retained for
10708 backwards compatibility. This timeout (specified as a number of seconds) is
10709 enforced from the client end for operations that can be carried out over a
10710 network. Specifically, it applies to network connections and calls to the
10711 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10712 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10713 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10714 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10715 Netscape SDK; for OpenLDAP no action is taken.
10716 </para>
10717 <para>
10718 The TIME parameter (also a number of seconds) is passed to the server to
10719 set a server-side limit on the time taken to complete a search.
10720 </para>
10721 <para>
10722 Here is an example of an LDAP query in an Exim lookup that uses some of these
10723 values. This is a single line, folded to fit on the page:
10724 </para>
10725 <literallayout class="monospaced">
10726 ${lookup ldap
10727   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10728   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10729   {$value}fail}
10730 </literallayout>
10731 <para>
10732 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10733 any of the auxiliary data. Exim configuration settings that include lookups
10734 which contain password information should be preceded by <quote>hide</quote> to prevent
10735 non-admin users from using the <option>-bP</option> option to see their values.
10736 </para>
10737 <para>
10738 The auxiliary data items may be given in any order. The default is no
10739 connection timeout (the system timeout is used), no user or password, no limit
10740 on the number of entries returned, and no time limit on queries.
10741 </para>
10742 <para>
10743 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10744 removes any URL quoting that it may contain before passing it LDAP. Apparently
10745 some libraries do this for themselves, but some do not. Removing the URL
10746 quoting has two advantages:
10747 </para>
10748 <itemizedlist>
10749 <listitem>
10750 <para>
10751 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10752 DNs as with DNs inside actual queries.
10753 </para>
10754 </listitem>
10755 <listitem>
10756 <para>
10757 It permits spaces inside USER= DNs.
10758 </para>
10759 </listitem>
10760 </itemizedlist>
10761 <para>
10762 For example, a setting such as
10763 </para>
10764 <literallayout class="monospaced">
10765 USER=cn=${quote_ldap_dn:$1}
10766 </literallayout>
10767 <para>
10768 should work even if <varname>$1</varname> contains spaces.
10769 </para>
10770 <para>
10771 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10772 expansion operator, rather than the LDAP quote operators. The only reason this
10773 field needs quoting is to ensure that it conforms to the Exim syntax, which
10774 does not allow unquoted spaces. For example:
10775 </para>
10776 <literallayout class="monospaced">
10777 PASS=${quote:$3}
10778 </literallayout>
10779 <para>
10780 The LDAP authentication mechanism can be used to check passwords as part of
10781 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10782 <xref linkend="CHAPexpand"/>.
10783 </para>
10784 </section>
10785 <section id="SECID71">
10786 <title>Format of data returned by LDAP</title>
10787 <para>
10788 <indexterm role="concept">
10789 <primary>LDAP</primary>
10790 <secondary>returned data formats</secondary>
10791 </indexterm>
10792 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10793 as a sequence of values, for example
10794 </para>
10795 <literallayout class="monospaced">
10796 cn=manager, o=University of Cambridge, c=UK
10797 </literallayout>
10798 <para>
10799 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10800 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10801 the result between the data from different entries. It is possible for multiple
10802 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10803 you know that whatever values are returned all came from a single entry in the
10804 directory.
10805 </para>
10806 <para>
10807 In the common case where you specify a single attribute in your LDAP query, the
10808 result is not quoted, and does not contain the attribute name. If the attribute
10809 has multiple values, they are separated by commas.
10810 </para>
10811 <para>
10812 If you specify multiple attributes, the result contains space-separated, quoted
10813 strings, each preceded by the attribute name and an equals sign. Within the
10814 quotes, the quote character, backslash, and newline are escaped with
10815 backslashes, and commas are used to separate multiple values for the attribute.
10816 Apart from the escaping, the string within quotes takes the same form as the
10817 output when a single attribute is requested. Specifying no attributes is the
10818 same as specifying all of an entry&#x2019;s attributes.
10819 </para>
10820 <para>
10821 Here are some examples of the output format. The first line of each pair is an
10822 LDAP query, and the second is the data that is returned. The attribute called
10823 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10824 </para>
10825 <literallayout class="monospaced">
10826 ldap:///o=base?attr1?sub?(uid=fred)
10827 value1.1, value1.2
10828
10829 ldap:///o=base?attr2?sub?(uid=fred)
10830 value two
10831
10832 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10833 attr1="value1.1, value1.2" attr2="value two"
10834
10835 ldap:///o=base??sub?(uid=fred)
10836 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10837 </literallayout>
10838 <para>
10839 The <option>extract</option> operator in string expansions can be used to pick out
10840 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10841 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10842 results of LDAP lookups.
10843 </para>
10844 </section>
10845 <section id="SECTnisplus">
10846 <title>More about NIS+</title>
10847 <para>
10848 <indexterm role="concept">
10849 <primary>NIS+ lookup type</primary>
10850 </indexterm>
10851 <indexterm role="concept">
10852 <primary>lookup</primary>
10853 <secondary>NIS+</secondary>
10854 </indexterm>
10855 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10856 and field name. If this is given, the result of a successful query is the
10857 contents of the named field; otherwise the result consists of a concatenation
10858 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10859 values containing spaces are quoted. For example, the query
10860 </para>
10861 <literallayout class="monospaced">
10862 [name=mg1456],passwd.org_dir
10863 </literallayout>
10864 <para>
10865 might return the string
10866 </para>
10867 <literallayout class="monospaced">
10868 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10869 home=/home/mg1456 shell=/bin/bash shadow=""
10870 </literallayout>
10871 <para>
10872 (split over two lines here to fit on the page), whereas
10873 </para>
10874 <literallayout class="monospaced">
10875 [name=mg1456],passwd.org_dir:gcos
10876 </literallayout>
10877 <para>
10878 would just return
10879 </para>
10880 <literallayout class="monospaced">
10881 Martin Guerre
10882 </literallayout>
10883 <para>
10884 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10885 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10886 operator is to double any quote characters within the text.
10887 </para>
10888 </section>
10889 <section id="SECTsql">
10890 <title>SQL lookups</title>
10891 <para>
10892 <indexterm role="concept">
10893 <primary>SQL lookup types</primary>
10894 </indexterm>
10895 <indexterm role="concept">
10896 <primary>MySQL</primary>
10897 <secondary>lookup type</secondary>
10898 </indexterm>
10899 <indexterm role="concept">
10900 <primary>PostgreSQL lookup type</primary>
10901 </indexterm>
10902 <indexterm role="concept">
10903 <primary>lookup</primary>
10904 <secondary>MySQL</secondary>
10905 </indexterm>
10906 <indexterm role="concept">
10907 <primary>lookup</primary>
10908 <secondary>PostgreSQL</secondary>
10909 </indexterm>
10910 <indexterm role="concept">
10911 <primary>Oracle</primary>
10912 <secondary>lookup type</secondary>
10913 </indexterm>
10914 <indexterm role="concept">
10915 <primary>lookup</primary>
10916 <secondary>Oracle</secondary>
10917 </indexterm>
10918 <indexterm role="concept">
10919 <primary>InterBase lookup type</primary>
10920 </indexterm>
10921 <indexterm role="concept">
10922 <primary>lookup</primary>
10923 <secondary>InterBase</secondary>
10924 </indexterm>
10925 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10926 databases. Queries for these databases contain SQL statements, so an example
10927 might be
10928 </para>
10929 <literallayout class="monospaced">
10930 ${lookup mysql{select mailbox from users where id='userx'}\
10931   {$value}fail}
10932 </literallayout>
10933 <para>
10934 If the result of the query contains more than one field, the data for each
10935 field in the row is returned, preceded by its name, so the result of
10936 </para>
10937 <literallayout class="monospaced">
10938 ${lookup pgsql{select home,name from users where id='userx'}\
10939   {$value}}
10940 </literallayout>
10941 <para>
10942 might be
10943 </para>
10944 <literallayout class="monospaced">
10945 home=/home/userx name="Mister X"
10946 </literallayout>
10947 <para>
10948 Empty values and values containing spaces are double quoted, with embedded
10949 quotes escaped by a backslash. If the result of the query contains just one
10950 field, the value is passed back verbatim, without a field name, for example:
10951 </para>
10952 <literallayout class="monospaced">
10953 Mister X
10954 </literallayout>
10955 <para>
10956 If the result of the query yields more than one row, it is all concatenated,
10957 with a newline between the data for each row.
10958 </para>
10959 </section>
10960 <section id="SECID72">
10961 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10962 <para>
10963 <indexterm role="concept">
10964 <primary>MySQL</primary>
10965 <secondary>lookup type</secondary>
10966 </indexterm>
10967 <indexterm role="concept">
10968 <primary>PostgreSQL lookup type</primary>
10969 </indexterm>
10970 <indexterm role="concept">
10971 <primary>lookup</primary>
10972 <secondary>MySQL</secondary>
10973 </indexterm>
10974 <indexterm role="concept">
10975 <primary>lookup</primary>
10976 <secondary>PostgreSQL</secondary>
10977 </indexterm>
10978 <indexterm role="concept">
10979 <primary>Oracle</primary>
10980 <secondary>lookup type</secondary>
10981 </indexterm>
10982 <indexterm role="concept">
10983 <primary>lookup</primary>
10984 <secondary>Oracle</secondary>
10985 </indexterm>
10986 <indexterm role="concept">
10987 <primary>InterBase lookup type</primary>
10988 </indexterm>
10989 <indexterm role="concept">
10990 <primary>lookup</primary>
10991 <secondary>InterBase</secondary>
10992 </indexterm>
10993 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10994 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10995 option (as appropriate) must be set to a colon-separated list of server
10996 information.
10997 (For MySQL and PostgreSQL only, the global option need not be set if all
10998 queries contain their own server information &ndash; see section
10999 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11000 items: host name, database name, user name, and password. In the case of
11001 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11002 name field is not used and should be empty. For example:
11003 </para>
11004 <literallayout class="monospaced">
11005 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11006 </literallayout>
11007 <para>
11008 Because password data is sensitive, you should always precede the setting with
11009 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11010 option. Here is an example where two MySQL servers are listed:
11011 </para>
11012 <literallayout class="monospaced">
11013 hide mysql_servers = localhost/users/root/secret:\
11014                      otherhost/users/root/othersecret
11015 </literallayout>
11016 <para>
11017 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11018 because this is a colon-separated list, the colon has to be doubled. For each
11019 query, these parameter groups are tried in order until a connection is made and
11020 a query is successfully processed. The result of a query may be that no data is
11021 found, but that is still a successful query. In other words, the list of
11022 servers provides a backup facility, not a list of different places to look.
11023 </para>
11024 <para>
11025 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11026 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11027 respectively, and the characters single-quote, double-quote, and backslash
11028 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11029 addition, escapes the percent and underscore characters. This cannot be done
11030 for MySQL because these escapes are not recognized in contexts where these
11031 characters are not special.
11032 </para>
11033 </section>
11034 <section id="SECTspeserque">
11035 <title>Specifying the server in the query</title>
11036 <para>
11037 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11038 it is possible to specify a list of servers with an individual query. This is
11039 done by starting the query with
11040 </para>
11041 <literallayout>
11042 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11043 </literallayout>
11044 <para>
11045 Each item in the list may take one of two forms:
11046 </para>
11047 <orderedlist numeration="arabic">
11048 <listitem>
11049 <para>
11050 If it contains no slashes it is assumed to be just a host name. The appropriate
11051 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11052 of the same name, and the remaining parameters (database, user, password) are
11053 taken from there.
11054 </para>
11055 </listitem>
11056 <listitem>
11057 <para>
11058 If it contains any slashes, it is taken as a complete parameter set.
11059 </para>
11060 </listitem>
11061 </orderedlist>
11062 <para>
11063 The list of servers is used in exactly the same way as the global list.
11064 Once a connection to a server has happened and a query has been
11065 successfully executed, processing of the lookup ceases.
11066 </para>
11067 <para>
11068 This feature is intended for use in master/slave situations where updates
11069 are occurring and you want to update the master rather than a slave. If the
11070 master is in the list as a backup for reading, you might have a global setting
11071 like this:
11072 </para>
11073 <literallayout class="monospaced">
11074 mysql_servers = slave1/db/name/pw:\
11075                 slave2/db/name/pw:\
11076                 master/db/name/pw
11077 </literallayout>
11078 <para>
11079 In an updating lookup, you could then write:
11080 </para>
11081 <literallayout class="monospaced">
11082 ${lookup mysql{servers=master; UPDATE ...} }
11083 </literallayout>
11084 <para>
11085 That query would then be sent only to the master server. If, on the other hand,
11086 the master is not to be used for reading, and so is not present in the global
11087 option, you can still update it by a query of this form:
11088 </para>
11089 <literallayout class="monospaced">
11090 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11091 </literallayout>
11092 </section>
11093 <section id="SECID73">
11094 <title>Special MySQL features</title>
11095 <para>
11096 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11097 causes a connection to the server on the local host by means of a Unix domain
11098 socket. An alternate socket can be specified in parentheses. The full syntax of
11099 each item in <option>mysql_servers</option> is:
11100 </para>
11101 <literallayout>
11102 &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;
11103 </literallayout>
11104 <para>
11105 Any of the three sub-parts of the first field can be omitted. For normal use on
11106 the local host it can be left blank or set to just <quote>localhost</quote>.
11107 </para>
11108 <para>
11109 No database need be supplied &ndash; but if it is absent here, it must be given in
11110 the queries.
11111 </para>
11112 <para>
11113 If a MySQL query is issued that does not request any data (an insert, update,
11114 or delete command), the result of the lookup is the number of rows affected.
11115 </para>
11116 <para>
11117 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11118 anything (for example, setting a field to the value it already has), the result
11119 is zero because no rows are affected.
11120 </para>
11121 </section>
11122 <section id="SECID74">
11123 <title>Special PostgreSQL features</title>
11124 <para>
11125 PostgreSQL lookups can also use Unix domain socket connections to the database.
11126 This is usually faster and costs less CPU time than a TCP/IP connection.
11127 However it can be used only if the mail server runs on the same machine as the
11128 database server. A configuration line for PostgreSQL via Unix domain sockets
11129 looks like this:
11130 </para>
11131 <literallayout class="monospaced">
11132 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11133 </literallayout>
11134 <para>
11135 In other words, instead of supplying a host name, a path to the socket is
11136 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11137 visually confused with the delimiters for the other server parameters.
11138 </para>
11139 <para>
11140 If a PostgreSQL query is issued that does not request any data (an insert,
11141 update, or delete command), the result of the lookup is the number of rows
11142 affected.
11143 </para>
11144 </section>
11145 <section id="SECTsqlite">
11146 <title>More about SQLite</title>
11147 <para>
11148 <indexterm role="concept">
11149 <primary>lookup</primary>
11150 <secondary>SQLite</secondary>
11151 </indexterm>
11152 <indexterm role="concept">
11153 <primary>sqlite lookup type</primary>
11154 </indexterm>
11155 SQLite is different to the other SQL lookups because a file name is required in
11156 addition to the SQL query. An SQLite database is a single file, and there is no
11157 daemon as in the other SQL databases. The interface to Exim requires the name
11158 of the file, as an absolute path, to be given at the start of the query. It is
11159 separated from the query by white space. This means that the path name cannot
11160 contain white space. Here is a lookup expansion example:
11161 </para>
11162 <literallayout class="monospaced">
11163 ${lookup sqlite {/some/thing/sqlitedb \
11164   select name from aliases where id='userx';}}
11165 </literallayout>
11166 <para>
11167 In a list, the syntax is similar. For example:
11168 </para>
11169 <literallayout class="monospaced">
11170 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
11171    select * from relays where ip='$sender_host_address';
11172 </literallayout>
11173 <para>
11174 The only character affected by the <option>quote_sqlite</option> operator is a single
11175 quote, which it doubles.
11176 </para>
11177 <para>
11178 The SQLite library handles multiple simultaneous accesses to the database
11179 internally. Multiple readers are permitted, but only one process can
11180 update at once. Attempts to access the database while it is being updated
11181 are rejected after a timeout period, during which the SQLite library
11182 waits for the lock to be released. In Exim, the default timeout is set
11183 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11184 option.
11185 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11186 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11187 </para>
11188 </section>
11189 </chapter>
11190
11191 <chapter id="CHAPdomhosaddlists">
11192 <title>Domain, host, address, and local part lists</title>
11193 <titleabbrev>Domain, host, and address lists</titleabbrev>
11194 <para>
11195 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11196 <primary>lists of domains; hosts; etc.</primary>
11197 </indexterm>
11198 A number of Exim configuration options contain lists of domains, hosts,
11199 email addresses, or local parts. For example, the <option>hold_domains</option> option
11200 contains a list of domains whose delivery is currently suspended. These lists
11201 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11202 arguments to expansion conditions such as <option>match_domain</option>.
11203 </para>
11204 <para>
11205 Each item in one of these lists is a pattern to be matched against a domain,
11206 host, email address, or local part, respectively. In the sections below, the
11207 different types of pattern for each case are described, but first we cover some
11208 general facilities that apply to all four kinds of list.
11209 </para>
11210 <section id="SECID75">
11211 <title>Expansion of lists</title>
11212 <para>
11213 <indexterm role="concept">
11214 <primary>expansion</primary>
11215 <secondary>of lists</secondary>
11216 </indexterm>
11217 Each list is expanded as a single string before it is used. The result of
11218 expansion must be a list, possibly containing empty items, which is split up
11219 into separate items for matching. By default, colon is the separator character,
11220 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11221 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11222 discusses the way to specify empty list items.
11223 </para>
11224 <para>
11225 If the string expansion is forced to fail, Exim behaves as if the item it is
11226 testing (domain, host, address, or local part) is not in the list. Other
11227 expansion failures cause temporary errors.
11228 </para>
11229 <para>
11230 If an item in a list is a regular expression, backslashes, dollars and possibly
11231 other special characters in the expression must be protected against
11232 misinterpretation by the string expander. The easiest way to do this is to use
11233 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11234 expression should not be expanded. For example, in an ACL you might have:
11235 </para>
11236 <literallayout class="monospaced">
11237 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11238                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11239 </literallayout>
11240 <para>
11241 The first item is a regular expression that is protected from expansion by
11242 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11243 senders based on the receiving domain.
11244 </para>
11245 </section>
11246 <section id="SECID76">
11247 <title>Negated items in lists</title>
11248 <para>
11249 <indexterm role="concept">
11250 <primary>list</primary>
11251 <secondary>negation</secondary>
11252 </indexterm>
11253 <indexterm role="concept">
11254 <primary>negation</primary>
11255 <secondary>in lists</secondary>
11256 </indexterm>
11257 Items in a list may be positive or negative. Negative items are indicated by a
11258 leading exclamation mark, which may be followed by optional white space. A list
11259 defines a set of items (domains, etc). When Exim processes one of these lists,
11260 it is trying to find out whether a domain, host, address, or local part
11261 (respectively) is in the set that is defined by the list. It works like this:
11262 </para>
11263 <para>
11264 The list is scanned from left to right. If a positive item is matched, the
11265 subject that is being checked is in the set; if a negative item is matched, the
11266 subject is not in the set. If the end of the list is reached without the
11267 subject having matched any of the patterns, it is in the set if the last item
11268 was a negative one, but not if it was a positive one. For example, the list in
11269 </para>
11270 <literallayout class="monospaced">
11271 domainlist relay_domains = !a.b.c : *.b.c
11272 </literallayout>
11273 <para>
11274 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11275 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11276 list is positive. However, if the setting were
11277 </para>
11278 <literallayout class="monospaced">
11279 domainlist relay_domains = !a.b.c
11280 </literallayout>
11281 <para>
11282 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11283 list is negative. In other words, a list that ends with a negative item behaves
11284 as if it had an extra item <literal>:*</literal> on the end.
11285 </para>
11286 <para>
11287 Another way of thinking about positive and negative items in lists is to read
11288 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11289 item.
11290 </para>
11291 </section>
11292 <section id="SECTfilnamlis">
11293 <title>File names in lists</title>
11294 <para>
11295 <indexterm role="concept">
11296 <primary>list</primary>
11297 <secondary>file name in</secondary>
11298 </indexterm>
11299 If an item in a domain, host, address, or local part list is an absolute file
11300 name (beginning with a slash character), each line of the file is read and
11301 processed as if it were an independent item in the list, except that further
11302 file names are not allowed,
11303 and no expansion of the data from the file takes place.
11304 Empty lines in the file are ignored, and the file may also contain comment
11305 lines:
11306 </para>
11307 <itemizedlist>
11308 <listitem>
11309 <para>
11310 For domain and host lists, if a # character appears anywhere in a line of the
11311 file, it and all following characters are ignored.
11312 </para>
11313 </listitem>
11314 <listitem>
11315 <para>
11316 Because local parts may legitimately contain # characters, a comment in an
11317 address list or local part list file is recognized only if # is preceded by
11318 white space or the start of the line. For example:
11319 </para>
11320 <literallayout class="monospaced">
11321 not#comment@x.y.z   # but this is a comment
11322 </literallayout>
11323 </listitem>
11324 </itemizedlist>
11325 <para>
11326 Putting a file name in a list has the same effect as inserting each line of the
11327 file as an item in the list (blank lines and comments excepted). However, there
11328 is one important difference: the file is read each time the list is processed,
11329 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11330 </para>
11331 <para>
11332 If a file name is preceded by an exclamation mark, the sense of any match
11333 within the file is inverted. For example, if
11334 </para>
11335 <literallayout class="monospaced">
11336 hold_domains = !/etc/nohold-domains
11337 </literallayout>
11338 <para>
11339 and the file contains the lines
11340 </para>
11341 <literallayout class="monospaced">
11342 !a.b.c
11343 *.b.c
11344 </literallayout>
11345 <para>
11346 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11347 any domain matching <literal>*.b.c</literal> is not.
11348 </para>
11349 </section>
11350 <section id="SECID77">
11351 <title>An lsearch file is not an out-of-line list</title>
11352 <para>
11353 As will be described in the sections that follow, lookups can be used in lists
11354 to provide indexed methods of checking list membership. There has been some
11355 confusion about the way <command>lsearch</command> lookups work in lists. Because
11356 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11357 sometimes thought that it is allowed to contain wild cards and other kinds of
11358 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11359 always fixed strings, just as for any other single-key lookup type.
11360 </para>
11361 <para>
11362 If you want to use a file to contain wild-card patterns that form part of a
11363 list, just give the file name on its own, without a search type, as described
11364 in the previous section. You could also use the <command>wildlsearch</command> or
11365 <command>nwildlsearch</command>, but there is no advantage in doing this.
11366 </para>
11367 </section>
11368 <section id="SECTnamedlists">
11369 <title>Named lists</title>
11370 <para>
11371 <indexterm role="concept">
11372 <primary>named lists</primary>
11373 </indexterm>
11374 <indexterm role="concept">
11375 <primary>list</primary>
11376 <secondary>named</secondary>
11377 </indexterm>
11378 A list of domains, hosts, email addresses, or local parts can be given a name
11379 which is then used to refer to the list elsewhere in the configuration. This is
11380 particularly convenient if the same list is required in several different
11381 places. It also allows lists to be given meaningful names, which can improve
11382 the readability of the configuration. For example, it is conventional to define
11383 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11384 locally on a host, using a configuration line such as
11385 </para>
11386 <literallayout class="monospaced">
11387 domainlist local_domains = localhost:my.dom.example
11388 </literallayout>
11389 <para>
11390 Named lists are referenced by giving their name preceded by a plus sign, so,
11391 for example, a router that is intended to handle local domains would be
11392 configured with the line
11393 </para>
11394 <literallayout class="monospaced">
11395 domains = +local_domains
11396 </literallayout>
11397 <para>
11398 The first router in a configuration is often one that handles all domains
11399 except the local ones, using a configuration with a negated item like this:
11400 </para>
11401 <literallayout class="monospaced">
11402 dnslookup:
11403   driver = dnslookup
11404   domains = ! +local_domains
11405   transport = remote_smtp
11406   no_more
11407 </literallayout>
11408 <para>
11409 The four kinds of named list are created by configuration lines starting with
11410 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11411 respectively. Then there follows the name that you are defining, followed by an
11412 equals sign and the list itself. For example:
11413 </para>
11414 <literallayout class="monospaced">
11415 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11416 addresslist bad_senders = cdb;/etc/badsenders
11417 </literallayout>
11418 <para>
11419 A named list may refer to other named lists:
11420 </para>
11421 <literallayout class="monospaced">
11422 domainlist  dom1 = first.example : second.example
11423 domainlist  dom2 = +dom1 : third.example
11424 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11425 </literallayout>
11426 <para>
11427 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11428 effect may not be what you intended, because the negation does not propagate
11429 out to the higher level. For example, consider:
11430 </para>
11431 <literallayout class="monospaced">
11432 domainlist  dom1 = !a.b
11433 domainlist  dom2 = +dom1 : *.b
11434 </literallayout>
11435 <para>
11436 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11437 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11438 means it matches the second list as well. The effect is not the same as
11439 </para>
11440 <literallayout class="monospaced">
11441 domainlist  dom2 = !a.b : *.b
11442 </literallayout>
11443 <para>
11444 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11445 referenced lists if you can.
11446 </para>
11447 <para>
11448 Named lists may have a performance advantage. When Exim is routing an
11449 address or checking an incoming message, it caches the result of tests on named
11450 lists. So, if you have a setting such as
11451 </para>
11452 <literallayout class="monospaced">
11453 domains = +local_domains
11454 </literallayout>
11455 <para>
11456 on several of your routers
11457 or in several ACL statements,
11458 the actual test is done only for the first one. However, the caching works only
11459 if there are no expansions within the list itself or any sublists that it
11460 references. In other words, caching happens only for lists that are known to be
11461 the same each time they are referenced.
11462 </para>
11463 <para>
11464 By default, there may be up to 16 named lists of each type. This limit can be
11465 extended by changing a compile-time variable. The use of domain and host lists
11466 is recommended for concepts such as local domains, relay domains, and relay
11467 hosts. The default configuration is set up like this.
11468 </para>
11469 </section>
11470 <section id="SECID78">
11471 <title>Named lists compared with macros</title>
11472 <para>
11473 <indexterm role="concept">
11474 <primary>list</primary>
11475 <secondary>named compared with macro</secondary>
11476 </indexterm>
11477 <indexterm role="concept">
11478 <primary>macro</primary>
11479 <secondary>compared with named list</secondary>
11480 </indexterm>
11481 At first sight, named lists might seem to be no different from macros in the
11482 configuration file. However, macros are just textual substitutions. If you
11483 write
11484 </para>
11485 <literallayout class="monospaced">
11486 ALIST = host1 : host2
11487 auth_advertise_hosts = !ALIST
11488 </literallayout>
11489 <para>
11490 it probably won&#x2019;t do what you want, because that is exactly the same as
11491 </para>
11492 <literallayout class="monospaced">
11493 auth_advertise_hosts = !host1 : host2
11494 </literallayout>
11495 <para>
11496 Notice that the second host name is not negated. However, if you use a host
11497 list, and write
11498 </para>
11499 <literallayout class="monospaced">
11500 hostlist alist = host1 : host2
11501 auth_advertise_hosts = ! +alist
11502 </literallayout>
11503 <para>
11504 the negation applies to the whole list, and so that is equivalent to
11505 </para>
11506 <literallayout class="monospaced">
11507 auth_advertise_hosts = !host1 : !host2
11508 </literallayout>
11509 </section>
11510 <section id="SECID79">
11511 <title>Named list caching</title>
11512 <para>
11513 <indexterm role="concept">
11514 <primary>list</primary>
11515 <secondary>caching of named</secondary>
11516 </indexterm>
11517 <indexterm role="concept">
11518 <primary>caching</primary>
11519 <secondary>named lists</secondary>
11520 </indexterm>
11521 While processing a message, Exim caches the result of checking a named list if
11522 it is sure that the list is the same each time. In practice, this means that
11523 the cache operates only if the list contains no $ characters, which guarantees
11524 that it will not change when it is expanded. Sometimes, however, you may have
11525 an expanded list that you know will be the same each time within a given
11526 message. For example:
11527 </para>
11528 <literallayout class="monospaced">
11529 domainlist special_domains = \
11530            ${lookup{$sender_host_address}cdb{/some/file}}
11531 </literallayout>
11532 <para>
11533 This provides a list of domains that depends only on the sending host&#x2019;s IP
11534 address. If this domain list is referenced a number of times (for example,
11535 in several ACL lines, or in several routers) the result of the check is not
11536 cached by default, because Exim does not know that it is going to be the
11537 same list each time.
11538 </para>
11539 <para>
11540 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11541 cache the result anyway. For example:
11542 </para>
11543 <literallayout class="monospaced">
11544 domainlist_cache special_domains = ${lookup{...
11545 </literallayout>
11546 <para>
11547 If you do this, you should be absolutely sure that caching is going to do
11548 the right thing in all cases. When in doubt, leave it out.
11549 </para>
11550 </section>
11551 <section id="SECTdomainlist">
11552 <title>Domain lists</title>
11553 <para>
11554 <indexterm role="concept">
11555 <primary>domain list</primary>
11556 <secondary>patterns for</secondary>
11557 </indexterm>
11558 <indexterm role="concept">
11559 <primary>list</primary>
11560 <secondary>domain list</secondary>
11561 </indexterm>
11562 Domain lists contain patterns that are to be matched against a mail domain.
11563 The following types of item may appear in domain lists:
11564 </para>
11565 <itemizedlist>
11566 <listitem>
11567 <para>
11568 <indexterm role="concept">
11569 <primary>primary host name</primary>
11570 </indexterm>
11571 <indexterm role="concept">
11572 <primary>host name</primary>
11573 <secondary>matched in domain list</secondary>
11574 </indexterm>
11575 <indexterm role="option">
11576 <primary><option>primary_hostname</option></primary>
11577 </indexterm>
11578 <indexterm role="concept">
11579 <primary>domain list</primary>
11580 <secondary>matching primary host name</secondary>
11581 </indexterm>
11582 <indexterm role="concept">
11583 <primary>@ in a domain list</primary>
11584 </indexterm>
11585 If a pattern consists of a single @ character, it matches the local host name,
11586 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11587 possible to use the same configuration file on several different hosts that
11588 differ only in their names.
11589 </para>
11590 </listitem>
11591 <listitem>
11592 <para>
11593 <indexterm role="concept">
11594 <primary>@[] in a domain list</primary>
11595 </indexterm>
11596 <indexterm role="concept">
11597 <primary>domain list</primary>
11598 <secondary>matching local IP interfaces</secondary>
11599 </indexterm>
11600 <indexterm role="concept">
11601 <primary>domain literal</primary>
11602 </indexterm>
11603 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11604 in square brackets (as in an email address that contains a domain literal), but
11605 only if that IP address is recognized as local for email routing purposes. The
11606 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11607 control which of a host&#x2019;s several IP addresses are treated as local.
11608 In today&#x2019;s Internet, the use of domain literals is controversial.
11609 </para>
11610 </listitem>
11611 <listitem>
11612 <para>
11613 <indexterm role="concept">
11614 <primary>@mx_any</primary>
11615 </indexterm>
11616 <indexterm role="concept">
11617 <primary>@mx_primary</primary>
11618 </indexterm>
11619 <indexterm role="concept">
11620 <primary>@mx_secondary</primary>
11621 </indexterm>
11622 <indexterm role="concept">
11623 <primary>domain list</primary>
11624 <secondary>matching MX pointers to local host</secondary>
11625 </indexterm>
11626 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11627 has an MX record pointing to the local host or to any host that is listed in
11628 <indexterm role="option">
11629 <primary><option>hosts_treat_as_local</option></primary>
11630 </indexterm>
11631 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11632 are similar, except that the first matches only when a primary MX target is the
11633 local host, and the second only when no primary MX target is the local host,
11634 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11635 preference value &ndash; there may of course be more than one of them.
11636 </para>
11637 <para>
11638 The MX lookup that takes place when matching a pattern of this type is
11639 performed with the resolver options for widening names turned off. Thus, for
11640 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11641 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11642 options of the <command>dnslookup</command> router for a discussion of domain widening.
11643 </para>
11644 <para>
11645 Sometimes you may want to ignore certain IP addresses when using one of these
11646 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11647 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11648 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11649 on a router). For example:
11650 </para>
11651 <literallayout class="monospaced">
11652 domains = @mx_any/ignore=127.0.0.1
11653 </literallayout>
11654 <para>
11655 This example matches any domain that has an MX record pointing to one of
11656 the local host&#x2019;s IP addresses other than 127.0.0.1.
11657 </para>
11658 <para>
11659 The list of IP addresses is in fact processed by the same code that processes
11660 host lists, so it may contain CIDR-coded network specifications and it may also
11661 contain negative items.
11662 </para>
11663 <para>
11664 Because the list of IP addresses is a sublist within a domain list, you have to
11665 be careful about delimiters if there is more than one address. Like any other
11666 list, the default delimiter can be changed. Thus, you might have:
11667 </para>
11668 <literallayout class="monospaced">
11669 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11670           an.other.domain : ...
11671 </literallayout>
11672 <para>
11673 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11674 involved, it is easiest to change the delimiter for the main list as well:
11675 </para>
11676 <literallayout class="monospaced">
11677 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11678           an.other.domain ? ...
11679 </literallayout>
11680 </listitem>
11681 <listitem>
11682 <para>
11683 <indexterm role="concept">
11684 <primary>asterisk</primary>
11685 <secondary>in domain list</secondary>
11686 </indexterm>
11687 <indexterm role="concept">
11688 <primary>domain list</primary>
11689 <secondary>asterisk in</secondary>
11690 </indexterm>
11691 <indexterm role="concept">
11692 <primary>domain list</primary>
11693 <secondary>matching <quote>ends with</quote></secondary>
11694 </indexterm>
11695 If a pattern starts with an asterisk, the remaining characters of the pattern
11696 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11697 domain lists differs from its use in partial matching lookups. In a domain
11698 list, the character following the asterisk need not be a dot, whereas partial
11699 matching works only in terms of dot-separated components. For example, a domain
11700 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11701 <emphasis>cipher.key.ex</emphasis>.
11702 </para>
11703 </listitem>
11704 <listitem>
11705 <para>
11706 <indexterm role="concept">
11707 <primary>regular expressions</primary>
11708 <secondary>in domain list</secondary>
11709 </indexterm>
11710 <indexterm role="concept">
11711 <primary>domain list</primary>
11712 <secondary>matching regular expression</secondary>
11713 </indexterm>
11714 If a pattern starts with a circumflex character, it is treated as a regular
11715 expression, and matched against the domain using a regular expression matching
11716 function. The circumflex is treated as part of the regular expression.
11717 Email domains are case-independent, so this regular expression match is by
11718 default case-independent, but you can make it case-dependent by starting it
11719 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11720 are given in chapter <xref linkend="CHAPregexp"/>.
11721 </para>
11722 <para>
11723 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11724 must escape any backslash and dollar characters in the regular expression, or
11725 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11726 it is not to be expanded (unless you really do want to build a regular
11727 expression by expansion, of course).
11728 </para>
11729 </listitem>
11730 <listitem>
11731 <para>
11732 <indexterm role="concept">
11733 <primary>lookup</primary>
11734 <secondary>in domain list</secondary>
11735 </indexterm>
11736 <indexterm role="concept">
11737 <primary>domain list</primary>
11738 <secondary>matching by lookup</secondary>
11739 </indexterm>
11740 If a pattern starts with the name of a single-key lookup type followed by a
11741 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11742 must be a file name in a suitable format for the lookup type. For example, for
11743 <quote>cdb;</quote> it must be an absolute path:
11744 </para>
11745 <literallayout class="monospaced">
11746 domains = cdb;/etc/mail/local_domains.cdb
11747 </literallayout>
11748 <para>
11749 The appropriate type of lookup is done on the file using the domain name as the
11750 key. In most cases, the data that is looked up is not used; Exim is interested
11751 only in whether or not the key is present in the file. However, when a lookup
11752 is used for the <option>domains</option> option on a router
11753 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11754 <varname>$domain_data</varname> variable and can be referred to in other router options or
11755 other statements in the same ACL.
11756 </para>
11757 </listitem>
11758 <listitem>
11759 <para>
11760 Any of the single-key lookup type names may be preceded by
11761 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11762 </para>
11763 <literallayout class="monospaced">
11764 domains = partial-dbm;/partial/domains
11765 </literallayout>
11766 <para>
11767 This causes partial matching logic to be invoked; a description of how this
11768 works is given in section <xref linkend="SECTpartiallookup"/>.
11769 </para>
11770 </listitem>
11771 <listitem>
11772 <para>
11773 <indexterm role="concept">
11774 <primary>asterisk</primary>
11775 <secondary>in lookup type</secondary>
11776 </indexterm>
11777 Any of the single-key lookup types may be followed by an asterisk. This causes
11778 a default lookup for a key consisting of a single asterisk to be done if the
11779 original lookup fails. This is not a useful feature when using a domain list to
11780 select particular domains (because any domain would match), but it might have
11781 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11782 expansion variable.
11783 </para>
11784 </listitem>
11785 <listitem>
11786 <para>
11787 If the pattern starts with the name of a query-style lookup type followed by a
11788 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11789 pattern must be an appropriate query for the lookup type, as described in
11790 chapter <xref linkend="CHAPfdlookup"/>. For example:
11791 </para>
11792 <literallayout class="monospaced">
11793 hold_domains = mysql;select domain from holdlist \
11794   where domain = '${quote_mysql:$domain}';
11795 </literallayout>
11796 <para>
11797 In most cases, the data that is looked up is not used (so for an SQL query, for
11798 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11799 whether or not the query succeeds. However, when a lookup is used for the
11800 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11801 variable and can be referred to in other options.
11802 </para>
11803 </listitem>
11804 <listitem>
11805 <para>
11806 <indexterm role="concept">
11807 <primary>domain list</primary>
11808 <secondary>matching literal domain name</secondary>
11809 </indexterm>
11810 If none of the above cases apply, a caseless textual comparison is made
11811 between the pattern and the domain.
11812 </para>
11813 </listitem>
11814 </itemizedlist>
11815 <para>
11816 Here is an example that uses several different kinds of pattern:
11817 </para>
11818 <literallayout class="monospaced">
11819 domainlist funny_domains = \
11820   @ : \
11821   lib.unseen.edu : \
11822   *.foundation.fict.example : \
11823   \N^[1-2]\d{3}\.fict\.example$\N : \
11824   partial-dbm;/opt/data/penguin/book : \
11825   nis;domains.byname : \
11826   nisplus;[name=$domain,status=local],domains.org_dir
11827 </literallayout>
11828 <para>
11829 There are obvious processing trade-offs among the various matching modes. Using
11830 an asterisk is faster than a regular expression, and listing a few names
11831 explicitly probably is too. The use of a file or database lookup is expensive,
11832 but may be the only option if hundreds of names are required. Because the
11833 patterns are tested in order, it makes sense to put the most commonly matched
11834 patterns earlier.
11835 </para>
11836 </section>
11837 <section id="SECThostlist">
11838 <title>Host lists</title>
11839 <para>
11840 <indexterm role="concept">
11841 <primary>host list</primary>
11842 <secondary>patterns in</secondary>
11843 </indexterm>
11844 <indexterm role="concept">
11845 <primary>list</primary>
11846 <secondary>host list</secondary>
11847 </indexterm>
11848 Host lists are used to control what remote hosts are allowed to do. For
11849 example, some hosts may be allowed to use the local host as a relay, and some
11850 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11851 two different ways, by name or by IP address. In a host list, some types of
11852 pattern are matched to a host name, and some are matched to an IP address.
11853 You need to be particularly careful with this when single-key lookups are
11854 involved, to ensure that the right value is being used as the key.
11855 </para>
11856 </section>
11857 <section id="SECID80">
11858 <title>Special host list patterns</title>
11859 <para>
11860 <indexterm role="concept">
11861 <primary>empty item in hosts list</primary>
11862 </indexterm>
11863 <indexterm role="concept">
11864 <primary>host list</primary>
11865 <secondary>empty string in</secondary>
11866 </indexterm>
11867 If a host list item is the empty string, it matches only when no remote host is
11868 involved. This is the case when a message is being received from a local
11869 process using SMTP on the standard input, that is, when a TCP/IP connection is
11870 not used.
11871 </para>
11872 <para>
11873 <indexterm role="concept">
11874 <primary>asterisk</primary>
11875 <secondary>in host list</secondary>
11876 </indexterm>
11877 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11878 the IP address nor the name is actually inspected.
11879 </para>
11880 </section>
11881 <section id="SECThoslispatip">
11882 <title>Host list patterns that match by IP address</title>
11883 <para>
11884 <indexterm role="concept">
11885 <primary>host list</primary>
11886 <secondary>matching IP addresses</secondary>
11887 </indexterm>
11888 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11889 the incoming address actually appears in the IPv6 host as
11890 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11891 list, it is converted into a traditional IPv4 address first. (Not all operating
11892 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11893 concerns.)
11894 </para>
11895 <para>
11896 The following types of pattern in a host list check the remote host by
11897 inspecting its IP address:
11898 </para>
11899 <itemizedlist>
11900 <listitem>
11901 <para>
11902 If the pattern is a plain domain name (not a regular expression, not starting
11903 with *, not a lookup of any kind), Exim calls the operating system function
11904 to find the associated IP address(es). Exim uses the newer
11905 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11906 This typically causes a forward DNS lookup of the name. The result is compared
11907 with the IP address of the subject host.
11908 </para>
11909 <para>
11910 If there is a temporary problem (such as a DNS timeout) with the host name
11911 lookup, a temporary error occurs. For example, if the list is being used in an
11912 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11913 temporary SMTP error code. If no IP address can be found for the host name,
11914 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11915 </para>
11916 </listitem>
11917 <listitem>
11918 <para>
11919 <indexterm role="concept">
11920 <primary>@ in a host list</primary>
11921 </indexterm>
11922 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11923 domain name, as just described.
11924 </para>
11925 </listitem>
11926 <listitem>
11927 <para>
11928 If the pattern is an IP address, it is matched against the IP address of the
11929 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11930 IPv6 addresses can be given in colon-separated format, but the colons have to
11931 be doubled so as not to be taken as item separators when the default list
11932 separator is used. IPv6 addresses are recognized even when Exim is compiled
11933 without IPv6 support. This means that if they appear in a host list on an
11934 IPv4-only host, Exim will not treat them as host names. They are just addresses
11935 that can never match a client host.
11936 </para>
11937 </listitem>
11938 <listitem>
11939 <para>
11940 <indexterm role="concept">
11941 <primary>@[] in a host list</primary>
11942 </indexterm>
11943 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11944 the local host. For example, if the local host is an IPv4 host with one
11945 interface address 10.45.23.56, these two ACL statements have the same effect:
11946 </para>
11947 <literallayout class="monospaced">
11948 accept hosts = 127.0.0.1 : 10.45.23.56
11949 accept hosts = @[]
11950 </literallayout>
11951 </listitem>
11952 <listitem>
11953 <para>
11954 <indexterm role="concept">
11955 <primary>CIDR notation</primary>
11956 </indexterm>
11957 If the pattern is an IP address followed by a slash and a mask length (for
11958 example 10.11.42.0/24), it is matched against the IP address of the subject
11959 host under the given mask. This allows, an entire network of hosts to be
11960 included (or excluded) by a single item. The mask uses CIDR notation; it
11961 specifies the number of address bits that must match, starting from the most
11962 significant end of the address.
11963 </para>
11964 <para>
11965 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11966 of a range of addresses. It is the number of bits in the network portion of the
11967 address. The above example specifies a 24-bit netmask, so it matches all 256
11968 addresses in the 10.11.42.0 network. An item such as
11969 </para>
11970 <literallayout class="monospaced">
11971 192.168.23.236/31
11972 </literallayout>
11973 <para>
11974 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11975 32 for an IPv4 address is the same as no mask at all; just a single address
11976 matches.
11977 </para>
11978 <para>
11979 Here is another example which shows an IPv4 and an IPv6 network:
11980 </para>
11981 <literallayout class="monospaced">
11982 recipient_unqualified_hosts = 192.168.0.0/16: \
11983                               3ffe::ffff::836f::::/48
11984 </literallayout>
11985 <para>
11986 The doubling of list separator characters applies only when these items
11987 appear inline in a host list. It is not required when indirecting via a file.
11988 For example:
11989 </para>
11990 <literallayout class="monospaced">
11991 recipient_unqualified_hosts = /opt/exim/unqualnets
11992 </literallayout>
11993 <para>
11994 could make use of a file containing
11995 </para>
11996 <literallayout class="monospaced">
11997 172.16.0.0/12
11998 3ffe:ffff:836f::/48
11999 </literallayout>
12000 <para>
12001 to have exactly the same effect as the previous example. When listing IPv6
12002 addresses inline, it is usually more convenient to use the facility for
12003 changing separator characters. This list contains the same two networks:
12004 </para>
12005 <literallayout class="monospaced">
12006 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12007                                  3ffe:ffff:836f::/48
12008 </literallayout>
12009 <para>
12010 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12011 list.
12012 </para>
12013 </listitem>
12014 </itemizedlist>
12015 </section>
12016 <section id="SECThoslispatsikey">
12017 <title>Host list patterns for single-key lookups by host address</title>
12018 <para>
12019 <indexterm role="concept">
12020 <primary>host list</primary>
12021 <secondary>lookup of IP address</secondary>
12022 </indexterm>
12023 When a host is to be identified by a single-key lookup of its complete IP
12024 address, the pattern takes this form:
12025 </para>
12026 <literallayout>
12027 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12028 </literallayout>
12029 <para>
12030 For example:
12031 </para>
12032 <literallayout class="monospaced">
12033 hosts_lookup = net-cdb;/hosts-by-ip.db
12034 </literallayout>
12035 <para>
12036 The text form of the IP address of the subject host is used as the lookup key.
12037 IPv6 addresses are converted to an unabbreviated form, using lower case
12038 letters, with dots as separators because colon is the key terminator in
12039 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12040 quoting the keys, but this is a facility that was added later.] The data
12041 returned by the lookup is not used.
12042 </para>
12043 <para>
12044 <indexterm role="concept">
12045 <primary>IP address</primary>
12046 <secondary>masking</secondary>
12047 </indexterm>
12048 <indexterm role="concept">
12049 <primary>host list</primary>
12050 <secondary>masked IP address</secondary>
12051 </indexterm>
12052 Single-key lookups can also be performed using masked IP addresses, using
12053 patterns of this form:
12054 </para>
12055 <literallayout>
12056 <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>
12057 </literallayout>
12058 <para>
12059 For example:
12060 </para>
12061 <literallayout class="monospaced">
12062 net24-dbm;/networks.db
12063 </literallayout>
12064 <para>
12065 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12066 length. A textual string is constructed from the masked value, followed by the
12067 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12068 is 192.168.34.6, the key that is looked up for the above example is
12069 <quote>192.168.34.0/24</quote>.
12070 </para>
12071 <para>
12072 When an IPv6 address is converted to a string, dots are normally used instead
12073 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12074 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12075 to quote keys was made available in <command>lsearch</command> files. However, the more
12076 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12077 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12078 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12079 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12080 addresses are always used.
12081 </para>
12082 <para>
12083 Ideally, it would be nice to tidy up this anomalous situation by changing to
12084 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12085 However, this would be an incompatible change that might break some existing
12086 configurations.
12087 </para>
12088 <para>
12089 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12090 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12091 the former case the key strings include the mask value, whereas in the latter
12092 case the IP address is used on its own.
12093 </para>
12094 </section>
12095 <section id="SECThoslispatnam">
12096 <title>Host list patterns that match by host name</title>
12097 <para>
12098 <indexterm role="concept">
12099 <primary>host</primary>
12100 <secondary>lookup failures</secondary>
12101 </indexterm>
12102 <indexterm role="concept">
12103 <primary>unknown host name</primary>
12104 </indexterm>
12105 <indexterm role="concept">
12106 <primary>host list</primary>
12107 <secondary>matching host name</secondary>
12108 </indexterm>
12109 There are several types of pattern that require Exim to know the name of the
12110 remote host. These are either wildcard patterns or lookups by name. (If a
12111 complete hostname is given without any wildcarding, it is used to find an IP
12112 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
12113 above.)
12114 </para>
12115 <para>
12116 If the remote host name is not already known when Exim encounters one of these
12117 patterns, it has to be found from the IP address.
12118 Although many sites on the Internet are conscientious about maintaining reverse
12119 DNS data for their hosts, there are also many that do not do this.
12120 Consequently, a name cannot always be found, and this may lead to unwanted
12121 effects. Take care when configuring host lists with wildcarded name patterns.
12122 Consider what will happen if a name cannot be found.
12123 </para>
12124 <para>
12125 Because of the problems of determining host names from IP addresses, matching
12126 against host names is not as common as matching against IP addresses.
12127 </para>
12128 <para>
12129 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12130 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12131 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12132 are done can be changed by setting the <option>host_lookup_order</option> option. For
12133 security, once Exim has found one or more names, it looks up the IP addresses
12134 for these names and compares them with the IP address that it started with.
12135 Only those names whose IP addresses match are accepted. Any other names are
12136 discarded. If no names are left, Exim behaves as if the host name cannot be
12137 found. In the most common case there is only one name and one IP address.
12138 </para>
12139 <para>
12140 There are some options that control what happens if a host name cannot be
12141 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12142 </para>
12143 <para>
12144 <indexterm role="concept">
12145 <primary>host</primary>
12146 <secondary>alias for</secondary>
12147 </indexterm>
12148 <indexterm role="concept">
12149 <primary>alias for host</primary>
12150 </indexterm>
12151 As a result of aliasing, hosts may have more than one name. When processing any
12152 of the following types of pattern, all the host&#x2019;s names are checked:
12153 </para>
12154 <itemizedlist>
12155 <listitem>
12156 <para>
12157 <indexterm role="concept">
12158 <primary>asterisk</primary>
12159 <secondary>in host list</secondary>
12160 </indexterm>
12161 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12162 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12163 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12164 requirement. Other kinds of wildcarding require the use of a regular
12165 expression.
12166 </para>
12167 </listitem>
12168 <listitem>
12169 <para>
12170 <indexterm role="concept">
12171 <primary>regular expressions</primary>
12172 <secondary>in host list</secondary>
12173 </indexterm>
12174 <indexterm role="concept">
12175 <primary>host list</primary>
12176 <secondary>regular expression in</secondary>
12177 </indexterm>
12178 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12179 matched against the host name. Host names are case-independent, so this regular
12180 expression match is by default case-independent, but you can make it
12181 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12182 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12183 example,
12184 </para>
12185 <literallayout class="monospaced">
12186 ^(a|b)\.c\.d$
12187 </literallayout>
12188 <para>
12189 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12190 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12191 that backslash and dollar characters are not misinterpreted as part of the
12192 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12193 part of the string as non-expandable. For example:
12194 </para>
12195 <literallayout class="monospaced">
12196 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12197 </literallayout>
12198 <para>
12199 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12200 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12201 example. Without it, a match at the start of the host name is all that is
12202 required.
12203 </para>
12204 </listitem>
12205 </itemizedlist>
12206 </section>
12207 <section id="SECTbehipnot">
12208 <title>Behaviour when an IP address or name cannot be found</title>
12209 <para>
12210 <indexterm role="concept">
12211 <primary>host</primary>
12212 <secondary>lookup failures, permanent</secondary>
12213 </indexterm>
12214 While processing a host list, Exim may need to look up an IP address from a
12215 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12216 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12217 behaviour when it fails to find the information it is seeking is the same.
12218 </para>
12219 <para>
12220 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12221 apply to temporary DNS errors, whose handling is described in the next section.
12222 </para>
12223 <para>
12224 <indexterm role="concept">
12225 <primary><literal>+include_unknown</literal></primary>
12226 </indexterm>
12227 <indexterm role="concept">
12228 <primary><literal>+ignore_unknown</literal></primary>
12229 </indexterm>
12230 By default, Exim behaves as if the host does not match the list. This may not
12231 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
12232 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
12233 top level &ndash; they are not recognized in an indirected file).
12234 </para>
12235 <itemizedlist>
12236 <listitem>
12237 <para>
12238 If any item that follows <literal>+include_unknown</literal> requires information that
12239 cannot found, Exim behaves as if the host does match the list. For example,
12240 </para>
12241 <literallayout class="monospaced">
12242 host_reject_connection = +include_unknown:*.enemy.ex
12243 </literallayout>
12244 <para>
12245 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12246 any hosts whose name it cannot find.
12247 </para>
12248 </listitem>
12249 <listitem>
12250 <para>
12251 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12252 be found, Exim ignores that item and proceeds to the rest of the list. For
12253 example:
12254 </para>
12255 <literallayout class="monospaced">
12256 accept hosts = +ignore_unknown : friend.example : \
12257                192.168.4.5
12258 </literallayout>
12259 <para>
12260 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12261 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12262 name can be found for 192.168.4.5, it is rejected.
12263 </para>
12264 </listitem>
12265 </itemizedlist>
12266 <para>
12267 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12268 list. The effect of each one lasts until the next, or until the end of the
12269 list.
12270 </para>
12271 </section>
12272 <section id="SECTtemdnserr">
12273 <title>Temporary DNS errors when looking up host information</title>
12274 <para>
12275 <indexterm role="concept">
12276 <primary>host</primary>
12277 <secondary>lookup failures, temporary</secondary>
12278 </indexterm>
12279 <indexterm role="concept">
12280 <primary><literal>+include_defer</literal></primary>
12281 </indexterm>
12282 <indexterm role="concept">
12283 <primary><literal>+ignore_defer</literal></primary>
12284 </indexterm>
12285 A temporary DNS lookup failure normally causes a defer action (except when
12286 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12287 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12288 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12289 section. These options should be used with care, probably only in non-critical
12290 host lists such as whitelists.
12291 </para>
12292 </section>
12293 <section id="SECThoslispatnamsk">
12294 <title>Host list patterns for single-key lookups by host name</title>
12295 <para>
12296 <indexterm role="concept">
12297 <primary>unknown host name</primary>
12298 </indexterm>
12299 <indexterm role="concept">
12300 <primary>host list</primary>
12301 <secondary>matching host name</secondary>
12302 </indexterm>
12303 If a pattern is of the form
12304 </para>
12305 <literallayout>
12306 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12307 </literallayout>
12308 <para>
12309 for example
12310 </para>
12311 <literallayout class="monospaced">
12312 dbm;/host/accept/list
12313 </literallayout>
12314 <para>
12315 a single-key lookup is performed, using the host name as its key. If the
12316 lookup succeeds, the host matches the item. The actual data that is looked up
12317 is not used.
12318 </para>
12319 <para>
12320 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12321 keys in the file, not IP addresses. If you want to do lookups based on IP
12322 addresses, you must precede the search type with <quote>net-</quote> (see section
12323 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12324 two items in the same list, one doing an address lookup and one doing a name
12325 lookup, both using the same file.
12326 </para>
12327 </section>
12328 <section id="SECID81">
12329 <title>Host list patterns for query-style lookups</title>
12330 <para>
12331 If a pattern is of the form
12332 </para>
12333 <literallayout>
12334 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12335 </literallayout>
12336 <para>
12337 the query is obeyed, and if it succeeds, the host matches the item. The actual
12338 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12339 <varname>$sender_host_name</varname> can be used in the query. For example:
12340 </para>
12341 <literallayout class="monospaced">
12342 hosts_lookup = pgsql;\
12343   select ip from hostlist where ip='$sender_host_address'
12344 </literallayout>
12345 <para>
12346 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12347 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12348 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12349 operator.
12350 </para>
12351 <para>
12352 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12353 looks up the host name if has not already done so. (See section
12354 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12355 </para>
12356 <para>
12357 Historical note: prior to release 4.30, Exim would always attempt to find a
12358 host name before running the query, unless the search type was preceded by
12359 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12360 still recognized for query-style lookups, but its presence or absence has no
12361 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12362 See section <xref linkend="SECThoslispatsikey"/>.)
12363 </para>
12364 </section>
12365 <section id="SECTmixwilhos">
12366 <title>Mixing wildcarded host names and addresses in host lists</title>
12367 <para>
12368 <indexterm role="concept">
12369 <primary>host list</primary>
12370 <secondary>mixing names and addresses in</secondary>
12371 </indexterm>
12372 If you have name lookups or wildcarded host names and IP addresses in the same
12373 host list, you should normally put the IP addresses first. For example, in an
12374 ACL you could have:
12375 </para>
12376 <literallayout class="monospaced">
12377 accept hosts = 10.9.8.7 : *.friend.example
12378 </literallayout>
12379 <para>
12380 The reason for this lies in the left-to-right way that Exim processes lists.
12381 It can test IP addresses without doing any DNS lookups, but when it reaches an
12382 item that requires a host name, it fails if it cannot find a host name to
12383 compare with the pattern. If the above list is given in the opposite order, the
12384 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12385 IP address is 10.9.8.7.
12386 </para>
12387 <para>
12388 If you really do want to do the name check first, and still recognize the IP
12389 address, you can rewrite the ACL like this:
12390 </para>
12391 <literallayout class="monospaced">
12392 accept hosts = *.friend.example
12393 accept hosts = 10.9.8.7
12394 </literallayout>
12395 <para>
12396 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12397 <xref linkend="CHAPACL"/> for details of ACLs.
12398 </para>
12399 </section>
12400 <section id="SECTaddresslist">
12401 <title>Address lists</title>
12402 <para>
12403 <indexterm role="concept">
12404 <primary>list</primary>
12405 <secondary>address list</secondary>
12406 </indexterm>
12407 <indexterm role="concept">
12408 <primary>address list</primary>
12409 <secondary>empty item</secondary>
12410 </indexterm>
12411 <indexterm role="concept">
12412 <primary>address list</primary>
12413 <secondary>patterns</secondary>
12414 </indexterm>
12415 Address lists contain patterns that are matched against mail addresses. There
12416 is one special case to be considered: the sender address of a bounce message is
12417 always empty. You can test for this by providing an empty item in an address
12418 list. For example, you can set up a router to process bounce messages by
12419 using this option setting:
12420 </para>
12421 <literallayout class="monospaced">
12422 senders = :
12423 </literallayout>
12424 <para>
12425 The presence of the colon creates an empty item. If you do not provide any
12426 data, the list is empty and matches nothing. The empty sender can also be
12427 detected by a regular expression that matches an empty string,
12428 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12429 </para>
12430 <para>
12431 Non-empty items in an address list can be straightforward email addresses. For
12432 example:
12433 </para>
12434 <literallayout class="monospaced">
12435 senders = jbc@askone.example : hs@anacreon.example
12436 </literallayout>
12437 <para>
12438 A certain amount of wildcarding is permitted. If a pattern contains an @
12439 character, but is not a regular expression and does not begin with a
12440 semicolon-terminated lookup type (described below), the local part of the
12441 subject address is compared with the local part of the pattern, which may start
12442 with an asterisk. If the local parts match, the domain is checked in exactly
12443 the same way as for a pattern in a domain list. For example, the domain can be
12444 wildcarded, refer to a named list, or be a lookup:
12445 </para>
12446 <literallayout class="monospaced">
12447 deny senders = *@*.spamming.site:\
12448                *@+hostile_domains:\
12449                bozo@partial-lsearch;/list/of/dodgy/sites:\
12450                *@dbm;/bad/domains.db
12451 </literallayout>
12452 <para>
12453 <indexterm role="concept">
12454 <primary>local part</primary>
12455 <secondary>starting with !</secondary>
12456 </indexterm>
12457 <indexterm role="concept">
12458 <primary>address list</primary>
12459 <secondary>local part starting with !</secondary>
12460 </indexterm>
12461 If a local part that begins with an exclamation mark is required, it has to be
12462 specified using a regular expression, because otherwise the exclamation mark is
12463 treated as a sign of negation, as is standard in lists.
12464 </para>
12465 <para>
12466 If a non-empty pattern that is not a regular expression or a lookup does not
12467 contain an @ character, it is matched against the domain part of the subject
12468 address. The only two formats that are recognized this way are a literal
12469 domain, or a domain pattern that starts with *. In both these cases, the effect
12470 is the same as if <literal>*@</literal> preceded the pattern. For example:
12471 </para>
12472 <literallayout class="monospaced">
12473 deny senders = enemy.domain : *.enemy.domain
12474 </literallayout>
12475 <para>
12476 The following kinds of more complicated address list pattern can match any
12477 address, including the empty address that is characteristic of bounce message
12478 senders:
12479 </para>
12480 <itemizedlist>
12481 <listitem>
12482 <para>
12483 <indexterm role="concept">
12484 <primary>regular expressions</primary>
12485 <secondary>in address list</secondary>
12486 </indexterm>
12487 <indexterm role="concept">
12488 <primary>address list</primary>
12489 <secondary>regular expression in</secondary>
12490 </indexterm>
12491 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12492 done against the complete address, with the pattern as the regular expression.
12493 You must take care that backslash and dollar characters are not misinterpreted
12494 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12495 to mark that part of the string as non-expandable. For example:
12496 </para>
12497 <literallayout class="monospaced">
12498 deny senders = \N^.*this.*@example\.com$\N : \
12499                \N^\d{8}.+@spamhaus.example$\N : ...
12500 </literallayout>
12501 <para>
12502 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12503 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12504 </para>
12505 </listitem>
12506 <listitem>
12507 <para>
12508 <indexterm role="concept">
12509 <primary>address list</primary>
12510 <secondary>lookup for complete address</secondary>
12511 </indexterm>
12512 Complete addresses can be looked up by using a pattern that starts with a
12513 lookup type terminated by a semicolon, followed by the data for the lookup. For
12514 example:
12515 </para>
12516 <literallayout class="monospaced">
12517 deny senders = cdb;/etc/blocked.senders : \
12518   mysql;select address from blocked where \
12519   address='${quote_mysql:$sender_address}'
12520 </literallayout>
12521 <para>
12522 Both query-style and single-key lookup types can be used. For a single-key
12523 lookup type, Exim uses the complete address as the key. However, empty keys are
12524 not supported for single-key lookups, so a match against the empty address
12525 always fails. This restriction does not apply to query-style lookups.
12526 </para>
12527 <para>
12528 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12529 cannot be used, and is ignored if specified, with an entry being written to the
12530 panic log.
12531 <indexterm role="concept">
12532 <primary>*@ with single-key lookup</primary>
12533 </indexterm>
12534 However, you can configure lookup defaults, as described in section
12535 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12536 default. For example, with this lookup:
12537 </para>
12538 <literallayout class="monospaced">
12539 accept senders = lsearch*@;/some/file
12540 </literallayout>
12541 <para>
12542 the file could contains lines like this:
12543 </para>
12544 <literallayout class="monospaced">
12545 user1@domain1.example
12546 *@domain2.example
12547 </literallayout>
12548 <para>
12549 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12550 that are tried is:
12551 </para>
12552 <literallayout class="monospaced">
12553 nimrod@jaeger.example
12554 *@jaeger.example
12555 *
12556 </literallayout>
12557 <para>
12558 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12559 would mean that every address matches, thus rendering the test useless.
12560 </para>
12561 <para>
12562 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12563 </para>
12564 <literallayout class="monospaced">
12565 deny recipients = dbm*@;/some/file
12566 deny recipients = *@dbm;/some/file
12567 </literallayout>
12568 <para>
12569 The first does a whole address lookup, with defaulting, as just described,
12570 because it starts with a lookup type. The second matches the local part and
12571 domain independently, as described in a bullet point below.
12572 </para>
12573 </listitem>
12574 </itemizedlist>
12575 <para>
12576 The following kinds of address list pattern can match only non-empty addresses.
12577 If the subject address is empty, a match against any of these pattern types
12578 always fails.
12579 </para>
12580 <itemizedlist>
12581 <listitem>
12582 <para>
12583 <indexterm role="concept">
12584 <primary>@@ with single-key lookup</primary>
12585 </indexterm>
12586 <indexterm role="concept">
12587 <primary>address list</primary>
12588 <secondary>@@ lookup type</secondary>
12589 </indexterm>
12590 <indexterm role="concept">
12591 <primary>address list</primary>
12592 <secondary>split local part and domain</secondary>
12593 </indexterm>
12594 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12595 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12596 split into a local part and a domain. The domain is looked up in the file. If
12597 it is not found, there is no match. If it is found, the data that is looked up
12598 from the file is treated as a colon-separated list of local part patterns, each
12599 of which is matched against the subject local part in turn.
12600 </para>
12601 <para>
12602 <indexterm role="concept">
12603 <primary>asterisk</primary>
12604 <secondary>in address list</secondary>
12605 </indexterm>
12606 The lookup may be a partial one, and/or one involving a search for a default
12607 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12608 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12609 even be further lookups. They may also be independently negated. For example,
12610 with
12611 </para>
12612 <literallayout class="monospaced">
12613 deny senders = @@dbm;/etc/reject-by-domain
12614 </literallayout>
12615 <para>
12616 the data from which the DBM file is built could contain lines like
12617 </para>
12618 <literallayout class="monospaced">
12619 baddomain.com:  !postmaster : *
12620 </literallayout>
12621 <para>
12622 to reject all senders except <option>postmaster</option> from that domain.
12623 </para>
12624 <para>
12625 <indexterm role="concept">
12626 <primary>local part</primary>
12627 <secondary>starting with !</secondary>
12628 </indexterm>
12629 If a local part that actually begins with an exclamation mark is required, it
12630 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12631 may be split over several lines by indenting the second and subsequent lines,
12632 but the separating colon must still be included at line breaks. White space
12633 surrounding the colons is ignored. For example:
12634 </para>
12635 <literallayout class="monospaced">
12636 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12637 spammer3 : spammer4
12638 </literallayout>
12639 <para>
12640 As in all colon-separated lists in Exim, a colon can be included in an item by
12641 doubling.
12642 </para>
12643 <para>
12644 If the last item in the list starts with a right angle-bracket, the remainder
12645 of the item is taken as a new key to look up in order to obtain a continuation
12646 list of local parts. The new key can be any sequence of characters. Thus one
12647 might have entries like
12648 </para>
12649 <literallayout class="monospaced">
12650 aol.com: spammer1 : spammer 2 : &gt;*
12651 xyz.com: spammer3 : &gt;*
12652 *:       ^\d{8}$
12653 </literallayout>
12654 <para>
12655 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12656 local parts for all domains, in addition to the specific local parts listed for
12657 each domain. Of course, using this feature costs another lookup each time a
12658 chain is followed, but the effort needed to maintain the data is reduced.
12659 </para>
12660 <para>
12661 <indexterm role="concept">
12662 <primary>loop</primary>
12663 <secondary>in lookups</secondary>
12664 </indexterm>
12665 It is possible to construct loops using this facility, and in order to catch
12666 them, the chains may be no more than fifty items long.
12667 </para>
12668 </listitem>
12669 <listitem>
12670 <para>
12671 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12672 lookup, but in this case, the chaining facility is not available. The lookup
12673 can only return a single list of local parts.
12674 </para>
12675 </listitem>
12676 </itemizedlist>
12677 <para>
12678 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12679 in these two examples:
12680 </para>
12681 <literallayout class="monospaced">
12682 senders = +my_list
12683 senders = *@+my_list
12684 </literallayout>
12685 <para>
12686 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12687 example it is a named domain list.
12688 </para>
12689 </section>
12690 <section id="SECTcasletadd">
12691 <title>Case of letters in address lists</title>
12692 <para>
12693 <indexterm role="concept">
12694 <primary>case of local parts</primary>
12695 </indexterm>
12696 <indexterm role="concept">
12697 <primary>address list</primary>
12698 <secondary>case forcing</secondary>
12699 </indexterm>
12700 <indexterm role="concept">
12701 <primary>case forcing in address lists</primary>
12702 </indexterm>
12703 Domains in email addresses are always handled caselessly, but for local parts
12704 case may be significant on some systems (see <option>caseful_local_part</option> for how
12705 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12706 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12707 blocking lists should be done in a case-independent manner. Since most address
12708 lists in Exim are used for this kind of control, Exim attempts to do this by
12709 default.
12710 </para>
12711 <para>
12712 The domain portion of an address is always lowercased before matching it to an
12713 address list. The local part is lowercased by default, and any string
12714 comparisons that take place are done caselessly. This means that the data in
12715 the address list itself, in files included as plain file names, and in any file
12716 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12717 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12718 works caselessly) must be in lower case, because these lookups are not
12719 case-independent.
12720 </para>
12721 <para>
12722 <indexterm role="concept">
12723 <primary><literal>+caseful</literal></primary>
12724 </indexterm>
12725 To allow for the possibility of caseful address list matching, if an item in
12726 an address list is the string <quote>+caseful</quote>, the original case of the local
12727 part is restored for any comparisons that follow, and string comparisons are no
12728 longer case-independent. This does not affect the domain, which remains in
12729 lower case. However, although independent matches on the domain alone are still
12730 performed caselessly, regular expressions that match against an entire address
12731 become case-sensitive after <quote>+caseful</quote> has been seen.
12732 </para>
12733 </section>
12734 <section id="SECTlocparlis">
12735 <title>Local part lists</title>
12736 <para>
12737 <indexterm role="concept">
12738 <primary>list</primary>
12739 <secondary>local part list</secondary>
12740 </indexterm>
12741 <indexterm role="concept">
12742 <primary>local part</primary>
12743 <secondary>list</secondary>
12744 </indexterm>
12745 Case-sensitivity in local part lists is handled in the same way as for address
12746 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12747 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12748 set false, the subject is lowercased and the matching is initially
12749 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12750 matching in the local part list, but not elsewhere in the router. If
12751 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12752 option is case-sensitive from the start.
12753 </para>
12754 <para>
12755 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12756 comments are handled in the same way as address lists &ndash; they are recognized
12757 only if the # is preceded by white space or the start of the line.
12758 Otherwise, local part lists are matched in the same way as domain lists, except
12759 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12760 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12761 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12762 types.
12763 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12764 </para>
12765 </section>
12766 </chapter>
12767
12768 <chapter id="CHAPexpand">
12769 <title>String expansions</title>
12770 <para>
12771 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12772 <primary>expansion</primary>
12773 <secondary>of strings</secondary>
12774 </indexterm>
12775 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12776 them are expanded every time they are used; others are expanded only once.
12777 </para>
12778 <para>
12779 When a string is being expanded it is copied verbatim from left to right except
12780 when a dollar or backslash character is encountered. A dollar specifies the
12781 start of a portion of the string that is interpreted and replaced as described
12782 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12783 escape character, as described in the following section.
12784 </para>
12785 <para>
12786 Whether a string is expanded depends upon the context.  Usually this is solely
12787 dependent upon the option for which a value is sought; in this documentation,
12788 options for which string expansion is performed are marked with &dagger; after
12789 the data type.  ACL rules always expand strings.  A couple of expansion
12790 conditions do not expand some of the brace-delimited branches, for security
12791 reasons.
12792 </para>
12793 <section id="SECTlittext">
12794 <title>Literal text in expanded strings</title>
12795 <para>
12796 <indexterm role="concept">
12797 <primary>expansion</primary>
12798 <secondary>including literal text</secondary>
12799 </indexterm>
12800 An uninterpreted dollar can be included in an expanded string by putting a
12801 backslash in front of it. A backslash can be used to prevent any special
12802 character being treated specially in an expansion, including backslash itself.
12803 If the string appears in quotes in the configuration file, two backslashes are
12804 required because the quotes themselves cause interpretation of backslashes when
12805 the string is read in (see section <xref linkend="SECTstrings"/>).
12806 </para>
12807 <para>
12808 <indexterm role="concept">
12809 <primary>expansion</primary>
12810 <secondary>non-expandable substrings</secondary>
12811 </indexterm>
12812 A portion of the string can specified as non-expandable by placing it between
12813 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12814 expressions, which often contain backslashes and dollar signs. For example:
12815 </para>
12816 <literallayout class="monospaced">
12817 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12818 </literallayout>
12819 <para>
12820 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12821 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12822 string.
12823 </para>
12824 </section>
12825 <section id="SECID82">
12826 <title>Character escape sequences in expanded strings</title>
12827 <para>
12828 <indexterm role="concept">
12829 <primary>expansion</primary>
12830 <secondary>escape sequences</secondary>
12831 </indexterm>
12832 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12833 expanded string is recognized as an escape sequence for the character newline,
12834 carriage return, or tab, respectively. A backslash followed by up to three
12835 octal digits is recognized as an octal encoding for a single character, and a
12836 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12837 encoding.
12838 </para>
12839 <para>
12840 These escape sequences are also recognized in quoted strings when they are read
12841 in. Their interpretation in expansions as well is useful for unquoted strings,
12842 and for other cases such as looked-up strings that are then expanded.
12843 </para>
12844 </section>
12845 <section id="SECID83">
12846 <title>Testing string expansions</title>
12847 <para>
12848 <indexterm role="concept">
12849 <primary>expansion</primary>
12850 <secondary>testing</secondary>
12851 </indexterm>
12852 <indexterm role="concept">
12853 <primary>testing</primary>
12854 <secondary>string expansion</secondary>
12855 </indexterm>
12856 <indexterm role="option">
12857 <primary><option>-be</option></primary>
12858 </indexterm>
12859 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12860 takes the command arguments, or lines from the standard input if there are no
12861 arguments, runs them through the string expansion code, and writes the results
12862 to the standard output. Variables based on configuration values are set up, but
12863 since no message is being processed, variables such as <varname>$local_part</varname> have no
12864 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12865 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12866 and <option>nhash</option>.
12867 </para>
12868 <para>
12869 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12870 instead runs under the uid and gid it was called with, to prevent users from
12871 using <option>-be</option> for reading files to which they do not have access.
12872 </para>
12873 <para>
12874 <indexterm role="option">
12875 <primary><option>-bem</option></primary>
12876 </indexterm>
12877 If you want to test expansions that include variables whose values are taken
12878 from a message, there are two other options that can be used. The <option>-bem</option>
12879 option is like <option>-be</option> except that it is followed by a file name. The file is
12880 read as a message before doing the test expansions. For example:
12881 </para>
12882 <literallayout class="monospaced">
12883 exim -bem /tmp/test.message '$h_subject:'
12884 </literallayout>
12885 <para>
12886 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12887 Exim message identifier. For example:
12888 </para>
12889 <literallayout class="monospaced">
12890 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12891 </literallayout>
12892 <para>
12893 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12894 is therefore restricted to admin users.
12895 </para>
12896 </section>
12897 <section id="SECTforexpfai">
12898 <title>Forced expansion failure</title>
12899 <para>
12900 <indexterm role="concept">
12901 <primary>expansion</primary>
12902 <secondary>forced failure</secondary>
12903 </indexterm>
12904 A number of expansions that are described in the following section have
12905 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12906 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12907 used depends on some condition that is evaluated as part of the expansion. If,
12908 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12909 the entire string expansion fails in a way that can be detected by the code
12910 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12911 its consequences depend on the circumstances. In some cases it is no different
12912 from any other expansion failure, but in others a different action may be
12913 taken. Such variations are mentioned in the documentation of the option that is
12914 being expanded.
12915 </para>
12916 </section>
12917 <section id="SECTexpansionitems">
12918 <title>Expansion items</title>
12919 <para>
12920 The following items are recognized in expanded strings. White space may be used
12921 between sub-items that are keywords or substrings enclosed in braces inside an
12922 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12923 white space is significant.
12924 </para>
12925 <variablelist>
12926 <varlistentry>
12927 <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>
12928 <listitem>
12929 <para>
12930 <indexterm role="concept">
12931 <primary>expansion</primary>
12932 <secondary>variables</secondary>
12933 </indexterm>
12934 Substitute the contents of the named variable, for example:
12935 </para>
12936 <literallayout class="monospaced">
12937 $local_part
12938 ${domain}
12939 </literallayout>
12940 <para>
12941 The second form can be used to separate the name from subsequent alphanumeric
12942 characters. This form (using braces) is available only for variables; it does
12943 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12944 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12945 given, the expansion fails.
12946 </para>
12947 </listitem></varlistentry>
12948 <varlistentry>
12949 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12950 <listitem>
12951 <para>
12952 <indexterm role="concept">
12953 <primary>expansion</primary>
12954 <secondary>operators</secondary>
12955 </indexterm>
12956 The string is first itself expanded, and then the operation specified by
12957 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12958 </para>
12959 <literallayout class="monospaced">
12960 ${lc:$local_part}
12961 </literallayout>
12962 <para>
12963 The string starts with the first character after the colon, which may be
12964 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12965 below. The operator notation is used for simple expansion items that have just
12966 one argument, because it reduces the number of braces and therefore makes the
12967 string easier to understand.
12968 </para>
12969 </listitem></varlistentry>
12970 <varlistentry>
12971 <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>
12972 <listitem>
12973 <para>
12974 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12975 expansion item below.
12976 </para>
12977 </listitem></varlistentry>
12978 <varlistentry>
12979 <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>
12980 <listitem>
12981 <para>
12982 <indexterm role="concept">
12983 <primary><option>dlfunc</option></primary>
12984 </indexterm>
12985 This expansion dynamically loads and then calls a locally-written C function.
12986 This functionality is available only if Exim is compiled with
12987 </para>
12988 <literallayout class="monospaced">
12989 EXPAND_DLFUNC=yes
12990 </literallayout>
12991 <para>
12992 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12993 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12994 (but of course Exim does start new processes frequently).
12995 </para>
12996 <para>
12997 There may be from zero to eight arguments to the function. When compiling
12998 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12999 included. The Exim variables and functions that are defined by that API
13000 are also available for dynamically loaded functions. The function itself
13001 must have the following type:
13002 </para>
13003 <literallayout class="monospaced">
13004 int dlfunction(uschar **yield, int argc, uschar *argv[])
13005 </literallayout>
13006 <para>
13007 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13008 function should return one of the following values:
13009 </para>
13010 <para>
13011 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13012 into the expanded string that is being built.
13013 </para>
13014 <para>
13015 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13016 from <emphasis>yield</emphasis>, if it is set.
13017 </para>
13018 <para>
13019 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13020 taken from <emphasis>yield</emphasis> if it is set.
13021 </para>
13022 <para>
13023 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13024 </para>
13025 <para>
13026 When compiling a function that is to be used in this way with gcc,
13027 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13028 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13029 </para>
13030 </listitem></varlistentry>
13031 <varlistentry>
13032 <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>
13033 <listitem>
13034 <para>
13035 <indexterm role="concept">
13036 <primary>expansion</primary>
13037 <secondary>extracting substrings by key</secondary>
13038 </indexterm>
13039 <indexterm role="concept">
13040 <primary><option>extract</option></primary>
13041 <secondary>substrings by key</secondary>
13042 </indexterm>
13043 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13044 white space is removed from the key (but not from any of the strings). The key
13045 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13046 form:
13047 </para>
13048 <literallayout>
13049 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13050 </literallayout>
13051 <para>
13052 <indexterm role="variable">
13053 <primary><varname>$value</varname></primary>
13054 </indexterm>
13055 where the equals signs and spaces (but not both) are optional. If any of the
13056 values contain white space, they must be enclosed in double quotes, and any
13057 values that are enclosed in double quotes are subject to escape processing as
13058 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13059 for the value that corresponds to the key. The search is case-insensitive. If
13060 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13061 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13062 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13063 is restored to any previous value it might have had.
13064 </para>
13065 <para>
13066 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13067 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13068 extracted is used. Thus, for example, these two expansions are identical, and
13069 yield <quote>2001</quote>:
13070 </para>
13071 <literallayout class="monospaced">
13072 ${extract{gid}{uid=1984 gid=2001}}
13073 ${extract{gid}{uid=1984 gid=2001}{$value}}
13074 </literallayout>
13075 <para>
13076 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13077 appear, for example:
13078 </para>
13079 <literallayout class="monospaced">
13080 ${extract{Z}{A=... B=...}{$value} fail }
13081 </literallayout>
13082 <para>
13083 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13084 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13085 </para>
13086 </listitem></varlistentry>
13087 <varlistentry>
13088 <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>
13089 <listitem>
13090 <para>
13091 <indexterm role="concept">
13092 <primary>expansion</primary>
13093 <secondary>extracting substrings by number</secondary>
13094 </indexterm>
13095 <indexterm role="concept">
13096 <primary><option>extract</option></primary>
13097 <secondary>substrings by number</secondary>
13098 </indexterm>
13099 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13100 apart from leading and trailing white space, which is ignored.
13101 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13102 behaves in the same way, except that, instead of extracting a named field, it
13103 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13104 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13105 &lt;<emphasis>string3</emphasis>&gt; as before.
13106 </para>
13107 <para>
13108 The fields in the string are separated by any one of the characters in the
13109 separator string. These may include space or tab characters.
13110 The first field is numbered one. If the number is negative, the fields are
13111 counted from the end of the string, with the rightmost one numbered -1. If the
13112 number given is zero, the entire string is returned. If the modulus of the
13113 number is greater than the number of fields in the string, the result is the
13114 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13115 provided. For example:
13116 </para>
13117 <literallayout class="monospaced">
13118 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13119 </literallayout>
13120 <para>
13121 yields <quote>42</quote>, and
13122 </para>
13123 <literallayout class="monospaced">
13124 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13125 </literallayout>
13126 <para>
13127 yields <quote>99</quote>. Two successive separators mean that the field between them is
13128 empty (for example, the fifth field above).
13129 </para>
13130 </listitem></varlistentry>
13131 <varlistentry>
13132 <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>
13133 <listitem>
13134 <para>
13135 <indexterm role="concept">
13136 <primary>list</primary>
13137 <secondary>selecting by condition</secondary>
13138 </indexterm>
13139 <indexterm role="concept">
13140 <primary>expansion</primary>
13141 <secondary>selecting from list by condition</secondary>
13142 </indexterm>
13143 <indexterm role="variable">
13144 <primary><varname>$item</varname></primary>
13145 </indexterm>
13146 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13147 default, but the separator can be changed in the usual way. For each item
13148 in this list, its value is place in <varname>$item</varname>, and then the condition is
13149 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13150 item in a new list; if the condition is false, the item is discarded. The
13151 separator used for the output list is the same as the one used for the
13152 input, but a separator setting is not included in the output. For example:
13153 </para>
13154 <literallayout class="monospaced">
13155 ${filter{a:b:c}{!eq{$item}{b}}
13156 </literallayout>
13157 <para>
13158 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13159 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13160 </para>
13161 </listitem></varlistentry>
13162 <varlistentry>
13163 <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>
13164 <listitem>
13165 <para>
13166 <indexterm role="concept">
13167 <primary>hash function</primary>
13168 <secondary>textual</secondary>
13169 </indexterm>
13170 <indexterm role="concept">
13171 <primary>expansion</primary>
13172 <secondary>textual hash</secondary>
13173 </indexterm>
13174 This is a textual hashing function, and was the first to be implemented in
13175 early versions of Exim. In current releases, there are other hashing functions
13176 (numeric, MD5, and SHA-1), which are described below.
13177 </para>
13178 <para>
13179 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13180 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13181 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13182 use the simpler operator notation that avoids some of the braces:
13183 </para>
13184 <literallayout class="monospaced">
13185 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13186 </literallayout>
13187 <para>
13188 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13189 or equal to the length of the string, the expansion item returns the string.
13190 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13191 function to the string. The new string consists of characters taken from the
13192 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13193 </para>
13194 <literallayout class="monospaced">
13195 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13196 </literallayout>
13197 <para>
13198 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13199 letters appear. For example:
13200 </para>
13201 <literallayout>
13202 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13203 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13204 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13205 </literallayout>
13206 </listitem></varlistentry>
13207 <varlistentry>
13208 <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>
13209 <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>
13210 <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>
13211 <listitem>
13212 <para>
13213 <indexterm role="concept">
13214 <primary>expansion</primary>
13215 <secondary>header insertion</secondary>
13216 </indexterm>
13217 <indexterm role="variable">
13218 <primary><varname>$header_</varname></primary>
13219 </indexterm>
13220 <indexterm role="variable">
13221 <primary><varname>$bheader_</varname></primary>
13222 </indexterm>
13223 <indexterm role="variable">
13224 <primary><varname>$rheader_</varname></primary>
13225 </indexterm>
13226 <indexterm role="concept">
13227 <primary>header lines</primary>
13228 <secondary>in expansion strings</secondary>
13229 </indexterm>
13230 <indexterm role="concept">
13231 <primary>header lines</primary>
13232 <secondary>character sets</secondary>
13233 </indexterm>
13234 <indexterm role="concept">
13235 <primary>header lines</primary>
13236 <secondary>decoding</secondary>
13237 </indexterm>
13238 Substitute the contents of the named message header line, for example
13239 </para>
13240 <literallayout class="monospaced">
13241 $header_reply-to:
13242 </literallayout>
13243 <para>
13244 The newline that terminates a header line is not included in the expansion, but
13245 internal newlines (caused by splitting the header line over several physical
13246 lines) may be present.
13247 </para>
13248 <para>
13249 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13250 the data in the header line is interpreted.
13251 </para>
13252 <itemizedlist>
13253 <listitem>
13254 <para>
13255 <indexterm role="concept">
13256 <primary>white space</primary>
13257 <secondary>in header lines</secondary>
13258 </indexterm>
13259 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13260 processing at all, and without the removal of leading and trailing white space.
13261 </para>
13262 </listitem>
13263 <listitem>
13264 <para>
13265 <indexterm role="concept">
13266 <primary>base64 encoding</primary>
13267 <secondary>in header lines</secondary>
13268 </indexterm>
13269 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13270 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13271 character set translation. If decoding of what looks superficially like a MIME
13272 <quote>word</quote> fails, the raw string is returned. If decoding
13273 <indexterm role="concept">
13274 <primary>binary zero</primary>
13275 <secondary>in header line</secondary>
13276 </indexterm>
13277 produces a binary zero character, it is replaced by a question mark &ndash; this is
13278 what Exim does for binary zeros that are actually received in header lines.
13279 </para>
13280 </listitem>
13281 <listitem>
13282 <para>
13283 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13284 standard character set. This is an attempt to produce the same string as would
13285 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13286 returned. Translation is attempted only on operating systems that support the
13287 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13288 a system Makefile or in <filename>Local/Makefile</filename>.
13289 </para>
13290 </listitem>
13291 </itemizedlist>
13292 <para>
13293 In a filter file, the target character set for <option>header</option> can be specified by a
13294 command of the following form:
13295 </para>
13296 <literallayout class="monospaced">
13297 headers charset "UTF-8"
13298 </literallayout>
13299 <para>
13300 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13301 subsequently obeyed filter commands. In the absence of this command, the target
13302 character set in a filter is taken from the setting of the <option>headers_charset</option>
13303 option in the runtime configuration. The value of this option defaults to the
13304 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13305 ISO-8859-1.
13306 </para>
13307 <para>
13308 Header names follow the syntax of RFC 2822, which states that they may contain
13309 any printing characters except space and colon. Consequently, curly brackets
13310 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13311 if they were variables. Attempting to do so causes a syntax error.
13312 </para>
13313 <para>
13314 Only header lines that are common to all copies of a message are visible to
13315 this mechanism. These are the original header lines that are received with the
13316 message, and any that are added by an ACL statement or by a system
13317 filter. Header lines that are added to a particular copy of a message by a
13318 router or transport are not accessible.
13319 </para>
13320 <para>
13321 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13322 before the DATA ACL, because the header structure is not set up until the
13323 message is received. Header lines that are added in a RCPT ACL (for example)
13324 are saved until the message&#x2019;s incoming header lines are available, at which
13325 point they are added. When a DATA ACL is running, however, header lines added
13326 by earlier ACLs are visible.
13327 </para>
13328 <para>
13329 Upper case and lower case letters are synonymous in header names. If the
13330 following character is white space, the terminating colon may be omitted, but
13331 this is not recommended, because you may then forget it when it is needed. When
13332 white space terminates the header name, it is included in the expanded string.
13333 If the message does not contain the given header, the expansion item is
13334 replaced by an empty string. (See the <option>def</option> condition in section
13335 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13336 </para>
13337 <para>
13338 If there is more than one header with the same name, they are all concatenated
13339 to form the substitution string, up to a maximum length of 64K. Unless
13340 <option>rheader</option> is being used, leading and trailing white space is removed from
13341 each header before concatenation, and a completely empty header is ignored. A
13342 newline character is then inserted between non-empty headers, but there is no
13343 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13344 those headers that contain lists of addresses, a comma is also inserted at the
13345 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13346 </para>
13347 </listitem></varlistentry>
13348 <varlistentry>
13349 <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>
13350 <listitem>
13351 <para>
13352 <indexterm role="concept">
13353 <primary>expansion</primary>
13354 <secondary>hmac hashing</secondary>
13355 </indexterm>
13356 <indexterm role="concept">
13357 <primary><option>hmac</option></primary>
13358 </indexterm>
13359 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13360 shared secret and some text into a message authentication code, as specified in
13361 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13362 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13363 cryptographic hash, allowing for authentication that is not possible with MD5
13364 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13365 present. For example:
13366 </para>
13367 <literallayout class="monospaced">
13368 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13369 </literallayout>
13370 <para>
13371 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13372 produces:
13373 </para>
13374 <literallayout class="monospaced">
13375 dd97e3ba5d1a61b5006108f8c8252953
13376 </literallayout>
13377 <para>
13378 As an example of how this might be used, you might put in the main part of
13379 an Exim configuration:
13380 </para>
13381 <literallayout class="monospaced">
13382 SPAMSCAN_SECRET=cohgheeLei2thahw
13383 </literallayout>
13384 <para>
13385 In a router or a transport you could then have:
13386 </para>
13387 <literallayout class="monospaced">
13388 headers_add = \
13389   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13390   ${hmac{md5}{SPAMSCAN_SECRET}\
13391   {${primary_hostname},${message_exim_id},$h_message-id:}}
13392 </literallayout>
13393 <para>
13394 Then given a message, you can check where it was scanned by looking at the
13395 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13396 this header line is authentic by recomputing the authentication code from the
13397 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13398 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13399 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13400 </para>
13401 </listitem></varlistentry>
13402 <varlistentry>
13403 <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>
13404 <listitem>
13405 <para>
13406 <indexterm role="concept">
13407 <primary>expansion</primary>
13408 <secondary>conditional</secondary>
13409 </indexterm>
13410 <indexterm role="concept">
13411 <primary><option>if</option>, expansion item</primary>
13412 </indexterm>
13413 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13414 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13415 in section <xref linkend="SECTexpcond"/> below. For example:
13416 </para>
13417 <literallayout class="monospaced">
13418 ${if eq {$local_part}{postmaster} {yes}{no} }
13419 </literallayout>
13420 <para>
13421 The second string need not be present; if it is not and the condition is not
13422 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13423 be present instead of the second string (without any curly brackets). In this
13424 case, the expansion is forced to fail if the condition is not true (see section
13425 <xref linkend="SECTforexpfai"/>).
13426 </para>
13427 <para>
13428 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13429 is true, and the empty string if the condition is false. This makes it less
13430 cumbersome to write custom ACL and router conditions. For example, instead of
13431 </para>
13432 <literallayout class="monospaced">
13433 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13434 </literallayout>
13435 <para>
13436 you can use
13437 </para>
13438 <literallayout class="monospaced">
13439 condition = ${if &gt;{$acl_m4}{3}}
13440 </literallayout>
13441 </listitem></varlistentry>
13442 <varlistentry>
13443 <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>
13444 <listitem>
13445 <para>
13446 <indexterm role="concept">
13447 <primary>expansion</primary>
13448 <secondary>string truncation</secondary>
13449 </indexterm>
13450 <indexterm role="concept">
13451 <primary><option>length</option> expansion item</primary>
13452 </indexterm>
13453 The <option>length</option> item is used to extract the initial portion of a string. Both
13454 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13455 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13456 change when expanded, you can use the simpler operator notation that avoids
13457 some of the braces:
13458 </para>
13459 <literallayout class="monospaced">
13460 ${length_&lt;n&gt;:&lt;string&gt;}
13461 </literallayout>
13462 <para>
13463 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13464 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13465 <option>strlen</option>, which gives the length of a string.
13466 </para>
13467 </listitem></varlistentry>
13468 <varlistentry>
13469 <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>
13470 <listitem>
13471 <para>
13472 This is the first of one of two different types of lookup item, which are both
13473 described in the next item.
13474 </para>
13475 </listitem></varlistentry>
13476 <varlistentry>
13477 <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>
13478 <listitem>
13479 <para>
13480 <indexterm role="concept">
13481 <primary>expansion</primary>
13482 <secondary>lookup in</secondary>
13483 </indexterm>
13484 <indexterm role="concept">
13485 <primary>file</primary>
13486 <secondary>lookups</secondary>
13487 </indexterm>
13488 <indexterm role="concept">
13489 <primary>lookup</primary>
13490 <secondary>in expanded string</secondary>
13491 </indexterm>
13492 The two forms of lookup item specify data lookups in files and databases, as
13493 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13494 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13495 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13496 </para>
13497 <para>
13498 If there is any white space in a lookup item which is part of a filter command,
13499 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13500 other place where white space is significant, the lookup item must be enclosed
13501 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13502 out by the system administrator.
13503 </para>
13504 <para>
13505 <indexterm role="variable">
13506 <primary><varname>$value</varname></primary>
13507 </indexterm>
13508 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13509 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13510 lookup. Afterwards it reverts to the value it had previously (at the outer
13511 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13512 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13513 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13514 lookup, thus providing a mechanism for looking up a default value when the
13515 original lookup fails.
13516 </para>
13517 <para>
13518 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13519 data for the outer lookup while the parameters of the second lookup are
13520 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13521 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13522 appear, and in this case, if the lookup fails, the entire expansion is forced
13523 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13524 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13525 successful lookup, and nothing in the case of failure.
13526 </para>
13527 <para>
13528 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13529 search type in order to do partial matching, and * or *@ may follow a search
13530 type to request default lookups if the key does not match (see sections
13531 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13532 </para>
13533 <para>
13534 <indexterm role="concept">
13535 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13536 <secondary>in lookup expansion</secondary>
13537 </indexterm>
13538 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13539 and non-wild parts of the key during the expansion of the replacement text.
13540 They return to their previous values at the end of the lookup item.
13541 </para>
13542 <para>
13543 This example looks up the postmaster alias in the conventional alias file:
13544 </para>
13545 <literallayout class="monospaced">
13546 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13547 </literallayout>
13548 <para>
13549 This example uses NIS+ to look up the full name of the user corresponding to
13550 the local part of an address, forcing the expansion to fail if it is not found:
13551 </para>
13552 <literallayout class="monospaced">
13553 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13554   {$value}fail}
13555 </literallayout>
13556 </listitem></varlistentry>
13557 <varlistentry>
13558 <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>
13559 <listitem>
13560 <para>
13561 <indexterm role="concept">
13562 <primary>expansion</primary>
13563 <secondary>list creation</secondary>
13564 </indexterm>
13565 <indexterm role="variable">
13566 <primary><varname>$item</varname></primary>
13567 </indexterm>
13568 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13569 default, but the separator can be changed in the usual way. For each item
13570 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13571 expanded and added to the output as an item in a new list. The separator used
13572 for the output list is the same as the one used for the input, but a separator
13573 setting is not included in the output. For example:
13574 </para>
13575 <literallayout class="monospaced">
13576 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13577 </literallayout>
13578 <para>
13579 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13580 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13581 and <emphasis role="bold">reduce</emphasis> expansion items.
13582 </para>
13583 </listitem></varlistentry>
13584 <varlistentry>
13585 <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>
13586 <listitem>
13587 <para>
13588 <indexterm role="concept">
13589 <primary>expansion</primary>
13590 <secondary>numeric hash</secondary>
13591 </indexterm>
13592 <indexterm role="concept">
13593 <primary>hash function</primary>
13594 <secondary>numeric</secondary>
13595 </indexterm>
13596 The three strings are expanded; the first two must yield numbers. Call them
13597 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13598 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13599 can use the simpler operator notation that avoids some of the braces:
13600 </para>
13601 <literallayout class="monospaced">
13602 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13603 </literallayout>
13604 <para>
13605 The second number is optional (in both notations). If there is only one number,
13606 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13607 processed by a div/mod hash function that returns two numbers, separated by a
13608 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13609 example,
13610 </para>
13611 <literallayout class="monospaced">
13612 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13613 </literallayout>
13614 <para>
13615 returns the string <quote>6/33</quote>.
13616 </para>
13617 </listitem></varlistentry>
13618 <varlistentry>
13619 <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>
13620 <listitem>
13621 <para>
13622 <indexterm role="concept">
13623 <primary>Perl</primary>
13624 <secondary>use in expanded string</secondary>
13625 </indexterm>
13626 <indexterm role="concept">
13627 <primary>expansion</primary>
13628 <secondary>calling Perl from</secondary>
13629 </indexterm>
13630 This item is available only if Exim has been built to include an embedded Perl
13631 interpreter. The subroutine name and the arguments are first separately
13632 expanded, and then the Perl subroutine is called with those arguments. No
13633 additional arguments need be given; the maximum number permitted, including the
13634 name of the subroutine, is nine.
13635 </para>
13636 <para>
13637 The return value of the subroutine is inserted into the expanded string, unless
13638 the return value is <option>undef</option>. In that case, the expansion fails in the same
13639 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13640 Whatever you return is evaluated in a scalar context. For example, if you
13641 return the name of a Perl vector, the return value is the size of the vector,
13642 not its contents.
13643 </para>
13644 <para>
13645 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13646 with the error message that was passed to <option>die</option>. More details of the embedded
13647 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13648 </para>
13649 <para>
13650 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13651 out the use of this expansion item in filter files.
13652 </para>
13653 </listitem></varlistentry>
13654 <varlistentry>
13655 <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>
13656 <listitem>
13657 <para>
13658 <indexterm role="concept">
13659 <primary><option>prvs</option> expansion item</primary>
13660 </indexterm>
13661 The first argument is a complete email address and the second is secret
13662 keystring. The third argument, specifying a key number, is optional. If absent,
13663 it defaults to 0. The result of the expansion is a prvs-signed email address,
13664 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13665 as part of a bounce address tag validation (BATV) scheme. For more discussion
13666 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13667 </para>
13668 </listitem></varlistentry>
13669 <varlistentry>
13670 <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>
13671 <listitem>
13672 <para>
13673 <indexterm role="concept">
13674 <primary><option>prvscheck</option> expansion item</primary>
13675 </indexterm>
13676 This expansion item is the complement of the <option>prvs</option> item. It is used for
13677 checking prvs-signed addresses. If the expansion of the first argument does not
13678 yield a syntactically valid prvs-signed address, the whole item expands to the
13679 empty string. When the first argument does expand to a syntactically valid
13680 prvs-signed address, the second argument is expanded, with the prvs-decoded
13681 version of the address and the key number extracted from the address in the
13682 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13683 </para>
13684 <para>
13685 These two variables can be used in the expansion of the second argument to
13686 retrieve the secret. The validity of the prvs-signed address is then checked
13687 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13688 which is empty for failure or <quote>1</quote> for success.
13689 </para>
13690 <para>
13691 The third argument is optional; if it is missing, it defaults to an empty
13692 string. This argument is now expanded. If the result is an empty string, the
13693 result of the expansion is the decoded version of the address. This is the case
13694 whether or not the signature was valid. Otherwise, the result of the expansion
13695 is the expansion of the third argument.
13696 </para>
13697 <para>
13698 All three variables can be used in the expansion of the third argument.
13699 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13700 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13701 </para>
13702 </listitem></varlistentry>
13703 <varlistentry>
13704 <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>
13705 <listitem>
13706 <para>
13707 <indexterm role="concept">
13708 <primary>expansion</primary>
13709 <secondary>inserting an entire file</secondary>
13710 </indexterm>
13711 <indexterm role="concept">
13712 <primary>file</primary>
13713 <secondary>inserting into expansion</secondary>
13714 </indexterm>
13715 <indexterm role="concept">
13716 <primary><option>readfile</option> expansion item</primary>
13717 </indexterm>
13718 The file name and end-of-line string are first expanded separately. The file is
13719 then read, and its contents replace the entire item. All newline characters in
13720 the file are replaced by the end-of-line string if it is present. Otherwise,
13721 newlines are left in the string.
13722 String expansion is not applied to the contents of the file. If you want this,
13723 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13724 the string expansion fails.
13725 </para>
13726 <para>
13727 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13728 locks out the use of this expansion item in filter files.
13729 </para>
13730 </listitem></varlistentry>
13731 <varlistentry>
13732 <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>
13733 <listitem>
13734 <para>
13735 <indexterm role="concept">
13736 <primary>expansion</primary>
13737 <secondary>inserting from a socket</secondary>
13738 </indexterm>
13739 <indexterm role="concept">
13740 <primary>socket, use of in expansion</primary>
13741 </indexterm>
13742 <indexterm role="concept">
13743 <primary><option>readsocket</option> expansion item</primary>
13744 </indexterm>
13745 This item inserts data from a Unix domain or Internet socket into the expanded
13746 string. The minimal way of using it uses just two arguments, as in these
13747 examples:
13748 </para>
13749 <literallayout class="monospaced">
13750 ${readsocket{/socket/name}{request string}}
13751 ${readsocket{inet:some.host:1234}{request string}}
13752 </literallayout>
13753 <para>
13754 For a Unix domain socket, the first substring must be the path to the socket.
13755 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13756 a host name or IP address, followed by a colon and a port, which can be a
13757 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13758 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13759 example:
13760 </para>
13761 <literallayout class="monospaced">
13762 ${readsocket{inet:[::1]:1234}{request string}}
13763 </literallayout>
13764 <para>
13765 Only a single host name may be given, but if looking it up yields more than
13766 one IP address, they are each tried in turn until a connection is made. For
13767 both kinds of socket, Exim makes a connection, writes the request string
13768 (unless it is an empty string) and reads from the socket until an end-of-file
13769 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13770 extend what can be done. Firstly, you can vary the timeout. For example:
13771 </para>
13772 <literallayout class="monospaced">
13773 ${readsocket{/socket/name}{request string}{3s}}
13774 </literallayout>
13775 <para>
13776 A fourth argument allows you to change any newlines that are in the data
13777 that is read, in the same way as for <option>readfile</option> (see above). This example
13778 turns them into spaces:
13779 </para>
13780 <literallayout class="monospaced">
13781 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13782 </literallayout>
13783 <para>
13784 As with all expansions, the substrings are expanded before the processing
13785 happens. Errors in these sub-expansions cause the expansion to fail. In
13786 addition, the following errors can occur:
13787 </para>
13788 <itemizedlist>
13789 <listitem>
13790 <para>
13791 Failure to create a socket file descriptor;
13792 </para>
13793 </listitem>
13794 <listitem>
13795 <para>
13796 Failure to connect the socket;
13797 </para>
13798 </listitem>
13799 <listitem>
13800 <para>
13801 Failure to write the request string;
13802 </para>
13803 </listitem>
13804 <listitem>
13805 <para>
13806 Timeout on reading from the socket.
13807 </para>
13808 </listitem>
13809 </itemizedlist>
13810 <para>
13811 By default, any of these errors causes the expansion to fail. However, if
13812 you supply a fifth substring, it is expanded and used when any of the above
13813 errors occurs. For example:
13814 </para>
13815 <literallayout class="monospaced">
13816 ${readsocket{/socket/name}{request string}{3s}{\n}\
13817   {socket failure}}
13818 </literallayout>
13819 <para>
13820 You can test for the existence of a Unix domain socket by wrapping this
13821 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13822 and the actual opening of the socket, so it is safer to use the fifth argument
13823 if you want to be absolutely sure of avoiding an expansion error for a
13824 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13825 </para>
13826 <para>
13827 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13828 locks out the use of this expansion item in filter files.
13829 </para>
13830 </listitem></varlistentry>
13831 <varlistentry>
13832 <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>
13833 <listitem>
13834 <para>
13835 <indexterm role="concept">
13836 <primary>expansion</primary>
13837 <secondary>reducing a list to a scalar</secondary>
13838 </indexterm>
13839 <indexterm role="concept">
13840 <primary>list</primary>
13841 <secondary>reducing to a scalar</secondary>
13842 </indexterm>
13843 <indexterm role="variable">
13844 <primary><varname>$value</varname></primary>
13845 </indexterm>
13846 <indexterm role="variable">
13847 <primary><varname>$item</varname></primary>
13848 </indexterm>
13849 This operation reduces a list to a single, scalar string. After expansion,
13850 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13851 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13852 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13853 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13854 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13855 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13856 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13857 number of ways. For example, to add up a list of numbers:
13858 </para>
13859 <literallayout class="monospaced">
13860 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13861 </literallayout>
13862 <para>
13863 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13864 can be found:
13865 </para>
13866 <literallayout class="monospaced">
13867 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13868 </literallayout>
13869 <para>
13870 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13871 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13872 expansion items.
13873 </para>
13874 </listitem></varlistentry>
13875 <varlistentry>
13876 <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>
13877 <listitem>
13878 <para>
13879 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13880 expansion item above.
13881 </para>
13882 </listitem></varlistentry>
13883 <varlistentry>
13884 <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>
13885 <listitem>
13886 <para>
13887 <indexterm role="concept">
13888 <primary>expansion</primary>
13889 <secondary>running a command</secondary>
13890 </indexterm>
13891 <indexterm role="concept">
13892 <primary><option>run</option> expansion item</primary>
13893 </indexterm>
13894 The command and its arguments are first expanded separately, and then the
13895 command is run in a separate process, but under the same uid and gid. As in
13896 other command executions from Exim, a shell is not used by default. If you want
13897 a shell, you must explicitly code it.
13898 </para>
13899 <para>
13900 The standard input for the command exists, but is empty. The standard output
13901 and standard error are set to the same file descriptor.
13902 <indexterm role="concept">
13903 <primary>return code</primary>
13904 <secondary>from <option>run</option> expansion</secondary>
13905 </indexterm>
13906 <indexterm role="variable">
13907 <primary><varname>$value</varname></primary>
13908 </indexterm>
13909 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13910 and replaces the entire item; during this expansion, the standard output/error
13911 from the command is in the variable <varname>$value</varname>. If the command fails,
13912 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13913 expansion, the standard output/error from the command is in the variable
13914 <varname>$value</varname>.
13915 </para>
13916 <para>
13917 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13918 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13919 command does not succeed. If both strings are omitted, the result is contents
13920 of the standard output/error on success, and nothing on failure.
13921 </para>
13922 <para>
13923 <indexterm role="variable">
13924 <primary><varname>$runrc</varname></primary>
13925 </indexterm>
13926 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13927 remains set afterwards, so in a filter file you can do things like this:
13928 </para>
13929 <literallayout class="monospaced">
13930 if "${run{x y z}{}}$runrc" is 1 then ...
13931   elif $runrc is 2 then ...
13932   ...
13933 endif
13934 </literallayout>
13935 <para>
13936 If execution of the command fails (for example, the command does not exist),
13937 the return code is 127 &ndash; the same code that shells use for non-existent
13938 commands.
13939 </para>
13940 <para>
13941 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13942 option values are expanded, except for those preconditions whose order of
13943 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13944 by the expansion of one option, and use it in another.
13945 </para>
13946 <para>
13947 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13948 out the use of this expansion item in filter files.
13949 </para>
13950 </listitem></varlistentry>
13951 <varlistentry>
13952 <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>
13953 <listitem>
13954 <para>
13955 <indexterm role="concept">
13956 <primary>expansion</primary>
13957 <secondary>string substitution</secondary>
13958 </indexterm>
13959 <indexterm role="concept">
13960 <primary><option>sg</option> expansion item</primary>
13961 </indexterm>
13962 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13963 option; hence its name. However, unlike the Perl equivalent, Exim does not
13964 modify the subject string; instead it returns the modified string for insertion
13965 into the overall expansion. The item takes three arguments: the subject string,
13966 a regular expression, and a substitution string. For example:
13967 </para>
13968 <literallayout class="monospaced">
13969 ${sg{abcdefabcdef}{abc}{xyz}}
13970 </literallayout>
13971 <para>
13972 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13973 if any $ or \ characters are required in the regular expression or in the
13974 substitution string, they have to be escaped. For example:
13975 </para>
13976 <literallayout class="monospaced">
13977 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13978 </literallayout>
13979 <para>
13980 yields <quote>defabc</quote>, and
13981 </para>
13982 <literallayout class="monospaced">
13983 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13984 </literallayout>
13985 <para>
13986 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13987 the regular expression from string expansion.
13988 </para>
13989 </listitem></varlistentry>
13990 <varlistentry>
13991 <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>
13992 <listitem>
13993 <para>
13994 <indexterm role="concept">
13995 <primary><option>substr</option> expansion item</primary>
13996 </indexterm>
13997 <indexterm role="concept">
13998 <primary>substring extraction</primary>
13999 </indexterm>
14000 <indexterm role="concept">
14001 <primary>expansion</primary>
14002 <secondary>substring extraction</secondary>
14003 </indexterm>
14004 The three strings are expanded; the first two must yield numbers. Call them
14005 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14006 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14007 can use the simpler operator notation that avoids some of the braces:
14008 </para>
14009 <literallayout class="monospaced">
14010 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14011 </literallayout>
14012 <para>
14013 The second number is optional (in both notations).
14014 If it is absent in the simpler format, the preceding underscore must also be
14015 omitted.
14016 </para>
14017 <para>
14018 The <option>substr</option> item can be used to extract more general substrings than
14019 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14020 length required. For example
14021 </para>
14022 <literallayout class="monospaced">
14023 ${substr{3}{2}{$local_part}}
14024 </literallayout>
14025 <para>
14026 If the starting offset is greater than the string length the result is the
14027 null string; if the length plus starting offset is greater than the string
14028 length, the result is the right-hand part of the string, starting from the
14029 given offset. The first character in the string has offset zero.
14030 </para>
14031 <para>
14032 The <option>substr</option> expansion item can take negative offset values to count
14033 from the right-hand end of its operand. The last character is offset -1, the
14034 second-last is offset -2, and so on. Thus, for example,
14035 </para>
14036 <literallayout class="monospaced">
14037 ${substr{-5}{2}{1234567}}
14038 </literallayout>
14039 <para>
14040 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14041 length of the string, the substring starts at the beginning of the string, and
14042 the length is reduced by the amount of overshoot. Thus, for example,
14043 </para>
14044 <literallayout class="monospaced">
14045 ${substr{-5}{2}{12}}
14046 </literallayout>
14047 <para>
14048 yields an empty string, but
14049 </para>
14050 <literallayout class="monospaced">
14051 ${substr{-3}{2}{12}}
14052 </literallayout>
14053 <para>
14054 yields <quote>1</quote>.
14055 </para>
14056 <para>
14057 When the second number is omitted from <option>substr</option>, the remainder of the string
14058 is taken if the offset is positive. If it is negative, all characters in the
14059 string preceding the offset point are taken. For example, an offset of -1 and
14060 no length, as in these semantically identical examples:
14061 </para>
14062 <literallayout class="monospaced">
14063 ${substr_-1:abcde}
14064 ${substr{-1}{abcde}}
14065 </literallayout>
14066 <para>
14067 yields all but the last character of the string, that is, <quote>abcd</quote>.
14068 </para>
14069 </listitem></varlistentry>
14070 <varlistentry>
14071 <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>
14072 <listitem>
14073 <para>
14074 <indexterm role="concept">
14075 <primary>expansion</primary>
14076 <secondary>character translation</secondary>
14077 </indexterm>
14078 <indexterm role="concept">
14079 <primary><option>tr</option> expansion item</primary>
14080 </indexterm>
14081 This item does single-character translation on its subject string. The second
14082 argument is a list of characters to be translated in the subject string. Each
14083 matching character is replaced by the corresponding character from the
14084 replacement list. For example
14085 </para>
14086 <literallayout class="monospaced">
14087 ${tr{abcdea}{ac}{13}}
14088 </literallayout>
14089 <para>
14090 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14091 last occurrence is used. If the third string is shorter than the second, its
14092 last character is replicated. However, if it is empty, no translation takes
14093 place.
14094 </para>
14095 </listitem></varlistentry>
14096 </variablelist>
14097 </section>
14098 <section id="SECTexpop">
14099 <title>Expansion operators</title>
14100 <para>
14101 <indexterm role="concept">
14102 <primary>expansion</primary>
14103 <secondary>operators</secondary>
14104 </indexterm>
14105 For expansion items that perform transformations on a single argument string,
14106 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14107 The substring is first expanded before the operation is applied to it. The
14108 following operations can be performed:
14109 </para>
14110 <variablelist>
14111 <varlistentry>
14112 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14113 <listitem>
14114 <para>
14115 <indexterm role="concept">
14116 <primary>expansion</primary>
14117 <secondary>RFC 2822 address handling</secondary>
14118 </indexterm>
14119 <indexterm role="concept">
14120 <primary><option>address</option> expansion item</primary>
14121 </indexterm>
14122 The string is interpreted as an RFC 2822 address, as it might appear in a
14123 header line, and the effective address is extracted from it. If the string does
14124 not parse successfully, the result is empty.
14125 </para>
14126 </listitem></varlistentry>
14127 <varlistentry>
14128 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14129 <listitem>
14130 <para>
14131 <indexterm role="concept">
14132 <primary>expansion</primary>
14133 <secondary>RFC 2822 address handling</secondary>
14134 </indexterm>
14135 <indexterm role="concept">
14136 <primary><option>addresses</option> expansion item</primary>
14137 </indexterm>
14138 The string (after expansion) is interpreted as a list of addresses in RFC
14139 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14140 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14141 result of the expansion is a colon-separated list, with appropriate
14142 doubling of colons should any happen to be present in the email addresses.
14143 Syntactically invalid RFC2822 address items are omitted from the output.
14144 </para>
14145 <para>
14146 It is possible to specify a character other than colon for the output
14147 separator by starting the string with &gt; followed by the new separator
14148 character. For example:
14149 </para>
14150 <literallayout class="monospaced">
14151 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14152 </literallayout>
14153 <para>
14154 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14155 expansion item, which extracts the working address from a single RFC2822
14156 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14157 processing lists.
14158 </para>
14159 </listitem></varlistentry>
14160 <varlistentry>
14161 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14162 <listitem>
14163 <para>
14164 <indexterm role="concept">
14165 <primary><option>base62</option> expansion item</primary>
14166 </indexterm>
14167 <indexterm role="concept">
14168 <primary>expansion</primary>
14169 <secondary>conversion to base 62</secondary>
14170 </indexterm>
14171 The string must consist entirely of decimal digits. The number is converted to
14172 base 62 and output as a string of six characters, including leading zeros. In
14173 the few operating environments where Exim uses base 36 instead of base 62 for
14174 its message identifiers (because those systems do not have case-sensitive file
14175 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14176 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14177 </para>
14178 </listitem></varlistentry>
14179 <varlistentry>
14180 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14181 <listitem>
14182 <para>
14183 <indexterm role="concept">
14184 <primary><option>base62d</option> expansion item</primary>
14185 </indexterm>
14186 <indexterm role="concept">
14187 <primary>expansion</primary>
14188 <secondary>conversion to base 62</secondary>
14189 </indexterm>
14190 The string must consist entirely of base-62 digits, or, in operating
14191 environments where Exim uses base 36 instead of base 62 for its message
14192 identifiers, base-36 digits. The number is converted to decimal and output as a
14193 string.
14194 </para>
14195 </listitem></varlistentry>
14196 <varlistentry>
14197 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14198 <listitem>
14199 <para>
14200 <indexterm role="concept">
14201 <primary>domain</primary>
14202 <secondary>extraction</secondary>
14203 </indexterm>
14204 <indexterm role="concept">
14205 <primary>expansion</primary>
14206 <secondary>domain extraction</secondary>
14207 </indexterm>
14208 The string is interpreted as an RFC 2822 address and the domain is extracted
14209 from it. If the string does not parse successfully, the result is empty.
14210 </para>
14211 </listitem></varlistentry>
14212 <varlistentry>
14213 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14214 <listitem>
14215 <para>
14216 <indexterm role="concept">
14217 <primary>expansion</primary>
14218 <secondary>escaping non-printing characters</secondary>
14219 </indexterm>
14220 <indexterm role="concept">
14221 <primary><option>escape</option> expansion item</primary>
14222 </indexterm>
14223 If the string contains any non-printing characters, they are converted to
14224 escape sequences starting with a backslash. Whether characters with the most
14225 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14226 is controlled by the <option>print_topbitchars</option> option.
14227 </para>
14228 </listitem></varlistentry>
14229 <varlistentry>
14230 <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>
14231 <listitem>
14232 <para>
14233 <indexterm role="concept">
14234 <primary>expansion</primary>
14235 <secondary>expression evaluation</secondary>
14236 </indexterm>
14237 <indexterm role="concept">
14238 <primary>expansion</primary>
14239 <secondary>arithmetic expression</secondary>
14240 </indexterm>
14241 <indexterm role="concept">
14242 <primary><option>eval</option> expansion item</primary>
14243 </indexterm>
14244 These items supports simple arithmetic and bitwise logical operations in
14245 expansion strings. The string (after expansion) must be a conventional
14246 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14247 logical operators, and parentheses. All operations are carried out using
14248 integer arithmetic. The operator priorities are as follows (the same as in the
14249 C programming language):
14250 </para>
14251 <informaltable frame="none">
14252 <tgroup cols="2" colsep="0" rowsep="0">
14253 <colspec colwidth="70pt" align="left"/>
14254 <colspec colwidth="300pt" align="left"/>
14255 <tbody>
14256 <row>
14257 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14258 <entry>not (~), negate (-)</entry>
14259 </row>
14260 <row>
14261 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14262 <entry>multiply (*), divide (/), remainder (%)</entry>
14263 </row>
14264 <row>
14265 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14266 <entry>plus (+), minus (-)</entry>
14267 </row>
14268 <row>
14269 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14270 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14271 </row>
14272 <row>
14273 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14274 <entry>and (&amp;)</entry>
14275 </row>
14276 <row>
14277 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14278 <entry>xor (^)</entry>
14279 </row>
14280 <row>
14281 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14282 <entry>or (|)</entry>
14283 </row>
14284 </tbody>
14285 </tgroup>
14286 </informaltable>
14287 <para>
14288 Binary operators with the same priority are evaluated from left to right. White
14289 space is permitted before or after operators.
14290 </para>
14291 <para>
14292 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14293 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14294 decimal, even if they start with a leading zero; hexadecimal numbers are not
14295 permitted. This can be useful when processing numbers extracted from dates or
14296 times, which often do have leading zeros.
14297 </para>
14298 <para>
14299 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14300 or 1024*1024*1024,
14301 respectively. Negative numbers are supported. The result of the computation is
14302 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14303 </para>
14304 <literallayout>
14305 <literal>${eval:1+1}            </literal>  yields 2
14306 <literal>${eval:1+2*3}          </literal>  yields 7
14307 <literal>${eval:(1+2)*3}        </literal>  yields 9
14308 <literal>${eval:2+42%5}         </literal>  yields 4
14309 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14310 <literal>${eval:0xc|5}          </literal>  yields 13
14311 <literal>${eval:0xc^5}          </literal>  yields 9
14312 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14313 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14314 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14315 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14316 </literallayout>
14317 <para>
14318 As a more realistic example, in an ACL you might have
14319 </para>
14320 <literallayout class="monospaced">
14321 deny   message = Too many bad recipients
14322        condition =                    \
14323          ${if and {                   \
14324            {&gt;{$rcpt_count}{10}}       \
14325            {                          \
14326            &lt;                          \
14327              {$recipients_count}      \
14328              {${eval:$rcpt_count/2}}  \
14329            }                          \
14330          }{yes}{no}}
14331 </literallayout>
14332 <para>
14333 The condition is true if there have been more than 10 RCPT commands and
14334 fewer than half of them have resulted in a valid recipient.
14335 </para>
14336 </listitem></varlistentry>
14337 <varlistentry>
14338 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14339 <listitem>
14340 <para>
14341 <indexterm role="concept">
14342 <primary>expansion</primary>
14343 <secondary>re-expansion of substring</secondary>
14344 </indexterm>
14345 The <option>expand</option> operator causes a string to be expanded for a second time. For
14346 example,
14347 </para>
14348 <literallayout class="monospaced">
14349 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14350 </literallayout>
14351 <para>
14352 first looks up a string in a file while expanding the operand for <option>expand</option>,
14353 and then re-expands what it has found.
14354 </para>
14355 </listitem></varlistentry>
14356 <varlistentry>
14357 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14358 <listitem>
14359 <para>
14360 <indexterm role="concept">
14361 <primary>Unicode</primary>
14362 </indexterm>
14363 <indexterm role="concept">
14364 <primary>UTF-8</primary>
14365 <secondary>conversion from</secondary>
14366 </indexterm>
14367 <indexterm role="concept">
14368 <primary>expansion</primary>
14369 <secondary>UTF-8 conversion</secondary>
14370 </indexterm>
14371 <indexterm role="concept">
14372 <primary><option>from_utf8</option> expansion item</primary>
14373 </indexterm>
14374 The world is slowly moving towards Unicode, although there are no standards for
14375 email yet. However, other applications (including some databases) are starting
14376 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14377 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14378 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14379 the result is an undefined sequence of bytes.
14380 </para>
14381 <para>
14382 Unicode code points with values less than 256 are compatible with ASCII and
14383 ISO-8859-1 (also known as Latin-1).
14384 For example, character 169 is the copyright symbol in both cases, though the
14385 way it is encoded is different. In UTF-8, more than one byte is needed for
14386 characters with code values greater than 127, whereas ISO-8859-1 is a
14387 single-byte encoding (but thereby limited to 256 characters). This makes
14388 translation from UTF-8 to ISO-8859-1 straightforward.
14389 </para>
14390 </listitem></varlistentry>
14391 <varlistentry>
14392 <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>
14393 <listitem>
14394 <para>
14395 <indexterm role="concept">
14396 <primary>hash function</primary>
14397 <secondary>textual</secondary>
14398 </indexterm>
14399 <indexterm role="concept">
14400 <primary>expansion</primary>
14401 <secondary>textual hash</secondary>
14402 </indexterm>
14403 The <option>hash</option> operator is a simpler interface to the hashing function that can
14404 be used when the two parameters are fixed numbers (as opposed to strings that
14405 change when expanded). The effect is the same as
14406 </para>
14407 <literallayout class="monospaced">
14408 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14409 </literallayout>
14410 <para>
14411 See the description of the general <option>hash</option> item above for details. The
14412 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14413 </para>
14414 </listitem></varlistentry>
14415 <varlistentry>
14416 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14417 <listitem>
14418 <para>
14419 <indexterm role="concept">
14420 <primary>base64 encoding</primary>
14421 <secondary>conversion from hex</secondary>
14422 </indexterm>
14423 <indexterm role="concept">
14424 <primary>expansion</primary>
14425 <secondary>hex to base64</secondary>
14426 </indexterm>
14427 <indexterm role="concept">
14428 <primary><option>hex2b64</option> expansion item</primary>
14429 </indexterm>
14430 This operator converts a hex string into one that is base64 encoded. This can
14431 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14432 </para>
14433 </listitem></varlistentry>
14434 <varlistentry>
14435 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14436 <listitem>
14437 <para>
14438 <indexterm role="concept">
14439 <primary>case forcing in strings</primary>
14440 </indexterm>
14441 <indexterm role="concept">
14442 <primary>string</primary>
14443 <secondary>case forcing</secondary>
14444 </indexterm>
14445 <indexterm role="concept">
14446 <primary>lower casing</primary>
14447 </indexterm>
14448 <indexterm role="concept">
14449 <primary>expansion</primary>
14450 <secondary>case forcing</secondary>
14451 </indexterm>
14452 <indexterm role="concept">
14453 <primary><option>lc</option> expansion item</primary>
14454 </indexterm>
14455 This forces the letters in the string into lower-case, for example:
14456 </para>
14457 <literallayout class="monospaced">
14458 ${lc:$local_part}
14459 </literallayout>
14460 </listitem></varlistentry>
14461 <varlistentry>
14462 <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>
14463 <listitem>
14464 <para>
14465 <indexterm role="concept">
14466 <primary>expansion</primary>
14467 <secondary>string truncation</secondary>
14468 </indexterm>
14469 <indexterm role="concept">
14470 <primary><option>length</option> expansion item</primary>
14471 </indexterm>
14472 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14473 can be used when the parameter is a fixed number (as opposed to a string that
14474 changes when expanded). The effect is the same as
14475 </para>
14476 <literallayout class="monospaced">
14477 ${length{&lt;number&gt;}{&lt;string&gt;}}
14478 </literallayout>
14479 <para>
14480 See the description of the general <option>length</option> item above for details. Note that
14481 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14482 when <option>length</option> is used as an operator.
14483 </para>
14484 </listitem></varlistentry>
14485 <varlistentry>
14486 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14487 <listitem>
14488 <para>
14489 <indexterm role="concept">
14490 <primary>expansion</primary>
14491 <secondary>local part extraction</secondary>
14492 </indexterm>
14493 <indexterm role="concept">
14494 <primary><option>local_part</option> expansion item</primary>
14495 </indexterm>
14496 The string is interpreted as an RFC 2822 address and the local part is
14497 extracted from it. If the string does not parse successfully, the result is
14498 empty.
14499 </para>
14500 </listitem></varlistentry>
14501 <varlistentry>
14502 <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>
14503 <listitem>
14504 <para>
14505 <indexterm role="concept">
14506 <primary>masked IP address</primary>
14507 </indexterm>
14508 <indexterm role="concept">
14509 <primary>IP address</primary>
14510 <secondary>masking</secondary>
14511 </indexterm>
14512 <indexterm role="concept">
14513 <primary>CIDR notation</primary>
14514 </indexterm>
14515 <indexterm role="concept">
14516 <primary>expansion</primary>
14517 <secondary>IP address masking</secondary>
14518 </indexterm>
14519 <indexterm role="concept">
14520 <primary><option>mask</option> expansion item</primary>
14521 </indexterm>
14522 If the form of the string to be operated on is not an IP address followed by a
14523 slash and an integer (that is, a network address in CIDR notation), the
14524 expansion fails. Otherwise, this operator converts the IP address to binary,
14525 masks off the least significant bits according to the bit count, and converts
14526 the result back to text, with mask appended. For example,
14527 </para>
14528 <literallayout class="monospaced">
14529 ${mask:10.111.131.206/28}
14530 </literallayout>
14531 <para>
14532 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14533 be mostly used for looking up masked addresses in files, the result for an IPv6
14534 address uses dots to separate components instead of colons, because colon
14535 terminates a key string in lsearch files. So, for example,
14536 </para>
14537 <literallayout class="monospaced">
14538 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14539 </literallayout>
14540 <para>
14541 returns the string
14542 </para>
14543 <literallayout class="monospaced">
14544 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14545 </literallayout>
14546 <para>
14547 Letters in IPv6 addresses are always output in lower case.
14548 </para>
14549 </listitem></varlistentry>
14550 <varlistentry>
14551 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14552 <listitem>
14553 <para>
14554 <indexterm role="concept">
14555 <primary>MD5 hash</primary>
14556 </indexterm>
14557 <indexterm role="concept">
14558 <primary>expansion</primary>
14559 <secondary>MD5 hash</secondary>
14560 </indexterm>
14561 <indexterm role="concept">
14562 <primary><option>md5</option> expansion item</primary>
14563 </indexterm>
14564 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14565 as a 32-digit hexadecimal number, in which any letters are in lower case.
14566 </para>
14567 </listitem></varlistentry>
14568 <varlistentry>
14569 <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>
14570 <listitem>
14571 <para>
14572 <indexterm role="concept">
14573 <primary>expansion</primary>
14574 <secondary>numeric hash</secondary>
14575 </indexterm>
14576 <indexterm role="concept">
14577 <primary>hash function</primary>
14578 <secondary>numeric</secondary>
14579 </indexterm>
14580 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14581 that can be used when the two parameters are fixed numbers (as opposed to
14582 strings that change when expanded). The effect is the same as
14583 </para>
14584 <literallayout class="monospaced">
14585 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14586 </literallayout>
14587 <para>
14588 See the description of the general <option>nhash</option> item above for details.
14589 </para>
14590 </listitem></varlistentry>
14591 <varlistentry>
14592 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14593 <listitem>
14594 <para>
14595 <indexterm role="concept">
14596 <primary>quoting</primary>
14597 <secondary>in string expansions</secondary>
14598 </indexterm>
14599 <indexterm role="concept">
14600 <primary>expansion</primary>
14601 <secondary>quoting</secondary>
14602 </indexterm>
14603 <indexterm role="concept">
14604 <primary><option>quote</option> expansion item</primary>
14605 </indexterm>
14606 The <option>quote</option> operator puts its argument into double quotes if it
14607 is an empty string or
14608 contains anything other than letters, digits, underscores, dots, and hyphens.
14609 Any occurrences of double quotes and backslashes are escaped with a backslash.
14610 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14611 respectively For example,
14612 </para>
14613 <literallayout class="monospaced">
14614 ${quote:ab"*"cd}
14615 </literallayout>
14616 <para>
14617 becomes
14618 </para>
14619 <literallayout class="monospaced">
14620 "ab\"*\"cd"
14621 </literallayout>
14622 <para>
14623 The place where this is useful is when the argument is a substitution from a
14624 variable or a message header.
14625 </para>
14626 </listitem></varlistentry>
14627 <varlistentry>
14628 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14629 <listitem>
14630 <para>
14631 <indexterm role="concept">
14632 <primary><option>quote_local_part</option> expansion item</primary>
14633 </indexterm>
14634 This operator is like <option>quote</option>, except that it quotes the string only if
14635 required to do so by the rules of RFC 2822 for quoting local parts. For
14636 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14637 If you are creating a new email address from the contents of <varname>$local_part</varname>
14638 (or any other unknown data), you should always use this operator.
14639 </para>
14640 </listitem></varlistentry>
14641 <varlistentry>
14642 <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>
14643 <listitem>
14644 <para>
14645 <indexterm role="concept">
14646 <primary>quoting</primary>
14647 <secondary>lookup-specific</secondary>
14648 </indexterm>
14649 This operator applies lookup-specific quoting rules to the string. Each
14650 query-style lookup type has its own quoting rules which are described with
14651 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14652 </para>
14653 <literallayout class="monospaced">
14654 ${quote_ldap:two * two}
14655 </literallayout>
14656 <para>
14657 returns
14658 </para>
14659 <literallayout class="monospaced">
14660 two%20%5C2A%20two
14661 </literallayout>
14662 <para>
14663 For single-key lookup types, no quoting is ever necessary and this operator
14664 yields an unchanged string.
14665 </para>
14666 </listitem></varlistentry>
14667 <varlistentry>
14668 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14669 <listitem>
14670 <para>
14671 <indexterm role="concept">
14672 <primary>random number</primary>
14673 </indexterm>
14674 This operator returns a somewhat random number which is less than the
14675 supplied number and is at least 0.  The quality of this randomness depends
14676 on how Exim was built; the values are not suitable for keying material.
14677 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14678 </para>
14679 <para revisionflag="changed">
14680 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
14681 for versions of GnuTLS with that function.
14682 </para>
14683 <para>
14684 Otherwise, the implementation may be arc4random(), random() seeded by
14685 srandomdev() or srandom(), or a custom implementation even weaker than
14686 random().
14687 </para>
14688 </listitem></varlistentry>
14689 <varlistentry>
14690 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14691 <listitem>
14692 <para>
14693 <indexterm role="concept">
14694 <primary>expansion</primary>
14695 <secondary>IP address</secondary>
14696 </indexterm>
14697 This operator reverses an IP address; for IPv4 addresses, the result is in
14698 dotted-quad decimal form, while for IPv6 addreses the result is in
14699 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
14700 for DNS.  For example,
14701 </para>
14702 <literallayout class="monospaced">
14703 ${reverse_ip:192.0.2.4}
14704 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3}
14705 </literallayout>
14706 <para>
14707 returns
14708 </para>
14709 <literallayout class="monospaced">
14710 4.2.0.192
14711 3.0.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
14712 </literallayout>
14713 </listitem></varlistentry>
14714 <varlistentry>
14715 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14716 <listitem>
14717 <para>
14718 <indexterm role="concept">
14719 <primary>expansion</primary>
14720 <secondary>RFC 2047</secondary>
14721 </indexterm>
14722 <indexterm role="concept">
14723 <primary>RFC 2047</primary>
14724 <secondary>expansion operator</secondary>
14725 </indexterm>
14726 <indexterm role="concept">
14727 <primary><option>rfc2047</option> expansion item</primary>
14728 </indexterm>
14729 This operator encodes text according to the rules of RFC 2047. This is an
14730 encoding that is used in header lines to encode non-ASCII characters. It is
14731 assumed that the input string is in the encoding specified by the
14732 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14733 contains only characters in the range 33&ndash;126, and no instances of the
14734 characters
14735 </para>
14736 <literallayout class="monospaced">
14737 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14738 </literallayout>
14739 <para>
14740 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14741 string, using as many <quote>encoded words</quote> as necessary to encode all the
14742 characters.
14743 </para>
14744 </listitem></varlistentry>
14745 <varlistentry>
14746 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14747 <listitem>
14748 <para>
14749 <indexterm role="concept">
14750 <primary>expansion</primary>
14751 <secondary>RFC 2047</secondary>
14752 </indexterm>
14753 <indexterm role="concept">
14754 <primary>RFC 2047</primary>
14755 <secondary>decoding</secondary>
14756 </indexterm>
14757 <indexterm role="concept">
14758 <primary><option>rfc2047d</option> expansion item</primary>
14759 </indexterm>
14760 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14761 bytes are replaced by question marks. Characters are converted into the
14762 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14763 not recognized unless <option>check_rfc2047_length</option> is set false.
14764 </para>
14765 <para>
14766 <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
14767 access a header line, RFC 2047 decoding is done automatically. You do not need
14768 to use this operator as well.
14769 </para>
14770 </listitem></varlistentry>
14771 <varlistentry>
14772 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14773 <listitem>
14774 <para>
14775 <indexterm role="concept">
14776 <primary>quoting</primary>
14777 <secondary>in regular expressions</secondary>
14778 </indexterm>
14779 <indexterm role="concept">
14780 <primary>regular expressions</primary>
14781 <secondary>quoting</secondary>
14782 </indexterm>
14783 <indexterm role="concept">
14784 <primary><option>rxquote</option> expansion item</primary>
14785 </indexterm>
14786 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14787 characters in its argument. This is useful when substituting the values of
14788 variables or headers inside regular expressions.
14789 </para>
14790 </listitem></varlistentry>
14791 <varlistentry>
14792 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14793 <listitem>
14794 <para>
14795 <indexterm role="concept">
14796 <primary>SHA-1 hash</primary>
14797 </indexterm>
14798 <indexterm role="concept">
14799 <primary>expansion</primary>
14800 <secondary>SHA-1 hashing</secondary>
14801 </indexterm>
14802 <indexterm role="concept">
14803 <primary><option>sha2</option> expansion item</primary>
14804 </indexterm>
14805 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14806 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14807 </para>
14808 </listitem></varlistentry>
14809 <varlistentry>
14810 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14811 <listitem>
14812 <para>
14813 <indexterm role="concept">
14814 <primary>expansion</primary>
14815 <secondary>statting a file</secondary>
14816 </indexterm>
14817 <indexterm role="concept">
14818 <primary>file</primary>
14819 <secondary>extracting characteristics</secondary>
14820 </indexterm>
14821 <indexterm role="concept">
14822 <primary><option>stat</option> expansion item</primary>
14823 </indexterm>
14824 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14825 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14826 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14827 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14828 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14829 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14830 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14831 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14832 can extract individual fields using the <option>extract</option> expansion item.
14833 </para>
14834 <para>
14835 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14836 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14837 systems for files larger than 2GB.
14838 </para>
14839 </listitem></varlistentry>
14840 <varlistentry>
14841 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14842 <listitem>
14843 <para>
14844 <indexterm role="concept">
14845 <primary>expansion</primary>
14846 <secondary>base64 encoding</secondary>
14847 </indexterm>
14848 <indexterm role="concept">
14849 <primary>base64 encoding</primary>
14850 <secondary>in string expansion</secondary>
14851 </indexterm>
14852 <indexterm role="concept">
14853 <primary><option>str2b64</option> expansion item</primary>
14854 </indexterm>
14855 This operator converts a string into one that is base64 encoded.
14856 </para>
14857 </listitem></varlistentry>
14858 <varlistentry>
14859 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14860 <listitem>
14861 <para>
14862 <indexterm role="concept">
14863 <primary>expansion</primary>
14864 <secondary>string length</secondary>
14865 </indexterm>
14866 <indexterm role="concept">
14867 <primary>string</primary>
14868 <secondary>length in expansion</secondary>
14869 </indexterm>
14870 <indexterm role="concept">
14871 <primary><option>strlen</option> expansion item</primary>
14872 </indexterm>
14873 The item is replace by the length of the expanded string, expressed as a
14874 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14875 </para>
14876 </listitem></varlistentry>
14877 <varlistentry>
14878 <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>
14879 <listitem>
14880 <para>
14881 <indexterm role="concept">
14882 <primary><option>substr</option> expansion item</primary>
14883 </indexterm>
14884 <indexterm role="concept">
14885 <primary>substring extraction</primary>
14886 </indexterm>
14887 <indexterm role="concept">
14888 <primary>expansion</primary>
14889 <secondary>substring expansion</secondary>
14890 </indexterm>
14891 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14892 can be used when the two parameters are fixed numbers (as opposed to strings
14893 that change when expanded). The effect is the same as
14894 </para>
14895 <literallayout class="monospaced">
14896 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14897 </literallayout>
14898 <para>
14899 See the description of the general <option>substr</option> item above for details. The
14900 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14901 </para>
14902 </listitem></varlistentry>
14903 <varlistentry>
14904 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14905 <listitem>
14906 <para>
14907 <indexterm role="concept">
14908 <primary><option>time_eval</option> expansion item</primary>
14909 </indexterm>
14910 <indexterm role="concept">
14911 <primary>time interval</primary>
14912 <secondary>decoding</secondary>
14913 </indexterm>
14914 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14915 seconds.
14916 </para>
14917 </listitem></varlistentry>
14918 <varlistentry>
14919 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14920 <listitem>
14921 <para>
14922 <indexterm role="concept">
14923 <primary><option>time_interval</option> expansion item</primary>
14924 </indexterm>
14925 <indexterm role="concept">
14926 <primary>time interval</primary>
14927 <secondary>formatting</secondary>
14928 </indexterm>
14929 The argument (after sub-expansion) must be a sequence of decimal digits that
14930 represents an interval of time as a number of seconds. It is converted into a
14931 number of larger units and output in Exim&#x2019;s normal time format, for example,
14932 <literal>1w3d4h2m6s</literal>.
14933 </para>
14934 </listitem></varlistentry>
14935 <varlistentry>
14936 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14937 <listitem>
14938 <para>
14939 <indexterm role="concept">
14940 <primary>case forcing in strings</primary>
14941 </indexterm>
14942 <indexterm role="concept">
14943 <primary>string</primary>
14944 <secondary>case forcing</secondary>
14945 </indexterm>
14946 <indexterm role="concept">
14947 <primary>upper casing</primary>
14948 </indexterm>
14949 <indexterm role="concept">
14950 <primary>expansion</primary>
14951 <secondary>case forcing</secondary>
14952 </indexterm>
14953 <indexterm role="concept">
14954 <primary><option>uc</option> expansion item</primary>
14955 </indexterm>
14956 This forces the letters in the string into upper-case.
14957 </para>
14958 </listitem></varlistentry>
14959 </variablelist>
14960 </section>
14961 <section id="SECTexpcond">
14962 <title>Expansion conditions</title>
14963 <para>
14964 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14965 <primary>expansion</primary>
14966 <secondary>conditions</secondary>
14967 </indexterm>
14968 The following conditions are available for testing by the <option>${if</option> construct
14969 while expanding strings:
14970 </para>
14971 <variablelist>
14972 <varlistentry>
14973 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14974 <listitem>
14975 <para>
14976 <indexterm role="concept">
14977 <primary>expansion</primary>
14978 <secondary>negating a condition</secondary>
14979 </indexterm>
14980 <indexterm role="concept">
14981 <primary>negation</primary>
14982 <secondary>in expansion condition</secondary>
14983 </indexterm>
14984 Preceding any condition with an exclamation mark negates the result of the
14985 condition.
14986 </para>
14987 </listitem></varlistentry>
14988 <varlistentry>
14989 <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>
14990 <listitem>
14991 <para>
14992 <indexterm role="concept">
14993 <primary>numeric comparison</primary>
14994 </indexterm>
14995 <indexterm role="concept">
14996 <primary>expansion</primary>
14997 <secondary>numeric comparison</secondary>
14998 </indexterm>
14999 There are a number of symbolic operators for doing numeric comparisons. They
15000 are:
15001 </para>
15002 <literallayout>
15003 <literal>=   </literal>   equal
15004 <literal>==  </literal>   equal
15005 <literal>&gt;   </literal>   greater
15006 <literal>&gt;=  </literal>   greater or equal
15007 <literal>&lt;   </literal>   less
15008 <literal>&lt;=  </literal>   less or equal
15009 </literallayout>
15010 <para>
15011 For example:
15012 </para>
15013 <literallayout class="monospaced">
15014 ${if &gt;{$message_size}{10M} ...
15015 </literallayout>
15016 <para>
15017 Note that the general negation operator provides for inequality testing. The
15018 two strings must take the form of optionally signed decimal integers,
15019 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
15020 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
15021 As a special case, the numerical value of an empty string is taken as
15022 zero.
15023 </para>
15024 <para>
15025 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15026 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15027 10M, not if 10M is larger than <varname>$message_size</varname>.
15028 </para>
15029 </listitem></varlistentry>
15030 <varlistentry>
15031 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15032 <listitem>
15033 <para>
15034 <indexterm role="concept">
15035 <primary>expansion</primary>
15036 <secondary>boolean parsing</secondary>
15037 </indexterm>
15038 <indexterm role="concept">
15039 <primary><option>bool</option> expansion condition</primary>
15040 </indexterm>
15041 This condition turns a string holding a true or false representation into
15042 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15043 (case-insensitively); also positive integer numbers map to true if non-zero,
15044 false if zero.
15045 An empty string is treated as false.
15046 Leading and trailing whitespace is ignored;
15047 thus a string consisting only of whitespace is false.
15048 All other string values will result in expansion failure.
15049 </para>
15050 <para>
15051 When combined with ACL variables, this expansion condition will let you
15052 make decisions in one place and act on those decisions in another place.
15053 For example:
15054 </para>
15055 <literallayout class="monospaced">
15056 ${if bool{$acl_m_privileged_sender} ...
15057 </literallayout>
15058 </listitem></varlistentry>
15059 <varlistentry>
15060 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15061 <listitem>
15062 <para>
15063 <indexterm role="concept">
15064 <primary>expansion</primary>
15065 <secondary>boolean parsing</secondary>
15066 </indexterm>
15067 <indexterm role="concept">
15068 <primary><option>bool_lax</option> expansion condition</primary>
15069 </indexterm>
15070 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15071 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15072 loose definition that the Router <option>condition</option> option uses.  The empty string
15073 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15074 true.  Leading and trailing whitespace is ignored.
15075 </para>
15076 <para>
15077 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15078 </para>
15079 </listitem></varlistentry>
15080 <varlistentry>
15081 <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>
15082 <listitem>
15083 <para>
15084 <indexterm role="concept">
15085 <primary>expansion</primary>
15086 <secondary>encrypted comparison</secondary>
15087 </indexterm>
15088 <indexterm role="concept">
15089 <primary>encrypted strings, comparing</primary>
15090 </indexterm>
15091 <indexterm role="concept">
15092 <primary><option>crypteq</option> expansion condition</primary>
15093 </indexterm>
15094 This condition is included in the Exim binary if it is built to support any
15095 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15096 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15097 included in the binary.
15098 </para>
15099 <para>
15100 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15101 compared against the second, which is already encrypted. The second string may
15102 be in the LDAP form for storing encrypted strings, which starts with the
15103 encryption type in curly brackets, followed by the data. If the second string
15104 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15105 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15106 Typically this will be a field from a password file. An example of an encrypted
15107 string in LDAP form is:
15108 </para>
15109 <literallayout class="monospaced">
15110 {md5}CY9rzUYh03PK3k6DJie09g==
15111 </literallayout>
15112 <para>
15113 If such a string appears directly in an expansion, the curly brackets have to
15114 be quoted, because they are part of the expansion syntax. For example:
15115 </para>
15116 <literallayout class="monospaced">
15117 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15118 </literallayout>
15119 <para>
15120 The following encryption types (whose names are matched case-independently) are
15121 supported:
15122 </para>
15123 <itemizedlist>
15124 <listitem>
15125 <para>
15126 <indexterm role="concept">
15127 <primary>MD5 hash</primary>
15128 </indexterm>
15129 <indexterm role="concept">
15130 <primary>base64 encoding</primary>
15131 <secondary>in encrypted password</secondary>
15132 </indexterm>
15133 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15134 printable characters to compare with the remainder of the second string. If the
15135 length of the comparison string is 24, Exim assumes that it is base64 encoded
15136 (as in the above example). If the length is 32, Exim assumes that it is a
15137 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15138 comparison fails.
15139 </para>
15140 </listitem>
15141 <listitem>
15142 <para>
15143 <indexterm role="concept">
15144 <primary>SHA-1 hash</primary>
15145 </indexterm>
15146 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15147 printable characters to compare with the remainder of the second string. If the
15148 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15149 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15150 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15151 </para>
15152 </listitem>
15153 <listitem>
15154 <para>
15155 <indexterm role="concept">
15156 <primary><function>crypt()</function></primary>
15157 </indexterm>
15158 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15159 only the first eight characters of the password. However, in modern operating
15160 systems this is no longer true, and in many cases the entire password is used,
15161 whatever its length.
15162 </para>
15163 </listitem>
15164 <listitem>
15165 <para>
15166 <indexterm role="concept">
15167 <primary><function>crypt16()</function></primary>
15168 </indexterm>
15169 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15170 use up to 16 characters of the password in some operating systems. Again, in
15171 modern operating systems, more characters may be used.
15172 </para>
15173 </listitem>
15174 </itemizedlist>
15175 <para>
15176 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15177 <function>crypt()</function>. For operating systems that have their own version, setting
15178 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15179 operating system version instead of its own. This option is set by default in
15180 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15181 support <function>crypt16()</function>.
15182 </para>
15183 <para>
15184 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15185 it was not using the same algorithm as some operating systems&#x2019; versions. It
15186 turns out that as well as <function>crypt16()</function> there is a function called
15187 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15188 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15189 </para>
15190 <para>
15191 However, since there is now a move away from the traditional <function>crypt()</function>
15192 functions towards using SHA1 and other algorithms, tidying up this area of
15193 Exim is seen as very low priority.
15194 </para>
15195 <para>
15196 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15197 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15198 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15199 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15200 function by specifying it explicitly in curly brackets.
15201 </para>
15202 </listitem></varlistentry>
15203 <varlistentry>
15204 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15205 <listitem>
15206 <para>
15207 <indexterm role="concept">
15208 <primary>expansion</primary>
15209 <secondary>checking for empty variable</secondary>
15210 </indexterm>
15211 <indexterm role="concept">
15212 <primary><option>def</option> expansion condition</primary>
15213 </indexterm>
15214 The <option>def</option> condition must be followed by the name of one of the expansion
15215 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15216 variable does not contain the empty string. For example:
15217 </para>
15218 <literallayout class="monospaced">
15219 ${if def:sender_ident {from $sender_ident}}
15220 </literallayout>
15221 <para>
15222 Note that the variable name is given without a leading <option>$</option> character. If the
15223 variable does not exist, the expansion fails.
15224 </para>
15225 </listitem></varlistentry>
15226 <varlistentry>
15227 <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>
15228 <listitem>
15229 <para>
15230 <indexterm role="concept">
15231 <primary>expansion</primary>
15232 <secondary>checking header line existence</secondary>
15233 </indexterm>
15234 This condition is true if a message is being processed and the named header
15235 exists in the message. For example,
15236 </para>
15237 <literallayout class="monospaced">
15238 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15239 </literallayout>
15240 <para>
15241 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15242 the header name must be terminated by a colon if white space does not follow.
15243 </para>
15244 </listitem></varlistentry>
15245 <varlistentry>
15246 <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>
15247 <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>
15248 <listitem>
15249 <para>
15250 <indexterm role="concept">
15251 <primary>string</primary>
15252 <secondary>comparison</secondary>
15253 </indexterm>
15254 <indexterm role="concept">
15255 <primary>expansion</primary>
15256 <secondary>string comparison</secondary>
15257 </indexterm>
15258 <indexterm role="concept">
15259 <primary><option>eq</option> expansion condition</primary>
15260 </indexterm>
15261 <indexterm role="concept">
15262 <primary><option>eqi</option> expansion condition</primary>
15263 </indexterm>
15264 The two substrings are first expanded. The condition is true if the two
15265 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15266 letters, whereas for <option>eqi</option> the comparison is case-independent.
15267 </para>
15268 </listitem></varlistentry>
15269 <varlistentry>
15270 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15271 <listitem>
15272 <para>
15273 <indexterm role="concept">
15274 <primary>expansion</primary>
15275 <secondary>file existence test</secondary>
15276 </indexterm>
15277 <indexterm role="concept">
15278 <primary>file</primary>
15279 <secondary>existence test</secondary>
15280 </indexterm>
15281 <indexterm role="concept">
15282 <primary><option>exists</option>, expansion condition</primary>
15283 </indexterm>
15284 The substring is first expanded and then interpreted as an absolute path. The
15285 condition is true if the named file (or directory) exists. The existence test
15286 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15287 users&#x2019; filter files may be locked out by the system administrator.
15288 </para>
15289 </listitem></varlistentry>
15290 <varlistentry>
15291 <term><emphasis role="bold">first_delivery</emphasis></term>
15292 <listitem>
15293 <para>
15294 <indexterm role="concept">
15295 <primary>delivery</primary>
15296 <secondary>first</secondary>
15297 </indexterm>
15298 <indexterm role="concept">
15299 <primary>first delivery</primary>
15300 </indexterm>
15301 <indexterm role="concept">
15302 <primary>expansion</primary>
15303 <secondary>first delivery test</secondary>
15304 </indexterm>
15305 <indexterm role="concept">
15306 <primary><option>first_delivery</option> expansion condition</primary>
15307 </indexterm>
15308 This condition, which has no data, is true during a message&#x2019;s first delivery
15309 attempt. It is false during any subsequent delivery attempts.
15310 </para>
15311 </listitem></varlistentry>
15312 <varlistentry>
15313 <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>
15314 <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>
15315 <listitem>
15316 <para>
15317 <indexterm role="concept">
15318 <primary>list</primary>
15319 <secondary>iterative conditions</secondary>
15320 </indexterm>
15321 <indexterm role="concept">
15322 <primary>expansion</primary>
15323 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15324 </indexterm>
15325 <indexterm role="concept">
15326 <primary>expansion</primary>
15327 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15328 </indexterm>
15329 <indexterm role="variable">
15330 <primary><varname>$item</varname></primary>
15331 </indexterm>
15332 These conditions iterate over a list. The first argument is expanded to form
15333 the list. By default, the list separator is a colon, but it can be changed by
15334 the normal method. The second argument is interpreted as a condition that is to
15335 be applied to each item in the list in turn. During the interpretation of the
15336 condition, the current list item is placed in a variable called <varname>$item</varname>.
15337 </para>
15338 <itemizedlist>
15339 <listitem>
15340 <para>
15341 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15342 the result of the whole condition is true. If the condition is false for all
15343 items in the list, the overall condition is false.
15344 </para>
15345 </listitem>
15346 <listitem>
15347 <para>
15348 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15349 and the result of the whole condition is false. If the condition is true for
15350 all items in the list, the overall condition is true.
15351 </para>
15352 </listitem>
15353 </itemizedlist>
15354 <para>
15355 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15356 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15357 that the condition must be false for at least one item. In this example, the
15358 list separator is changed to a comma:
15359 </para>
15360 <literallayout class="monospaced">
15361 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15362 </literallayout>
15363 <para>
15364 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15365 being processed, to enable these expansion items to be nested.
15366 </para>
15367 </listitem></varlistentry>
15368 <varlistentry>
15369 <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>
15370 <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>
15371 <listitem>
15372 <para>
15373 <indexterm role="concept">
15374 <primary>string</primary>
15375 <secondary>comparison</secondary>
15376 </indexterm>
15377 <indexterm role="concept">
15378 <primary>expansion</primary>
15379 <secondary>string comparison</secondary>
15380 </indexterm>
15381 <indexterm role="concept">
15382 <primary><option>ge</option> expansion condition</primary>
15383 </indexterm>
15384 <indexterm role="concept">
15385 <primary><option>gei</option> expansion condition</primary>
15386 </indexterm>
15387 The two substrings are first expanded. The condition is true if the first
15388 string is lexically greater than or equal to the second string. For <option>ge</option> the
15389 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15390 case-independent.
15391 </para>
15392 </listitem></varlistentry>
15393 <varlistentry>
15394 <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>
15395 <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>
15396 <listitem>
15397 <para>
15398 <indexterm role="concept">
15399 <primary>string</primary>
15400 <secondary>comparison</secondary>
15401 </indexterm>
15402 <indexterm role="concept">
15403 <primary>expansion</primary>
15404 <secondary>string comparison</secondary>
15405 </indexterm>
15406 <indexterm role="concept">
15407 <primary><option>gt</option> expansion condition</primary>
15408 </indexterm>
15409 <indexterm role="concept">
15410 <primary><option>gti</option> expansion condition</primary>
15411 </indexterm>
15412 The two substrings are first expanded. The condition is true if the first
15413 string is lexically greater than the second string. For <option>gt</option> the comparison
15414 includes the case of letters, whereas for <option>gti</option> the comparison is
15415 case-independent.
15416 </para>
15417 </listitem></varlistentry>
15418 <varlistentry revisionflag="changed">
15419 <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>
15420 <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>
15421 <listitem>
15422 <para revisionflag="changed">
15423 <indexterm role="concept">
15424 <primary>string</primary>
15425 <secondary>comparison</secondary>
15426 </indexterm>
15427 <indexterm role="concept">
15428 <primary>list</primary>
15429 <secondary>iterative conditions</secondary>
15430 </indexterm>
15431 Both strings are expanded; the second string is treated as a list of simple
15432 strings; if the first string is a member of the second, then the condition
15433 is true.
15434 </para>
15435 <para revisionflag="changed">
15436 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
15437 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
15438 </para>
15439 <literallayout class="monospaced" revisionflag="changed">
15440 ${if inlist{needle}{foo:needle:bar}}
15441   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
15442 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
15443   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
15444 </literallayout>
15445 </listitem></varlistentry>
15446 <varlistentry>
15447 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15448 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15449 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15450 <listitem>
15451 <para>
15452 <indexterm role="concept">
15453 <primary>IP address</primary>
15454 <secondary>testing string format</secondary>
15455 </indexterm>
15456 <indexterm role="concept">
15457 <primary>string</primary>
15458 <secondary>testing for IP address</secondary>
15459 </indexterm>
15460 <indexterm role="concept">
15461 <primary><option>isip</option> expansion condition</primary>
15462 </indexterm>
15463 <indexterm role="concept">
15464 <primary><option>isip4</option> expansion condition</primary>
15465 </indexterm>
15466 <indexterm role="concept">
15467 <primary><option>isip6</option> expansion condition</primary>
15468 </indexterm>
15469 The substring is first expanded, and then tested to see if it has the form of
15470 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15471 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15472 </para>
15473 <para>
15474 For an IPv4 address, the test is for four dot-separated components, each of
15475 which consists of from one to three digits. For an IPv6 address, up to eight
15476 colon-separated components are permitted, each containing from one to four
15477 hexadecimal digits. There may be fewer than eight components if an empty
15478 component (adjacent colons) is present. Only one empty component is permitted.
15479 </para>
15480 <para>
15481 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15482 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15483 check. The main use of these tests is to distinguish between IP addresses and
15484 host names, or between IPv4 and IPv6 addresses. For example, you could use
15485 </para>
15486 <literallayout class="monospaced">
15487 ${if isip4{$sender_host_address}...
15488 </literallayout>
15489 <para>
15490 to test which IP version an incoming SMTP connection is using.
15491 </para>
15492 </listitem></varlistentry>
15493 <varlistentry>
15494 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15495 <listitem>
15496 <para>
15497 <indexterm role="concept">
15498 <primary>LDAP</primary>
15499 <secondary>use for authentication</secondary>
15500 </indexterm>
15501 <indexterm role="concept">
15502 <primary>expansion</primary>
15503 <secondary>LDAP authentication test</secondary>
15504 </indexterm>
15505 <indexterm role="concept">
15506 <primary><option>ldapauth</option> expansion condition</primary>
15507 </indexterm>
15508 This condition supports user authentication using LDAP. See section
15509 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15510 queries. For this use, the query must contain a user name and password. The
15511 query itself is not used, and can be empty. The condition is true if the
15512 password is not empty, and the user name and password are accepted by the LDAP
15513 server. An empty password is rejected without calling LDAP because LDAP binds
15514 with an empty password are considered anonymous regardless of the username, and
15515 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15516 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15517 this can be used.
15518 </para>
15519 </listitem></varlistentry>
15520 <varlistentry>
15521 <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>
15522 <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>
15523 <listitem>
15524 <para>
15525 <indexterm role="concept">
15526 <primary>string</primary>
15527 <secondary>comparison</secondary>
15528 </indexterm>
15529 <indexterm role="concept">
15530 <primary>expansion</primary>
15531 <secondary>string comparison</secondary>
15532 </indexterm>
15533 <indexterm role="concept">
15534 <primary><option>le</option> expansion condition</primary>
15535 </indexterm>
15536 <indexterm role="concept">
15537 <primary><option>lei</option> expansion condition</primary>
15538 </indexterm>
15539 The two substrings are first expanded. The condition is true if the first
15540 string is lexically less than or equal to the second string. For <option>le</option> the
15541 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15542 case-independent.
15543 </para>
15544 </listitem></varlistentry>
15545 <varlistentry>
15546 <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>
15547 <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>
15548 <listitem>
15549 <para>
15550 <indexterm role="concept">
15551 <primary>string</primary>
15552 <secondary>comparison</secondary>
15553 </indexterm>
15554 <indexterm role="concept">
15555 <primary>expansion</primary>
15556 <secondary>string comparison</secondary>
15557 </indexterm>
15558 <indexterm role="concept">
15559 <primary><option>lt</option> expansion condition</primary>
15560 </indexterm>
15561 <indexterm role="concept">
15562 <primary><option>lti</option> expansion condition</primary>
15563 </indexterm>
15564 The two substrings are first expanded. The condition is true if the first
15565 string is lexically less than the second string. For <option>lt</option> the comparison
15566 includes the case of letters, whereas for <option>lti</option> the comparison is
15567 case-independent.
15568 </para>
15569 </listitem></varlistentry>
15570 <varlistentry>
15571 <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>
15572 <listitem>
15573 <para>
15574 <indexterm role="concept">
15575 <primary>expansion</primary>
15576 <secondary>regular expression comparison</secondary>
15577 </indexterm>
15578 <indexterm role="concept">
15579 <primary>regular expressions</primary>
15580 <secondary>match in expanded string</secondary>
15581 </indexterm>
15582 <indexterm role="concept">
15583 <primary><option>match</option> expansion condition</primary>
15584 </indexterm>
15585 The two substrings are first expanded. The second is then treated as a regular
15586 expression and applied to the first. Because of the pre-expansion, if the
15587 regular expression contains dollar, or backslash characters, they must be
15588 escaped. Care must also be taken if the regular expression contains braces
15589 (curly brackets). A closing brace must be escaped so that it is not taken as a
15590 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15591 <literal>\N</literal> feature to disable expansion of the regular expression.
15592 For example,
15593 </para>
15594 <literallayout class="monospaced">
15595 ${if match {$local_part}{\N^\d{3}\N} ...
15596 </literallayout>
15597 <para>
15598 If the whole expansion string is in double quotes, further escaping of
15599 backslashes is also required.
15600 </para>
15601 <para>
15602 The condition is true if the regular expression match succeeds.
15603 The regular expression is not required to begin with a circumflex
15604 metacharacter, but if there is no circumflex, the expression is not anchored,
15605 and it may match anywhere in the subject, not just at the start. If you want
15606 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15607 metacharacter at an appropriate point.
15608 </para>
15609 <para>
15610 <indexterm role="concept">
15611 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15612 <secondary>in <option>if</option> expansion</secondary>
15613 </indexterm>
15614 At the start of an <option>if</option> expansion the values of the numeric variable
15615 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15616 succeeds causes them to be reset to the substrings of that condition and they
15617 will have these values during the expansion of the success string. At the end
15618 of the <option>if</option> expansion, the previous values are restored. After testing a
15619 combination of conditions using <option>or</option>, the subsequent values of the numeric
15620 variables are those of the condition that succeeded.
15621 </para>
15622 </listitem></varlistentry>
15623 <varlistentry>
15624 <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>
15625 <listitem>
15626 <para>
15627 <indexterm role="concept">
15628 <primary><option>match_address</option> expansion condition</primary>
15629 </indexterm>
15630 See <emphasis role="bold">match_local_part</emphasis>.
15631 </para>
15632 </listitem></varlistentry>
15633 <varlistentry>
15634 <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>
15635 <listitem>
15636 <para>
15637 <indexterm role="concept">
15638 <primary><option>match_domain</option> expansion condition</primary>
15639 </indexterm>
15640 See <emphasis role="bold">match_local_part</emphasis>.
15641 </para>
15642 </listitem></varlistentry>
15643 <varlistentry>
15644 <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>
15645 <listitem>
15646 <para>
15647 <indexterm role="concept">
15648 <primary><option>match_ip</option> expansion condition</primary>
15649 </indexterm>
15650 </para>
15651 <para revisionflag="changed">
15652 This condition matches an IP address to a list of IP address patterns. It must
15653 be followed by two argument strings. The first (after expansion) must be an IP
15654 address or an empty string. The second (not expanded) is a restricted host
15655 list that can match only an IP address, not a host name. For example:
15656 </para>
15657 <literallayout class="monospaced">
15658 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15659 </literallayout>
15660 <para>
15661 The specific types of host list item that are permitted in the list are:
15662 </para>
15663 <itemizedlist>
15664 <listitem>
15665 <para>
15666 An IP address, optionally with a CIDR mask.
15667 </para>
15668 </listitem>
15669 <listitem>
15670 <para>
15671 A single asterisk, which matches any IP address.
15672 </para>
15673 </listitem>
15674 <listitem>
15675 <para>
15676 An empty item, which matches only if the IP address is empty. This could be
15677 useful for testing for a locally submitted message or one from specific hosts
15678 in a single test such as
15679 </para>
15680 <literallayout class="monospaced">
15681   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15682 </literallayout>
15683 <para>
15684 where the first item in the list is the empty string.
15685 </para>
15686 </listitem>
15687 <listitem>
15688 <para>
15689 The item @[] matches any of the local host&#x2019;s interface addresses.
15690 </para>
15691 </listitem>
15692 <listitem>
15693 <para>
15694 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15695 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15696 address into a host name. The most common type of linear search for
15697 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15698 masks. For example:
15699 </para>
15700 <literallayout class="monospaced">
15701   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15702 </literallayout>
15703 <para>
15704 It is of course possible to use other kinds of lookup, and in such a case, you
15705 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15706 address mask, for example:
15707 </para>
15708 <literallayout class="monospaced">
15709   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15710 </literallayout>
15711 <para>
15712 However, unless you are combining a <option>match_ip</option> condition with others, it is
15713 just as easy to use the fact that a lookup is itself a condition, and write:
15714 </para>
15715 <literallayout class="monospaced">
15716   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15717 </literallayout>
15718 </listitem>
15719 </itemizedlist>
15720 <para revisionflag="changed">
15721 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
15722 Exim was built with the EXPAND_LISTMATCH_RHS option.
15723 </para>
15724 <para>
15725 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15726 </para>
15727 </listitem></varlistentry>
15728 <varlistentry>
15729 <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>
15730 <listitem>
15731 <para>
15732 <indexterm role="concept">
15733 <primary>domain list</primary>
15734 <secondary>in expansion condition</secondary>
15735 </indexterm>
15736 <indexterm role="concept">
15737 <primary>address list</primary>
15738 <secondary>in expansion condition</secondary>
15739 </indexterm>
15740 <indexterm role="concept">
15741 <primary>local part</primary>
15742 <secondary>list, in expansion condition</secondary>
15743 </indexterm>
15744 <indexterm role="concept">
15745 <primary><option>match_local_part</option> expansion condition</primary>
15746 </indexterm>
15747 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15748 possible to test domain, address, and local part lists within expansions. Each
15749 condition requires two arguments: an item and a list to match. A trivial
15750 example is:
15751 </para>
15752 <literallayout class="monospaced">
15753 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15754 </literallayout>
15755 <para>
15756 In each case, the second argument may contain any of the allowable items for a
15757 list of the appropriate type. Also, because the second argument (after
15758 expansion) is a standard form of list, it is possible to refer to a named list.
15759 Thus, you can use conditions like this:
15760 </para>
15761 <literallayout class="monospaced">
15762 ${if match_domain{$domain}{+local_domains}{...
15763 </literallayout>
15764 <para>
15765 <indexterm role="concept">
15766 <primary><literal>+caseful</literal></primary>
15767 </indexterm>
15768 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15769 item can be used, as in all address lists, to cause subsequent items to
15770 have their local parts matched casefully. Domains are always matched
15771 caselessly.
15772 </para>
15773 <para revisionflag="changed">
15774 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
15775 Exim was built with the EXPAND_LISTMATCH_RHS option.
15776 </para>
15777 <para>
15778 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15779 hosts have two identities: a name and an IP address, and it is not clear
15780 how to specify cleanly how such a test would work. However, IP addresses can be
15781 matched using <option>match_ip</option>.
15782 </para>
15783 </listitem></varlistentry>
15784 <varlistentry>
15785 <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>
15786 <listitem>
15787 <para>
15788 <indexterm role="concept">
15789 <primary>PAM authentication</primary>
15790 </indexterm>
15791 <indexterm role="concept">
15792 <primary>AUTH</primary>
15793 <secondary>with PAM</secondary>
15794 </indexterm>
15795 <indexterm role="concept">
15796 <primary>Solaris</primary>
15797 <secondary>PAM support</secondary>
15798 </indexterm>
15799 <indexterm role="concept">
15800 <primary>expansion</primary>
15801 <secondary>PAM authentication test</secondary>
15802 </indexterm>
15803 <indexterm role="concept">
15804 <primary><option>pam</option> expansion condition</primary>
15805 </indexterm>
15806 <emphasis>Pluggable Authentication Modules</emphasis>
15807 (<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
15808 available in the latest releases of Solaris and in some GNU/Linux
15809 distributions. The Exim support, which is intended for use in conjunction with
15810 the SMTP AUTH command, is available only if Exim is compiled with
15811 </para>
15812 <literallayout class="monospaced">
15813 SUPPORT_PAM=yes
15814 </literallayout>
15815 <para>
15816 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15817 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15818 </para>
15819 <para>
15820 The argument string is first expanded, and the result must be a
15821 colon-separated list of strings. Leading and trailing white space is ignored.
15822 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15823 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15824 The remaining items in the data string are passed over in response to requests
15825 from the authentication function. In the simple case there will only be one
15826 request, for a password, so the data consists of just two strings.
15827 </para>
15828 <para>
15829 There can be problems if any of the strings are permitted to contain colon
15830 characters. In the usual way, these have to be doubled to avoid being taken as
15831 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15832 item can be used to double any existing colons. For example, the configuration
15833 of a LOGIN authenticator might contain this setting:
15834 </para>
15835 <literallayout class="monospaced">
15836 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15837 </literallayout>
15838 <para>
15839 For a PLAIN authenticator you could use:
15840 </para>
15841 <literallayout class="monospaced">
15842 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15843 </literallayout>
15844 <para>
15845 In some operating systems, PAM authentication can be done only from a process
15846 running as root. Since Exim is running as the Exim user when receiving
15847 messages, this means that PAM cannot be used directly in those systems.
15848 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15849 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>.
15850 The patched module allows one special uid/gid combination, in addition to root,
15851 to authenticate. If you build the patched module to allow the Exim user and
15852 group, PAM can then be used from an Exim authenticator.
15853 </para>
15854 </listitem></varlistentry>
15855 <varlistentry>
15856 <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>
15857 <listitem>
15858 <para>
15859 <indexterm role="concept">
15860 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15861 </indexterm>
15862 <indexterm role="concept">
15863 <primary>Cyrus</primary>
15864 </indexterm>
15865 <indexterm role="concept">
15866 <primary>expansion</primary>
15867 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15868 </indexterm>
15869 <indexterm role="concept">
15870 <primary><option>pwcheck</option> expansion condition</primary>
15871 </indexterm>
15872 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15873 This is one way of making it possible for passwords to be checked by a process
15874 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15875 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15876 </para>
15877 <para>
15878 The pwcheck support is not included in Exim by default. You need to specify
15879 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15880 building Exim. For example:
15881 </para>
15882 <literallayout class="monospaced">
15883 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15884 </literallayout>
15885 <para>
15886 You do not need to install the full Cyrus software suite in order to use
15887 the pwcheck daemon. You can compile and install just the daemon alone
15888 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15889 access to the <filename>/var/pwcheck</filename> directory.
15890 </para>
15891 <para>
15892 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15893 password, separated by a colon. For example, in a LOGIN authenticator
15894 configuration, you might have this:
15895 </para>
15896 <literallayout class="monospaced">
15897 server_condition = ${if pwcheck{$auth1:$auth2}}
15898 </literallayout>
15899 <para>
15900 Again, for a PLAIN authenticator configuration, this would be:
15901 </para>
15902 <literallayout class="monospaced">
15903 server_condition = ${if pwcheck{$auth2:$auth3}}
15904 </literallayout>
15905 </listitem></varlistentry>
15906 <varlistentry>
15907 <term><emphasis role="bold">queue_running</emphasis></term>
15908 <listitem>
15909 <para>
15910 <indexterm role="concept">
15911 <primary>queue runner</primary>
15912 <secondary>detecting when delivering from</secondary>
15913 </indexterm>
15914 <indexterm role="concept">
15915 <primary>expansion</primary>
15916 <secondary>queue runner test</secondary>
15917 </indexterm>
15918 <indexterm role="concept">
15919 <primary><option>queue_running</option> expansion condition</primary>
15920 </indexterm>
15921 This condition, which has no data, is true during delivery attempts that are
15922 initiated by queue runner processes, and false otherwise.
15923 </para>
15924 </listitem></varlistentry>
15925 <varlistentry>
15926 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15927 <listitem>
15928 <para>
15929 <indexterm role="concept">
15930 <primary>Radius</primary>
15931 </indexterm>
15932 <indexterm role="concept">
15933 <primary>expansion</primary>
15934 <secondary>Radius authentication</secondary>
15935 </indexterm>
15936 <indexterm role="concept">
15937 <primary><option>radius</option> expansion condition</primary>
15938 </indexterm>
15939 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15940 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15941 the Radius client configuration file in order to build Exim with Radius
15942 support.
15943 </para>
15944 <para>
15945 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15946 library, using the original API. If you are using release 0.4.0 or later of
15947 this library, you need to set
15948 </para>
15949 <literallayout class="monospaced">
15950 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15951 </literallayout>
15952 <para>
15953 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15954 <option>libradius</option> library that comes with FreeBSD. To do this, set
15955 </para>
15956 <literallayout class="monospaced">
15957 RADIUS_LIB_TYPE=RADLIB
15958 </literallayout>
15959 <para>
15960 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15961 You may also have to supply a suitable setting in EXTRALIBS so that the
15962 Radius library can be found when Exim is linked.
15963 </para>
15964 <para>
15965 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15966 Radius client library, which calls the Radius server. The condition is true if
15967 the authentication is successful. For example:
15968 </para>
15969 <literallayout class="monospaced">
15970 server_condition = ${if radius{&lt;arguments&gt;}}
15971 </literallayout>
15972 </listitem></varlistentry>
15973 <varlistentry>
15974 <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>
15975 <listitem>
15976 <para>
15977 <indexterm role="concept">
15978 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15979 </indexterm>
15980 <indexterm role="concept">
15981 <primary>Cyrus</primary>
15982 </indexterm>
15983 <indexterm role="concept">
15984 <primary>expansion</primary>
15985 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15986 </indexterm>
15987 <indexterm role="concept">
15988 <primary><option>saslauthd</option> expansion condition</primary>
15989 </indexterm>
15990 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15991 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15992 Using this daemon is one way of making it possible for passwords to be checked
15993 by a process that is not running as root.
15994 </para>
15995 <para>
15996 The saslauthd support is not included in Exim by default. You need to specify
15997 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15998 building Exim. For example:
15999 </para>
16000 <literallayout class="monospaced">
16001 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16002 </literallayout>
16003 <para>
16004 You do not need to install the full Cyrus software suite in order to use
16005 the saslauthd daemon. You can compile and install just the daemon alone
16006 from the Cyrus SASL library.
16007 </para>
16008 <para>
16009 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16010 two are mandatory. For example:
16011 </para>
16012 <literallayout class="monospaced">
16013 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16014 </literallayout>
16015 <para>
16016 The service and the realm are optional (which is why the arguments are enclosed
16017 in their own set of braces). For details of the meaning of the service and
16018 realm, and how to run the daemon, consult the Cyrus documentation.
16019 </para>
16020 </listitem></varlistentry>
16021 </variablelist>
16022 </section>
16023 <section id="SECID84">
16024 <title>Combining expansion conditions</title>
16025 <para>
16026 <indexterm role="concept">
16027 <primary>expansion</primary>
16028 <secondary>combining conditions</secondary>
16029 </indexterm>
16030 Several conditions can be tested at once by combining them using the <option>and</option>
16031 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16032 conditions on their own, and precede their lists of sub-conditions. Each
16033 sub-condition must be enclosed in braces within the overall braces that contain
16034 the list. No repetition of <option>if</option> is used.
16035 </para>
16036 <variablelist>
16037 <varlistentry>
16038 <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>
16039 <listitem>
16040 <para>
16041 <indexterm role="concept">
16042 <primary><quote>or</quote> expansion condition</primary>
16043 </indexterm>
16044 <indexterm role="concept">
16045 <primary>expansion</primary>
16046 <secondary><quote>or</quote> of conditions</secondary>
16047 </indexterm>
16048 The sub-conditions are evaluated from left to right. The condition is true if
16049 any one of the sub-conditions is true.
16050 For example,
16051 </para>
16052 <literallayout class="monospaced">
16053 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16054 </literallayout>
16055 <para>
16056 When a true sub-condition is found, the following ones are parsed but not
16057 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16058 numeric variables afterwards are taken from the first one that succeeds.
16059 </para>
16060 </listitem></varlistentry>
16061 <varlistentry>
16062 <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>
16063 <listitem>
16064 <para>
16065 <indexterm role="concept">
16066 <primary><quote>and</quote> expansion condition</primary>
16067 </indexterm>
16068 <indexterm role="concept">
16069 <primary>expansion</primary>
16070 <secondary><quote>and</quote> of conditions</secondary>
16071 </indexterm>
16072 The sub-conditions are evaluated from left to right. The condition is true if
16073 all of the sub-conditions are true. If there are several <quote>match</quote>
16074 sub-conditions, the values of the numeric variables afterwards are taken from
16075 the last one. When a false sub-condition is found, the following ones are
16076 parsed but not evaluated.
16077 </para>
16078 </listitem></varlistentry>
16079 </variablelist>
16080 <para>
16081 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16082 </para>
16083 </section>
16084 <section id="SECTexpvar">
16085 <title>Expansion variables</title>
16086 <para>
16087 <indexterm role="concept">
16088 <primary>expansion</primary>
16089 <secondary>variables, list of</secondary>
16090 </indexterm>
16091 This section contains an alphabetical list of all the expansion variables. Some
16092 of them are available only when Exim is compiled with specific options such as
16093 support for TLS or the content scanning extension.
16094 </para>
16095 <variablelist>
16096 <varlistentry>
16097 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16098 <listitem>
16099 <para>
16100 <indexterm role="concept">
16101 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16102 </indexterm>
16103 When a <option>match</option> expansion condition succeeds, these variables contain the
16104 captured substrings identified by the regular expression during subsequent
16105 processing of the success string of the containing <option>if</option> expansion item.
16106 However, they do not retain their values afterwards; in fact, their previous
16107 values are restored at the end of processing an <option>if</option> item. The numerical
16108 variables may also be set externally by some other matching process which
16109 precedes the expansion of the string. For example, the commands available in
16110 Exim filter files include an <option>if</option> command with its own regular expression
16111 matching condition.
16112 </para>
16113 </listitem></varlistentry>
16114 <varlistentry>
16115 <term><varname>$acl_c...</varname></term>
16116 <listitem>
16117 <para>
16118 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16119 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16120 long, but the sixth character must be either a digit or an underscore. For
16121 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16122 variables persist throughout the lifetime of an SMTP connection. They can be
16123 used to pass information between ACLs and between different invocations of the
16124 same ACL. When a message is received, the values of these variables are saved
16125 with the message, and can be accessed by filters, routers, and transports
16126 during subsequent delivery.
16127 </para>
16128 </listitem></varlistentry>
16129 <varlistentry>
16130 <term><varname>$acl_m...</varname></term>
16131 <listitem>
16132 <para>
16133 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16134 are reset after a message has been received. Thus, if several messages are
16135 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16136 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16137 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16138 message is received, the values of these variables are saved with the message,
16139 and can be accessed by filters, routers, and transports during subsequent
16140 delivery.
16141 </para>
16142 </listitem></varlistentry>
16143 <varlistentry>
16144 <term><varname>$acl_verify_message</varname></term>
16145 <listitem>
16146 <para>
16147 <indexterm role="variable">
16148 <primary><varname>$acl_verify_message</varname></primary>
16149 </indexterm>
16150 After an address verification has failed, this variable contains the failure
16151 message. It retains its value for use in subsequent modifiers. The message can
16152 be preserved by coding like this:
16153 </para>
16154 <literallayout class="monospaced">
16155 warn !verify = sender
16156      set acl_m0 = $acl_verify_message
16157 </literallayout>
16158 <para>
16159 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16160 <option>log_message</option> modifiers, to include information about the verification
16161 failure.
16162 </para>
16163 </listitem></varlistentry>
16164 <varlistentry>
16165 <term><varname>$address_data</varname></term>
16166 <listitem>
16167 <para>
16168 <indexterm role="variable">
16169 <primary><varname>$address_data</varname></primary>
16170 </indexterm>
16171 This variable is set by means of the <option>address_data</option> option in routers. The
16172 value then remains with the address while it is processed by subsequent routers
16173 and eventually a transport. If the transport is handling multiple addresses,
16174 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16175 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16176 user filter files.
16177 </para>
16178 <para>
16179 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16180 a recipient address, the final value is still in the variable for subsequent
16181 conditions and modifiers of the ACL statement. If routing the address caused it
16182 to be redirected to just one address, the child address is also routed as part
16183 of the verification, and in this case the final value of <varname>$address_data</varname> is
16184 from the child&#x2019;s routing.
16185 </para>
16186 <para>
16187 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16188 sender address, the final value is also preserved, but this time in
16189 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16190 address.
16191 </para>
16192 <para>
16193 In both cases (recipient and sender verification), the value does not persist
16194 after the end of the current ACL statement. If you want to preserve
16195 these values for longer, you can save them in ACL variables.
16196 </para>
16197 </listitem></varlistentry>
16198 <varlistentry>
16199 <term><varname>$address_file</varname></term>
16200 <listitem>
16201 <para>
16202 <indexterm role="variable">
16203 <primary><varname>$address_file</varname></primary>
16204 </indexterm>
16205 When, as a result of aliasing, forwarding, or filtering, a message is directed
16206 to a specific file, this variable holds the name of the file when the transport
16207 is running. At other times, the variable is empty. For example, using the
16208 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16209 </para>
16210 <literallayout class="monospaced">
16211 /home/r2d2/savemail
16212 </literallayout>
16213 <para>
16214 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16215 contains the text string <literal>/home/r2d2/savemail</literal>.
16216 <indexterm role="concept">
16217 <primary>Sieve filter</primary>
16218 <secondary>value of <varname>$address_file</varname></secondary>
16219 </indexterm>
16220 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16221 then up to the transport configuration to generate an appropriate absolute path
16222 to the relevant file.
16223 </para>
16224 </listitem></varlistentry>
16225 <varlistentry>
16226 <term><varname>$address_pipe</varname></term>
16227 <listitem>
16228 <para>
16229 <indexterm role="variable">
16230 <primary><varname>$address_pipe</varname></primary>
16231 </indexterm>
16232 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16233 this variable holds the pipe command when the transport is running.
16234 </para>
16235 </listitem></varlistentry>
16236 <varlistentry>
16237 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16238 <listitem>
16239 <para>
16240 <indexterm role="variable">
16241 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16242 </indexterm>
16243 These variables are used in SMTP authenticators (see chapters
16244 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <term><varname>$authenticated_id</varname></term>
16249 <listitem>
16250 <para>
16251 <indexterm role="concept">
16252 <primary>authentication</primary>
16253 <secondary>id</secondary>
16254 </indexterm>
16255 <indexterm role="variable">
16256 <primary><varname>$authenticated_id</varname></primary>
16257 </indexterm>
16258 When a server successfully authenticates a client it may be configured to
16259 preserve some of the authentication information in the variable
16260 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16261 user/password authenticator configuration might preserve the user name for use
16262 in the routers. Note that this is not the same information that is saved in
16263 <varname>$sender_host_authenticated</varname>.
16264 When a message is submitted locally (that is, not over a TCP connection)
16265 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16266 process. However, a trusted user can override this by means of the <option>-oMai</option>
16267 command line option.
16268 </para>
16269 </listitem></varlistentry>
16270 <varlistentry>
16271 <term><varname>$authenticated_sender</varname></term>
16272 <listitem>
16273 <para>
16274 <indexterm role="concept">
16275 <primary>sender</primary>
16276 <secondary>authenticated</secondary>
16277 </indexterm>
16278 <indexterm role="concept">
16279 <primary>authentication</primary>
16280 <secondary>sender</secondary>
16281 </indexterm>
16282 <indexterm role="concept">
16283 <primary>AUTH</primary>
16284 <secondary>on MAIL command</secondary>
16285 </indexterm>
16286 <indexterm role="variable">
16287 <primary><varname>$authenticated_sender</varname></primary>
16288 </indexterm>
16289 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16290 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16291 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16292 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16293 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16294 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16295 </para>
16296 <para>
16297 <indexterm role="variable">
16298 <primary><varname>$qualify_domain</varname></primary>
16299 </indexterm>
16300 When a message is submitted locally (that is, not over a TCP connection), the
16301 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16302 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16303 can override this by means of the <option>-oMas</option> command line option.
16304 </para>
16305 </listitem></varlistentry>
16306 <varlistentry>
16307 <term><varname>$authentication_failed</varname></term>
16308 <listitem>
16309 <para>
16310 <indexterm role="concept">
16311 <primary>authentication</primary>
16312 <secondary>failure</secondary>
16313 </indexterm>
16314 <indexterm role="variable">
16315 <primary><varname>$authentication_failed</varname></primary>
16316 </indexterm>
16317 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16318 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16319 possible to distinguish between <quote>did not try to authenticate</quote>
16320 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16321 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16322 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16323 negative response to an AUTH command, including (for example) an attempt to use
16324 an undefined mechanism.
16325 </para>
16326 </listitem></varlistentry>
16327 <varlistentry revisionflag="changed">
16328 <term><varname>$av_failed</varname></term>
16329 <listitem>
16330 <para revisionflag="changed">
16331 <indexterm role="concept">
16332 <primary>content scanning</primary>
16333 <secondary>AV scanner failure</secondary>
16334 </indexterm>
16335 This variable is available when Exim is compiled with the content-scanning
16336 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
16337 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
16338 the ACL malware condition.
16339 </para>
16340 </listitem></varlistentry>
16341 <varlistentry>
16342 <term><varname>$body_linecount</varname></term>
16343 <listitem>
16344 <para>
16345 <indexterm role="concept">
16346 <primary>message body</primary>
16347 <secondary>line count</secondary>
16348 </indexterm>
16349 <indexterm role="concept">
16350 <primary>body of message</primary>
16351 <secondary>line count</secondary>
16352 </indexterm>
16353 <indexterm role="variable">
16354 <primary><varname>$body_linecount</varname></primary>
16355 </indexterm>
16356 When a message is being received or delivered, this variable contains the
16357 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
16358 </para>
16359 </listitem></varlistentry>
16360 <varlistentry>
16361 <term><varname>$body_zerocount</varname></term>
16362 <listitem>
16363 <para>
16364 <indexterm role="concept">
16365 <primary>message body</primary>
16366 <secondary>binary zero count</secondary>
16367 </indexterm>
16368 <indexterm role="concept">
16369 <primary>body of message</primary>
16370 <secondary>binary zero count</secondary>
16371 </indexterm>
16372 <indexterm role="concept">
16373 <primary>binary zero</primary>
16374 <secondary>in message body</secondary>
16375 </indexterm>
16376 <indexterm role="variable">
16377 <primary><varname>$body_zerocount</varname></primary>
16378 </indexterm>
16379 When a message is being received or delivered, this variable contains the
16380 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
16381 </para>
16382 </listitem></varlistentry>
16383 <varlistentry>
16384 <term><varname>$bounce_recipient</varname></term>
16385 <listitem>
16386 <para>
16387 <indexterm role="variable">
16388 <primary><varname>$bounce_recipient</varname></primary>
16389 </indexterm>
16390 This is set to the recipient address of a bounce message while Exim is creating
16391 it. It is useful if a customized bounce message text file is in use (see
16392 chapter <xref linkend="CHAPemsgcust"/>).
16393 </para>
16394 </listitem></varlistentry>
16395 <varlistentry>
16396 <term><varname>$bounce_return_size_limit</varname></term>
16397 <listitem>
16398 <para>
16399 <indexterm role="variable">
16400 <primary><varname>$bounce_return_size_limit</varname></primary>
16401 </indexterm>
16402 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16403 up to a multiple of 1000. It is useful when a customized error message text
16404 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16405 </para>
16406 </listitem></varlistentry>
16407 <varlistentry>
16408 <term><varname>$caller_gid</varname></term>
16409 <listitem>
16410 <para>
16411 <indexterm role="concept">
16412 <primary>gid (group id)</primary>
16413 <secondary>caller</secondary>
16414 </indexterm>
16415 <indexterm role="variable">
16416 <primary><varname>$caller_gid</varname></primary>
16417 </indexterm>
16418 The real group id under which the process that called Exim was running. This is
16419 not the same as the group id of the originator of a message (see
16420 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16421 incarnation normally contains the Exim gid.
16422 </para>
16423 </listitem></varlistentry>
16424 <varlistentry>
16425 <term><varname>$caller_uid</varname></term>
16426 <listitem>
16427 <para>
16428 <indexterm role="concept">
16429 <primary>uid (user id)</primary>
16430 <secondary>caller</secondary>
16431 </indexterm>
16432 <indexterm role="variable">
16433 <primary><varname>$caller_uid</varname></primary>
16434 </indexterm>
16435 The real user id under which the process that called Exim was running. This is
16436 not the same as the user id of the originator of a message (see
16437 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16438 incarnation normally contains the Exim uid.
16439 </para>
16440 </listitem></varlistentry>
16441 <varlistentry>
16442 <term><varname>$compile_date</varname></term>
16443 <listitem>
16444 <para>
16445 <indexterm role="variable">
16446 <primary><varname>$compile_date</varname></primary>
16447 </indexterm>
16448 The date on which the Exim binary was compiled.
16449 </para>
16450 </listitem></varlistentry>
16451 <varlistentry>
16452 <term><varname>$compile_number</varname></term>
16453 <listitem>
16454 <para>
16455 <indexterm role="variable">
16456 <primary><varname>$compile_number</varname></primary>
16457 </indexterm>
16458 The building process for Exim keeps a count of the number
16459 of times it has been compiled. This serves to distinguish different
16460 compilations of the same version of the program.
16461 </para>
16462 </listitem></varlistentry>
16463 <varlistentry>
16464 <term><varname>$demime_errorlevel</varname></term>
16465 <listitem>
16466 <para>
16467 <indexterm role="variable">
16468 <primary><varname>$demime_errorlevel</varname></primary>
16469 </indexterm>
16470 This variable is available when Exim is compiled with
16471 the content-scanning extension and the obsolete <option>demime</option> condition. For
16472 details, see section <xref linkend="SECTdemimecond"/>.
16473 </para>
16474 </listitem></varlistentry>
16475 <varlistentry>
16476 <term><varname>$demime_reason</varname></term>
16477 <listitem>
16478 <para>
16479 <indexterm role="variable">
16480 <primary><varname>$demime_reason</varname></primary>
16481 </indexterm>
16482 This variable is available when Exim is compiled with the
16483 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16484 see section <xref linkend="SECTdemimecond"/>.
16485 </para>
16486 </listitem></varlistentry>
16487 <varlistentry>
16488 <term><varname>$dnslist_domain</varname></term>
16489 <term><varname>$dnslist_matched</varname></term>
16490 <term><varname>$dnslist_text</varname></term>
16491 <term><varname>$dnslist_value</varname></term>
16492 <listitem>
16493 <para>
16494 <indexterm role="variable">
16495 <primary><varname>$dnslist_domain</varname></primary>
16496 </indexterm>
16497 <indexterm role="variable">
16498 <primary><varname>$dnslist_matched</varname></primary>
16499 </indexterm>
16500 <indexterm role="variable">
16501 <primary><varname>$dnslist_text</varname></primary>
16502 </indexterm>
16503 <indexterm role="variable">
16504 <primary><varname>$dnslist_value</varname></primary>
16505 </indexterm>
16506 <indexterm role="concept">
16507 <primary>black list (DNS)</primary>
16508 </indexterm>
16509 When a DNS (black) list lookup succeeds, these variables are set to contain
16510 the following data from the lookup: the list&#x2019;s domain name, the key that was
16511 looked up, the contents of any associated TXT record, and the value from the
16512 main A record. See section <xref linkend="SECID204"/> for more details.
16513 </para>
16514 </listitem></varlistentry>
16515 <varlistentry>
16516 <term><varname>$domain</varname></term>
16517 <listitem>
16518 <para>
16519 <indexterm role="variable">
16520 <primary><varname>$domain</varname></primary>
16521 </indexterm>
16522 When an address is being routed, or delivered on its own, this variable
16523 contains the domain. Uppercase letters in the domain are converted into lower
16524 case for <varname>$domain</varname>.
16525 </para>
16526 <para>
16527 Global address rewriting happens when a message is received, so the value of
16528 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16529 is set during user filtering, but not during system filtering, because a
16530 message may have many recipients and the system filter is called just once.
16531 </para>
16532 <para>
16533 When more than one address is being delivered at once (for example, several
16534 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16535 have the same domain. Transports can be restricted to handling only one domain
16536 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16537 the default for local transports. For further details of the environment in
16538 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16539 </para>
16540 <para>
16541 <indexterm role="option">
16542 <primary><option>delay_warning_condition</option></primary>
16543 </indexterm>
16544 At the end of a delivery, if all deferred addresses have the same domain, it is
16545 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16546 </para>
16547 <para>
16548 The <varname>$domain</varname> variable is also used in some other circumstances:
16549 </para>
16550 <itemizedlist>
16551 <listitem>
16552 <para>
16553 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16554 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16555 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16556 normally set during the running of the MAIL ACL. However, if the sender address
16557 is verified with a callout during the MAIL ACL, the sender domain is placed in
16558 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16559 the <command>smtp</command> transport.
16560 </para>
16561 </listitem>
16562 <listitem>
16563 <para>
16564 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16565 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16566 it can be used in the expansion of the replacement address, for example, to
16567 rewrite domains by file lookup.
16568 </para>
16569 </listitem>
16570 <listitem>
16571 <para>
16572 With one important exception, whenever a domain list is being scanned,
16573 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16574 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16575 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16576 that, in a RCPT ACL, the sender domain list can be dependent on the
16577 recipient domain (which is what is in <varname>$domain</varname> at this time).
16578 </para>
16579 </listitem>
16580 <listitem>
16581 <para>
16582 <indexterm role="concept">
16583 <primary>ETRN</primary>
16584 <secondary>value of <varname>$domain</varname></secondary>
16585 </indexterm>
16586 <indexterm role="option">
16587 <primary><option>smtp_etrn_command</option></primary>
16588 </indexterm>
16589 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16590 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16591 </para>
16592 </listitem>
16593 </itemizedlist>
16594 </listitem></varlistentry>
16595 <varlistentry>
16596 <term><varname>$domain_data</varname></term>
16597 <listitem>
16598 <para>
16599 <indexterm role="variable">
16600 <primary><varname>$domain_data</varname></primary>
16601 </indexterm>
16602 When the <option>domains</option> option on a router matches a domain by
16603 means of a lookup, the data read by the lookup is available during the running
16604 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16605 address to a transport, the value is available in that transport. If the
16606 transport is handling multiple addresses, the value from the first address is
16607 used.
16608 </para>
16609 <para>
16610 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16611 domain by means of a lookup. The data read by the lookup is available during
16612 the rest of the ACL statement. In all other situations, this variable expands
16613 to nothing.
16614 </para>
16615 </listitem></varlistentry>
16616 <varlistentry>
16617 <term><varname>$exim_gid</varname></term>
16618 <listitem>
16619 <para>
16620 <indexterm role="variable">
16621 <primary><varname>$exim_gid</varname></primary>
16622 </indexterm>
16623 This variable contains the numerical value of the Exim group id.
16624 </para>
16625 </listitem></varlistentry>
16626 <varlistentry>
16627 <term><varname>$exim_path</varname></term>
16628 <listitem>
16629 <para>
16630 <indexterm role="variable">
16631 <primary><varname>$exim_path</varname></primary>
16632 </indexterm>
16633 This variable contains the path to the Exim binary.
16634 </para>
16635 </listitem></varlistentry>
16636 <varlistentry>
16637 <term><varname>$exim_uid</varname></term>
16638 <listitem>
16639 <para>
16640 <indexterm role="variable">
16641 <primary><varname>$exim_uid</varname></primary>
16642 </indexterm>
16643 This variable contains the numerical value of the Exim user id.
16644 </para>
16645 </listitem></varlistentry>
16646 <varlistentry>
16647 <term><varname>$found_extension</varname></term>
16648 <listitem>
16649 <para>
16650 <indexterm role="variable">
16651 <primary><varname>$found_extension</varname></primary>
16652 </indexterm>
16653 This variable is available when Exim is compiled with the
16654 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16655 see section <xref linkend="SECTdemimecond"/>.
16656 </para>
16657 </listitem></varlistentry>
16658 <varlistentry>
16659 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16660 <listitem>
16661 <para>
16662 This is not strictly an expansion variable. It is expansion syntax for
16663 inserting the message header line with the given name. Note that the name must
16664 be terminated by colon or white space, because it may contain a wide variety of
16665 characters. Note also that braces must <emphasis>not</emphasis> be used.
16666 </para>
16667 </listitem></varlistentry>
16668 <varlistentry>
16669 <term><varname>$home</varname></term>
16670 <listitem>
16671 <para>
16672 <indexterm role="variable">
16673 <primary><varname>$home</varname></primary>
16674 </indexterm>
16675 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16676 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16677 means it is set during the running of users&#x2019; filter files. A router may also
16678 explicitly set a home directory for use by a transport; this can be overridden
16679 by a setting on the transport itself.
16680 </para>
16681 <para>
16682 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16683 of the environment variable HOME.
16684 </para>
16685 </listitem></varlistentry>
16686 <varlistentry>
16687 <term><varname>$host</varname></term>
16688 <listitem>
16689 <para>
16690 <indexterm role="variable">
16691 <primary><varname>$host</varname></primary>
16692 </indexterm>
16693 If a router assigns an address to a transport (any transport), and passes a
16694 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16695 to run is the name of the first host on the list. Note that this applies both
16696 to local and remote transports.
16697 </para>
16698 <para>
16699 <indexterm role="concept">
16700 <primary>transport</primary>
16701 <secondary>filter</secondary>
16702 </indexterm>
16703 <indexterm role="concept">
16704 <primary>filter</primary>
16705 <secondary>transport filter</secondary>
16706 </indexterm>
16707 For the <command>smtp</command> transport, if there is more than one host, the value of
16708 <varname>$host</varname> changes as the transport works its way through the list. In
16709 particular, when the <command>smtp</command> transport is expanding its options for encryption
16710 using TLS, or for specifying a transport filter (see chapter
16711 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16712 is connected.
16713 </para>
16714 <para>
16715 When used in the client part of an authenticator configuration (see chapter
16716 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16717 client is connected.
16718 </para>
16719 </listitem></varlistentry>
16720 <varlistentry>
16721 <term><varname>$host_address</varname></term>
16722 <listitem>
16723 <para>
16724 <indexterm role="variable">
16725 <primary><varname>$host_address</varname></primary>
16726 </indexterm>
16727 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16728 for a remote connection. It is also set to the IP address that is being checked
16729 when the <option>ignore_target_hosts</option> option is being processed.
16730 </para>
16731 </listitem></varlistentry>
16732 <varlistentry>
16733 <term><varname>$host_data</varname></term>
16734 <listitem>
16735 <para>
16736 <indexterm role="variable">
16737 <primary><varname>$host_data</varname></primary>
16738 </indexterm>
16739 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16740 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16741 allows you, for example, to do things like this:
16742 </para>
16743 <literallayout class="monospaced">
16744 deny  hosts = net-lsearch;/some/file
16745 message = $host_data
16746 </literallayout>
16747 </listitem></varlistentry>
16748 <varlistentry>
16749 <term><varname>$host_lookup_deferred</varname></term>
16750 <listitem>
16751 <para>
16752 <indexterm role="concept">
16753 <primary>host name</primary>
16754 <secondary>lookup, failure of</secondary>
16755 </indexterm>
16756 <indexterm role="variable">
16757 <primary><varname>$host_lookup_deferred</varname></primary>
16758 </indexterm>
16759 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16760 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16761 name from its IP address, and the attempt is not successful, one of these
16762 variables is set to <quote>1</quote>.
16763 </para>
16764 <itemizedlist>
16765 <listitem>
16766 <para>
16767 If the lookup receives a definite negative response (for example, a DNS lookup
16768 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16769 </para>
16770 </listitem>
16771 <listitem>
16772 <para>
16773 If there is any kind of problem during the lookup, such that Exim cannot
16774 tell whether or not the host name is defined (for example, a timeout for a DNS
16775 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16776 </para>
16777 </listitem>
16778 </itemizedlist>
16779 <para>
16780 Looking up a host&#x2019;s name from its IP address consists of more than just a
16781 single reverse lookup. Exim checks that a forward lookup of at least one of the
16782 names it receives from a reverse lookup yields the original IP address. If this
16783 is not the case, Exim does not accept the looked up name(s), and
16784 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16785 IP address (for example, the existence of a PTR record in the DNS) is not
16786 sufficient on its own for the success of a host name lookup. If the reverse
16787 lookup succeeds, but there is a lookup problem such as a timeout when checking
16788 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16789 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16790 </para>
16791 </listitem></varlistentry>
16792 <varlistentry>
16793 <term><varname>$host_lookup_failed</varname></term>
16794 <listitem>
16795 <para>
16796 <indexterm role="variable">
16797 <primary><varname>$host_lookup_failed</varname></primary>
16798 </indexterm>
16799 See <varname>$host_lookup_deferred</varname>.
16800 </para>
16801 </listitem></varlistentry>
16802 <varlistentry>
16803 <term><varname>$inode</varname></term>
16804 <listitem>
16805 <para>
16806 <indexterm role="variable">
16807 <primary><varname>$inode</varname></primary>
16808 </indexterm>
16809 The only time this variable is set is while expanding the <option>directory_file</option>
16810 option in the <command>appendfile</command> transport. The variable contains the inode number
16811 of the temporary file which is about to be renamed. It can be used to construct
16812 a unique name for the file.
16813 </para>
16814 </listitem></varlistentry>
16815 <varlistentry>
16816 <term><varname>$interface_address</varname></term>
16817 <listitem>
16818 <para>
16819 <indexterm role="variable">
16820 <primary><varname>$interface_address</varname></primary>
16821 </indexterm>
16822 This is an obsolete name for <varname>$received_ip_address</varname>.
16823 </para>
16824 </listitem></varlistentry>
16825 <varlistentry>
16826 <term><varname>$interface_port</varname></term>
16827 <listitem>
16828 <para>
16829 <indexterm role="variable">
16830 <primary><varname>$interface_port</varname></primary>
16831 </indexterm>
16832 This is an obsolete name for <varname>$received_port</varname>.
16833 </para>
16834 </listitem></varlistentry>
16835 <varlistentry>
16836 <term><varname>$item</varname></term>
16837 <listitem>
16838 <para>
16839 <indexterm role="variable">
16840 <primary><varname>$item</varname></primary>
16841 </indexterm>
16842 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16843 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16844 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16845 empty.
16846 </para>
16847 </listitem></varlistentry>
16848 <varlistentry>
16849 <term><varname>$ldap_dn</varname></term>
16850 <listitem>
16851 <para>
16852 <indexterm role="variable">
16853 <primary><varname>$ldap_dn</varname></primary>
16854 </indexterm>
16855 This variable, which is available only when Exim is compiled with LDAP support,
16856 contains the DN from the last entry in the most recently successful LDAP
16857 lookup.
16858 </para>
16859 </listitem></varlistentry>
16860 <varlistentry>
16861 <term><varname>$load_average</varname></term>
16862 <listitem>
16863 <para>
16864 <indexterm role="variable">
16865 <primary><varname>$load_average</varname></primary>
16866 </indexterm>
16867 This variable contains the system load average, multiplied by 1000 so that it
16868 is an integer. For example, if the load average is 0.21, the value of the
16869 variable is 210. The value is recomputed every time the variable is referenced.
16870 </para>
16871 </listitem></varlistentry>
16872 <varlistentry>
16873 <term><varname>$local_part</varname></term>
16874 <listitem>
16875 <para>
16876 <indexterm role="variable">
16877 <primary><varname>$local_part</varname></primary>
16878 </indexterm>
16879 When an address is being routed, or delivered on its own, this
16880 variable contains the local part. When a number of addresses are being
16881 delivered together (for example, multiple RCPT commands in an SMTP
16882 session), <varname>$local_part</varname> is not set.
16883 </para>
16884 <para>
16885 Global address rewriting happens when a message is received, so the value of
16886 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16887 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16888 because a message may have many recipients and the system filter is called just
16889 once.
16890 </para>
16891 <para>
16892 <indexterm role="variable">
16893 <primary><varname>$local_part_prefix</varname></primary>
16894 </indexterm>
16895 <indexterm role="variable">
16896 <primary><varname>$local_part_suffix</varname></primary>
16897 </indexterm>
16898 If a local part prefix or suffix has been recognized, it is not included in the
16899 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16900 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16901 <varname>$local_part_suffix</varname>, respectively.
16902 </para>
16903 <para>
16904 When a message is being delivered to a file, pipe, or autoreply transport as a
16905 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16906 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16907 <varname>$address_pipe</varname>).
16908 </para>
16909 <para>
16910 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16911 local part of the recipient address.
16912 </para>
16913 <para>
16914 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16915 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16916 it can be used in the expansion of the replacement address, for example.
16917 </para>
16918 <para>
16919 In all cases, all quoting is removed from the local part. For example, for both
16920 the addresses
16921 </para>
16922 <literallayout class="monospaced">
16923 "abc:xyz"@test.example
16924 abc\:xyz@test.example
16925 </literallayout>
16926 <para>
16927 the value of <varname>$local_part</varname> is
16928 </para>
16929 <literallayout class="monospaced">
16930 abc:xyz
16931 </literallayout>
16932 <para>
16933 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16934 inside a quoting operator. For example, in a <command>redirect</command> router you could
16935 have:
16936 </para>
16937 <literallayout class="monospaced">
16938 data = ${quote_local_part:$local_part}@new.domain.example
16939 </literallayout>
16940 <para>
16941 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16942 to process local parts in a case-dependent manner in a router, you can set the
16943 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16944 </para>
16945 </listitem></varlistentry>
16946 <varlistentry>
16947 <term><varname>$local_part_data</varname></term>
16948 <listitem>
16949 <para>
16950 <indexterm role="variable">
16951 <primary><varname>$local_part_data</varname></primary>
16952 </indexterm>
16953 When the <option>local_parts</option> option on a router matches a local part by means of a
16954 lookup, the data read by the lookup is available during the running of the
16955 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16956 to a transport, the value is available in that transport. If the transport is
16957 handling multiple addresses, the value from the first address is used.
16958 </para>
16959 <para>
16960 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16961 matches a local part by means of a lookup. The data read by the lookup is
16962 available during the rest of the ACL statement. In all other situations, this
16963 variable expands to nothing.
16964 </para>
16965 </listitem></varlistentry>
16966 <varlistentry>
16967 <term><varname>$local_part_prefix</varname></term>
16968 <listitem>
16969 <para>
16970 <indexterm role="variable">
16971 <primary><varname>$local_part_prefix</varname></primary>
16972 </indexterm>
16973 When an address is being routed or delivered, and a
16974 specific prefix for the local part was recognized, it is available in this
16975 variable, having been removed from <varname>$local_part</varname>.
16976 </para>
16977 </listitem></varlistentry>
16978 <varlistentry>
16979 <term><varname>$local_part_suffix</varname></term>
16980 <listitem>
16981 <para>
16982 <indexterm role="variable">
16983 <primary><varname>$local_part_suffix</varname></primary>
16984 </indexterm>
16985 When an address is being routed or delivered, and a
16986 specific suffix for the local part was recognized, it is available in this
16987 variable, having been removed from <varname>$local_part</varname>.
16988 </para>
16989 </listitem></varlistentry>
16990 <varlistentry>
16991 <term><varname>$local_scan_data</varname></term>
16992 <listitem>
16993 <para>
16994 <indexterm role="variable">
16995 <primary><varname>$local_scan_data</varname></primary>
16996 </indexterm>
16997 This variable contains the text returned by the <function>local_scan()</function> function when
16998 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16999 </para>
17000 </listitem></varlistentry>
17001 <varlistentry>
17002 <term><varname>$local_user_gid</varname></term>
17003 <listitem>
17004 <para>
17005 <indexterm role="variable">
17006 <primary><varname>$local_user_gid</varname></primary>
17007 </indexterm>
17008 See <varname>$local_user_uid</varname>.
17009 </para>
17010 </listitem></varlistentry>
17011 <varlistentry>
17012 <term><varname>$local_user_uid</varname></term>
17013 <listitem>
17014 <para>
17015 <indexterm role="variable">
17016 <primary><varname>$local_user_uid</varname></primary>
17017 </indexterm>
17018 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17019 <option>check_local_user</option> router precondition succeeds. This means that their values
17020 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17021 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17022 router-specific expansions. At all other times, the values in these variables
17023 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17024 </para>
17025 </listitem></varlistentry>
17026 <varlistentry>
17027 <term><varname>$localhost_number</varname></term>
17028 <listitem>
17029 <para>
17030 <indexterm role="variable">
17031 <primary><varname>$localhost_number</varname></primary>
17032 </indexterm>
17033 This contains the expanded value of the
17034 <option>localhost_number</option> option. The expansion happens after the main options have
17035 been read.
17036 </para>
17037 </listitem></varlistentry>
17038 <varlistentry>
17039 <term><varname>$log_inodes</varname></term>
17040 <listitem>
17041 <para>
17042 <indexterm role="variable">
17043 <primary><varname>$log_inodes</varname></primary>
17044 </indexterm>
17045 The number of free inodes in the disk partition where Exim&#x2019;s
17046 log files are being written. The value is recalculated whenever the variable is
17047 referenced. If the relevant file system does not have the concept of inodes,
17048 the value of is -1. See also the <option>check_log_inodes</option> option.
17049 </para>
17050 </listitem></varlistentry>
17051 <varlistentry>
17052 <term><varname>$log_space</varname></term>
17053 <listitem>
17054 <para>
17055 <indexterm role="variable">
17056 <primary><varname>$log_space</varname></primary>
17057 </indexterm>
17058 The amount of free space (as a number of kilobytes) in the disk
17059 partition where Exim&#x2019;s log files are being written. The value is recalculated
17060 whenever the variable is referenced. If the operating system does not have the
17061 ability to find the amount of free space (only true for experimental systems),
17062 the space value is -1. See also the <option>check_log_space</option> option.
17063 </para>
17064 </listitem></varlistentry>
17065 <varlistentry>
17066 <term><varname>$mailstore_basename</varname></term>
17067 <listitem>
17068 <para>
17069 <indexterm role="variable">
17070 <primary><varname>$mailstore_basename</varname></primary>
17071 </indexterm>
17072 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17073 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17074 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17075 contains the basename of the files that are being written, that is, the name
17076 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17077 variable is empty.
17078 </para>
17079 </listitem></varlistentry>
17080 <varlistentry>
17081 <term><varname>$malware_name</varname></term>
17082 <listitem>
17083 <para>
17084 <indexterm role="variable">
17085 <primary><varname>$malware_name</varname></primary>
17086 </indexterm>
17087 This variable is available when Exim is compiled with the
17088 content-scanning extension. It is set to the name of the virus that was found
17089 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17090 </para>
17091 </listitem></varlistentry>
17092 <varlistentry>
17093 <term><varname>$max_received_linelength</varname></term>
17094 <listitem>
17095 <para>
17096 <indexterm role="variable">
17097 <primary><varname>$max_received_linelength</varname></primary>
17098 </indexterm>
17099 <indexterm role="concept">
17100 <primary>maximum</primary>
17101 <secondary>line length</secondary>
17102 </indexterm>
17103 <indexterm role="concept">
17104 <primary>line length</primary>
17105 <secondary>maximum</secondary>
17106 </indexterm>
17107 This variable contains the number of bytes in the longest line that was
17108 received as part of the message, not counting the line termination
17109 character(s).
17110 </para>
17111 </listitem></varlistentry>
17112 <varlistentry>
17113 <term><varname>$message_age</varname></term>
17114 <listitem>
17115 <para>
17116 <indexterm role="concept">
17117 <primary>message</primary>
17118 <secondary>age of</secondary>
17119 </indexterm>
17120 <indexterm role="variable">
17121 <primary><varname>$message_age</varname></primary>
17122 </indexterm>
17123 This variable is set at the start of a delivery attempt to contain the number
17124 of seconds since the message was received. It does not change during a single
17125 delivery attempt.
17126 </para>
17127 </listitem></varlistentry>
17128 <varlistentry>
17129 <term><varname>$message_body</varname></term>
17130 <listitem>
17131 <para>
17132 <indexterm role="concept">
17133 <primary>body of message</primary>
17134 <secondary>expansion variable</secondary>
17135 </indexterm>
17136 <indexterm role="concept">
17137 <primary>message body</primary>
17138 <secondary>in expansion</secondary>
17139 </indexterm>
17140 <indexterm role="concept">
17141 <primary>binary zero</primary>
17142 <secondary>in message body</secondary>
17143 </indexterm>
17144 <indexterm role="variable">
17145 <primary><varname>$message_body</varname></primary>
17146 </indexterm>
17147 <indexterm role="option">
17148 <primary><option>message_body_visible</option></primary>
17149 </indexterm>
17150 This variable contains the initial portion of a message&#x2019;s body while it is
17151 being delivered, and is intended mainly for use in filter files. The maximum
17152 number of characters of the body that are put into the variable is set by the
17153 <option>message_body_visible</option> configuration option; the default is 500.
17154 </para>
17155 <para>
17156 <indexterm role="option">
17157 <primary><option>message_body_newlines</option></primary>
17158 </indexterm>
17159 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17160 easier to search for phrases that might be split over a line break. However,
17161 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17162 zeros are always converted into spaces.
17163 </para>
17164 </listitem></varlistentry>
17165 <varlistentry>
17166 <term><varname>$message_body_end</varname></term>
17167 <listitem>
17168 <para>
17169 <indexterm role="concept">
17170 <primary>body of message</primary>
17171 <secondary>expansion variable</secondary>
17172 </indexterm>
17173 <indexterm role="concept">
17174 <primary>message body</primary>
17175 <secondary>in expansion</secondary>
17176 </indexterm>
17177 <indexterm role="variable">
17178 <primary><varname>$message_body_end</varname></primary>
17179 </indexterm>
17180 This variable contains the final portion of a message&#x2019;s
17181 body while it is being delivered. The format and maximum size are as for
17182 <varname>$message_body</varname>.
17183 </para>
17184 </listitem></varlistentry>
17185 <varlistentry>
17186 <term><varname>$message_body_size</varname></term>
17187 <listitem>
17188 <para>
17189 <indexterm role="concept">
17190 <primary>body of message</primary>
17191 <secondary>size</secondary>
17192 </indexterm>
17193 <indexterm role="concept">
17194 <primary>message body</primary>
17195 <secondary>size</secondary>
17196 </indexterm>
17197 <indexterm role="variable">
17198 <primary><varname>$message_body_size</varname></primary>
17199 </indexterm>
17200 When a message is being delivered, this variable contains the size of the body
17201 in bytes. The count starts from the character after the blank line that
17202 separates the body from the header. Newlines are included in the count. See
17203 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17204 </para>
17205 </listitem></varlistentry>
17206 <varlistentry>
17207 <term><varname>$message_exim_id</varname></term>
17208 <listitem>
17209 <para>
17210 <indexterm role="variable">
17211 <primary><varname>$message_exim_id</varname></primary>
17212 </indexterm>
17213 When a message is being received or delivered, this variable contains the
17214 unique message id that is generated and used by Exim to identify the message.
17215 An id is not created for a message until after its header has been successfully
17216 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17217 line; it is the local id that Exim assigns to the message, for example:
17218 <literal>1BXTIK-0001yO-VA</literal>.
17219 </para>
17220 </listitem></varlistentry>
17221 <varlistentry>
17222 <term><varname>$message_headers</varname></term>
17223 <listitem>
17224 <para>
17225 <indexterm role="variable">
17226 <primary><varname>$message_headers</varname></primary>
17227 </indexterm>
17228 This variable contains a concatenation of all the header lines when a message
17229 is being processed, except for lines added by routers or transports. The header
17230 lines are separated by newline characters. Their contents are decoded in the
17231 same way as a header line that is inserted by <option>bheader</option>.
17232 </para>
17233 </listitem></varlistentry>
17234 <varlistentry>
17235 <term><varname>$message_headers_raw</varname></term>
17236 <listitem>
17237 <para>
17238 <indexterm role="variable">
17239 <primary><varname>$message_headers_raw</varname></primary>
17240 </indexterm>
17241 This variable is like <varname>$message_headers</varname> except that no processing of the
17242 contents of header lines is done.
17243 </para>
17244 </listitem></varlistentry>
17245 <varlistentry>
17246 <term><varname>$message_id</varname></term>
17247 <listitem>
17248 <para>
17249 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17250 </para>
17251 </listitem></varlistentry>
17252 <varlistentry>
17253 <term><varname>$message_linecount</varname></term>
17254 <listitem>
17255 <para>
17256 <indexterm role="variable">
17257 <primary><varname>$message_linecount</varname></primary>
17258 </indexterm>
17259 This variable contains the total number of lines in the header and body of the
17260 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17261 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17262 number of lines received. Before delivery happens (that is, before filters,
17263 routers, and transports run) the count is increased to include the
17264 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17265 lines that are added by ACLs. The blank line that separates the message header
17266 from the body is not counted.
17267 </para>
17268 <para>
17269 As with the special case of <varname>$message_size</varname>, during the expansion of the
17270 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17271 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17272 file that has been written (minus one for the blank line between the
17273 header and the body).
17274 </para>
17275 <para>
17276 Here is an example of the use of this variable in a DATA ACL:
17277 </para>
17278 <literallayout class="monospaced">
17279 deny message   = Too many lines in message header
17280      condition = \
17281       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17282 </literallayout>
17283 <para>
17284 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17285 message has not yet been received.
17286 </para>
17287 </listitem></varlistentry>
17288 <varlistentry>
17289 <term><varname>$message_size</varname></term>
17290 <listitem>
17291 <para>
17292 <indexterm role="concept">
17293 <primary>size</primary>
17294 <secondary>of message</secondary>
17295 </indexterm>
17296 <indexterm role="concept">
17297 <primary>message</primary>
17298 <secondary>size</secondary>
17299 </indexterm>
17300 <indexterm role="variable">
17301 <primary><varname>$message_size</varname></primary>
17302 </indexterm>
17303 When a message is being processed, this variable contains its size in bytes. In
17304 most cases, the size includes those headers that were received with the
17305 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17306 deliveries as they are written. However, there is one special case: during the
17307 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17308 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17309 precise size of the file that has been written. See also
17310 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17311 </para>
17312 <para>
17313 <indexterm role="concept">
17314 <primary>RCPT</primary>
17315 <secondary>value of <varname>$message_size</varname></secondary>
17316 </indexterm>
17317 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17318 contains the size supplied on the MAIL command, or -1 if no size was given. The
17319 value may not, of course, be truthful.
17320 </para>
17321 </listitem></varlistentry>
17322 <varlistentry>
17323 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17324 <listitem>
17325 <para>
17326 A number of variables whose names start with <varname>$mime</varname> are
17327 available when Exim is compiled with the content-scanning extension. For
17328 details, see section <xref linkend="SECTscanmimepart"/>.
17329 </para>
17330 </listitem></varlistentry>
17331 <varlistentry>
17332 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
17333 <listitem>
17334 <para>
17335 These variables are counters that can be incremented by means
17336 of the <option>add</option> command in filter files.
17337 </para>
17338 </listitem></varlistentry>
17339 <varlistentry>
17340 <term><varname>$original_domain</varname></term>
17341 <listitem>
17342 <para>
17343 <indexterm role="variable">
17344 <primary><varname>$domain</varname></primary>
17345 </indexterm>
17346 <indexterm role="variable">
17347 <primary><varname>$original_domain</varname></primary>
17348 </indexterm>
17349 When a top-level address is being processed for delivery, this contains the
17350 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17351 generated by an alias, forward, or filter file) is being processed, this
17352 variable contains the domain of the original address (lower cased). This
17353 differs from <varname>$parent_domain</varname> only when there is more than one level of
17354 aliasing or forwarding. When more than one address is being delivered in a
17355 single transport run, <varname>$original_domain</varname> is not set.
17356 </para>
17357 <para>
17358 If a new address is created by means of a <option>deliver</option> command in a system
17359 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17360 part <emphasis>system-filter</emphasis> and the default qualify domain.
17361 </para>
17362 </listitem></varlistentry>
17363 <varlistentry>
17364 <term><varname>$original_local_part</varname></term>
17365 <listitem>
17366 <para>
17367 <indexterm role="variable">
17368 <primary><varname>$local_part</varname></primary>
17369 </indexterm>
17370 <indexterm role="variable">
17371 <primary><varname>$original_local_part</varname></primary>
17372 </indexterm>
17373 When a top-level address is being processed for delivery, this contains the
17374 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17375 local part, because <varname>$original_local_part</varname> always contains the full local
17376 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17377 filter file) is being processed, this variable contains the full local part of
17378 the original address.
17379 </para>
17380 <para>
17381 If the router that did the redirection processed the local part
17382 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17383 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17384 one level of aliasing or forwarding. When more than one address is being
17385 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17386 </para>
17387 <para>
17388 If a new address is created by means of a <option>deliver</option> command in a system
17389 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17390 part <emphasis>system-filter</emphasis> and the default qualify domain.
17391 </para>
17392 </listitem></varlistentry>
17393 <varlistentry>
17394 <term><varname>$originator_gid</varname></term>
17395 <listitem>
17396 <para>
17397 <indexterm role="concept">
17398 <primary>gid (group id)</primary>
17399 <secondary>of originating user</secondary>
17400 </indexterm>
17401 <indexterm role="concept">
17402 <primary>sender</primary>
17403 <secondary>gid</secondary>
17404 </indexterm>
17405 <indexterm role="variable">
17406 <primary><varname>$caller_gid</varname></primary>
17407 </indexterm>
17408 <indexterm role="variable">
17409 <primary><varname>$originator_gid</varname></primary>
17410 </indexterm>
17411 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17412 message was received. For messages received via the command line, this is the
17413 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17414 normally the gid of the Exim user.
17415 </para>
17416 </listitem></varlistentry>
17417 <varlistentry>
17418 <term><varname>$originator_uid</varname></term>
17419 <listitem>
17420 <para>
17421 <indexterm role="concept">
17422 <primary>uid (user id)</primary>
17423 <secondary>of originating user</secondary>
17424 </indexterm>
17425 <indexterm role="concept">
17426 <primary>sender</primary>
17427 <secondary>uid</secondary>
17428 </indexterm>
17429 <indexterm role="variable">
17430 <primary><varname>$caller_uid</varname></primary>
17431 </indexterm>
17432 <indexterm role="variable">
17433 <primary><varname>$originaltor_uid</varname></primary>
17434 </indexterm>
17435 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17436 messages received via the command line, this is the uid of the sending user.
17437 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17438 user.
17439 </para>
17440 </listitem></varlistentry>
17441 <varlistentry>
17442 <term><varname>$parent_domain</varname></term>
17443 <listitem>
17444 <para>
17445 <indexterm role="variable">
17446 <primary><varname>$parent_domain</varname></primary>
17447 </indexterm>
17448 This variable is similar to <varname>$original_domain</varname> (see
17449 above), except that it refers to the immediately preceding parent address.
17450 </para>
17451 </listitem></varlistentry>
17452 <varlistentry>
17453 <term><varname>$parent_local_part</varname></term>
17454 <listitem>
17455 <para>
17456 <indexterm role="variable">
17457 <primary><varname>$parent_local_part</varname></primary>
17458 </indexterm>
17459 This variable is similar to <varname>$original_local_part</varname>
17460 (see above), except that it refers to the immediately preceding parent address.
17461 </para>
17462 </listitem></varlistentry>
17463 <varlistentry>
17464 <term><varname>$pid</varname></term>
17465 <listitem>
17466 <para>
17467 <indexterm role="concept">
17468 <primary>pid (process id)</primary>
17469 <secondary>of current process</secondary>
17470 </indexterm>
17471 <indexterm role="variable">
17472 <primary><varname>$pid</varname></primary>
17473 </indexterm>
17474 This variable contains the current process id.
17475 </para>
17476 </listitem></varlistentry>
17477 <varlistentry>
17478 <term><varname>$pipe_addresses</varname></term>
17479 <listitem>
17480 <para>
17481 <indexterm role="concept">
17482 <primary>filter</primary>
17483 <secondary>transport filter</secondary>
17484 </indexterm>
17485 <indexterm role="concept">
17486 <primary>transport</primary>
17487 <secondary>filter</secondary>
17488 </indexterm>
17489 <indexterm role="variable">
17490 <primary><varname>$pipe_addresses</varname></primary>
17491 </indexterm>
17492 This is not an expansion variable, but is mentioned here because the string
17493 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17494 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17495 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17496 It cannot be used in general expansion strings, and provokes an <quote>unknown
17497 variable</quote> error if encountered.
17498 </para>
17499 </listitem></varlistentry>
17500 <varlistentry>
17501 <term><varname>$primary_hostname</varname></term>
17502 <listitem>
17503 <para>
17504 <indexterm role="variable">
17505 <primary><varname>$primary_hostname</varname></primary>
17506 </indexterm>
17507 This variable contains the value set by <option>primary_hostname</option> in the
17508 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17509 a single-component name, Exim calls <function>gethostbyname()</function> (or
17510 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17511 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17512 </para>
17513 </listitem></varlistentry>
17514 <varlistentry>
17515 <term><varname>$prvscheck_address</varname></term>
17516 <listitem>
17517 <para>
17518 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17519 which is described in sections <xref linkend="SECTexpansionitems"/> and
17520 <xref linkend="SECTverifyPRVS"/>.
17521 </para>
17522 </listitem></varlistentry>
17523 <varlistentry>
17524 <term><varname>$prvscheck_keynum</varname></term>
17525 <listitem>
17526 <para>
17527 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17528 which is described in sections <xref linkend="SECTexpansionitems"/> and
17529 <xref linkend="SECTverifyPRVS"/>.
17530 </para>
17531 </listitem></varlistentry>
17532 <varlistentry>
17533 <term><varname>$prvscheck_result</varname></term>
17534 <listitem>
17535 <para>
17536 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17537 which is described in sections <xref linkend="SECTexpansionitems"/> and
17538 <xref linkend="SECTverifyPRVS"/>.
17539 </para>
17540 </listitem></varlistentry>
17541 <varlistentry>
17542 <term><varname>$qualify_domain</varname></term>
17543 <listitem>
17544 <para>
17545 <indexterm role="variable">
17546 <primary><varname>$qualify_domain</varname></primary>
17547 </indexterm>
17548 The value set for the <option>qualify_domain</option> option in the configuration file.
17549 </para>
17550 </listitem></varlistentry>
17551 <varlistentry>
17552 <term><varname>$qualify_recipient</varname></term>
17553 <listitem>
17554 <para>
17555 <indexterm role="variable">
17556 <primary><varname>$qualify_recipient</varname></primary>
17557 </indexterm>
17558 The value set for the <option>qualify_recipient</option> option in the configuration file,
17559 or if not set, the value of <varname>$qualify_domain</varname>.
17560 </para>
17561 </listitem></varlistentry>
17562 <varlistentry>
17563 <term><varname>$rcpt_count</varname></term>
17564 <listitem>
17565 <para>
17566 <indexterm role="variable">
17567 <primary><varname>$rcpt_count</varname></primary>
17568 </indexterm>
17569 When a message is being received by SMTP, this variable contains the number of
17570 RCPT commands received for the current message. If this variable is used in a
17571 RCPT ACL, its value includes the current command.
17572 </para>
17573 </listitem></varlistentry>
17574 <varlistentry>
17575 <term><varname>$rcpt_defer_count</varname></term>
17576 <listitem>
17577 <para>
17578 <indexterm role="variable">
17579 <primary><varname>$rcpt_defer_count</varname></primary>
17580 </indexterm>
17581 <indexterm role="concept">
17582 <primary>4<emphasis>xx</emphasis> responses</primary>
17583 <secondary>count of</secondary>
17584 </indexterm>
17585 When a message is being received by SMTP, this variable contains the number of
17586 RCPT commands in the current message that have previously been rejected with a
17587 temporary (4<emphasis>xx</emphasis>) response.
17588 </para>
17589 </listitem></varlistentry>
17590 <varlistentry>
17591 <term><varname>$rcpt_fail_count</varname></term>
17592 <listitem>
17593 <para>
17594 <indexterm role="variable">
17595 <primary><varname>$rcpt_fail_count</varname></primary>
17596 </indexterm>
17597 When a message is being received by SMTP, this variable contains the number of
17598 RCPT commands in the current message that have previously been rejected with a
17599 permanent (5<emphasis>xx</emphasis>) response.
17600 </para>
17601 </listitem></varlistentry>
17602 <varlistentry>
17603 <term><varname>$received_count</varname></term>
17604 <listitem>
17605 <para>
17606 <indexterm role="variable">
17607 <primary><varname>$received_count</varname></primary>
17608 </indexterm>
17609 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17610 including the one added by Exim (so its value is always greater than zero). It
17611 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17612 delivering.
17613 </para>
17614 </listitem></varlistentry>
17615 <varlistentry>
17616 <term><varname>$received_for</varname></term>
17617 <listitem>
17618 <para>
17619 <indexterm role="variable">
17620 <primary><varname>$received_for</varname></primary>
17621 </indexterm>
17622 If there is only a single recipient address in an incoming message, this
17623 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17624 built. The value is copied after recipient rewriting has happened, but before
17625 the <function>local_scan()</function> function is run.
17626 </para>
17627 </listitem></varlistentry>
17628 <varlistentry>
17629 <term><varname>$received_ip_address</varname></term>
17630 <listitem>
17631 <para>
17632 <indexterm role="variable">
17633 <primary><varname>$received_ip_address</varname></primary>
17634 </indexterm>
17635 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17636 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17637 is set to the local port number. (The remote IP address and port are in
17638 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17639 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17640 option.
17641 </para>
17642 <para>
17643 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17644 could be used, for example, to make the file name for a TLS certificate depend
17645 on which interface and/or port is being used for the incoming connection. The
17646 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17647 messages that are received, thus making these variables available at delivery
17648 time.
17649 </para>
17650 <para>
17651 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17652 the values are unknown (unless they are explicitly set by options of the
17653 <command>smtp</command> transport).
17654 </para>
17655 </listitem></varlistentry>
17656 <varlistentry>
17657 <term><varname>$received_port</varname></term>
17658 <listitem>
17659 <para>
17660 <indexterm role="variable">
17661 <primary><varname>$received_port</varname></primary>
17662 </indexterm>
17663 See <varname>$received_ip_address</varname>.
17664 </para>
17665 </listitem></varlistentry>
17666 <varlistentry>
17667 <term><varname>$received_protocol</varname></term>
17668 <listitem>
17669 <para>
17670 <indexterm role="variable">
17671 <primary><varname>$received_protocol</varname></primary>
17672 </indexterm>
17673 When a message is being processed, this variable contains the name of the
17674 protocol by which it was received. Most of the names used by Exim are defined
17675 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17676 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17677 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17678 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17679 connection and the client was successfully authenticated.
17680 </para>
17681 <para>
17682 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17683 automatically set up on connection without the use of STARTTLS (see
17684 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17685 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17686 where the client initially uses EHLO, sets up an encrypted connection using
17687 STARTTLS, and then uses HELO afterwards.
17688 </para>
17689 <para>
17690 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17691 messages that are injected locally by trusted callers. This is commonly used to
17692 identify messages that are being re-injected after some kind of scanning.
17693 </para>
17694 </listitem></varlistentry>
17695 <varlistentry>
17696 <term><varname>$received_time</varname></term>
17697 <listitem>
17698 <para>
17699 <indexterm role="variable">
17700 <primary><varname>$received_time</varname></primary>
17701 </indexterm>
17702 This variable contains the date and time when the current message was received,
17703 as a number of seconds since the start of the Unix epoch.
17704 </para>
17705 </listitem></varlistentry>
17706 <varlistentry>
17707 <term><varname>$recipient_data</varname></term>
17708 <listitem>
17709 <para>
17710 <indexterm role="variable">
17711 <primary><varname>$recipient_data</varname></primary>
17712 </indexterm>
17713 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17714 condition. It contains the data from the lookup, and the value remains set
17715 until the next <option>recipients</option> test. Thus, you can do things like this:
17716 </para>
17717 <literallayout>
17718 <literal>require recipients  = cdb*@;/some/file</literal>
17719 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17720 </literallayout>
17721 <para>
17722 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17723 method in the address list, using the semicolon syntax as in the example above.
17724 The variable is not set for a lookup that is used as part of the string
17725 expansion that all such lists undergo before being interpreted.
17726 </para>
17727 </listitem></varlistentry>
17728 <varlistentry>
17729 <term><varname>$recipient_verify_failure</varname></term>
17730 <listitem>
17731 <para>
17732 <indexterm role="variable">
17733 <primary><varname>$recipient_verify_failure</varname></primary>
17734 </indexterm>
17735 In an ACL, when a recipient verification fails, this variable contains
17736 information about the failure. It is set to one of the following words:
17737 </para>
17738 <itemizedlist>
17739 <listitem>
17740 <para>
17741 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17742 was neither local nor came from an exempted host.
17743 </para>
17744 </listitem>
17745 <listitem>
17746 <para>
17747 <quote>route</quote>: Routing failed.
17748 </para>
17749 </listitem>
17750 <listitem>
17751 <para>
17752 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17753 or before the MAIL command (that is, on initial connection, HELO, or
17754 MAIL).
17755 </para>
17756 </listitem>
17757 <listitem>
17758 <para>
17759 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17760 </para>
17761 </listitem>
17762 <listitem>
17763 <para>
17764 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17765 </para>
17766 </listitem>
17767 </itemizedlist>
17768 <para>
17769 The main use of this variable is expected to be to distinguish between
17770 rejections of MAIL and rejections of RCPT.
17771 </para>
17772 </listitem></varlistentry>
17773 <varlistentry>
17774 <term><varname>$recipients</varname></term>
17775 <listitem>
17776 <para>
17777 <indexterm role="variable">
17778 <primary><varname>$recipients</varname></primary>
17779 </indexterm>
17780 This variable contains a list of envelope recipients for a message. A comma and
17781 a space separate the addresses in the replacement text. However, the variable
17782 is not generally available, to prevent exposure of Bcc recipients in
17783 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17784 cases:
17785 </para>
17786 <orderedlist numeration="arabic">
17787 <listitem>
17788 <para>
17789 In a system filter file.
17790 </para>
17791 </listitem>
17792 <listitem>
17793 <para>
17794 In the ACLs associated with the DATA command and with non-SMTP messages, that
17795 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17796 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17797 <option>acl_not_smtp_mime</option>.
17798 </para>
17799 </listitem>
17800 <listitem>
17801 <para>
17802 From within a <function>local_scan()</function> function.
17803 </para>
17804 </listitem>
17805 </orderedlist>
17806 </listitem></varlistentry>
17807 <varlistentry>
17808 <term><varname>$recipients_count</varname></term>
17809 <listitem>
17810 <para>
17811 <indexterm role="variable">
17812 <primary><varname>$recipients_count</varname></primary>
17813 </indexterm>
17814 When a message is being processed, this variable contains the number of
17815 envelope recipients that came with the message. Duplicates are not excluded
17816 from the count. While a message is being received over SMTP, the number
17817 increases for each accepted recipient. It can be referenced in an ACL.
17818 </para>
17819 </listitem></varlistentry>
17820 <varlistentry>
17821 <term><varname>$regex_match_string</varname></term>
17822 <listitem>
17823 <para>
17824 <indexterm role="variable">
17825 <primary><varname>$regex_match_string</varname></primary>
17826 </indexterm>
17827 This variable is set to contain the matching regular expression after a
17828 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17829 </para>
17830 </listitem></varlistentry>
17831 <varlistentry>
17832 <term><varname>$reply_address</varname></term>
17833 <listitem>
17834 <para>
17835 <indexterm role="variable">
17836 <primary><varname>$reply_address</varname></primary>
17837 </indexterm>
17838 When a message is being processed, this variable contains the contents of the
17839 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17840 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17841 white space, the value is not processed in any way. In particular, no RFC 2047
17842 decoding or character code translation takes place.
17843 </para>
17844 </listitem></varlistentry>
17845 <varlistentry>
17846 <term><varname>$return_path</varname></term>
17847 <listitem>
17848 <para>
17849 <indexterm role="variable">
17850 <primary><varname>$return_path</varname></primary>
17851 </indexterm>
17852 When a message is being delivered, this variable contains the return path &ndash;
17853 the sender field that will be sent as part of the envelope. It is not enclosed
17854 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17855 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17856 mailing list has been expanded by a router which specifies a different address
17857 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17858 address, whereas <varname>$sender_address</varname> always contains the original sender address
17859 that was received with the message. In other words, <varname>$sender_address</varname> contains
17860 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17861 envelope sender.
17862 </para>
17863 </listitem></varlistentry>
17864 <varlistentry>
17865 <term><varname>$return_size_limit</varname></term>
17866 <listitem>
17867 <para>
17868 <indexterm role="variable">
17869 <primary><varname>$return_size_limit</varname></primary>
17870 </indexterm>
17871 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17872 </para>
17873 </listitem></varlistentry>
17874 <varlistentry>
17875 <term><varname>$runrc</varname></term>
17876 <listitem>
17877 <para>
17878 <indexterm role="concept">
17879 <primary>return code</primary>
17880 <secondary>from <option>run</option> expansion</secondary>
17881 </indexterm>
17882 <indexterm role="variable">
17883 <primary><varname>$runrc</varname></primary>
17884 </indexterm>
17885 This variable contains the return code from a command that is run by the
17886 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17887 assume the order in which option values are expanded, except for those
17888 preconditions whose order of testing is documented. Therefore, you cannot
17889 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17890 another.
17891 </para>
17892 </listitem></varlistentry>
17893 <varlistentry>
17894 <term><varname>$self_hostname</varname></term>
17895 <listitem>
17896 <para>
17897 <indexterm role="option">
17898 <primary><option>self</option></primary>
17899 <secondary>value of host name</secondary>
17900 </indexterm>
17901 <indexterm role="variable">
17902 <primary><varname>$self_hostname</varname></primary>
17903 </indexterm>
17904 When an address is routed to a supposedly remote host that turns out to be the
17905 local host, what happens is controlled by the <option>self</option> generic router option.
17906 One of its values causes the address to be passed to another router. When this
17907 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17908 original router encountered. In other circumstances its contents are null.
17909 </para>
17910 </listitem></varlistentry>
17911 <varlistentry>
17912 <term><varname>$sender_address</varname></term>
17913 <listitem>
17914 <para>
17915 <indexterm role="variable">
17916 <primary><varname>$sender_address</varname></primary>
17917 </indexterm>
17918 When a message is being processed, this variable contains the sender&#x2019;s address
17919 that was received in the message&#x2019;s envelope. The case of letters in the address
17920 is retained, in both the local part and the domain. For bounce messages, the
17921 value of this variable is the empty string. See also <varname>$return_path</varname>.
17922 </para>
17923 </listitem></varlistentry>
17924 <varlistentry>
17925 <term><varname>$sender_address_data</varname></term>
17926 <listitem>
17927 <para>
17928 <indexterm role="variable">
17929 <primary><varname>$address_data</varname></primary>
17930 </indexterm>
17931 <indexterm role="variable">
17932 <primary><varname>$sender_address_data</varname></primary>
17933 </indexterm>
17934 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17935 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17936 distinguish it from data from a recipient address. The value does not persist
17937 after the end of the current ACL statement. If you want to preserve it for
17938 longer, you can save it in an ACL variable.
17939 </para>
17940 </listitem></varlistentry>
17941 <varlistentry>
17942 <term><varname>$sender_address_domain</varname></term>
17943 <listitem>
17944 <para>
17945 <indexterm role="variable">
17946 <primary><varname>$sender_address_domain</varname></primary>
17947 </indexterm>
17948 The domain portion of <varname>$sender_address</varname>.
17949 </para>
17950 </listitem></varlistentry>
17951 <varlistentry>
17952 <term><varname>$sender_address_local_part</varname></term>
17953 <listitem>
17954 <para>
17955 <indexterm role="variable">
17956 <primary><varname>$sender_address_local_part</varname></primary>
17957 </indexterm>
17958 The local part portion of <varname>$sender_address</varname>.
17959 </para>
17960 </listitem></varlistentry>
17961 <varlistentry>
17962 <term><varname>$sender_data</varname></term>
17963 <listitem>
17964 <para>
17965 <indexterm role="variable">
17966 <primary><varname>$sender_data</varname></primary>
17967 </indexterm>
17968 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17969 in a router <option>senders</option> option. It contains the data from the lookup, and the
17970 value remains set until the next <option>senders</option> test. Thus, you can do things like
17971 this:
17972 </para>
17973 <literallayout>
17974 <literal>require senders      = cdb*@;/some/file</literal>
17975 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17976 </literallayout>
17977 <para>
17978 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17979 method in the address list, using the semicolon syntax as in the example above.
17980 The variable is not set for a lookup that is used as part of the string
17981 expansion that all such lists undergo before being interpreted.
17982 </para>
17983 </listitem></varlistentry>
17984 <varlistentry>
17985 <term><varname>$sender_fullhost</varname></term>
17986 <listitem>
17987 <para>
17988 <indexterm role="variable">
17989 <primary><varname>$sender_fullhost</varname></primary>
17990 </indexterm>
17991 When a message is received from a remote host, this variable contains the host
17992 name and IP address in a single string. It ends with the IP address in square
17993 brackets, followed by a colon and a port number if the logging of ports is
17994 enabled. The format of the rest of the string depends on whether the host
17995 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17996 looking up its IP address. (Looking up the IP address can be forced by the
17997 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17998 start of the string is a verified host name; if this is not present,
17999 verification either failed or was not requested. A host name in parentheses is
18000 the argument of a HELO or EHLO command. This is omitted if it is identical to
18001 the verified host name or to the host&#x2019;s IP address in square brackets.
18002 </para>
18003 </listitem></varlistentry>
18004 <varlistentry>
18005 <term><varname>$sender_helo_name</varname></term>
18006 <listitem>
18007 <para>
18008 <indexterm role="variable">
18009 <primary><varname>$sender_helo_name</varname></primary>
18010 </indexterm>
18011 When a message is received from a remote host that has issued a HELO or EHLO
18012 command, the argument of that command is placed in this variable. It is also
18013 set if HELO or EHLO is used when a message is received using SMTP locally via
18014 the <option>-bs</option> or <option>-bS</option> options.
18015 </para>
18016 </listitem></varlistentry>
18017 <varlistentry>
18018 <term><varname>$sender_host_address</varname></term>
18019 <listitem>
18020 <para>
18021 <indexterm role="variable">
18022 <primary><varname>$sender_host_address</varname></primary>
18023 </indexterm>
18024 When a message is received from a remote host, this variable contains that
18025 host&#x2019;s IP address. For locally submitted messages, it is empty.
18026 </para>
18027 </listitem></varlistentry>
18028 <varlistentry>
18029 <term><varname>$sender_host_authenticated</varname></term>
18030 <listitem>
18031 <para>
18032 <indexterm role="variable">
18033 <primary><varname>$sender_host_authenticated</varname></primary>
18034 </indexterm>
18035 This variable contains the name (not the public name) of the authenticator
18036 driver that successfully authenticated the client from which the message was
18037 received. It is empty if there was no successful authentication. See also
18038 <varname>$authenticated_id</varname>.
18039 </para>
18040 </listitem></varlistentry>
18041 <varlistentry>
18042 <term><varname>$sender_host_name</varname></term>
18043 <listitem>
18044 <para>
18045 <indexterm role="variable">
18046 <primary><varname>$sender_host_name</varname></primary>
18047 </indexterm>
18048 When a message is received from a remote host, this variable contains the
18049 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18050 other means, this variable is empty.
18051 </para>
18052 <para>
18053 <indexterm role="variable">
18054 <primary><varname>$host_lookup_failed</varname></primary>
18055 </indexterm>
18056 If the host name has not previously been looked up, a reference to
18057 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18058 A looked up name is accepted only if it leads back to the original IP address
18059 via a forward lookup. If either the reverse or the forward lookup fails to find
18060 any data, or if the forward lookup does not yield the original IP address,
18061 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18062 </para>
18063 <para>
18064 <indexterm role="variable">
18065 <primary><varname>$host_lookup_deferred</varname></primary>
18066 </indexterm>
18067 However, if either of the lookups cannot be completed (for example, there is a
18068 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18069 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18070 </para>
18071 <para>
18072 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18073 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18074 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18075 is set to <quote>1</quote>.
18076 </para>
18077 <para>
18078 Exim does not automatically look up every calling host&#x2019;s name. If you want
18079 maximum efficiency, you should arrange your configuration so that it avoids
18080 these lookups altogether. The lookup happens only if one or more of the
18081 following are true:
18082 </para>
18083 <itemizedlist>
18084 <listitem>
18085 <para>
18086 A string containing <varname>$sender_host_name</varname> is expanded.
18087 </para>
18088 </listitem>
18089 <listitem>
18090 <para>
18091 The calling host matches the list in <option>host_lookup</option>. In the default
18092 configuration, this option is set to *, so it must be changed if lookups are
18093 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18094 </para>
18095 </listitem>
18096 <listitem>
18097 <para>
18098 Exim needs the host name in order to test an item in a host list. The items
18099 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18100 <xref linkend="SECThoslispatnamsk"/>.
18101 </para>
18102 </listitem>
18103 <listitem>
18104 <para>
18105 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18106 In this case, the host name is required to compare with the name quoted in any
18107 EHLO or HELO commands that the client issues.
18108 </para>
18109 </listitem>
18110 <listitem>
18111 <para>
18112 The remote host issues a EHLO or HELO command that quotes one of the
18113 domains in <option>helo_lookup_domains</option>. The default value of this option is
18114 </para>
18115 <literallayout class="monospaced">
18116   helo_lookup_domains = @ : @[]
18117 </literallayout>
18118 <para>
18119 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18120 IP address in an EHLO or HELO command.
18121 </para>
18122 </listitem>
18123 </itemizedlist>
18124 </listitem></varlistentry>
18125 <varlistentry>
18126 <term><varname>$sender_host_port</varname></term>
18127 <listitem>
18128 <para>
18129 <indexterm role="variable">
18130 <primary><varname>$sender_host_port</varname></primary>
18131 </indexterm>
18132 When a message is received from a remote host, this variable contains the port
18133 number that was used on the remote host.
18134 </para>
18135 </listitem></varlistentry>
18136 <varlistentry>
18137 <term><varname>$sender_ident</varname></term>
18138 <listitem>
18139 <para>
18140 <indexterm role="variable">
18141 <primary><varname>$sender_ident</varname></primary>
18142 </indexterm>
18143 When a message is received from a remote host, this variable contains the
18144 identification received in response to an RFC 1413 request. When a message has
18145 been received locally, this variable contains the login name of the user that
18146 called Exim.
18147 </para>
18148 </listitem></varlistentry>
18149 <varlistentry>
18150 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18151 <listitem>
18152 <para>
18153 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18154 <option>ratelimit</option> ACL condition. Details are given in section
18155 <xref linkend="SECTratelimiting"/>.
18156 </para>
18157 </listitem></varlistentry>
18158 <varlistentry>
18159 <term><varname>$sender_rcvhost</varname></term>
18160 <listitem>
18161 <para>
18162 <indexterm role="concept">
18163 <primary>DNS</primary>
18164 <secondary>reverse lookup</secondary>
18165 </indexterm>
18166 <indexterm role="concept">
18167 <primary>reverse DNS lookup</primary>
18168 </indexterm>
18169 <indexterm role="variable">
18170 <primary><varname>$sender_rcvhost</varname></primary>
18171 </indexterm>
18172 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18173 either the verified host name (as obtained from a reverse DNS lookup) or, if
18174 there is no verified host name, the IP address in square brackets. After that
18175 there may be text in parentheses. When the first item is a verified host name,
18176 the first thing in the parentheses is the IP address in square brackets,
18177 followed by a colon and a port number if port logging is enabled. When the
18178 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
18179 the parentheses.
18180 </para>
18181 <para>
18182 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
18183 was used and its argument was not identical to the real host name or IP
18184 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
18185 all three items are present in the parentheses, a newline and tab are inserted
18186 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
18187 </para>
18188 </listitem></varlistentry>
18189 <varlistentry>
18190 <term><varname>$sender_verify_failure</varname></term>
18191 <listitem>
18192 <para>
18193 <indexterm role="variable">
18194 <primary><varname>$sender_verify_failure</varname></primary>
18195 </indexterm>
18196 In an ACL, when a sender verification fails, this variable contains information
18197 about the failure. The details are the same as for
18198 <varname>$recipient_verify_failure</varname>.
18199 </para>
18200 </listitem></varlistentry>
18201 <varlistentry>
18202 <term><varname>$sending_ip_address</varname></term>
18203 <listitem>
18204 <para>
18205 <indexterm role="variable">
18206 <primary><varname>$sending_ip_address</varname></primary>
18207 </indexterm>
18208 This variable is set whenever an outgoing SMTP connection to another host has
18209 been set up. It contains the IP address of the local interface that is being
18210 used. This is useful if a host that has more than one IP address wants to take
18211 on different personalities depending on which one is being used. For incoming
18212 connections, see <varname>$received_ip_address</varname>.
18213 </para>
18214 </listitem></varlistentry>
18215 <varlistentry>
18216 <term><varname>$sending_port</varname></term>
18217 <listitem>
18218 <para>
18219 <indexterm role="variable">
18220 <primary><varname>$sending_port</varname></primary>
18221 </indexterm>
18222 This variable is set whenever an outgoing SMTP connection to another host has
18223 been set up. It contains the local port that is being used. For incoming
18224 connections, see <varname>$received_port</varname>.
18225 </para>
18226 </listitem></varlistentry>
18227 <varlistentry>
18228 <term><varname>$smtp_active_hostname</varname></term>
18229 <listitem>
18230 <para>
18231 <indexterm role="variable">
18232 <primary><varname>$smtp_active_hostname</varname></primary>
18233 </indexterm>
18234 During an incoming SMTP session, this variable contains the value of the active
18235 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18236 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18237 value can be consulted during routing and delivery.
18238 </para>
18239 </listitem></varlistentry>
18240 <varlistentry>
18241 <term><varname>$smtp_command</varname></term>
18242 <listitem>
18243 <para>
18244 <indexterm role="variable">
18245 <primary><varname>$smtp_command</varname></primary>
18246 </indexterm>
18247 During the processing of an incoming SMTP command, this variable contains the
18248 entire command. This makes it possible to distinguish between HELO and EHLO in
18249 the HELO ACL, and also to distinguish between commands such as these:
18250 </para>
18251 <literallayout class="monospaced">
18252 MAIL FROM:&lt;&gt;
18253 MAIL FROM: &lt;&gt;
18254 </literallayout>
18255 <para>
18256 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18257 command, the address in <varname>$smtp_command</varname> is the original address before any
18258 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18259 the address after SMTP-time rewriting.
18260 </para>
18261 </listitem></varlistentry>
18262 <varlistentry>
18263 <term><varname>$smtp_command_argument</varname></term>
18264 <listitem>
18265 <para>
18266 <indexterm role="concept">
18267 <primary>SMTP</primary>
18268 <secondary>command, argument for</secondary>
18269 </indexterm>
18270 <indexterm role="variable">
18271 <primary><varname>$smtp_command_argument</varname></primary>
18272 </indexterm>
18273 While an ACL is running to check an SMTP command, this variable contains the
18274 argument, that is, the text that follows the command name, with leading white
18275 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18276 somewhat redundant, but is retained for backwards compatibility.
18277 </para>
18278 </listitem></varlistentry>
18279 <varlistentry>
18280 <term><varname>$smtp_count_at_connection_start</varname></term>
18281 <listitem>
18282 <para>
18283 <indexterm role="variable">
18284 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18285 </indexterm>
18286 This variable is set greater than zero only in processes spawned by the Exim
18287 daemon for handling incoming SMTP connections. The name is deliberately long,
18288 in order to emphasize what the contents are. When the daemon accepts a new
18289 connection, it increments this variable. A copy of the variable is passed to
18290 the child process that handles the connection, but its value is fixed, and
18291 never changes. It is only an approximation of how many incoming connections
18292 there actually are, because many other connections may come and go while a
18293 single connection is being processed. When a child process terminates, the
18294 daemon decrements its copy of the variable.
18295 </para>
18296 </listitem></varlistentry>
18297 <varlistentry>
18298 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
18299 <listitem>
18300 <para>
18301 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
18302 that were current at the end of the system filter file. This allows a system
18303 filter file to set values that can be tested in users&#x2019; filter files. For
18304 example, a system filter could set a value indicating how likely it is that a
18305 message is junk mail.
18306 </para>
18307 </listitem></varlistentry>
18308 <varlistentry>
18309 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18310 <listitem>
18311 <para>
18312 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18313 is compiled with the content-scanning extension. For details, see section
18314 <xref linkend="SECTscanspamass"/>.
18315 </para>
18316 </listitem></varlistentry>
18317 <varlistentry>
18318 <term><varname>$spool_directory</varname></term>
18319 <listitem>
18320 <para>
18321 <indexterm role="variable">
18322 <primary><varname>$spool_directory</varname></primary>
18323 </indexterm>
18324 The name of Exim&#x2019;s spool directory.
18325 </para>
18326 </listitem></varlistentry>
18327 <varlistentry>
18328 <term><varname>$spool_inodes</varname></term>
18329 <listitem>
18330 <para>
18331 <indexterm role="variable">
18332 <primary><varname>$spool_inodes</varname></primary>
18333 </indexterm>
18334 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
18335 being written. The value is recalculated whenever the variable is referenced.
18336 If the relevant file system does not have the concept of inodes, the value of
18337 is -1. See also the <option>check_spool_inodes</option> option.
18338 </para>
18339 </listitem></varlistentry>
18340 <varlistentry>
18341 <term><varname>$spool_space</varname></term>
18342 <listitem>
18343 <para>
18344 <indexterm role="variable">
18345 <primary><varname>$spool_space</varname></primary>
18346 </indexterm>
18347 The amount of free space (as a number of kilobytes) in the disk partition where
18348 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
18349 variable is referenced. If the operating system does not have the ability to
18350 find the amount of free space (only true for experimental systems), the space
18351 value is -1. For example, to check in an ACL that there is at least 50
18352 megabytes free on the spool, you could write:
18353 </para>
18354 <literallayout class="monospaced">
18355 condition = ${if &gt; {$spool_space}{50000}}
18356 </literallayout>
18357 <para>
18358 See also the <option>check_spool_space</option> option.
18359 </para>
18360 </listitem></varlistentry>
18361 <varlistentry>
18362 <term><varname>$thisaddress</varname></term>
18363 <listitem>
18364 <para>
18365 <indexterm role="variable">
18366 <primary><varname>$thisaddress</varname></primary>
18367 </indexterm>
18368 This variable is set only during the processing of the <option>foranyaddress</option>
18369 command in a filter file. Its use is explained in the description of that
18370 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
18371 interfaces to mail filtering</emphasis>.
18372 </para>
18373 </listitem></varlistentry>
18374 <varlistentry revisionflag="changed">
18375 <term><varname>$tls_bits</varname></term>
18376 <listitem>
18377 <para revisionflag="changed">
18378 <indexterm role="variable">
18379 <primary><varname>$tls_bits</varname></primary>
18380 </indexterm>
18381 Contains an approximation of the TLS cipher&#x2019;s bit-strength; the meaning of
18382 this depends upon the TLS implementation used.
18383 If TLS has not been negotiated, the value will be 0.
18384 The value of this is automatically fed into the Cyrus SASL authenticator
18385 when acting as a server, to specify the "external SSF" (a SASL term).
18386 </para>
18387 </listitem></varlistentry>
18388 <varlistentry>
18389 <term><varname>$tls_certificate_verified</varname></term>
18390 <listitem>
18391 <para>
18392 <indexterm role="variable">
18393 <primary><varname>$tls_certificate_verified</varname></primary>
18394 </indexterm>
18395 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18396 message was received, and <quote>0</quote> otherwise.
18397 </para>
18398 </listitem></varlistentry>
18399 <varlistentry>
18400 <term><varname>$tls_cipher</varname></term>
18401 <listitem>
18402 <para>
18403 <indexterm role="variable">
18404 <primary><varname>$tls_cipher</varname></primary>
18405 </indexterm>
18406 When a message is received from a remote host over an encrypted SMTP
18407 connection, this variable is set to the cipher suite that was negotiated, for
18408 example DES-CBC3-SHA. In other circumstances, in particular, for message
18409 received over unencrypted connections, the variable is empty. Testing
18410 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18411 non-encrypted connections during ACL processing.
18412 </para>
18413 <para>
18414 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18415 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18416 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18417 and then set to the outgoing cipher suite if one is negotiated. See chapter
18418 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18419 details of the <command>smtp</command> transport.
18420 </para>
18421 </listitem></varlistentry>
18422 <varlistentry>
18423 <term><varname>$tls_peerdn</varname></term>
18424 <listitem>
18425 <para>
18426 <indexterm role="variable">
18427 <primary><varname>$tls_peerdn</varname></primary>
18428 </indexterm>
18429 When a message is received from a remote host over an encrypted SMTP
18430 connection, and Exim is configured to request a certificate from the client,
18431 the value of the Distinguished Name of the certificate is made available in the
18432 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18433 value is retained during message delivery, except during outbound SMTP
18434 deliveries.
18435 </para>
18436 </listitem></varlistentry>
18437 <varlistentry revisionflag="changed">
18438 <term><varname>$tls_sni</varname></term>
18439 <listitem>
18440 <para revisionflag="changed">
18441 <indexterm role="variable">
18442 <primary><varname>$tls_sni</varname></primary>
18443 </indexterm>
18444 <indexterm role="concept">
18445 <primary>TLS</primary>
18446 <secondary>Server Name Indication</secondary>
18447 </indexterm>
18448 When a TLS session is being established, if the client sends the Server
18449 Name Indication extension, the value will be placed in this variable.
18450 If the variable appears in <option>tls_certificate</option> then this option and
18451 some others, described in <xref linkend="SECTtlssni"/>,
18452 will be re-expanded early in the TLS session, to permit
18453 a different certificate to be presented (and optionally a different key to be
18454 used) to the client, based upon the value of the SNI extension.
18455 </para>
18456 <para revisionflag="changed">
18457 The value will be retained for the lifetime of the message.  During outbound
18458 SMTP deliveries, it reflects the value of the <option>tls_sni</option> option on
18459 the transport.
18460 </para>
18461 </listitem></varlistentry>
18462 <varlistentry>
18463 <term><varname>$tod_bsdinbox</varname></term>
18464 <listitem>
18465 <para>
18466 <indexterm role="variable">
18467 <primary><varname>$tod_bsdinbox</varname></primary>
18468 </indexterm>
18469 The time of day and the date, in the format required for BSD-style mailbox
18470 files, for example: Thu Oct 17 17:14:09 1995.
18471 </para>
18472 </listitem></varlistentry>
18473 <varlistentry>
18474 <term><varname>$tod_epoch</varname></term>
18475 <listitem>
18476 <para>
18477 <indexterm role="variable">
18478 <primary><varname>$tod_epoch</varname></primary>
18479 </indexterm>
18480 The time and date as a number of seconds since the start of the Unix epoch.
18481 </para>
18482 </listitem></varlistentry>
18483 <varlistentry>
18484 <term><varname>$tod_epoch_l</varname></term>
18485 <listitem>
18486 <para>
18487 <indexterm role="variable">
18488 <primary><varname>$tod_epoch_l</varname></primary>
18489 </indexterm>
18490 The time and date as a number of microseconds since the start of the Unix epoch.
18491 </para>
18492 </listitem></varlistentry>
18493 <varlistentry>
18494 <term><varname>$tod_full</varname></term>
18495 <listitem>
18496 <para>
18497 <indexterm role="variable">
18498 <primary><varname>$tod_full</varname></primary>
18499 </indexterm>
18500 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18501 +0100. The timezone is always given as a numerical offset from UTC, with
18502 positive values used for timezones that are ahead (east) of UTC, and negative
18503 values for those that are behind (west).
18504 </para>
18505 </listitem></varlistentry>
18506 <varlistentry>
18507 <term><varname>$tod_log</varname></term>
18508 <listitem>
18509 <para>
18510 <indexterm role="variable">
18511 <primary><varname>$tod_log</varname></primary>
18512 </indexterm>
18513 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18514 1995-10-12 15:32:29, but without a timezone.
18515 </para>
18516 </listitem></varlistentry>
18517 <varlistentry>
18518 <term><varname>$tod_logfile</varname></term>
18519 <listitem>
18520 <para>
18521 <indexterm role="variable">
18522 <primary><varname>$tod_logfile</varname></primary>
18523 </indexterm>
18524 This variable contains the date in the format yyyymmdd. This is the format that
18525 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18526 flag.
18527 </para>
18528 </listitem></varlistentry>
18529 <varlistentry>
18530 <term><varname>$tod_zone</varname></term>
18531 <listitem>
18532 <para>
18533 <indexterm role="variable">
18534 <primary><varname>$tod_zone</varname></primary>
18535 </indexterm>
18536 This variable contains the numerical value of the local timezone, for example:
18537 -0500.
18538 </para>
18539 </listitem></varlistentry>
18540 <varlistentry>
18541 <term><varname>$tod_zulu</varname></term>
18542 <listitem>
18543 <para>
18544 <indexterm role="variable">
18545 <primary><varname>$tod_zulu</varname></primary>
18546 </indexterm>
18547 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18548 by ISO 8601, for example: 20030221154023Z.
18549 </para>
18550 </listitem></varlistentry>
18551 <varlistentry>
18552 <term><varname>$value</varname></term>
18553 <listitem>
18554 <para>
18555 <indexterm role="variable">
18556 <primary><varname>$value</varname></primary>
18557 </indexterm>
18558 This variable contains the result of an expansion lookup, extraction operation,
18559 or external command, as described above. It is also used during a
18560 <emphasis role="bold">reduce</emphasis> expansion.
18561 </para>
18562 </listitem></varlistentry>
18563 <varlistentry>
18564 <term><varname>$version_number</varname></term>
18565 <listitem>
18566 <para>
18567 <indexterm role="variable">
18568 <primary><varname>$version_number</varname></primary>
18569 </indexterm>
18570 The version number of Exim.
18571 </para>
18572 </listitem></varlistentry>
18573 <varlistentry>
18574 <term><varname>$warn_message_delay</varname></term>
18575 <listitem>
18576 <para>
18577 <indexterm role="variable">
18578 <primary><varname>$warn_message_delay</varname></primary>
18579 </indexterm>
18580 This variable is set only during the creation of a message warning about a
18581 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18582 </para>
18583 </listitem></varlistentry>
18584 <varlistentry>
18585 <term><varname>$warn_message_recipients</varname></term>
18586 <listitem>
18587 <para>
18588 <indexterm role="variable">
18589 <primary><varname>$warn_message_recipients</varname></primary>
18590 </indexterm>
18591 This variable is set only during the creation of a message warning about a
18592 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18593 </para>
18594 </listitem></varlistentry>
18595 </variablelist>
18596 <para>
18597 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18598 </para>
18599 </section>
18600 </chapter>
18601
18602 <chapter id="CHAPperl">
18603 <title>Embedded Perl</title>
18604 <para>
18605 <indexterm role="concept" id="IIDperl" class="startofrange">
18606 <primary>Perl</primary>
18607 <secondary>calling from Exim</secondary>
18608 </indexterm>
18609 Exim can be built to include an embedded Perl interpreter. When this is done,
18610 Perl subroutines can be called as part of the string expansion process. To make
18611 use of the Perl support, you need version 5.004 or later of Perl installed on
18612 your system. To include the embedded interpreter in the Exim binary, include
18613 the line
18614 </para>
18615 <literallayout class="monospaced">
18616 EXIM_PERL = perl.o
18617 </literallayout>
18618 <para>
18619 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18620 </para>
18621 <section id="SECID85">
18622 <title>Setting up so Perl can be used</title>
18623 <para>
18624 <indexterm role="option">
18625 <primary><option>perl_startup</option></primary>
18626 </indexterm>
18627 Access to Perl subroutines is via a global configuration option called
18628 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18629 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18630 interpreter is started and there is almost no overhead for Exim (since none of
18631 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18632 option then the associated value is taken to be Perl code which is executed in
18633 a newly created Perl interpreter.
18634 </para>
18635 <para>
18636 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18637 need backslashes before any characters to escape special meanings. The option
18638 should usually be something like
18639 </para>
18640 <literallayout class="monospaced">
18641 perl_startup = do '/etc/exim.pl'
18642 </literallayout>
18643 <para>
18644 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18645 use from Exim. Exim can be configured either to start up a Perl interpreter as
18646 soon as it is entered, or to wait until the first time it is needed. Starting
18647 the interpreter at the beginning ensures that it is done while Exim still has
18648 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18649 fact used in a particular run. Also, note that this does not mean that Exim is
18650 necessarily running as root when Perl is called at a later time. By default,
18651 the interpreter is started only when it is needed, but this can be changed in
18652 two ways:
18653 </para>
18654 <itemizedlist>
18655 <listitem>
18656 <para>
18657 <indexterm role="option">
18658 <primary><option>perl_at_start</option></primary>
18659 </indexterm>
18660 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18661 a startup when Exim is entered.
18662 </para>
18663 </listitem>
18664 <listitem>
18665 <para>
18666 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18667 overriding the setting of <option>perl_at_start</option>.
18668 </para>
18669 </listitem>
18670 </itemizedlist>
18671 <para>
18672 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18673 initial startup, even if <option>perl_at_start</option> is set.
18674 </para>
18675 </section>
18676 <section id="SECID86">
18677 <title>Calling Perl subroutines</title>
18678 <para>
18679 When the configuration file includes a <option>perl_startup</option> option you can make use
18680 of the string expansion item to call the Perl subroutines that are defined
18681 by the <option>perl_startup</option> code. The operator is used in any of the following
18682 forms:
18683 </para>
18684 <literallayout class="monospaced">
18685 ${perl{foo}}
18686 ${perl{foo}{argument}}
18687 ${perl{foo}{argument1}{argument2} ... }
18688 </literallayout>
18689 <para>
18690 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18691 arguments may be passed. Passing more than this results in an expansion failure
18692 with an error message of the form
18693 </para>
18694 <literallayout class="monospaced">
18695 Too many arguments passed to Perl subroutine "foo" (max is 8)
18696 </literallayout>
18697 <para>
18698 The return value of the Perl subroutine is evaluated in a scalar context before
18699 it is passed back to Exim to be inserted into the expanded string. If the
18700 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18701 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18702 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18703 that was passed to <option>die</option>.
18704 </para>
18705 </section>
18706 <section id="SECID87">
18707 <title>Calling Exim functions from Perl</title>
18708 <para>
18709 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18710 is available to call back into Exim&#x2019;s string expansion function. For example,
18711 the Perl code
18712 </para>
18713 <literallayout class="monospaced">
18714 my $lp = Exim::expand_string('$local_part');
18715 </literallayout>
18716 <para>
18717 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18718 Note those are single quotes and not double quotes to protect against
18719 <varname>$local_part</varname> being interpolated as a Perl variable.
18720 </para>
18721 <para>
18722 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18723 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18724 expansion string, the Perl call from the original expansion string fails with
18725 an appropriate error message, in the same way as if <option>die</option> were used.
18726 </para>
18727 <para>
18728 <indexterm role="concept">
18729 <primary>debugging</primary>
18730 <secondary>from embedded Perl</secondary>
18731 </indexterm>
18732 <indexterm role="concept">
18733 <primary>log</primary>
18734 <secondary>writing from embedded Perl</secondary>
18735 </indexterm>
18736 Two other Exim functions are available for use from within Perl code.
18737 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18738 debugging is enabled. If you want a newline at the end, you must supply it.
18739 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18740 timestamp. In this case, you should not supply a terminating newline.
18741 </para>
18742 </section>
18743 <section id="SECID88">
18744 <title>Use of standard output and error by Perl</title>
18745 <para>
18746 <indexterm role="concept">
18747 <primary>Perl</primary>
18748 <secondary>standard output and error</secondary>
18749 </indexterm>
18750 You should not write to the standard error or output streams from within your
18751 Perl code, as it is not defined how these are set up. In versions of Exim
18752 before 4.50, it is possible for the standard output or error to refer to the
18753 SMTP connection during message reception via the daemon. Writing to this stream
18754 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18755 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18756 avoided, but the output is lost.
18757 </para>
18758 <para>
18759 <indexterm role="concept">
18760 <primary>Perl</primary>
18761 <secondary>use of <option>warn</option></secondary>
18762 </indexterm>
18763 The Perl <option>warn</option> statement writes to the standard error stream by default.
18764 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18765 you have no control. When Exim starts up the Perl interpreter, it arranges for
18766 output from the <option>warn</option> statement to be written to the Exim main log. You can
18767 change this by including appropriate Perl magic somewhere in your Perl code.
18768 For example, to discard <option>warn</option> output completely, you need this:
18769 </para>
18770 <literallayout class="monospaced">
18771 $SIG{__WARN__} = sub { };
18772 </literallayout>
18773 <para>
18774 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18775 example, the code for the subroutine is empty, so it does nothing, but you can
18776 include any Perl code that you like. The text of the <option>warn</option> message is passed
18777 as the first subroutine argument.
18778 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18779 </para>
18780 </section>
18781 </chapter>
18782
18783 <chapter id="CHAPinterfaces">
18784 <title>Starting the daemon and the use of network interfaces</title>
18785 <titleabbrev>Starting the daemon</titleabbrev>
18786 <para>
18787 <indexterm role="concept">
18788 <primary>daemon</primary>
18789 <secondary>starting</secondary>
18790 </indexterm>
18791 <indexterm role="concept">
18792 <primary>interface</primary>
18793 <secondary>listening</secondary>
18794 </indexterm>
18795 <indexterm role="concept">
18796 <primary>network interface</primary>
18797 </indexterm>
18798 <indexterm role="concept">
18799 <primary>interface</primary>
18800 <secondary>network</secondary>
18801 </indexterm>
18802 <indexterm role="concept">
18803 <primary>IP address</primary>
18804 <secondary>for listening</secondary>
18805 </indexterm>
18806 <indexterm role="concept">
18807 <primary>daemon</primary>
18808 <secondary>listening IP addresses</secondary>
18809 </indexterm>
18810 <indexterm role="concept">
18811 <primary>TCP/IP</primary>
18812 <secondary>setting listening interfaces</secondary>
18813 </indexterm>
18814 <indexterm role="concept">
18815 <primary>TCP/IP</primary>
18816 <secondary>setting listening ports</secondary>
18817 </indexterm>
18818 A host that is connected to a TCP/IP network may have one or more physical
18819 hardware network interfaces. Each of these interfaces may be configured as one
18820 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18821 works with. Each of these logical interfaces is associated with an IP address.
18822 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18823 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18824 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18825 </para>
18826 <orderedlist numeration="arabic">
18827 <listitem>
18828 <para>
18829 When a listening daemon is started, Exim needs to know which interfaces
18830 and ports to listen on.
18831 </para>
18832 </listitem>
18833 <listitem>
18834 <para>
18835 When Exim is routing an address, it needs to know which IP addresses
18836 are associated with local interfaces. This is required for the correct
18837 processing of MX lists by removing the local host and others with the
18838 same or higher priority values. Also, Exim needs to detect cases
18839 when an address is routed to an IP address that in fact belongs to the
18840 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18841 option of the smtp transport is set (as appropriate), this is treated
18842 as an error situation.
18843 </para>
18844 </listitem>
18845 <listitem>
18846 <para>
18847 When Exim connects to a remote host, it may need to know which interface to use
18848 for the outgoing connection.
18849 </para>
18850 </listitem>
18851 </orderedlist>
18852 <para>
18853 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18854 of cases. If your host has only one interface, and you want all its IP
18855 addresses to be treated in the same way, and you are using only the
18856 standard SMTP port, you should not need to take any special action. The
18857 rest of this chapter does not apply to you.
18858 </para>
18859 <para>
18860 In a more complicated situation you may want to listen only on certain
18861 interfaces, or on different ports, and for this reason there are a number of
18862 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18863 chapter describes how they operate.
18864 </para>
18865 <para>
18866 When a message is received over TCP/IP, the interface and port that were
18867 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18868 </para>
18869 <section id="SECID89">
18870 <title>Starting a listening daemon</title>
18871 <para>
18872 When a listening daemon is started (by means of the <option>-bd</option> command line
18873 option), the interfaces and ports on which it listens are controlled by the
18874 following options:
18875 </para>
18876 <itemizedlist>
18877 <listitem>
18878 <para>
18879 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18880 compatibility, this option can also be specified in the singular.)
18881 </para>
18882 </listitem>
18883 <listitem>
18884 <para>
18885 <option>local_interfaces</option> contains list of interface IP addresses on which to
18886 listen. Each item may optionally also specify a port.
18887 </para>
18888 </listitem>
18889 </itemizedlist>
18890 <para>
18891 The default list separator in both cases is a colon, but this can be changed as
18892 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18893 it is usually best to change the separator to avoid having to double all the
18894 colons. For example:
18895 </para>
18896 <literallayout class="monospaced">
18897 local_interfaces = &lt;; 127.0.0.1 ; \
18898                       192.168.23.65 ; \
18899                       ::1 ; \
18900                       3ffe:ffff:836f::fe86:a061
18901 </literallayout>
18902 <para>
18903 There are two different formats for specifying a port along with an IP address
18904 in <option>local_interfaces</option>:
18905 </para>
18906 <orderedlist numeration="arabic">
18907 <listitem>
18908 <para>
18909 The port is added onto the address with a dot separator. For example, to listen
18910 on port 1234 on two different IP addresses:
18911 </para>
18912 <literallayout class="monospaced">
18913 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18914                       3ffe:ffff:836f::fe86:a061.1234
18915 </literallayout>
18916 </listitem>
18917 <listitem>
18918 <para>
18919 The IP address is enclosed in square brackets, and the port is added
18920 with a colon separator, for example:
18921 </para>
18922 <literallayout class="monospaced">
18923 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18924                       [3ffe:ffff:836f::fe86:a061]:1234
18925 </literallayout>
18926 </listitem>
18927 </orderedlist>
18928 <para>
18929 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18930 default setting contains just one port:
18931 </para>
18932 <literallayout class="monospaced">
18933 daemon_smtp_ports = smtp
18934 </literallayout>
18935 <para>
18936 If more than one port is listed, each interface that does not have its own port
18937 specified listens on all of them. Ports that are listed in
18938 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18939 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18940 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18941 </para>
18942 </section>
18943 <section id="SECID90">
18944 <title>Special IP listening addresses</title>
18945 <para>
18946 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18947 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18948 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18949 instead of setting up separate listening sockets for each interface. The
18950 default value of <option>local_interfaces</option> is
18951 </para>
18952 <literallayout class="monospaced">
18953 local_interfaces = 0.0.0.0
18954 </literallayout>
18955 <para>
18956 when Exim is built without IPv6 support; otherwise it is:
18957 </para>
18958 <literallayout class="monospaced">
18959 local_interfaces = &lt;; ::0 ; 0.0.0.0
18960 </literallayout>
18961 <para>
18962 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18963 </para>
18964 </section>
18965 <section id="SECID91">
18966 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18967 <para>
18968 The <option>-oX</option> command line option can be used to override the values of
18969 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18970 instance. Another way of doing this would be to use macros and the <option>-D</option>
18971 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18972 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18973 exim.
18974 </para>
18975 <para>
18976 The value of <option>-oX</option> is a list of items. The default colon separator can be
18977 changed in the usual way if required. If there are any items that do not
18978 contain dots or colons (that is, are not IP addresses), the value of
18979 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18980 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18981 replaced by those items. Thus, for example,
18982 </para>
18983 <literallayout class="monospaced">
18984 -oX 1225
18985 </literallayout>
18986 <para>
18987 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18988 whereas
18989 </para>
18990 <literallayout class="monospaced">
18991 -oX 192.168.34.5.1125
18992 </literallayout>
18993 <para>
18994 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18995 (However, since <option>local_interfaces</option> now contains no items without ports, the
18996 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18997 </para>
18998 </section>
18999 <section id="SECTsupobssmt">
19000 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
19001 <para>
19002 <indexterm role="concept">
19003 <primary>ssmtp protocol</primary>
19004 </indexterm>
19005 <indexterm role="concept">
19006 <primary>smtps protocol</primary>
19007 </indexterm>
19008 <indexterm role="concept">
19009 <primary>SMTP</primary>
19010 <secondary>ssmtp protocol</secondary>
19011 </indexterm>
19012 <indexterm role="concept">
19013 <primary>SMTP</primary>
19014 <secondary>smtps protocol</secondary>
19015 </indexterm>
19016 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
19017 before the STARTTLS command was standardized for SMTP. Some legacy clients
19018 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
19019 list of port numbers, connections to those ports must use SSMTP. The most
19020 common use of this option is expected to be
19021 </para>
19022 <literallayout class="monospaced">
19023 tls_on_connect_ports = 465
19024 </literallayout>
19025 <para>
19026 because 465 is the usual port number used by the legacy clients. There is also
19027 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
19028 this way when a daemon is started.
19029 </para>
19030 <para>
19031 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
19032 daemon to listen on those ports. You must still specify them in
19033 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
19034 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
19035 connections via the daemon.)
19036 </para>
19037 </section>
19038 <section id="SECID92">
19039 <title>IPv6 address scopes</title>
19040 <para>
19041 <indexterm role="concept">
19042 <primary>IPv6</primary>
19043 <secondary>address scopes</secondary>
19044 </indexterm>
19045 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
19046 can, in principle, have the same link-local IPv6 address on different
19047 interfaces. Thus, additional information is needed, over and above the IP
19048 address, to distinguish individual interfaces. A convention of using a
19049 percent sign followed by something (often the interface name) has been
19050 adopted in some cases, leading to addresses like this:
19051 </para>
19052 <literallayout class="monospaced">
19053 fe80::202:b3ff:fe03:45c1%eth0
19054 </literallayout>
19055 <para>
19056 To accommodate this usage, a percent sign followed by an arbitrary string is
19057 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
19058 to convert a textual IPv6 address for actual use. This function recognizes the
19059 percent convention in operating systems that support it, and it processes the
19060 address appropriately. Unfortunately, some older libraries have problems with
19061 <function>getaddrinfo()</function>. If
19062 </para>
19063 <literallayout class="monospaced">
19064 IPV6_USE_INET_PTON=yes
19065 </literallayout>
19066 <para>
19067 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
19068 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
19069 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
19070 function.) Of course, this means that the additional functionality of
19071 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
19072 </para>
19073 </section>
19074 <section id="SECID93">
19075 <title>Disabling IPv6</title>
19076 <para>
19077 <indexterm role="concept">
19078 <primary>IPv6</primary>
19079 <secondary>disabling</secondary>
19080 </indexterm>
19081 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
19082 run on a host whose kernel does not support IPv6. The binary will fall back to
19083 using IPv4, but it may waste resources looking up AAAA records, and trying to
19084 connect to IPv6 addresses, causing delays to mail delivery. If you set the
19085 <indexterm role="option">
19086 <primary><option>disable_ipv6</option></primary>
19087 </indexterm>
19088 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
19089 activities take place. AAAA records are never looked up, and any IPv6 addresses
19090 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
19091 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
19092 to handle IPv6 literal addresses.
19093 </para>
19094 <para>
19095 On the other hand, when IPv6 is in use, there may be times when you want to
19096 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
19097 option to globally suppress the lookup of AAAA records for specified domains,
19098 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
19099 IPv6 addresses in an individual router.
19100 </para>
19101 </section>
19102 <section id="SECID94">
19103 <title>Examples of starting a listening daemon</title>
19104 <para>
19105 The default case in an IPv6 environment is
19106 </para>
19107 <literallayout class="monospaced">
19108 daemon_smtp_ports = smtp
19109 local_interfaces = &lt;; ::0 ; 0.0.0.0
19110 </literallayout>
19111 <para>
19112 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
19113 Either one or two sockets may be used, depending on the characteristics of
19114 the TCP/IP stack. (This is complicated and messy; for more information,
19115 read the comments in the <filename>daemon.c</filename> source file.)
19116 </para>
19117 <para>
19118 To specify listening on ports 25 and 26 on all interfaces:
19119 </para>
19120 <literallayout class="monospaced">
19121 daemon_smtp_ports = 25 : 26
19122 </literallayout>
19123 <para>
19124 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
19125 </para>
19126 <literallayout class="monospaced">
19127 local_interfaces = &lt;; ::0.25     ; ::0.26 \
19128                       0.0.0.0.25 ; 0.0.0.0.26
19129 </literallayout>
19130 <para>
19131 To listen on the default port on all IPv4 interfaces, and on port 26 on the
19132 IPv4 loopback address only:
19133 </para>
19134 <literallayout class="monospaced">
19135 local_interfaces = 0.0.0.0 : 127.0.0.1.26
19136 </literallayout>
19137 <para>
19138 To specify listening on the default port on specific interfaces only:
19139 </para>
19140 <literallayout class="monospaced">
19141 local_interfaces = 192.168.34.67 : 192.168.34.67
19142 </literallayout>
19143 <para>
19144 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
19145 </para>
19146 </section>
19147 <section id="SECTreclocipadd">
19148 <title>Recognizing the local host</title>
19149 <para>
19150 The <option>local_interfaces</option> option is also used when Exim needs to determine
19151 whether or not an IP address refers to the local host. That is, the IP
19152 addresses of all the interfaces on which a daemon is listening are always
19153 treated as local.
19154 </para>
19155 <para>
19156 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
19157 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
19158 available interfaces from the operating system, and extracts the relevant
19159 (that is, IPv4 or IPv6) addresses to use for checking.
19160 </para>
19161 <para>
19162 Some systems set up large numbers of virtual interfaces in order to provide
19163 many virtual web servers. In this situation, you may want to listen for
19164 email on only a few of the available interfaces, but nevertheless treat all
19165 interfaces as local when routing. You can do this by setting
19166 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
19167 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
19168 used for listening. Consider this example:
19169 </para>
19170 <literallayout class="monospaced">
19171 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
19172                       192.168.53.235 ; \
19173                       3ffe:2101:12:1:a00:20ff:fe86:a061
19174
19175 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
19176 </literallayout>
19177 <para>
19178 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
19179 address, but all available interface addresses are treated as local when
19180 Exim is routing.
19181 </para>
19182 <para>
19183 In some environments the local host name may be in an MX list, but with an IP
19184 address that is not assigned to any local interface. In other cases it may be
19185 desirable to treat other host names as if they referred to the local host. Both
19186 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
19187 This contains host names rather than IP addresses. When a host is referenced
19188 during routing, either via an MX record or directly, it is treated as the local
19189 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
19190 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
19191 </para>
19192 </section>
19193 <section id="SECID95">
19194 <title>Delivering to a remote host</title>
19195 <para>
19196 Delivery to a remote host is handled by the smtp transport. By default, it
19197 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
19198 there is more than one) when connecting to a remote host. However, the
19199 <option>interface</option> option can be set to specify which interface is used. See the
19200 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
19201 details.
19202 </para>
19203 </section>
19204 </chapter>
19205
19206 <chapter id="CHAPmainconfig">
19207 <title>Main configuration</title>
19208 <para>
19209 <indexterm role="concept" id="IIDconfima" class="startofrange">
19210 <primary>configuration file</primary>
19211 <secondary>main section</secondary>
19212 </indexterm>
19213 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
19214 <primary>main configuration</primary>
19215 </indexterm>
19216 The first part of the run time configuration file contains three types of item:
19217 </para>
19218 <itemizedlist>
19219 <listitem>
19220 <para>
19221 Macro definitions: These lines start with an upper case letter. See section
19222 <xref linkend="SECTmacrodefs"/> for details of macro processing.
19223 </para>
19224 </listitem>
19225 <listitem>
19226 <para>
19227 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
19228 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
19229 section <xref linkend="SECTnamedlists"/>.
19230 </para>
19231 </listitem>
19232 <listitem>
19233 <para>
19234 Main configuration settings: Each setting occupies one line of the file
19235 (with possible continuations). If any setting is preceded by the word
19236 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
19237 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
19238 settings.
19239 </para>
19240 </listitem>
19241 </itemizedlist>
19242 <para>
19243 This chapter specifies all the main configuration options, along with their
19244 types and default values. For ease of finding a particular option, they appear
19245 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
19246 are now so many options, they are first listed briefly in functional groups, as
19247 an aid to finding the name of the option you are looking for. Some options are
19248 listed in more than one group.
19249 </para>
19250 <section id="SECID96">
19251 <title>Miscellaneous</title>
19252 <informaltable frame="none">
19253 <tgroup cols="2" colsep="0" rowsep="0">
19254 <colspec colwidth="196pt" align="left"/>
19255 <colspec colwidth="254pt" align="left"/>
19256 <tbody>
19257 <row>
19258 <entry><option>bi_command</option></entry>
19259 <entry>to run for <option>-bi</option> command line option</entry>
19260 </row>
19261 <row>
19262 <entry><option>disable_ipv6</option></entry>
19263 <entry>do no IPv6 processing</entry>
19264 </row>
19265 <row>
19266 <entry><option>keep_malformed</option></entry>
19267 <entry>for broken files &ndash; should not happen</entry>
19268 </row>
19269 <row>
19270 <entry><option>localhost_number</option></entry>
19271 <entry>for unique message ids in clusters</entry>
19272 </row>
19273 <row>
19274 <entry><option>message_body_newlines</option></entry>
19275 <entry>retain newlines in <varname>$message_body</varname></entry>
19276 </row>
19277 <row>
19278 <entry><option>message_body_visible</option></entry>
19279 <entry>how much to show in <varname>$message_body</varname></entry>
19280 </row>
19281 <row>
19282 <entry><option>mua_wrapper</option></entry>
19283 <entry>run in <quote>MUA wrapper</quote> mode</entry>
19284 </row>
19285 <row>
19286 <entry><option>print_topbitchars</option></entry>
19287 <entry>top-bit characters are printing</entry>
19288 </row>
19289 <row>
19290 <entry><option>timezone</option></entry>
19291 <entry>force time zone</entry>
19292 </row>
19293 </tbody>
19294 </tgroup>
19295 </informaltable>
19296 </section>
19297 <section id="SECID97">
19298 <title>Exim parameters</title>
19299 <informaltable frame="none">
19300 <tgroup cols="2" colsep="0" rowsep="0">
19301 <colspec colwidth="196pt" align="left"/>
19302 <colspec colwidth="254pt" align="left"/>
19303 <tbody>
19304 <row>
19305 <entry><option>exim_group</option></entry>
19306 <entry>override compiled-in value</entry>
19307 </row>
19308 <row>
19309 <entry><option>exim_path</option></entry>
19310 <entry>override compiled-in value</entry>
19311 </row>
19312 <row>
19313 <entry><option>exim_user</option></entry>
19314 <entry>override compiled-in value</entry>
19315 </row>
19316 <row>
19317 <entry><option>primary_hostname</option></entry>
19318 <entry>default from <function>uname()</function></entry>
19319 </row>
19320 <row>
19321 <entry><option>split_spool_directory</option></entry>
19322 <entry>use multiple directories</entry>
19323 </row>
19324 <row>
19325 <entry><option>spool_directory</option></entry>
19326 <entry>override compiled-in value</entry>
19327 </row>
19328 </tbody>
19329 </tgroup>
19330 </informaltable>
19331 </section>
19332 <section id="SECID98">
19333 <title>Privilege controls</title>
19334 <informaltable frame="none">
19335 <tgroup cols="2" colsep="0" rowsep="0">
19336 <colspec colwidth="196pt" align="left"/>
19337 <colspec colwidth="254pt" align="left"/>
19338 <tbody>
19339 <row>
19340 <entry><option>admin_groups</option></entry>
19341 <entry>groups that are Exim admin users</entry>
19342 </row>
19343 <row>
19344 <entry><option>deliver_drop_privilege</option></entry>
19345 <entry>drop root for delivery processes</entry>
19346 </row>
19347 <row>
19348 <entry><option>local_from_check</option></entry>
19349 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19350 </row>
19351 <row>
19352 <entry><option>local_from_prefix</option></entry>
19353 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19354 </row>
19355 <row>
19356 <entry><option>local_from_suffix</option></entry>
19357 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19358 </row>
19359 <row>
19360 <entry><option>local_sender_retain</option></entry>
19361 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19362 </row>
19363 <row>
19364 <entry><option>never_users</option></entry>
19365 <entry>do not run deliveries as these</entry>
19366 </row>
19367 <row>
19368 <entry><option>prod_requires_admin</option></entry>
19369 <entry>forced delivery requires admin user</entry>
19370 </row>
19371 <row>
19372 <entry><option>queue_list_requires_admin</option></entry>
19373 <entry>queue listing requires admin user</entry>
19374 </row>
19375 <row>
19376 <entry><option>trusted_groups</option></entry>
19377 <entry>groups that are trusted</entry>
19378 </row>
19379 <row>
19380 <entry><option>trusted_users</option></entry>
19381 <entry>users that are trusted</entry>
19382 </row>
19383 </tbody>
19384 </tgroup>
19385 </informaltable>
19386 </section>
19387 <section id="SECID99">
19388 <title>Logging</title>
19389 <informaltable frame="none">
19390 <tgroup cols="2" colsep="0" rowsep="0">
19391 <colspec colwidth="196pt" align="left"/>
19392 <colspec colwidth="254pt" align="left"/>
19393 <tbody>
19394 <row>
19395 <entry><option>hosts_connection_nolog</option></entry>
19396 <entry>exemption from connect logging</entry>
19397 </row>
19398 <row>
19399 <entry><option>log_file_path</option></entry>
19400 <entry>override compiled-in value</entry>
19401 </row>
19402 <row>
19403 <entry><option>log_selector</option></entry>
19404 <entry>set/unset optional logging</entry>
19405 </row>
19406 <row>
19407 <entry><option>log_timezone</option></entry>
19408 <entry>add timezone to log lines</entry>
19409 </row>
19410 <row>
19411 <entry><option>message_logs</option></entry>
19412 <entry>create per-message logs</entry>
19413 </row>
19414 <row>
19415 <entry><option>preserve_message_logs</option></entry>
19416 <entry>after message completion</entry>
19417 </row>
19418 <row>
19419 <entry><option>process_log_path</option></entry>
19420 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19421 </row>
19422 <row>
19423 <entry><option>syslog_duplication</option></entry>
19424 <entry>controls duplicate log lines on syslog</entry>
19425 </row>
19426 <row>
19427 <entry><option>syslog_facility</option></entry>
19428 <entry>set syslog <quote>facility</quote> field</entry>
19429 </row>
19430 <row>
19431 <entry><option>syslog_processname</option></entry>
19432 <entry>set syslog <quote>ident</quote> field</entry>
19433 </row>
19434 <row>
19435 <entry><option>syslog_timestamp</option></entry>
19436 <entry>timestamp syslog lines</entry>
19437 </row>
19438 <row>
19439 <entry><option>write_rejectlog</option></entry>
19440 <entry>control use of message log</entry>
19441 </row>
19442 </tbody>
19443 </tgroup>
19444 </informaltable>
19445 </section>
19446 <section id="SECID100">
19447 <title>Frozen messages</title>
19448 <informaltable frame="none">
19449 <tgroup cols="2" colsep="0" rowsep="0">
19450 <colspec colwidth="196pt" align="left"/>
19451 <colspec colwidth="254pt" align="left"/>
19452 <tbody>
19453 <row>
19454 <entry><option>auto_thaw</option></entry>
19455 <entry>sets time for retrying frozen messages</entry>
19456 </row>
19457 <row>
19458 <entry><option>freeze_tell</option></entry>
19459 <entry>send message when freezing</entry>
19460 </row>
19461 <row>
19462 <entry><option>move_frozen_messages</option></entry>
19463 <entry>to another directory</entry>
19464 </row>
19465 <row>
19466 <entry><option>timeout_frozen_after</option></entry>
19467 <entry>keep frozen messages only so long</entry>
19468 </row>
19469 </tbody>
19470 </tgroup>
19471 </informaltable>
19472 </section>
19473 <section id="SECID101">
19474 <title>Data lookups</title>
19475 <informaltable frame="none">
19476 <tgroup cols="2" colsep="0" rowsep="0">
19477 <colspec colwidth="196pt" align="left"/>
19478 <colspec colwidth="254pt" align="left"/>
19479 <tbody>
19480 <row>
19481 <entry><option>ibase_servers</option></entry>
19482 <entry>InterBase servers</entry>
19483 </row>
19484 <row>
19485 <entry><option>ldap_ca_cert_dir</option></entry>
19486 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
19487 </row>
19488 <row>
19489 <entry><option>ldap_ca_cert_file</option></entry>
19490 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
19491 </row>
19492 <row>
19493 <entry><option>ldap_cert_file</option></entry>
19494 <entry>client cert file for LDAP</entry>
19495 </row>
19496 <row>
19497 <entry><option>ldap_cert_key</option></entry>
19498 <entry>client key file for LDAP</entry>
19499 </row>
19500 <row>
19501 <entry><option>ldap_cipher_suite</option></entry>
19502 <entry>TLS negotiation preference control</entry>
19503 </row>
19504 <row>
19505 <entry><option>ldap_default_servers</option></entry>
19506 <entry>used if no server in query</entry>
19507 </row>
19508 <row>
19509 <entry><option>ldap_require_cert</option></entry>
19510 <entry>action to take without LDAP server cert</entry>
19511 </row>
19512 <row>
19513 <entry><option>ldap_start_tls</option></entry>
19514 <entry>require TLS within LDAP</entry>
19515 </row>
19516 <row>
19517 <entry><option>ldap_version</option></entry>
19518 <entry>set protocol version</entry>
19519 </row>
19520 <row>
19521 <entry><option>lookup_open_max</option></entry>
19522 <entry>lookup files held open</entry>
19523 </row>
19524 <row>
19525 <entry><option>mysql_servers</option></entry>
19526 <entry>default MySQL servers</entry>
19527 </row>
19528 <row>
19529 <entry><option>oracle_servers</option></entry>
19530 <entry>Oracle servers</entry>
19531 </row>
19532 <row>
19533 <entry><option>pgsql_servers</option></entry>
19534 <entry>default PostgreSQL servers</entry>
19535 </row>
19536 <row>
19537 <entry><option>sqlite_lock_timeout</option></entry>
19538 <entry>as it says</entry>
19539 </row>
19540 </tbody>
19541 </tgroup>
19542 </informaltable>
19543 </section>
19544 <section id="SECID102">
19545 <title>Message ids</title>
19546 <informaltable frame="none">
19547 <tgroup cols="2" colsep="0" rowsep="0">
19548 <colspec colwidth="196pt" align="left"/>
19549 <colspec colwidth="254pt" align="left"/>
19550 <tbody>
19551 <row>
19552 <entry><option>message_id_header_domain</option></entry>
19553 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19554 </row>
19555 <row>
19556 <entry><option>message_id_header_text</option></entry>
19557 <entry>ditto</entry>
19558 </row>
19559 </tbody>
19560 </tgroup>
19561 </informaltable>
19562 </section>
19563 <section id="SECID103">
19564 <title>Embedded Perl Startup</title>
19565 <informaltable frame="none">
19566 <tgroup cols="2" colsep="0" rowsep="0">
19567 <colspec colwidth="196pt" align="left"/>
19568 <colspec colwidth="254pt" align="left"/>
19569 <tbody>
19570 <row>
19571 <entry><option>perl_at_start</option></entry>
19572 <entry>always start the interpreter</entry>
19573 </row>
19574 <row>
19575 <entry><option>perl_startup</option></entry>
19576 <entry>code to obey when starting Perl</entry>
19577 </row>
19578 </tbody>
19579 </tgroup>
19580 </informaltable>
19581 </section>
19582 <section id="SECID104">
19583 <title>Daemon</title>
19584 <informaltable frame="none">
19585 <tgroup cols="2" colsep="0" rowsep="0">
19586 <colspec colwidth="196pt" align="left"/>
19587 <colspec colwidth="254pt" align="left"/>
19588 <tbody>
19589 <row>
19590 <entry><option>daemon_smtp_ports</option></entry>
19591 <entry>default ports</entry>
19592 </row>
19593 <row>
19594 <entry><option>daemon_startup_retries</option></entry>
19595 <entry>number of times to retry</entry>
19596 </row>
19597 <row>
19598 <entry><option>daemon_startup_sleep</option></entry>
19599 <entry>time to sleep between tries</entry>
19600 </row>
19601 <row>
19602 <entry><option>extra_local_interfaces</option></entry>
19603 <entry>not necessarily listened on</entry>
19604 </row>
19605 <row>
19606 <entry><option>local_interfaces</option></entry>
19607 <entry>on which to listen, with optional ports</entry>
19608 </row>
19609 <row>
19610 <entry><option>pid_file_path</option></entry>
19611 <entry>override compiled-in value</entry>
19612 </row>
19613 <row>
19614 <entry><option>queue_run_max</option></entry>
19615 <entry>maximum simultaneous queue runners</entry>
19616 </row>
19617 </tbody>
19618 </tgroup>
19619 </informaltable>
19620 </section>
19621 <section id="SECID105">
19622 <title>Resource control</title>
19623 <informaltable frame="none">
19624 <tgroup cols="2" colsep="0" rowsep="0">
19625 <colspec colwidth="196pt" align="left"/>
19626 <colspec colwidth="254pt" align="left"/>
19627 <tbody>
19628 <row>
19629 <entry><option>check_log_inodes</option></entry>
19630 <entry>before accepting a message</entry>
19631 </row>
19632 <row>
19633 <entry><option>check_log_space</option></entry>
19634 <entry>before accepting a message</entry>
19635 </row>
19636 <row>
19637 <entry><option>check_spool_inodes</option></entry>
19638 <entry>before accepting a message</entry>
19639 </row>
19640 <row>
19641 <entry><option>check_spool_space</option></entry>
19642 <entry>before accepting a message</entry>
19643 </row>
19644 <row>
19645 <entry><option>deliver_queue_load_max</option></entry>
19646 <entry>no queue deliveries if load high</entry>
19647 </row>
19648 <row>
19649 <entry><option>queue_only_load</option></entry>
19650 <entry>queue incoming if load high</entry>
19651 </row>
19652 <row>
19653 <entry><option>queue_only_load_latch</option></entry>
19654 <entry>don&#x2019;t re-evaluate load for each message</entry>
19655 </row>
19656 <row>
19657 <entry><option>queue_run_max</option></entry>
19658 <entry>maximum simultaneous queue runners</entry>
19659 </row>
19660 <row>
19661 <entry><option>remote_max_parallel</option></entry>
19662 <entry>parallel SMTP delivery per message</entry>
19663 </row>
19664 <row>
19665 <entry><option>smtp_accept_max</option></entry>
19666 <entry>simultaneous incoming connections</entry>
19667 </row>
19668 <row>
19669 <entry><option>smtp_accept_max_nonmail</option></entry>
19670 <entry>non-mail commands</entry>
19671 </row>
19672 <row>
19673 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19674 <entry>hosts to which the limit applies</entry>
19675 </row>
19676 <row>
19677 <entry><option>smtp_accept_max_per_connection</option></entry>
19678 <entry>messages per connection</entry>
19679 </row>
19680 <row>
19681 <entry><option>smtp_accept_max_per_host</option></entry>
19682 <entry>connections from one host</entry>
19683 </row>
19684 <row>
19685 <entry><option>smtp_accept_queue</option></entry>
19686 <entry>queue mail if more connections</entry>
19687 </row>
19688 <row>
19689 <entry><option>smtp_accept_queue_per_connection</option></entry>
19690 <entry>queue if more messages per connection</entry>
19691 </row>
19692 <row>
19693 <entry><option>smtp_accept_reserve</option></entry>
19694 <entry>only reserve hosts if more connections</entry>
19695 </row>
19696 <row>
19697 <entry><option>smtp_check_spool_space</option></entry>
19698 <entry>from SIZE on MAIL command</entry>
19699 </row>
19700 <row>
19701 <entry><option>smtp_connect_backlog</option></entry>
19702 <entry>passed to TCP/IP stack</entry>
19703 </row>
19704 <row>
19705 <entry><option>smtp_load_reserve</option></entry>
19706 <entry>SMTP from reserved hosts if load high</entry>
19707 </row>
19708 <row>
19709 <entry><option>smtp_reserve_hosts</option></entry>
19710 <entry>these are the reserve hosts</entry>
19711 </row>
19712 </tbody>
19713 </tgroup>
19714 </informaltable>
19715 </section>
19716 <section id="SECID106">
19717 <title>Policy controls</title>
19718 <informaltable frame="none">
19719 <tgroup cols="2" colsep="0" rowsep="0">
19720 <colspec colwidth="196pt" align="left"/>
19721 <colspec colwidth="254pt" align="left"/>
19722 <tbody>
19723 <row>
19724 <entry><option>acl_not_smtp</option></entry>
19725 <entry>ACL for non-SMTP messages</entry>
19726 </row>
19727 <row>
19728 <entry><option>acl_not_smtp_mime</option></entry>
19729 <entry>ACL for non-SMTP MIME parts</entry>
19730 </row>
19731 <row>
19732 <entry><option>acl_not_smtp_start</option></entry>
19733 <entry>ACL for start of non-SMTP message</entry>
19734 </row>
19735 <row>
19736 <entry><option>acl_smtp_auth</option></entry>
19737 <entry>ACL for AUTH</entry>
19738 </row>
19739 <row>
19740 <entry><option>acl_smtp_connect</option></entry>
19741 <entry>ACL for connection</entry>
19742 </row>
19743 <row>
19744 <entry><option>acl_smtp_data</option></entry>
19745 <entry>ACL for DATA</entry>
19746 </row>
19747 <row>
19748 <entry><option>acl_smtp_dkim</option></entry>
19749 <entry>ACL for DKIM verification</entry>
19750 </row>
19751 <row>
19752 <entry><option>acl_smtp_etrn</option></entry>
19753 <entry>ACL for ETRN</entry>
19754 </row>
19755 <row>
19756 <entry><option>acl_smtp_expn</option></entry>
19757 <entry>ACL for EXPN</entry>
19758 </row>
19759 <row>
19760 <entry><option>acl_smtp_helo</option></entry>
19761 <entry>ACL for EHLO or HELO</entry>
19762 </row>
19763 <row>
19764 <entry><option>acl_smtp_mail</option></entry>
19765 <entry>ACL for MAIL</entry>
19766 </row>
19767 <row>
19768 <entry><option>acl_smtp_mailauth</option></entry>
19769 <entry>ACL for AUTH on MAIL command</entry>
19770 </row>
19771 <row>
19772 <entry><option>acl_smtp_mime</option></entry>
19773 <entry>ACL for MIME parts</entry>
19774 </row>
19775 <row>
19776 <entry><option>acl_smtp_predata</option></entry>
19777 <entry>ACL for start of data</entry>
19778 </row>
19779 <row>
19780 <entry><option>acl_smtp_quit</option></entry>
19781 <entry>ACL for QUIT</entry>
19782 </row>
19783 <row>
19784 <entry><option>acl_smtp_rcpt</option></entry>
19785 <entry>ACL for RCPT</entry>
19786 </row>
19787 <row>
19788 <entry><option>acl_smtp_starttls</option></entry>
19789 <entry>ACL for STARTTLS</entry>
19790 </row>
19791 <row>
19792 <entry><option>acl_smtp_vrfy</option></entry>
19793 <entry>ACL for VRFY</entry>
19794 </row>
19795 <row>
19796 <entry><option>av_scanner</option></entry>
19797 <entry>specify virus scanner</entry>
19798 </row>
19799 <row>
19800 <entry><option>check_rfc2047_length</option></entry>
19801 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19802 </row>
19803 <row>
19804 <entry><option>dns_csa_search_limit</option></entry>
19805 <entry>control CSA parent search depth</entry>
19806 </row>
19807 <row>
19808 <entry><option>dns_csa_use_reverse</option></entry>
19809 <entry>en/disable CSA IP reverse search</entry>
19810 </row>
19811 <row>
19812 <entry><option>header_maxsize</option></entry>
19813 <entry>total size of message header</entry>
19814 </row>
19815 <row>
19816 <entry><option>header_line_maxsize</option></entry>
19817 <entry>individual header line limit</entry>
19818 </row>
19819 <row>
19820 <entry><option>helo_accept_junk_hosts</option></entry>
19821 <entry>allow syntactic junk from these hosts</entry>
19822 </row>
19823 <row>
19824 <entry><option>helo_allow_chars</option></entry>
19825 <entry>allow illegal chars in HELO names</entry>
19826 </row>
19827 <row>
19828 <entry><option>helo_lookup_domains</option></entry>
19829 <entry>lookup hostname for these HELO names</entry>
19830 </row>
19831 <row>
19832 <entry><option>helo_try_verify_hosts</option></entry>
19833 <entry>HELO soft-checked for these hosts</entry>
19834 </row>
19835 <row>
19836 <entry><option>helo_verify_hosts</option></entry>
19837 <entry>HELO hard-checked for these hosts</entry>
19838 </row>
19839 <row>
19840 <entry><option>host_lookup</option></entry>
19841 <entry>host name looked up for these hosts</entry>
19842 </row>
19843 <row>
19844 <entry><option>host_lookup_order</option></entry>
19845 <entry>order of DNS and local name lookups</entry>
19846 </row>
19847 <row>
19848 <entry><option>host_reject_connection</option></entry>
19849 <entry>reject connection from these hosts</entry>
19850 </row>
19851 <row>
19852 <entry><option>hosts_treat_as_local</option></entry>
19853 <entry>useful in some cluster configurations</entry>
19854 </row>
19855 <row>
19856 <entry><option>local_scan_timeout</option></entry>
19857 <entry>timeout for <function>local_scan()</function></entry>
19858 </row>
19859 <row>
19860 <entry><option>message_size_limit</option></entry>
19861 <entry>for all messages</entry>
19862 </row>
19863 <row>
19864 <entry><option>percent_hack_domains</option></entry>
19865 <entry>recognize %-hack for these domains</entry>
19866 </row>
19867 <row>
19868 <entry><option>spamd_address</option></entry>
19869 <entry>set interface to SpamAssassin</entry>
19870 </row>
19871 <row>
19872 <entry><option>strict_acl_vars</option></entry>
19873 <entry>object to unset ACL variables</entry>
19874 </row>
19875 </tbody>
19876 </tgroup>
19877 </informaltable>
19878 </section>
19879 <section id="SECID107">
19880 <title>Callout cache</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>callout_domain_negative_expire</option></entry>
19888 <entry>timeout for negative domain cache item</entry>
19889 </row>
19890 <row>
19891 <entry><option>callout_domain_positive_expire</option></entry>
19892 <entry>timeout for positive domain cache item</entry>
19893 </row>
19894 <row>
19895 <entry><option>callout_negative_expire</option></entry>
19896 <entry>timeout for negative address cache item</entry>
19897 </row>
19898 <row>
19899 <entry><option>callout_positive_expire</option></entry>
19900 <entry>timeout for positive address cache item</entry>
19901 </row>
19902 <row>
19903 <entry><option>callout_random_local_part</option></entry>
19904 <entry>string to use for <quote>random</quote> testing</entry>
19905 </row>
19906 </tbody>
19907 </tgroup>
19908 </informaltable>
19909 </section>
19910 <section id="SECID108">
19911 <title>TLS</title>
19912 <informaltable frame="none">
19913 <tgroup cols="2" colsep="0" rowsep="0">
19914 <colspec colwidth="196pt" align="left"/>
19915 <colspec colwidth="254pt" align="left"/>
19916 <tbody>
19917 <row>
19918 <entry><option>gnutls_compat_mode</option></entry>
19919 <entry>use GnuTLS compatibility mode</entry>
19920 </row>
19921 <row>
19922 <entry><option>openssl_options</option></entry>
19923 <entry>adjust OpenSSL compatibility options</entry>
19924 </row>
19925 <row>
19926 <entry><option>tls_advertise_hosts</option></entry>
19927 <entry>advertise TLS to these hosts</entry>
19928 </row>
19929 <row>
19930 <entry><option>tls_certificate</option></entry>
19931 <entry>location of server certificate</entry>
19932 </row>
19933 <row>
19934 <entry><option>tls_crl</option></entry>
19935 <entry>certificate revocation list</entry>
19936 </row>
19937 <row>
19938 <entry><option>tls_dh_max_bits</option></entry>
19939 <entry>clamp D-H bit count suggestion</entry>
19940 </row>
19941 <row>
19942 <entry><option>tls_dhparam</option></entry>
19943 <entry>DH parameters for server</entry>
19944 </row>
19945 <row>
19946 <entry><option>tls_on_connect_ports</option></entry>
19947 <entry>specify SSMTP (SMTPS) ports</entry>
19948 </row>
19949 <row>
19950 <entry><option>tls_privatekey</option></entry>
19951 <entry>location of server private key</entry>
19952 </row>
19953 <row>
19954 <entry><option>tls_remember_esmtp</option></entry>
19955 <entry>don&#x2019;t reset after starting TLS</entry>
19956 </row>
19957 <row>
19958 <entry><option>tls_require_ciphers</option></entry>
19959 <entry>specify acceptable ciphers</entry>
19960 </row>
19961 <row>
19962 <entry><option>tls_try_verify_hosts</option></entry>
19963 <entry>try to verify client certificate</entry>
19964 </row>
19965 <row>
19966 <entry><option>tls_verify_certificates</option></entry>
19967 <entry>expected client certificates</entry>
19968 </row>
19969 <row>
19970 <entry><option>tls_verify_hosts</option></entry>
19971 <entry>insist on client certificate verify</entry>
19972 </row>
19973 </tbody>
19974 </tgroup>
19975 </informaltable>
19976 </section>
19977 <section id="SECID109">
19978 <title>Local user handling</title>
19979 <informaltable frame="none">
19980 <tgroup cols="2" colsep="0" rowsep="0">
19981 <colspec colwidth="196pt" align="left"/>
19982 <colspec colwidth="254pt" align="left"/>
19983 <tbody>
19984 <row>
19985 <entry><option>finduser_retries</option></entry>
19986 <entry>useful in NIS environments</entry>
19987 </row>
19988 <row>
19989 <entry><option>gecos_name</option></entry>
19990 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19991 </row>
19992 <row>
19993 <entry><option>gecos_pattern</option></entry>
19994 <entry>ditto</entry>
19995 </row>
19996 <row>
19997 <entry><option>max_username_length</option></entry>
19998 <entry>for systems that truncate</entry>
19999 </row>
20000 <row>
20001 <entry><option>unknown_login</option></entry>
20002 <entry>used when no login name found</entry>
20003 </row>
20004 <row>
20005 <entry><option>unknown_username</option></entry>
20006 <entry>ditto</entry>
20007 </row>
20008 <row>
20009 <entry><option>uucp_from_pattern</option></entry>
20010 <entry>for recognizing <quote>From </quote> lines</entry>
20011 </row>
20012 <row>
20013 <entry><option>uucp_from_sender</option></entry>
20014 <entry>ditto</entry>
20015 </row>
20016 </tbody>
20017 </tgroup>
20018 </informaltable>
20019 </section>
20020 <section id="SECID110">
20021 <title>All incoming messages (SMTP and non-SMTP)</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>header_maxsize</option></entry>
20029 <entry>total size of message header</entry>
20030 </row>
20031 <row>
20032 <entry><option>header_line_maxsize</option></entry>
20033 <entry>individual header line limit</entry>
20034 </row>
20035 <row>
20036 <entry><option>message_size_limit</option></entry>
20037 <entry>applies to all messages</entry>
20038 </row>
20039 <row>
20040 <entry><option>percent_hack_domains</option></entry>
20041 <entry>recognize %-hack for these domains</entry>
20042 </row>
20043 <row>
20044 <entry><option>received_header_text</option></entry>
20045 <entry>expanded to make <emphasis>Received:</emphasis></entry>
20046 </row>
20047 <row>
20048 <entry><option>received_headers_max</option></entry>
20049 <entry>for mail loop detection</entry>
20050 </row>
20051 <row>
20052 <entry><option>recipients_max</option></entry>
20053 <entry>limit per message</entry>
20054 </row>
20055 <row>
20056 <entry><option>recipients_max_reject</option></entry>
20057 <entry>permanently reject excess recipients</entry>
20058 </row>
20059 </tbody>
20060 </tgroup>
20061 </informaltable>
20062 </section>
20063 <section id="SECID111">
20064 <title>Non-SMTP incoming messages</title>
20065 <informaltable frame="none">
20066 <tgroup cols="2" colsep="0" rowsep="0">
20067 <colspec colwidth="196pt" align="left"/>
20068 <colspec colwidth="254pt" align="left"/>
20069 <tbody>
20070 <row>
20071 <entry><option>receive_timeout</option></entry>
20072 <entry>for non-SMTP messages</entry>
20073 </row>
20074 </tbody>
20075 </tgroup>
20076 </informaltable>
20077 </section>
20078 <section id="SECID112">
20079 <title>Incoming SMTP messages</title>
20080 <para>
20081 See also the <emphasis>Policy controls</emphasis> section above.
20082 </para>
20083 <informaltable frame="none">
20084 <tgroup cols="2" colsep="0" rowsep="0">
20085 <colspec colwidth="196pt" align="left"/>
20086 <colspec colwidth="254pt" align="left"/>
20087 <tbody>
20088 <row>
20089 <entry><option>host_lookup</option></entry>
20090 <entry>host name looked up for these hosts</entry>
20091 </row>
20092 <row>
20093 <entry><option>host_lookup_order</option></entry>
20094 <entry>order of DNS and local name lookups</entry>
20095 </row>
20096 <row>
20097 <entry><option>recipient_unqualified_hosts</option></entry>
20098 <entry>may send unqualified recipients</entry>
20099 </row>
20100 <row>
20101 <entry><option>rfc1413_hosts</option></entry>
20102 <entry>make ident calls to these hosts</entry>
20103 </row>
20104 <row>
20105 <entry><option>rfc1413_query_timeout</option></entry>
20106 <entry>zero disables ident calls</entry>
20107 </row>
20108 <row>
20109 <entry><option>sender_unqualified_hosts</option></entry>
20110 <entry>may send unqualified senders</entry>
20111 </row>
20112 <row>
20113 <entry><option>smtp_accept_keepalive</option></entry>
20114 <entry>some TCP/IP magic</entry>
20115 </row>
20116 <row>
20117 <entry><option>smtp_accept_max</option></entry>
20118 <entry>simultaneous incoming connections</entry>
20119 </row>
20120 <row>
20121 <entry><option>smtp_accept_max_nonmail</option></entry>
20122 <entry>non-mail commands</entry>
20123 </row>
20124 <row>
20125 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20126 <entry>hosts to which the limit applies</entry>
20127 </row>
20128 <row>
20129 <entry><option>smtp_accept_max_per_connection</option></entry>
20130 <entry>messages per connection</entry>
20131 </row>
20132 <row>
20133 <entry><option>smtp_accept_max_per_host</option></entry>
20134 <entry>connections from one host</entry>
20135 </row>
20136 <row>
20137 <entry><option>smtp_accept_queue</option></entry>
20138 <entry>queue mail if more connections</entry>
20139 </row>
20140 <row>
20141 <entry><option>smtp_accept_queue_per_connection</option></entry>
20142 <entry>queue if more messages per connection</entry>
20143 </row>
20144 <row>
20145 <entry><option>smtp_accept_reserve</option></entry>
20146 <entry>only reserve hosts if more connections</entry>
20147 </row>
20148 <row>
20149 <entry><option>smtp_active_hostname</option></entry>
20150 <entry>host name to use in messages</entry>
20151 </row>
20152 <row>
20153 <entry><option>smtp_banner</option></entry>
20154 <entry>text for welcome banner</entry>
20155 </row>
20156 <row>
20157 <entry><option>smtp_check_spool_space</option></entry>
20158 <entry>from SIZE on MAIL command</entry>
20159 </row>
20160 <row>
20161 <entry><option>smtp_connect_backlog</option></entry>
20162 <entry>passed to TCP/IP stack</entry>
20163 </row>
20164 <row>
20165 <entry><option>smtp_enforce_sync</option></entry>
20166 <entry>of SMTP command/responses</entry>
20167 </row>
20168 <row>
20169 <entry><option>smtp_etrn_command</option></entry>
20170 <entry>what to run for ETRN</entry>
20171 </row>
20172 <row>
20173 <entry><option>smtp_etrn_serialize</option></entry>
20174 <entry>only one at once</entry>
20175 </row>
20176 <row>
20177 <entry><option>smtp_load_reserve</option></entry>
20178 <entry>only reserve hosts if this load</entry>
20179 </row>
20180 <row>
20181 <entry><option>smtp_max_unknown_commands</option></entry>
20182 <entry>before dropping connection</entry>
20183 </row>
20184 <row>
20185 <entry><option>smtp_ratelimit_hosts</option></entry>
20186 <entry>apply ratelimiting to these hosts</entry>
20187 </row>
20188 <row>
20189 <entry><option>smtp_ratelimit_mail</option></entry>
20190 <entry>ratelimit for MAIL commands</entry>
20191 </row>
20192 <row>
20193 <entry><option>smtp_ratelimit_rcpt</option></entry>
20194 <entry>ratelimit for RCPT commands</entry>
20195 </row>
20196 <row>
20197 <entry><option>smtp_receive_timeout</option></entry>
20198 <entry>per command or data line</entry>
20199 </row>
20200 <row>
20201 <entry><option>smtp_reserve_hosts</option></entry>
20202 <entry>these are the reserve hosts</entry>
20203 </row>
20204 <row>
20205 <entry><option>smtp_return_error_details</option></entry>
20206 <entry>give detail on rejections</entry>
20207 </row>
20208 </tbody>
20209 </tgroup>
20210 </informaltable>
20211 </section>
20212 <section id="SECID113">
20213 <title>SMTP extensions</title>
20214 <informaltable frame="none">
20215 <tgroup cols="2" colsep="0" rowsep="0">
20216 <colspec colwidth="196pt" align="left"/>
20217 <colspec colwidth="254pt" align="left"/>
20218 <tbody>
20219 <row>
20220 <entry><option>accept_8bitmime</option></entry>
20221 <entry>advertise 8BITMIME</entry>
20222 </row>
20223 <row>
20224 <entry><option>auth_advertise_hosts</option></entry>
20225 <entry>advertise AUTH to these hosts</entry>
20226 </row>
20227 <row>
20228 <entry><option>ignore_fromline_hosts</option></entry>
20229 <entry>allow <quote>From </quote> from these hosts</entry>
20230 </row>
20231 <row>
20232 <entry><option>ignore_fromline_local</option></entry>
20233 <entry>allow <quote>From </quote> from local SMTP</entry>
20234 </row>
20235 <row>
20236 <entry><option>pipelining_advertise_hosts</option></entry>
20237 <entry>advertise pipelining to these hosts</entry>
20238 </row>
20239 <row>
20240 <entry><option>tls_advertise_hosts</option></entry>
20241 <entry>advertise TLS to these hosts</entry>
20242 </row>
20243 </tbody>
20244 </tgroup>
20245 </informaltable>
20246 </section>
20247 <section id="SECID114">
20248 <title>Processing messages</title>
20249 <informaltable frame="none">
20250 <tgroup cols="2" colsep="0" rowsep="0">
20251 <colspec colwidth="196pt" align="left"/>
20252 <colspec colwidth="254pt" align="left"/>
20253 <tbody>
20254 <row>
20255 <entry><option>allow_domain_literals</option></entry>
20256 <entry>recognize domain literal syntax</entry>
20257 </row>
20258 <row>
20259 <entry><option>allow_mx_to_ip</option></entry>
20260 <entry>allow MX to point to IP address</entry>
20261 </row>
20262 <row>
20263 <entry><option>allow_utf8_domains</option></entry>
20264 <entry>in addresses</entry>
20265 </row>
20266 <row>
20267 <entry><option>check_rfc2047_length</option></entry>
20268 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20269 </row>
20270 <row>
20271 <entry><option>delivery_date_remove</option></entry>
20272 <entry>from incoming messages</entry>
20273 </row>
20274 <row>
20275 <entry><option>envelope_to_remove</option></entry>
20276 <entry>from incoming messages</entry>
20277 </row>
20278 <row>
20279 <entry><option>extract_addresses_remove_arguments</option></entry>
20280 <entry>affects <option>-t</option> processing</entry>
20281 </row>
20282 <row>
20283 <entry><option>headers_charset</option></entry>
20284 <entry>default for translations</entry>
20285 </row>
20286 <row>
20287 <entry><option>qualify_domain</option></entry>
20288 <entry>default for senders</entry>
20289 </row>
20290 <row>
20291 <entry><option>qualify_recipient</option></entry>
20292 <entry>default for recipients</entry>
20293 </row>
20294 <row>
20295 <entry><option>return_path_remove</option></entry>
20296 <entry>from incoming messages</entry>
20297 </row>
20298 <row>
20299 <entry><option>strip_excess_angle_brackets</option></entry>
20300 <entry>in addresses</entry>
20301 </row>
20302 <row>
20303 <entry><option>strip_trailing_dot</option></entry>
20304 <entry>at end of addresses</entry>
20305 </row>
20306 <row>
20307 <entry><option>untrusted_set_sender</option></entry>
20308 <entry>untrusted can set envelope sender</entry>
20309 </row>
20310 </tbody>
20311 </tgroup>
20312 </informaltable>
20313 </section>
20314 <section id="SECID115">
20315 <title>System filter</title>
20316 <informaltable frame="none">
20317 <tgroup cols="2" colsep="0" rowsep="0">
20318 <colspec colwidth="196pt" align="left"/>
20319 <colspec colwidth="254pt" align="left"/>
20320 <tbody>
20321 <row>
20322 <entry><option>system_filter</option></entry>
20323 <entry>locate system filter</entry>
20324 </row>
20325 <row>
20326 <entry><option>system_filter_directory_transport</option></entry>
20327 <entry>transport for delivery to a directory</entry>
20328 </row>
20329 <row>
20330 <entry><option>system_filter_file_transport</option></entry>
20331 <entry>transport for delivery to a file</entry>
20332 </row>
20333 <row>
20334 <entry><option>system_filter_group</option></entry>
20335 <entry>group for filter running</entry>
20336 </row>
20337 <row>
20338 <entry><option>system_filter_pipe_transport</option></entry>
20339 <entry>transport for delivery to a pipe</entry>
20340 </row>
20341 <row>
20342 <entry><option>system_filter_reply_transport</option></entry>
20343 <entry>transport for autoreply delivery</entry>
20344 </row>
20345 <row>
20346 <entry><option>system_filter_user</option></entry>
20347 <entry>user for filter running</entry>
20348 </row>
20349 </tbody>
20350 </tgroup>
20351 </informaltable>
20352 </section>
20353 <section id="SECID116">
20354 <title>Routing and delivery</title>
20355 <informaltable frame="none">
20356 <tgroup cols="2" colsep="0" rowsep="0">
20357 <colspec colwidth="196pt" align="left"/>
20358 <colspec colwidth="254pt" align="left"/>
20359 <tbody>
20360 <row>
20361 <entry><option>disable_ipv6</option></entry>
20362 <entry>do no IPv6 processing</entry>
20363 </row>
20364 <row>
20365 <entry><option>dns_again_means_nonexist</option></entry>
20366 <entry>for broken domains</entry>
20367 </row>
20368 <row>
20369 <entry><option>dns_check_names_pattern</option></entry>
20370 <entry>pre-DNS syntax check</entry>
20371 </row>
20372 <row>
20373 <entry><option>dns_ipv4_lookup</option></entry>
20374 <entry>only v4 lookup for these domains</entry>
20375 </row>
20376 <row>
20377 <entry><option>dns_retrans</option></entry>
20378 <entry>parameter for resolver</entry>
20379 </row>
20380 <row>
20381 <entry><option>dns_retry</option></entry>
20382 <entry>parameter for resolver</entry>
20383 </row>
20384 <row>
20385 <entry><option>dns_use_edns0</option></entry>
20386 <entry>parameter for resolver</entry>
20387 </row>
20388 <row>
20389 <entry><option>hold_domains</option></entry>
20390 <entry>hold delivery for these domains</entry>
20391 </row>
20392 <row>
20393 <entry><option>local_interfaces</option></entry>
20394 <entry>for routing checks</entry>
20395 </row>
20396 <row>
20397 <entry><option>queue_domains</option></entry>
20398 <entry>no immediate delivery for these</entry>
20399 </row>
20400 <row>
20401 <entry><option>queue_only</option></entry>
20402 <entry>no immediate delivery at all</entry>
20403 </row>
20404 <row>
20405 <entry><option>queue_only_file</option></entry>
20406 <entry>no immediate delivery if file exists</entry>
20407 </row>
20408 <row>
20409 <entry><option>queue_only_load</option></entry>
20410 <entry>no immediate delivery if load is high</entry>
20411 </row>
20412 <row>
20413 <entry><option>queue_only_load_latch</option></entry>
20414 <entry>don&#x2019;t re-evaluate load for each message</entry>
20415 </row>
20416 <row>
20417 <entry><option>queue_only_override</option></entry>
20418 <entry>allow command line to override</entry>
20419 </row>
20420 <row>
20421 <entry><option>queue_run_in_order</option></entry>
20422 <entry>order of arrival</entry>
20423 </row>
20424 <row>
20425 <entry><option>queue_run_max</option></entry>
20426 <entry>of simultaneous queue runners</entry>
20427 </row>
20428 <row>
20429 <entry><option>queue_smtp_domains</option></entry>
20430 <entry>no immediate SMTP delivery for these</entry>
20431 </row>
20432 <row>
20433 <entry><option>remote_max_parallel</option></entry>
20434 <entry>parallel SMTP delivery per message</entry>
20435 </row>
20436 <row>
20437 <entry><option>remote_sort_domains</option></entry>
20438 <entry>order of remote deliveries</entry>
20439 </row>
20440 <row>
20441 <entry><option>retry_data_expire</option></entry>
20442 <entry>timeout for retry data</entry>
20443 </row>
20444 <row>
20445 <entry><option>retry_interval_max</option></entry>
20446 <entry>safety net for retry rules</entry>
20447 </row>
20448 </tbody>
20449 </tgroup>
20450 </informaltable>
20451 </section>
20452 <section id="SECID117">
20453 <title>Bounce and warning messages</title>
20454 <informaltable frame="none">
20455 <tgroup cols="2" colsep="0" rowsep="0">
20456 <colspec colwidth="196pt" align="left"/>
20457 <colspec colwidth="254pt" align="left"/>
20458 <tbody>
20459 <row>
20460 <entry><option>bounce_message_file</option></entry>
20461 <entry>content of bounce</entry>
20462 </row>
20463 <row>
20464 <entry><option>bounce_message_text</option></entry>
20465 <entry>content of bounce</entry>
20466 </row>
20467 <row>
20468 <entry><option>bounce_return_body</option></entry>
20469 <entry>include body if returning message</entry>
20470 </row>
20471 <row>
20472 <entry><option>bounce_return_message</option></entry>
20473 <entry>include original message in bounce</entry>
20474 </row>
20475 <row>
20476 <entry><option>bounce_return_size_limit</option></entry>
20477 <entry>limit on returned message</entry>
20478 </row>
20479 <row>
20480 <entry><option>bounce_sender_authentication</option></entry>
20481 <entry>send authenticated sender with bounce</entry>
20482 </row>
20483 <row>
20484 <entry><option>dsn_from</option></entry>
20485 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20486 </row>
20487 <row>
20488 <entry><option>errors_copy</option></entry>
20489 <entry>copy bounce messages</entry>
20490 </row>
20491 <row>
20492 <entry><option>errors_reply_to</option></entry>
20493 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20494 </row>
20495 <row>
20496 <entry><option>delay_warning</option></entry>
20497 <entry>time schedule</entry>
20498 </row>
20499 <row>
20500 <entry><option>delay_warning_condition</option></entry>
20501 <entry>condition for warning messages</entry>
20502 </row>
20503 <row>
20504 <entry><option>ignore_bounce_errors_after</option></entry>
20505 <entry>discard undeliverable bounces</entry>
20506 </row>
20507 <row>
20508 <entry><option>smtp_return_error_details</option></entry>
20509 <entry>give detail on rejections</entry>
20510 </row>
20511 <row>
20512 <entry><option>warn_message_file</option></entry>
20513 <entry>content of warning message</entry>
20514 </row>
20515 </tbody>
20516 </tgroup>
20517 </informaltable>
20518 </section>
20519 <section id="SECTalomo">
20520 <title>Alphabetical list of main options</title>
20521 <para>
20522 Those options that undergo string expansion before use are marked with
20523 &dagger;.
20524 </para>
20525 <para revisionflag="changed">
20526 <indexterm role="option">
20527 <primary><option>accept_8bitmime</option></primary>
20528 </indexterm>
20529 </para>
20530 <informaltable frame="all" revisionflag="changed">
20531 <tgroup cols="4" colsep="0" rowsep="0">
20532 <colspec colwidth="8*" align="left"/>
20533 <colspec colwidth="6*" align="center"/>
20534 <colspec colwidth="6*" align="center"/>
20535 <colspec colwidth="6*" align="right"/>
20536 <tbody>
20537 <row>
20538 <entry><option>accept_8bitmime</option></entry>
20539 <entry>Use: <emphasis>main</emphasis></entry>
20540 <entry>Type: <emphasis>boolean</emphasis></entry>
20541 <entry>Default: <emphasis>true</emphasis></entry>
20542 </row>
20543 </tbody>
20544 </tgroup>
20545 </informaltable>
20546 <para revisionflag="changed">
20547 <indexterm role="concept">
20548 <primary>8BITMIME</primary>
20549 </indexterm>
20550 <indexterm role="concept">
20551 <primary>8-bit characters</primary>
20552 </indexterm>
20553 This option causes Exim to send 8BITMIME in its response to an SMTP
20554 EHLO command, and to accept the BODY= parameter on MAIL commands.
20555 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20556 takes no steps to do anything special with messages received by this route.
20557 </para>
20558 <para revisionflag="changed">
20559 Historically Exim kept this option off by default, but the maintainers
20560 feel that in today&#x2019;s Internet, this causes more problems than it solves.
20561 It now defaults to true.
20562 A more detailed analysis of the issues is provided by Dan Bernstein:
20563 </para>
20564 <literallayout revisionflag="changed">
20565 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
20566 </literallayout>
20567 <para>
20568 <indexterm role="option">
20569 <primary><option>acl_not_smtp</option></primary>
20570 </indexterm>
20571 </para>
20572 <informaltable frame="all">
20573 <tgroup cols="4" colsep="0" rowsep="0">
20574 <colspec colwidth="8*" align="left"/>
20575 <colspec colwidth="6*" align="center"/>
20576 <colspec colwidth="6*" align="center"/>
20577 <colspec colwidth="6*" align="right"/>
20578 <tbody>
20579 <row>
20580 <entry><option>acl_not_smtp</option></entry>
20581 <entry>Use: <emphasis>main</emphasis></entry>
20582 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20583 <entry>Default: <emphasis>unset</emphasis></entry>
20584 </row>
20585 </tbody>
20586 </tgroup>
20587 </informaltable>
20588 <para>
20589 <indexterm role="concept">
20590 <primary>access control lists (ACLs)</primary>
20591 <secondary>for non-SMTP messages</secondary>
20592 </indexterm>
20593 <indexterm role="concept">
20594 <primary>non-SMTP messages</primary>
20595 <secondary>ACLs for</secondary>
20596 </indexterm>
20597 This option defines the ACL that is run when a non-SMTP message has been
20598 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20599 further details.
20600 </para>
20601 <para>
20602 <indexterm role="option">
20603 <primary><option>acl_not_smtp_mime</option></primary>
20604 </indexterm>
20605 </para>
20606 <informaltable frame="all">
20607 <tgroup cols="4" colsep="0" rowsep="0">
20608 <colspec colwidth="8*" align="left"/>
20609 <colspec colwidth="6*" align="center"/>
20610 <colspec colwidth="6*" align="center"/>
20611 <colspec colwidth="6*" align="right"/>
20612 <tbody>
20613 <row>
20614 <entry><option>acl_not_smtp_mime</option></entry>
20615 <entry>Use: <emphasis>main</emphasis></entry>
20616 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20617 <entry>Default: <emphasis>unset</emphasis></entry>
20618 </row>
20619 </tbody>
20620 </tgroup>
20621 </informaltable>
20622 <para>
20623 This option defines the ACL that is run for individual MIME parts of non-SMTP
20624 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20625 SMTP messages.
20626 </para>
20627 <para>
20628 <indexterm role="option">
20629 <primary><option>acl_not_smtp_start</option></primary>
20630 </indexterm>
20631 </para>
20632 <informaltable frame="all">
20633 <tgroup cols="4" colsep="0" rowsep="0">
20634 <colspec colwidth="8*" align="left"/>
20635 <colspec colwidth="6*" align="center"/>
20636 <colspec colwidth="6*" align="center"/>
20637 <colspec colwidth="6*" align="right"/>
20638 <tbody>
20639 <row>
20640 <entry><option>acl_not_smtp_start</option></entry>
20641 <entry>Use: <emphasis>main</emphasis></entry>
20642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20643 <entry>Default: <emphasis>unset</emphasis></entry>
20644 </row>
20645 </tbody>
20646 </tgroup>
20647 </informaltable>
20648 <para>
20649 <indexterm role="concept">
20650 <primary>access control lists (ACLs)</primary>
20651 <secondary>at start of non-SMTP message</secondary>
20652 </indexterm>
20653 <indexterm role="concept">
20654 <primary>non-SMTP messages</primary>
20655 <secondary>ACLs for</secondary>
20656 </indexterm>
20657 This option defines the ACL that is run before Exim starts reading a
20658 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20659 </para>
20660 <para>
20661 <indexterm role="option">
20662 <primary><option>acl_smtp_auth</option></primary>
20663 </indexterm>
20664 </para>
20665 <informaltable frame="all">
20666 <tgroup cols="4" colsep="0" rowsep="0">
20667 <colspec colwidth="8*" align="left"/>
20668 <colspec colwidth="6*" align="center"/>
20669 <colspec colwidth="6*" align="center"/>
20670 <colspec colwidth="6*" align="right"/>
20671 <tbody>
20672 <row>
20673 <entry><option>acl_smtp_auth</option></entry>
20674 <entry>Use: <emphasis>main</emphasis></entry>
20675 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20676 <entry>Default: <emphasis>unset</emphasis></entry>
20677 </row>
20678 </tbody>
20679 </tgroup>
20680 </informaltable>
20681 <para>
20682 <indexterm role="concept">
20683 <primary>access control lists (ACLs)</primary>
20684 <secondary>setting up for SMTP commands</secondary>
20685 </indexterm>
20686 <indexterm role="concept">
20687 <primary>AUTH</primary>
20688 <secondary>ACL for</secondary>
20689 </indexterm>
20690 This option defines the ACL that is run when an SMTP AUTH command is
20691 received. See chapter <xref linkend="CHAPACL"/> for further details.
20692 </para>
20693 <para>
20694 <indexterm role="option">
20695 <primary><option>acl_smtp_connect</option></primary>
20696 </indexterm>
20697 </para>
20698 <informaltable frame="all">
20699 <tgroup cols="4" colsep="0" rowsep="0">
20700 <colspec colwidth="8*" align="left"/>
20701 <colspec colwidth="6*" align="center"/>
20702 <colspec colwidth="6*" align="center"/>
20703 <colspec colwidth="6*" align="right"/>
20704 <tbody>
20705 <row>
20706 <entry><option>acl_smtp_connect</option></entry>
20707 <entry>Use: <emphasis>main</emphasis></entry>
20708 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20709 <entry>Default: <emphasis>unset</emphasis></entry>
20710 </row>
20711 </tbody>
20712 </tgroup>
20713 </informaltable>
20714 <para>
20715 <indexterm role="concept">
20716 <primary>access control lists (ACLs)</primary>
20717 <secondary>on SMTP connection</secondary>
20718 </indexterm>
20719 This option defines the ACL that is run when an SMTP connection is received.
20720 See chapter <xref linkend="CHAPACL"/> for further details.
20721 </para>
20722 <para>
20723 <indexterm role="option">
20724 <primary><option>acl_smtp_data</option></primary>
20725 </indexterm>
20726 </para>
20727 <informaltable frame="all">
20728 <tgroup cols="4" colsep="0" rowsep="0">
20729 <colspec colwidth="8*" align="left"/>
20730 <colspec colwidth="6*" align="center"/>
20731 <colspec colwidth="6*" align="center"/>
20732 <colspec colwidth="6*" align="right"/>
20733 <tbody>
20734 <row>
20735 <entry><option>acl_smtp_data</option></entry>
20736 <entry>Use: <emphasis>main</emphasis></entry>
20737 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20738 <entry>Default: <emphasis>unset</emphasis></entry>
20739 </row>
20740 </tbody>
20741 </tgroup>
20742 </informaltable>
20743 <para>
20744 <indexterm role="concept">
20745 <primary>DATA</primary>
20746 <secondary>ACL for</secondary>
20747 </indexterm>
20748 This option defines the ACL that is run after an SMTP DATA command has been
20749 processed and the message itself has been received, but before the final
20750 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20751 </para>
20752 <para>
20753 <indexterm role="option">
20754 <primary><option>acl_smtp_etrn</option></primary>
20755 </indexterm>
20756 </para>
20757 <informaltable frame="all">
20758 <tgroup cols="4" colsep="0" rowsep="0">
20759 <colspec colwidth="8*" align="left"/>
20760 <colspec colwidth="6*" align="center"/>
20761 <colspec colwidth="6*" align="center"/>
20762 <colspec colwidth="6*" align="right"/>
20763 <tbody>
20764 <row>
20765 <entry><option>acl_smtp_etrn</option></entry>
20766 <entry>Use: <emphasis>main</emphasis></entry>
20767 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20768 <entry>Default: <emphasis>unset</emphasis></entry>
20769 </row>
20770 </tbody>
20771 </tgroup>
20772 </informaltable>
20773 <para>
20774 <indexterm role="concept">
20775 <primary>ETRN</primary>
20776 <secondary>ACL for</secondary>
20777 </indexterm>
20778 This option defines the ACL that is run when an SMTP ETRN command is
20779 received. See chapter <xref linkend="CHAPACL"/> for further details.
20780 </para>
20781 <para>
20782 <indexterm role="option">
20783 <primary><option>acl_smtp_expn</option></primary>
20784 </indexterm>
20785 </para>
20786 <informaltable frame="all">
20787 <tgroup cols="4" colsep="0" rowsep="0">
20788 <colspec colwidth="8*" align="left"/>
20789 <colspec colwidth="6*" align="center"/>
20790 <colspec colwidth="6*" align="center"/>
20791 <colspec colwidth="6*" align="right"/>
20792 <tbody>
20793 <row>
20794 <entry><option>acl_smtp_expn</option></entry>
20795 <entry>Use: <emphasis>main</emphasis></entry>
20796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20797 <entry>Default: <emphasis>unset</emphasis></entry>
20798 </row>
20799 </tbody>
20800 </tgroup>
20801 </informaltable>
20802 <para>
20803 <indexterm role="concept">
20804 <primary>EXPN</primary>
20805 <secondary>ACL for</secondary>
20806 </indexterm>
20807 This option defines the ACL that is run when an SMTP EXPN command is
20808 received. See chapter <xref linkend="CHAPACL"/> for further details.
20809 </para>
20810 <para>
20811 <indexterm role="option">
20812 <primary><option>acl_smtp_helo</option></primary>
20813 </indexterm>
20814 </para>
20815 <informaltable frame="all">
20816 <tgroup cols="4" colsep="0" rowsep="0">
20817 <colspec colwidth="8*" align="left"/>
20818 <colspec colwidth="6*" align="center"/>
20819 <colspec colwidth="6*" align="center"/>
20820 <colspec colwidth="6*" align="right"/>
20821 <tbody>
20822 <row>
20823 <entry><option>acl_smtp_helo</option></entry>
20824 <entry>Use: <emphasis>main</emphasis></entry>
20825 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20826 <entry>Default: <emphasis>unset</emphasis></entry>
20827 </row>
20828 </tbody>
20829 </tgroup>
20830 </informaltable>
20831 <para>
20832 <indexterm role="concept">
20833 <primary>EHLO</primary>
20834 <secondary>ACL for</secondary>
20835 </indexterm>
20836 <indexterm role="concept">
20837 <primary>HELO</primary>
20838 <secondary>ACL for</secondary>
20839 </indexterm>
20840 This option defines the ACL that is run when an SMTP EHLO or HELO
20841 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20842 </para>
20843 <para>
20844 <indexterm role="option">
20845 <primary><option>acl_smtp_mail</option></primary>
20846 </indexterm>
20847 </para>
20848 <informaltable frame="all">
20849 <tgroup cols="4" colsep="0" rowsep="0">
20850 <colspec colwidth="8*" align="left"/>
20851 <colspec colwidth="6*" align="center"/>
20852 <colspec colwidth="6*" align="center"/>
20853 <colspec colwidth="6*" align="right"/>
20854 <tbody>
20855 <row>
20856 <entry><option>acl_smtp_mail</option></entry>
20857 <entry>Use: <emphasis>main</emphasis></entry>
20858 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20859 <entry>Default: <emphasis>unset</emphasis></entry>
20860 </row>
20861 </tbody>
20862 </tgroup>
20863 </informaltable>
20864 <para>
20865 <indexterm role="concept">
20866 <primary>MAIL</primary>
20867 <secondary>ACL for</secondary>
20868 </indexterm>
20869 This option defines the ACL that is run when an SMTP MAIL command is
20870 received. See chapter <xref linkend="CHAPACL"/> for further details.
20871 </para>
20872 <para>
20873 <indexterm role="option">
20874 <primary><option>acl_smtp_mailauth</option></primary>
20875 </indexterm>
20876 </para>
20877 <informaltable frame="all">
20878 <tgroup cols="4" colsep="0" rowsep="0">
20879 <colspec colwidth="8*" align="left"/>
20880 <colspec colwidth="6*" align="center"/>
20881 <colspec colwidth="6*" align="center"/>
20882 <colspec colwidth="6*" align="right"/>
20883 <tbody>
20884 <row>
20885 <entry><option>acl_smtp_mailauth</option></entry>
20886 <entry>Use: <emphasis>main</emphasis></entry>
20887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20888 <entry>Default: <emphasis>unset</emphasis></entry>
20889 </row>
20890 </tbody>
20891 </tgroup>
20892 </informaltable>
20893 <para>
20894 <indexterm role="concept">
20895 <primary>AUTH</primary>
20896 <secondary>on MAIL command</secondary>
20897 </indexterm>
20898 This option defines the ACL that is run when there is an AUTH parameter on
20899 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20900 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20901 </para>
20902 <para>
20903 <indexterm role="option">
20904 <primary><option>acl_smtp_mime</option></primary>
20905 </indexterm>
20906 </para>
20907 <informaltable frame="all">
20908 <tgroup cols="4" colsep="0" rowsep="0">
20909 <colspec colwidth="8*" align="left"/>
20910 <colspec colwidth="6*" align="center"/>
20911 <colspec colwidth="6*" align="center"/>
20912 <colspec colwidth="6*" align="right"/>
20913 <tbody>
20914 <row>
20915 <entry><option>acl_smtp_mime</option></entry>
20916 <entry>Use: <emphasis>main</emphasis></entry>
20917 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20918 <entry>Default: <emphasis>unset</emphasis></entry>
20919 </row>
20920 </tbody>
20921 </tgroup>
20922 </informaltable>
20923 <para>
20924 <indexterm role="concept">
20925 <primary>MIME content scanning</primary>
20926 <secondary>ACL for</secondary>
20927 </indexterm>
20928 This option is available when Exim is built with the content-scanning
20929 extension. It defines the ACL that is run for each MIME part in a message. See
20930 section <xref linkend="SECTscanmimepart"/> for details.
20931 </para>
20932 <para>
20933 <indexterm role="option">
20934 <primary><option>acl_smtp_predata</option></primary>
20935 </indexterm>
20936 </para>
20937 <informaltable frame="all">
20938 <tgroup cols="4" colsep="0" rowsep="0">
20939 <colspec colwidth="8*" align="left"/>
20940 <colspec colwidth="6*" align="center"/>
20941 <colspec colwidth="6*" align="center"/>
20942 <colspec colwidth="6*" align="right"/>
20943 <tbody>
20944 <row>
20945 <entry><option>acl_smtp_predata</option></entry>
20946 <entry>Use: <emphasis>main</emphasis></entry>
20947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20948 <entry>Default: <emphasis>unset</emphasis></entry>
20949 </row>
20950 </tbody>
20951 </tgroup>
20952 </informaltable>
20953 <para>
20954 This option defines the ACL that is run when an SMTP DATA command is
20955 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20956 further details.
20957 </para>
20958 <para>
20959 <indexterm role="option">
20960 <primary><option>acl_smtp_quit</option></primary>
20961 </indexterm>
20962 </para>
20963 <informaltable frame="all">
20964 <tgroup cols="4" colsep="0" rowsep="0">
20965 <colspec colwidth="8*" align="left"/>
20966 <colspec colwidth="6*" align="center"/>
20967 <colspec colwidth="6*" align="center"/>
20968 <colspec colwidth="6*" align="right"/>
20969 <tbody>
20970 <row>
20971 <entry><option>acl_smtp_quit</option></entry>
20972 <entry>Use: <emphasis>main</emphasis></entry>
20973 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20974 <entry>Default: <emphasis>unset</emphasis></entry>
20975 </row>
20976 </tbody>
20977 </tgroup>
20978 </informaltable>
20979 <para>
20980 <indexterm role="concept">
20981 <primary>QUIT, ACL for</primary>
20982 </indexterm>
20983 This option defines the ACL that is run when an SMTP QUIT command is
20984 received. See chapter <xref linkend="CHAPACL"/> for further details.
20985 </para>
20986 <para>
20987 <indexterm role="option">
20988 <primary><option>acl_smtp_rcpt</option></primary>
20989 </indexterm>
20990 </para>
20991 <informaltable frame="all">
20992 <tgroup cols="4" colsep="0" rowsep="0">
20993 <colspec colwidth="8*" align="left"/>
20994 <colspec colwidth="6*" align="center"/>
20995 <colspec colwidth="6*" align="center"/>
20996 <colspec colwidth="6*" align="right"/>
20997 <tbody>
20998 <row>
20999 <entry><option>acl_smtp_rcpt</option></entry>
21000 <entry>Use: <emphasis>main</emphasis></entry>
21001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21002 <entry>Default: <emphasis>unset</emphasis></entry>
21003 </row>
21004 </tbody>
21005 </tgroup>
21006 </informaltable>
21007 <para>
21008 <indexterm role="concept">
21009 <primary>RCPT</primary>
21010 <secondary>ACL for</secondary>
21011 </indexterm>
21012 This option defines the ACL that is run when an SMTP RCPT command is
21013 received. See chapter <xref linkend="CHAPACL"/> for further details.
21014 </para>
21015 <para>
21016 <indexterm role="option">
21017 <primary><option>acl_smtp_starttls</option></primary>
21018 </indexterm>
21019 </para>
21020 <informaltable frame="all">
21021 <tgroup cols="4" colsep="0" rowsep="0">
21022 <colspec colwidth="8*" align="left"/>
21023 <colspec colwidth="6*" align="center"/>
21024 <colspec colwidth="6*" align="center"/>
21025 <colspec colwidth="6*" align="right"/>
21026 <tbody>
21027 <row>
21028 <entry><option>acl_smtp_starttls</option></entry>
21029 <entry>Use: <emphasis>main</emphasis></entry>
21030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21031 <entry>Default: <emphasis>unset</emphasis></entry>
21032 </row>
21033 </tbody>
21034 </tgroup>
21035 </informaltable>
21036 <para>
21037 <indexterm role="concept">
21038 <primary>STARTTLS, ACL for</primary>
21039 </indexterm>
21040 This option defines the ACL that is run when an SMTP STARTTLS command is
21041 received. See chapter <xref linkend="CHAPACL"/> for further details.
21042 </para>
21043 <para>
21044 <indexterm role="option">
21045 <primary><option>acl_smtp_vrfy</option></primary>
21046 </indexterm>
21047 </para>
21048 <informaltable frame="all">
21049 <tgroup cols="4" colsep="0" rowsep="0">
21050 <colspec colwidth="8*" align="left"/>
21051 <colspec colwidth="6*" align="center"/>
21052 <colspec colwidth="6*" align="center"/>
21053 <colspec colwidth="6*" align="right"/>
21054 <tbody>
21055 <row>
21056 <entry><option>acl_smtp_vrfy</option></entry>
21057 <entry>Use: <emphasis>main</emphasis></entry>
21058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21059 <entry>Default: <emphasis>unset</emphasis></entry>
21060 </row>
21061 </tbody>
21062 </tgroup>
21063 </informaltable>
21064 <para>
21065 <indexterm role="concept">
21066 <primary>VRFY</primary>
21067 <secondary>ACL for</secondary>
21068 </indexterm>
21069 This option defines the ACL that is run when an SMTP VRFY command is
21070 received. See chapter <xref linkend="CHAPACL"/> for further details.
21071 </para>
21072 <para>
21073 <indexterm role="option">
21074 <primary><option>admin_groups</option></primary>
21075 </indexterm>
21076 </para>
21077 <informaltable frame="all">
21078 <tgroup cols="4" colsep="0" rowsep="0">
21079 <colspec colwidth="8*" align="left"/>
21080 <colspec colwidth="6*" align="center"/>
21081 <colspec colwidth="6*" align="center"/>
21082 <colspec colwidth="6*" align="right"/>
21083 <tbody>
21084 <row>
21085 <entry><option>admin_groups</option></entry>
21086 <entry>Use: <emphasis>main</emphasis></entry>
21087 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
21088 <entry>Default: <emphasis>unset</emphasis></entry>
21089 </row>
21090 </tbody>
21091 </tgroup>
21092 </informaltable>
21093 <para>
21094 <indexterm role="concept">
21095 <primary>admin user</primary>
21096 </indexterm>
21097 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
21098 current group or any of the supplementary groups of an Exim caller is in this
21099 colon-separated list, the caller has admin privileges. If all your system
21100 programmers are in a specific group, for example, you can give them all Exim
21101 admin privileges by putting that group in <option>admin_groups</option>. However, this does
21102 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
21103 To permit this, you have to add individuals to the Exim group.
21104 </para>
21105 <para>
21106 <indexterm role="option">
21107 <primary><option>allow_domain_literals</option></primary>
21108 </indexterm>
21109 </para>
21110 <informaltable frame="all">
21111 <tgroup cols="4" colsep="0" rowsep="0">
21112 <colspec colwidth="8*" align="left"/>
21113 <colspec colwidth="6*" align="center"/>
21114 <colspec colwidth="6*" align="center"/>
21115 <colspec colwidth="6*" align="right"/>
21116 <tbody>
21117 <row>
21118 <entry><option>allow_domain_literals</option></entry>
21119 <entry>Use: <emphasis>main</emphasis></entry>
21120 <entry>Type: <emphasis>boolean</emphasis></entry>
21121 <entry>Default: <emphasis>false</emphasis></entry>
21122 </row>
21123 </tbody>
21124 </tgroup>
21125 </informaltable>
21126 <para>
21127 <indexterm role="concept">
21128 <primary>domain literal</primary>
21129 </indexterm>
21130 If this option is set, the RFC 2822 domain literal format is permitted in
21131 email addresses. The option is not set by default, because the domain literal
21132 format is not normally required these days, and few people know about it. It
21133 has, however, been exploited by mail abusers.
21134 </para>
21135 <para>
21136 Unfortunately, it seems that some DNS black list maintainers are using this
21137 format to report black listing to postmasters. If you want to accept messages
21138 addressed to your hosts by IP address, you need to set
21139 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
21140 domains (defined in the named domain list <option>local_domains</option> in the default
21141 configuration). This <quote>magic string</quote> matches the domain literal form of all
21142 the local host&#x2019;s IP addresses.
21143 </para>
21144 <para>
21145 <indexterm role="option">
21146 <primary><option>allow_mx_to_ip</option></primary>
21147 </indexterm>
21148 </para>
21149 <informaltable frame="all">
21150 <tgroup cols="4" colsep="0" rowsep="0">
21151 <colspec colwidth="8*" align="left"/>
21152 <colspec colwidth="6*" align="center"/>
21153 <colspec colwidth="6*" align="center"/>
21154 <colspec colwidth="6*" align="right"/>
21155 <tbody>
21156 <row>
21157 <entry><option>allow_mx_to_ip</option></entry>
21158 <entry>Use: <emphasis>main</emphasis></entry>
21159 <entry>Type: <emphasis>boolean</emphasis></entry>
21160 <entry>Default: <emphasis>false</emphasis></entry>
21161 </row>
21162 </tbody>
21163 </tgroup>
21164 </informaltable>
21165 <para>
21166 <indexterm role="concept">
21167 <primary>MX record</primary>
21168 <secondary>pointing to IP address</secondary>
21169 </indexterm>
21170 It appears that more and more DNS zone administrators are breaking the rules
21171 and putting domain names that look like IP addresses on the right hand side of
21172 MX records. Exim follows the rules and rejects this, giving an error message
21173 that explains the mis-configuration. However, some other MTAs support this
21174 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
21175 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
21176 recommended, except when you have no other choice.
21177 </para>
21178 <para>
21179 <indexterm role="option">
21180 <primary><option>allow_utf8_domains</option></primary>
21181 </indexterm>
21182 </para>
21183 <informaltable frame="all">
21184 <tgroup cols="4" colsep="0" rowsep="0">
21185 <colspec colwidth="8*" align="left"/>
21186 <colspec colwidth="6*" align="center"/>
21187 <colspec colwidth="6*" align="center"/>
21188 <colspec colwidth="6*" align="right"/>
21189 <tbody>
21190 <row>
21191 <entry><option>allow_utf8_domains</option></entry>
21192 <entry>Use: <emphasis>main</emphasis></entry>
21193 <entry>Type: <emphasis>boolean</emphasis></entry>
21194 <entry>Default: <emphasis>false</emphasis></entry>
21195 </row>
21196 </tbody>
21197 </tgroup>
21198 </informaltable>
21199 <para>
21200 <indexterm role="concept">
21201 <primary>domain</primary>
21202 <secondary>UTF-8 characters in</secondary>
21203 </indexterm>
21204 <indexterm role="concept">
21205 <primary>UTF-8</primary>
21206 <secondary>in domain name</secondary>
21207 </indexterm>
21208 Lots of discussion is going on about internationalized domain names. One
21209 camp is strongly in favour of just using UTF-8 characters, and it seems
21210 that at least two other MTAs permit this. This option allows Exim users to
21211 experiment if they wish.
21212 </para>
21213 <para>
21214 If it is set true, Exim&#x2019;s domain parsing function allows valid
21215 UTF-8 multicharacters to appear in domain name components, in addition to
21216 letters, digits, and hyphens. However, just setting this option is not
21217 enough; if you want to look up these domain names in the DNS, you must also
21218 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
21219 suitable setting is:
21220 </para>
21221 <literallayout class="monospaced">
21222 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
21223   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
21224 </literallayout>
21225 <para>
21226 Alternatively, you can just disable this feature by setting
21227 </para>
21228 <literallayout class="monospaced">
21229 dns_check_names_pattern =
21230 </literallayout>
21231 <para>
21232 That is, set the option to an empty string so that no check is done.
21233 </para>
21234 <para>
21235 <indexterm role="option">
21236 <primary><option>auth_advertise_hosts</option></primary>
21237 </indexterm>
21238 </para>
21239 <informaltable frame="all">
21240 <tgroup cols="4" colsep="0" rowsep="0">
21241 <colspec colwidth="8*" align="left"/>
21242 <colspec colwidth="6*" align="center"/>
21243 <colspec colwidth="6*" align="center"/>
21244 <colspec colwidth="6*" align="right"/>
21245 <tbody>
21246 <row>
21247 <entry><option>auth_advertise_hosts</option></entry>
21248 <entry>Use: <emphasis>main</emphasis></entry>
21249 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
21250 <entry>Default: <emphasis>*</emphasis></entry>
21251 </row>
21252 </tbody>
21253 </tgroup>
21254 </informaltable>
21255 <para>
21256 <indexterm role="concept">
21257 <primary>authentication</primary>
21258 <secondary>advertising</secondary>
21259 </indexterm>
21260 <indexterm role="concept">
21261 <primary>AUTH</primary>
21262 <secondary>advertising</secondary>
21263 </indexterm>
21264 If any server authentication mechanisms are configured, Exim advertises them in
21265 response to an EHLO command only if the calling host matches this list.
21266 Otherwise, Exim does not advertise AUTH.
21267 Exim does not accept AUTH commands from clients to which it has not
21268 advertised the availability of AUTH. The advertising of individual
21269 authentication mechanisms can be controlled by the use of the
21270 <option>server_advertise_condition</option> generic authenticator option on the individual
21271 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
21272 </para>
21273 <para>
21274 Certain mail clients (for example, Netscape) require the user to provide a name
21275 and password for authentication if AUTH is advertised, even though it may
21276 not be needed (the host may accept messages from hosts on its local LAN without
21277 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
21278 to make these clients more friendly by excluding them from the set of hosts to
21279 which Exim advertises AUTH.
21280 </para>
21281 <para>
21282 <indexterm role="concept">
21283 <primary>AUTH</primary>
21284 <secondary>advertising when encrypted</secondary>
21285 </indexterm>
21286 If you want to advertise the availability of AUTH only when the connection
21287 is encrypted using TLS, you can make use of the fact that the value of this
21288 option is expanded, with a setting like this:
21289 </para>
21290 <literallayout class="monospaced">
21291 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
21292 </literallayout>
21293 <para>
21294 <indexterm role="variable">
21295 <primary><varname>$tls_cipher</varname></primary>
21296 </indexterm>
21297 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
21298 the expansion is empty, thus matching no hosts. Otherwise, the result of the
21299 expansion is *, which matches all hosts.
21300 </para>
21301 <para>
21302 <indexterm role="option">
21303 <primary><option>auto_thaw</option></primary>
21304 </indexterm>
21305 </para>
21306 <informaltable frame="all">
21307 <tgroup cols="4" colsep="0" rowsep="0">
21308 <colspec colwidth="8*" align="left"/>
21309 <colspec colwidth="6*" align="center"/>
21310 <colspec colwidth="6*" align="center"/>
21311 <colspec colwidth="6*" align="right"/>
21312 <tbody>
21313 <row>
21314 <entry><option>auto_thaw</option></entry>
21315 <entry>Use: <emphasis>main</emphasis></entry>
21316 <entry>Type: <emphasis>time</emphasis></entry>
21317 <entry>Default: <emphasis>0s</emphasis></entry>
21318 </row>
21319 </tbody>
21320 </tgroup>
21321 </informaltable>
21322 <para>
21323 <indexterm role="concept">
21324 <primary>thawing messages</primary>
21325 </indexterm>
21326 <indexterm role="concept">
21327 <primary>unfreezing messages</primary>
21328 </indexterm>
21329 If this option is set to a time greater than zero, a queue runner will try a
21330 new delivery attempt on any frozen message, other than a bounce message, if
21331 this much time has passed since it was frozen. This may result in the message
21332 being re-frozen if nothing has changed since the last attempt. It is a way of
21333 saying <quote>keep on trying, even though there are big problems</quote>.
21334 </para>
21335 <para>
21336 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
21337 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
21338 thought to be very useful any more, and its use should probably be avoided.
21339 </para>
21340 <para>
21341 <indexterm role="option">
21342 <primary><option>av_scanner</option></primary>
21343 </indexterm>
21344 </para>
21345 <informaltable frame="all">
21346 <tgroup cols="4" colsep="0" rowsep="0">
21347 <colspec colwidth="8*" align="left"/>
21348 <colspec colwidth="6*" align="center"/>
21349 <colspec colwidth="6*" align="center"/>
21350 <colspec colwidth="6*" align="right"/>
21351 <tbody>
21352 <row>
21353 <entry><option>av_scanner</option></entry>
21354 <entry>Use: <emphasis>main</emphasis></entry>
21355 <entry>Type: <emphasis>string</emphasis></entry>
21356 <entry>Default: <emphasis>see below</emphasis></entry>
21357 </row>
21358 </tbody>
21359 </tgroup>
21360 </informaltable>
21361 <para>
21362 This option is available if Exim is built with the content-scanning extension.
21363 It specifies which anti-virus scanner to use. The default value is:
21364 </para>
21365 <literallayout class="monospaced">
21366 sophie:/var/run/sophie
21367 </literallayout>
21368 <para>
21369 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21370 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21371 </para>
21372 <para>
21373 <indexterm role="option">
21374 <primary><option>bi_command</option></primary>
21375 </indexterm>
21376 </para>
21377 <informaltable frame="all">
21378 <tgroup cols="4" colsep="0" rowsep="0">
21379 <colspec colwidth="8*" align="left"/>
21380 <colspec colwidth="6*" align="center"/>
21381 <colspec colwidth="6*" align="center"/>
21382 <colspec colwidth="6*" align="right"/>
21383 <tbody>
21384 <row>
21385 <entry><option>bi_command</option></entry>
21386 <entry>Use: <emphasis>main</emphasis></entry>
21387 <entry>Type: <emphasis>string</emphasis></entry>
21388 <entry>Default: <emphasis>unset</emphasis></entry>
21389 </row>
21390 </tbody>
21391 </tgroup>
21392 </informaltable>
21393 <para>
21394 <indexterm role="option">
21395 <primary><option>-bi</option></primary>
21396 </indexterm>
21397 This option supplies the name of a command that is run when Exim is called with
21398 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21399 just the command name, it is not a complete command line. If an argument is
21400 required, it must come from the <option>-oA</option> command line option.
21401 </para>
21402 <para>
21403 <indexterm role="option">
21404 <primary><option>bounce_message_file</option></primary>
21405 </indexterm>
21406 </para>
21407 <informaltable frame="all">
21408 <tgroup cols="4" colsep="0" rowsep="0">
21409 <colspec colwidth="8*" align="left"/>
21410 <colspec colwidth="6*" align="center"/>
21411 <colspec colwidth="6*" align="center"/>
21412 <colspec colwidth="6*" align="right"/>
21413 <tbody>
21414 <row>
21415 <entry><option>bounce_message_file</option></entry>
21416 <entry>Use: <emphasis>main</emphasis></entry>
21417 <entry>Type: <emphasis>string</emphasis></entry>
21418 <entry>Default: <emphasis>unset</emphasis></entry>
21419 </row>
21420 </tbody>
21421 </tgroup>
21422 </informaltable>
21423 <para>
21424 <indexterm role="concept">
21425 <primary>bounce message</primary>
21426 <secondary>customizing</secondary>
21427 </indexterm>
21428 <indexterm role="concept">
21429 <primary>customizing</primary>
21430 <secondary>bounce message</secondary>
21431 </indexterm>
21432 This option defines a template file containing paragraphs of text to be used
21433 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
21434 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
21435 </para>
21436 <para>
21437 <indexterm role="option">
21438 <primary><option>bounce_message_text</option></primary>
21439 </indexterm>
21440 </para>
21441 <informaltable frame="all">
21442 <tgroup cols="4" colsep="0" rowsep="0">
21443 <colspec colwidth="8*" align="left"/>
21444 <colspec colwidth="6*" align="center"/>
21445 <colspec colwidth="6*" align="center"/>
21446 <colspec colwidth="6*" align="right"/>
21447 <tbody>
21448 <row>
21449 <entry><option>bounce_message_text</option></entry>
21450 <entry>Use: <emphasis>main</emphasis></entry>
21451 <entry>Type: <emphasis>string</emphasis></entry>
21452 <entry>Default: <emphasis>unset</emphasis></entry>
21453 </row>
21454 </tbody>
21455 </tgroup>
21456 </informaltable>
21457 <para>
21458 When this option is set, its contents are included in the default bounce
21459 message immediately after <quote>This message was created automatically by mail
21460 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21461 </para>
21462 <para>
21463 <indexterm role="option">
21464 <primary><option>bounce_return_body</option></primary>
21465 </indexterm>
21466 </para>
21467 <informaltable frame="all">
21468 <tgroup cols="4" colsep="0" rowsep="0">
21469 <colspec colwidth="8*" align="left"/>
21470 <colspec colwidth="6*" align="center"/>
21471 <colspec colwidth="6*" align="center"/>
21472 <colspec colwidth="6*" align="right"/>
21473 <tbody>
21474 <row>
21475 <entry><option>bounce_return_body</option></entry>
21476 <entry>Use: <emphasis>main</emphasis></entry>
21477 <entry>Type: <emphasis>boolean</emphasis></entry>
21478 <entry>Default: <emphasis>true</emphasis></entry>
21479 </row>
21480 </tbody>
21481 </tgroup>
21482 </informaltable>
21483 <para>
21484 <indexterm role="concept">
21485 <primary>bounce message</primary>
21486 <secondary>including body</secondary>
21487 </indexterm>
21488 This option controls whether the body of an incoming message is included in a
21489 bounce message when <option>bounce_return_message</option> is true. The default setting
21490 causes the entire message, both header and body, to be returned (subject to the
21491 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21492 message header is included. In the case of a non-SMTP message containing an
21493 error that is detected during reception, only those header lines preceding the
21494 point at which the error was detected are returned.
21495 <indexterm role="concept">
21496 <primary>bounce message</primary>
21497 <secondary>including original</secondary>
21498 </indexterm>
21499 </para>
21500 <para>
21501 <indexterm role="option">
21502 <primary><option>bounce_return_message</option></primary>
21503 </indexterm>
21504 </para>
21505 <informaltable frame="all">
21506 <tgroup cols="4" colsep="0" rowsep="0">
21507 <colspec colwidth="8*" align="left"/>
21508 <colspec colwidth="6*" align="center"/>
21509 <colspec colwidth="6*" align="center"/>
21510 <colspec colwidth="6*" align="right"/>
21511 <tbody>
21512 <row>
21513 <entry><option>bounce_return_message</option></entry>
21514 <entry>Use: <emphasis>main</emphasis></entry>
21515 <entry>Type: <emphasis>boolean</emphasis></entry>
21516 <entry>Default: <emphasis>true</emphasis></entry>
21517 </row>
21518 </tbody>
21519 </tgroup>
21520 </informaltable>
21521 <para>
21522 If this option is set false, none of the original message is included in
21523 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21524 <option>bounce_return_body</option>.
21525 </para>
21526 <para>
21527 <indexterm role="option">
21528 <primary><option>bounce_return_size_limit</option></primary>
21529 </indexterm>
21530 </para>
21531 <informaltable frame="all">
21532 <tgroup cols="4" colsep="0" rowsep="0">
21533 <colspec colwidth="8*" align="left"/>
21534 <colspec colwidth="6*" align="center"/>
21535 <colspec colwidth="6*" align="center"/>
21536 <colspec colwidth="6*" align="right"/>
21537 <tbody>
21538 <row>
21539 <entry><option>bounce_return_size_limit</option></entry>
21540 <entry>Use: <emphasis>main</emphasis></entry>
21541 <entry>Type: <emphasis>integer</emphasis></entry>
21542 <entry>Default: <emphasis>100K</emphasis></entry>
21543 </row>
21544 </tbody>
21545 </tgroup>
21546 </informaltable>
21547 <para>
21548 <indexterm role="concept">
21549 <primary>size</primary>
21550 <secondary>of bounce, limit</secondary>
21551 </indexterm>
21552 <indexterm role="concept">
21553 <primary>bounce message</primary>
21554 <secondary>size limit</secondary>
21555 </indexterm>
21556 <indexterm role="concept">
21557 <primary>limit</primary>
21558 <secondary>bounce message size</secondary>
21559 </indexterm>
21560 This option sets a limit in bytes on the size of messages that are returned to
21561 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21562 limit should be less than the value of the global <option>message_size_limit</option> and of
21563 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21564 that Exim generates. If this option is set to zero there is no limit.
21565 </para>
21566 <para>
21567 When the body of any message that is to be included in a bounce message is
21568 greater than the limit, it is truncated, and a comment pointing this out is
21569 added at the top. The actual cutoff may be greater than the value given, owing
21570 to the use of buffering for transferring the message in chunks (typically 8K in
21571 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21572 messages.
21573 </para>
21574 <para>
21575 <indexterm role="option">
21576 <primary><option>bounce_sender_authentication</option></primary>
21577 </indexterm>
21578 </para>
21579 <informaltable frame="all">
21580 <tgroup cols="4" colsep="0" rowsep="0">
21581 <colspec colwidth="8*" align="left"/>
21582 <colspec colwidth="6*" align="center"/>
21583 <colspec colwidth="6*" align="center"/>
21584 <colspec colwidth="6*" align="right"/>
21585 <tbody>
21586 <row>
21587 <entry><option>bounce_sender_authentication</option></entry>
21588 <entry>Use: <emphasis>main</emphasis></entry>
21589 <entry>Type: <emphasis>string</emphasis></entry>
21590 <entry>Default: <emphasis>unset</emphasis></entry>
21591 </row>
21592 </tbody>
21593 </tgroup>
21594 </informaltable>
21595 <para>
21596 <indexterm role="concept">
21597 <primary>bounce message</primary>
21598 <secondary>sender authentication</secondary>
21599 </indexterm>
21600 <indexterm role="concept">
21601 <primary>authentication</primary>
21602 <secondary>bounce message</secondary>
21603 </indexterm>
21604 <indexterm role="concept">
21605 <primary>AUTH</primary>
21606 <secondary>on bounce message</secondary>
21607 </indexterm>
21608 This option provides an authenticated sender address that is sent with any
21609 bounce messages generated by Exim that are sent over an authenticated SMTP
21610 connection. A typical setting might be:
21611 </para>
21612 <literallayout class="monospaced">
21613 bounce_sender_authentication = mailer-daemon@my.domain.example
21614 </literallayout>
21615 <para>
21616 which would cause bounce messages to be sent using the SMTP command:
21617 </para>
21618 <literallayout class="monospaced">
21619 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21620 </literallayout>
21621 <para>
21622 The value of <option>bounce_sender_authentication</option> must always be a complete email
21623 address.
21624 </para>
21625 <para>
21626 <indexterm role="option">
21627 <primary><option>callout_domain_negative_expire</option></primary>
21628 </indexterm>
21629 </para>
21630 <informaltable frame="all">
21631 <tgroup cols="4" colsep="0" rowsep="0">
21632 <colspec colwidth="8*" align="left"/>
21633 <colspec colwidth="6*" align="center"/>
21634 <colspec colwidth="6*" align="center"/>
21635 <colspec colwidth="6*" align="right"/>
21636 <tbody>
21637 <row>
21638 <entry><option>callout_domain_negative_expire</option></entry>
21639 <entry>Use: <emphasis>main</emphasis></entry>
21640 <entry>Type: <emphasis>time</emphasis></entry>
21641 <entry>Default: <emphasis>3h</emphasis></entry>
21642 </row>
21643 </tbody>
21644 </tgroup>
21645 </informaltable>
21646 <para>
21647 <indexterm role="concept">
21648 <primary>caching</primary>
21649 <secondary>callout timeouts</secondary>
21650 </indexterm>
21651 <indexterm role="concept">
21652 <primary>callout</primary>
21653 <secondary>caching timeouts</secondary>
21654 </indexterm>
21655 This option specifies the expiry time for negative callout cache data for a
21656 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21657 section <xref linkend="SECTcallvercache"/> for details of the caching.
21658 </para>
21659 <para>
21660 <indexterm role="option">
21661 <primary><option>callout_domain_positive_expire</option></primary>
21662 </indexterm>
21663 </para>
21664 <informaltable frame="all">
21665 <tgroup cols="4" colsep="0" rowsep="0">
21666 <colspec colwidth="8*" align="left"/>
21667 <colspec colwidth="6*" align="center"/>
21668 <colspec colwidth="6*" align="center"/>
21669 <colspec colwidth="6*" align="right"/>
21670 <tbody>
21671 <row>
21672 <entry><option>callout_domain_positive_expire</option></entry>
21673 <entry>Use: <emphasis>main</emphasis></entry>
21674 <entry>Type: <emphasis>time</emphasis></entry>
21675 <entry>Default: <emphasis>7d</emphasis></entry>
21676 </row>
21677 </tbody>
21678 </tgroup>
21679 </informaltable>
21680 <para>
21681 This option specifies the expiry time for positive callout cache data for a
21682 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21683 section <xref linkend="SECTcallvercache"/> for details of the caching.
21684 </para>
21685 <para>
21686 <indexterm role="option">
21687 <primary><option>callout_negative_expire</option></primary>
21688 </indexterm>
21689 </para>
21690 <informaltable frame="all">
21691 <tgroup cols="4" colsep="0" rowsep="0">
21692 <colspec colwidth="8*" align="left"/>
21693 <colspec colwidth="6*" align="center"/>
21694 <colspec colwidth="6*" align="center"/>
21695 <colspec colwidth="6*" align="right"/>
21696 <tbody>
21697 <row>
21698 <entry><option>callout_negative_expire</option></entry>
21699 <entry>Use: <emphasis>main</emphasis></entry>
21700 <entry>Type: <emphasis>time</emphasis></entry>
21701 <entry>Default: <emphasis>2h</emphasis></entry>
21702 </row>
21703 </tbody>
21704 </tgroup>
21705 </informaltable>
21706 <para>
21707 This option specifies the expiry time for negative callout cache data for an
21708 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21709 section <xref linkend="SECTcallvercache"/> for details of the caching.
21710 </para>
21711 <para>
21712 <indexterm role="option">
21713 <primary><option>callout_positive_expire</option></primary>
21714 </indexterm>
21715 </para>
21716 <informaltable frame="all">
21717 <tgroup cols="4" colsep="0" rowsep="0">
21718 <colspec colwidth="8*" align="left"/>
21719 <colspec colwidth="6*" align="center"/>
21720 <colspec colwidth="6*" align="center"/>
21721 <colspec colwidth="6*" align="right"/>
21722 <tbody>
21723 <row>
21724 <entry><option>callout_positive_expire</option></entry>
21725 <entry>Use: <emphasis>main</emphasis></entry>
21726 <entry>Type: <emphasis>time</emphasis></entry>
21727 <entry>Default: <emphasis>24h</emphasis></entry>
21728 </row>
21729 </tbody>
21730 </tgroup>
21731 </informaltable>
21732 <para>
21733 This option specifies the expiry time for positive callout cache data for an
21734 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21735 section <xref linkend="SECTcallvercache"/> for details of the caching.
21736 </para>
21737 <para>
21738 <indexterm role="option">
21739 <primary><option>callout_random_local_part</option></primary>
21740 </indexterm>
21741 </para>
21742 <informaltable frame="all">
21743 <tgroup cols="4" colsep="0" rowsep="0">
21744 <colspec colwidth="8*" align="left"/>
21745 <colspec colwidth="6*" align="center"/>
21746 <colspec colwidth="6*" align="center"/>
21747 <colspec colwidth="6*" align="right"/>
21748 <tbody>
21749 <row>
21750 <entry><option>callout_random_local_part</option></entry>
21751 <entry>Use: <emphasis>main</emphasis></entry>
21752 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21753 <entry>Default: <emphasis>see below</emphasis></entry>
21754 </row>
21755 </tbody>
21756 </tgroup>
21757 </informaltable>
21758 <para>
21759 This option defines the <quote>random</quote> local part that can be used as part of
21760 callout verification. The default value is
21761 </para>
21762 <literallayout class="monospaced">
21763 $primary_hostname-$tod_epoch-testing
21764 </literallayout>
21765 <para>
21766 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21767 </para>
21768 <para>
21769 <indexterm role="option">
21770 <primary><option>check_log_inodes</option></primary>
21771 </indexterm>
21772 </para>
21773 <informaltable frame="all">
21774 <tgroup cols="4" colsep="0" rowsep="0">
21775 <colspec colwidth="8*" align="left"/>
21776 <colspec colwidth="6*" align="center"/>
21777 <colspec colwidth="6*" align="center"/>
21778 <colspec colwidth="6*" align="right"/>
21779 <tbody>
21780 <row>
21781 <entry><option>check_log_inodes</option></entry>
21782 <entry>Use: <emphasis>main</emphasis></entry>
21783 <entry>Type: <emphasis>integer</emphasis></entry>
21784 <entry>Default: <emphasis>0</emphasis></entry>
21785 </row>
21786 </tbody>
21787 </tgroup>
21788 </informaltable>
21789 <para>
21790 See <option>check_spool_space</option> below.
21791 </para>
21792 <para>
21793 <indexterm role="option">
21794 <primary><option>check_log_space</option></primary>
21795 </indexterm>
21796 </para>
21797 <informaltable frame="all">
21798 <tgroup cols="4" colsep="0" rowsep="0">
21799 <colspec colwidth="8*" align="left"/>
21800 <colspec colwidth="6*" align="center"/>
21801 <colspec colwidth="6*" align="center"/>
21802 <colspec colwidth="6*" align="right"/>
21803 <tbody>
21804 <row>
21805 <entry><option>check_log_space</option></entry>
21806 <entry>Use: <emphasis>main</emphasis></entry>
21807 <entry>Type: <emphasis>integer</emphasis></entry>
21808 <entry>Default: <emphasis>0</emphasis></entry>
21809 </row>
21810 </tbody>
21811 </tgroup>
21812 </informaltable>
21813 <para>
21814 See <option>check_spool_space</option> below.
21815 </para>
21816 <para>
21817 <indexterm role="option">
21818 <primary><option>check_rfc2047_length</option></primary>
21819 </indexterm>
21820 <indexterm role="concept">
21821 <primary>RFC 2047</primary>
21822 <secondary>disabling length check</secondary>
21823 </indexterm>
21824 <indexterm role="option">
21825 <primary><option>check_rfc2047_length</option></primary>
21826 </indexterm>
21827 </para>
21828 <informaltable frame="all">
21829 <tgroup cols="4" colsep="0" rowsep="0">
21830 <colspec colwidth="8*" align="left"/>
21831 <colspec colwidth="6*" align="center"/>
21832 <colspec colwidth="6*" align="center"/>
21833 <colspec colwidth="6*" align="right"/>
21834 <tbody>
21835 <row>
21836 <entry><option>check_rfc2047_length</option></entry>
21837 <entry>Use: <emphasis>main</emphasis></entry>
21838 <entry>Type: <emphasis>boolean</emphasis></entry>
21839 <entry>Default: <emphasis>true</emphasis></entry>
21840 </row>
21841 </tbody>
21842 </tgroup>
21843 </informaltable>
21844 <para>
21845 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21846 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21847 word; strings to be encoded that exceed this length are supposed to use
21848 multiple encoded words. By default, Exim does not recognize encoded words that
21849 exceed the maximum length. However, it seems that some software, in violation
21850 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21851 set false, Exim recognizes encoded words of any length.
21852 </para>
21853 <para>
21854 <indexterm role="option">
21855 <primary><option>check_spool_inodes</option></primary>
21856 </indexterm>
21857 </para>
21858 <informaltable frame="all">
21859 <tgroup cols="4" colsep="0" rowsep="0">
21860 <colspec colwidth="8*" align="left"/>
21861 <colspec colwidth="6*" align="center"/>
21862 <colspec colwidth="6*" align="center"/>
21863 <colspec colwidth="6*" align="right"/>
21864 <tbody>
21865 <row>
21866 <entry><option>check_spool_inodes</option></entry>
21867 <entry>Use: <emphasis>main</emphasis></entry>
21868 <entry>Type: <emphasis>integer</emphasis></entry>
21869 <entry>Default: <emphasis>0</emphasis></entry>
21870 </row>
21871 </tbody>
21872 </tgroup>
21873 </informaltable>
21874 <para>
21875 See <option>check_spool_space</option> below.
21876 </para>
21877 <para>
21878 <indexterm role="option">
21879 <primary><option>check_spool_space</option></primary>
21880 </indexterm>
21881 </para>
21882 <informaltable frame="all">
21883 <tgroup cols="4" colsep="0" rowsep="0">
21884 <colspec colwidth="8*" align="left"/>
21885 <colspec colwidth="6*" align="center"/>
21886 <colspec colwidth="6*" align="center"/>
21887 <colspec colwidth="6*" align="right"/>
21888 <tbody>
21889 <row>
21890 <entry><option>check_spool_space</option></entry>
21891 <entry>Use: <emphasis>main</emphasis></entry>
21892 <entry>Type: <emphasis>integer</emphasis></entry>
21893 <entry>Default: <emphasis>0</emphasis></entry>
21894 </row>
21895 </tbody>
21896 </tgroup>
21897 </informaltable>
21898 <para>
21899 <indexterm role="concept">
21900 <primary>checking disk space</primary>
21901 </indexterm>
21902 <indexterm role="concept">
21903 <primary>disk space, checking</primary>
21904 </indexterm>
21905 <indexterm role="concept">
21906 <primary>spool directory</primary>
21907 <secondary>checking space</secondary>
21908 </indexterm>
21909 The four <option>check_...</option> options allow for checking of disk resources before a
21910 message is accepted.
21911 </para>
21912 <para>
21913 <indexterm role="variable">
21914 <primary><varname>$log_inodes</varname></primary>
21915 </indexterm>
21916 <indexterm role="variable">
21917 <primary><varname>$log_space</varname></primary>
21918 </indexterm>
21919 <indexterm role="variable">
21920 <primary><varname>$spool_inodes</varname></primary>
21921 </indexterm>
21922 <indexterm role="variable">
21923 <primary><varname>$spool_space</varname></primary>
21924 </indexterm>
21925 When any of these options are set, they apply to all incoming messages. If you
21926 want to apply different checks to different kinds of message, you can do so by
21927 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21928 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21929 </para>
21930 <para>
21931 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21932 either value is greater than zero, for example:
21933 </para>
21934 <literallayout class="monospaced">
21935 check_spool_space = 10M
21936 check_spool_inodes = 100
21937 </literallayout>
21938 <para>
21939 The spool partition is the one that contains the directory defined by
21940 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21941 transit.
21942 </para>
21943 <para>
21944 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21945 files are written if either is greater than zero. These should be set only if
21946 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21947 </para>
21948 <para>
21949 If there is less space or fewer inodes than requested, Exim refuses to accept
21950 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21951 error response to the MAIL command. If ESMTP is in use and there was a
21952 SIZE parameter on the MAIL command, its value is added to the
21953 <option>check_spool_space</option> value, and the check is performed even if
21954 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21955 </para>
21956 <para>
21957 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21958 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21959 </para>
21960 <para>
21961 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21962 failure a message is written to stderr and Exim exits with a non-zero code, as
21963 it obviously cannot send an error message of any kind.
21964 </para>
21965 <para>
21966 <indexterm role="option">
21967 <primary><option>daemon_smtp_ports</option></primary>
21968 </indexterm>
21969 </para>
21970 <informaltable frame="all">
21971 <tgroup cols="4" colsep="0" rowsep="0">
21972 <colspec colwidth="8*" align="left"/>
21973 <colspec colwidth="6*" align="center"/>
21974 <colspec colwidth="6*" align="center"/>
21975 <colspec colwidth="6*" align="right"/>
21976 <tbody>
21977 <row>
21978 <entry><option>daemon_smtp_ports</option></entry>
21979 <entry>Use: <emphasis>main</emphasis></entry>
21980 <entry>Type: <emphasis>string</emphasis></entry>
21981 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21982 </row>
21983 </tbody>
21984 </tgroup>
21985 </informaltable>
21986 <para>
21987 <indexterm role="concept">
21988 <primary>port</primary>
21989 <secondary>for daemon</secondary>
21990 </indexterm>
21991 <indexterm role="concept">
21992 <primary>TCP/IP</primary>
21993 <secondary>setting listening ports</secondary>
21994 </indexterm>
21995 This option specifies one or more default SMTP ports on which the Exim daemon
21996 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21997 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21998 </para>
21999 <para>
22000 <indexterm role="option">
22001 <primary><option>daemon_startup_retries</option></primary>
22002 </indexterm>
22003 </para>
22004 <informaltable frame="all">
22005 <tgroup cols="4" colsep="0" rowsep="0">
22006 <colspec colwidth="8*" align="left"/>
22007 <colspec colwidth="6*" align="center"/>
22008 <colspec colwidth="6*" align="center"/>
22009 <colspec colwidth="6*" align="right"/>
22010 <tbody>
22011 <row>
22012 <entry><option>daemon_startup_retries</option></entry>
22013 <entry>Use: <emphasis>main</emphasis></entry>
22014 <entry>Type: <emphasis>integer</emphasis></entry>
22015 <entry>Default: <emphasis>9</emphasis></entry>
22016 </row>
22017 </tbody>
22018 </tgroup>
22019 </informaltable>
22020 <para>
22021 <indexterm role="concept">
22022 <primary>daemon startup, retrying</primary>
22023 </indexterm>
22024 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
22025 the daemon at startup when it cannot immediately bind a listening socket
22026 (typically because the socket is already in use): <option>daemon_startup_retries</option>
22027 defines the number of retries after the first failure, and
22028 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
22029 </para>
22030 <para>
22031 <indexterm role="option">
22032 <primary><option>daemon_startup_sleep</option></primary>
22033 </indexterm>
22034 </para>
22035 <informaltable frame="all">
22036 <tgroup cols="4" colsep="0" rowsep="0">
22037 <colspec colwidth="8*" align="left"/>
22038 <colspec colwidth="6*" align="center"/>
22039 <colspec colwidth="6*" align="center"/>
22040 <colspec colwidth="6*" align="right"/>
22041 <tbody>
22042 <row>
22043 <entry><option>daemon_startup_sleep</option></entry>
22044 <entry>Use: <emphasis>main</emphasis></entry>
22045 <entry>Type: <emphasis>time</emphasis></entry>
22046 <entry>Default: <emphasis>30s</emphasis></entry>
22047 </row>
22048 </tbody>
22049 </tgroup>
22050 </informaltable>
22051 <para>
22052 See <option>daemon_startup_retries</option>.
22053 </para>
22054 <para>
22055 <indexterm role="option">
22056 <primary><option>delay_warning</option></primary>
22057 </indexterm>
22058 </para>
22059 <informaltable frame="all">
22060 <tgroup cols="4" colsep="0" rowsep="0">
22061 <colspec colwidth="8*" align="left"/>
22062 <colspec colwidth="6*" align="center"/>
22063 <colspec colwidth="6*" align="center"/>
22064 <colspec colwidth="6*" align="right"/>
22065 <tbody>
22066 <row>
22067 <entry><option>delay_warning</option></entry>
22068 <entry>Use: <emphasis>main</emphasis></entry>
22069 <entry>Type: <emphasis>time list</emphasis></entry>
22070 <entry>Default: <emphasis>24h</emphasis></entry>
22071 </row>
22072 </tbody>
22073 </tgroup>
22074 </informaltable>
22075 <para>
22076 <indexterm role="concept">
22077 <primary>warning of delay</primary>
22078 </indexterm>
22079 <indexterm role="concept">
22080 <primary>delay warning, specifying</primary>
22081 </indexterm>
22082 When a message is delayed, Exim sends a warning message to the sender at
22083 intervals specified by this option. The data is a colon-separated list of times
22084 after which to send warning messages. If the value of the option is an empty
22085 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
22086 message has been on the queue for longer than the last time, the last interval
22087 between the times is used to compute subsequent warning times. For example,
22088 with
22089 </para>
22090 <literallayout class="monospaced">
22091 delay_warning = 4h:8h:24h
22092 </literallayout>
22093 <para>
22094 the first message is sent after 4 hours, the second after 8 hours, and
22095 the third one after 24 hours. After that, messages are sent every 16 hours,
22096 because that is the interval between the last two times on the list. If you set
22097 just one time, it specifies the repeat interval. For example, with:
22098 </para>
22099 <literallayout class="monospaced">
22100 delay_warning = 6h
22101 </literallayout>
22102 <para>
22103 messages are repeated every six hours. To stop warnings after a given time, set
22104 a very large time at the end of the list. For example:
22105 </para>
22106 <literallayout class="monospaced">
22107 delay_warning = 2h:12h:99d
22108 </literallayout>
22109 <para>
22110 <indexterm role="option">
22111 <primary><option>delay_warning_condition</option></primary>
22112 </indexterm>
22113 </para>
22114 <informaltable frame="all">
22115 <tgroup cols="4" colsep="0" rowsep="0">
22116 <colspec colwidth="8*" align="left"/>
22117 <colspec colwidth="6*" align="center"/>
22118 <colspec colwidth="6*" align="center"/>
22119 <colspec colwidth="6*" align="right"/>
22120 <tbody>
22121 <row>
22122 <entry><option>delay_warning_condition</option></entry>
22123 <entry>Use: <emphasis>main</emphasis></entry>
22124 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22125 <entry>Default: <emphasis>see below</emphasis></entry>
22126 </row>
22127 </tbody>
22128 </tgroup>
22129 </informaltable>
22130 <para>
22131 <indexterm role="variable">
22132 <primary><varname>$domain</varname></primary>
22133 </indexterm>
22134 The string is expanded at the time a warning message might be sent. If all the
22135 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
22136 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
22137 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
22138 <quote>false</quote> (the comparison being done caselessly) then the warning message is
22139 not sent. The default is:
22140 </para>
22141 <literallayout class="monospaced">
22142 delay_warning_condition = ${if or {\
22143   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
22144   { match{$h_precedence:}{(?i)bulk|list|junk} }\
22145   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
22146   } {no}{yes}}
22147 </literallayout>
22148 <para>
22149 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
22150 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
22151 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
22152 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
22153 </para>
22154 <para>
22155 <indexterm role="option">
22156 <primary><option>deliver_drop_privilege</option></primary>
22157 </indexterm>
22158 </para>
22159 <informaltable frame="all">
22160 <tgroup cols="4" colsep="0" rowsep="0">
22161 <colspec colwidth="8*" align="left"/>
22162 <colspec colwidth="6*" align="center"/>
22163 <colspec colwidth="6*" align="center"/>
22164 <colspec colwidth="6*" align="right"/>
22165 <tbody>
22166 <row>
22167 <entry><option>deliver_drop_privilege</option></entry>
22168 <entry>Use: <emphasis>main</emphasis></entry>
22169 <entry>Type: <emphasis>boolean</emphasis></entry>
22170 <entry>Default: <emphasis>false</emphasis></entry>
22171 </row>
22172 </tbody>
22173 </tgroup>
22174 </informaltable>
22175 <para>
22176 <indexterm role="concept">
22177 <primary>unprivileged delivery</primary>
22178 </indexterm>
22179 <indexterm role="concept">
22180 <primary>delivery</primary>
22181 <secondary>unprivileged</secondary>
22182 </indexterm>
22183 If this option is set true, Exim drops its root privilege at the start of a
22184 delivery process, and runs as the Exim user throughout. This severely restricts
22185 the kinds of local delivery that are possible, but is viable in certain types
22186 of configuration. There is a discussion about the use of root privilege in
22187 chapter <xref linkend="CHAPsecurity"/>.
22188 </para>
22189 <para>
22190 <indexterm role="option">
22191 <primary><option>deliver_queue_load_max</option></primary>
22192 </indexterm>
22193 </para>
22194 <informaltable frame="all">
22195 <tgroup cols="4" colsep="0" rowsep="0">
22196 <colspec colwidth="8*" align="left"/>
22197 <colspec colwidth="6*" align="center"/>
22198 <colspec colwidth="6*" align="center"/>
22199 <colspec colwidth="6*" align="right"/>
22200 <tbody>
22201 <row>
22202 <entry><option>deliver_queue_load_max</option></entry>
22203 <entry>Use: <emphasis>main</emphasis></entry>
22204 <entry>Type: <emphasis>fixed-point</emphasis></entry>
22205 <entry>Default: <emphasis>unset</emphasis></entry>
22206 </row>
22207 </tbody>
22208 </tgroup>
22209 </informaltable>
22210 <para>
22211 <indexterm role="concept">
22212 <primary>load average</primary>
22213 </indexterm>
22214 <indexterm role="concept">
22215 <primary>queue runner</primary>
22216 <secondary>abandoning</secondary>
22217 </indexterm>
22218 When this option is set, a queue run is abandoned if the system load average
22219 becomes greater than the value of the option. The option has no effect on
22220 ancient operating systems on which Exim cannot determine the load average.
22221 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
22222 </para>
22223 <para>
22224 <indexterm role="option">
22225 <primary><option>delivery_date_remove</option></primary>
22226 </indexterm>
22227 </para>
22228 <informaltable frame="all">
22229 <tgroup cols="4" colsep="0" rowsep="0">
22230 <colspec colwidth="8*" align="left"/>
22231 <colspec colwidth="6*" align="center"/>
22232 <colspec colwidth="6*" align="center"/>
22233 <colspec colwidth="6*" align="right"/>
22234 <tbody>
22235 <row>
22236 <entry><option>delivery_date_remove</option></entry>
22237 <entry>Use: <emphasis>main</emphasis></entry>
22238 <entry>Type: <emphasis>boolean</emphasis></entry>
22239 <entry>Default: <emphasis>true</emphasis></entry>
22240 </row>
22241 </tbody>
22242 </tgroup>
22243 </informaltable>
22244 <para>
22245 <indexterm role="concept">
22246 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
22247 </indexterm>
22248 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
22249 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22250 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
22251 should not be present in incoming messages, and this option causes them to be
22252 removed at the time the message is received, to avoid any problems that might
22253 occur when a delivered message is subsequently sent on to some other recipient.
22254 </para>
22255 <para>
22256 <indexterm role="option">
22257 <primary><option>disable_fsync</option></primary>
22258 </indexterm>
22259 </para>
22260 <informaltable frame="all">
22261 <tgroup cols="4" colsep="0" rowsep="0">
22262 <colspec colwidth="8*" align="left"/>
22263 <colspec colwidth="6*" align="center"/>
22264 <colspec colwidth="6*" align="center"/>
22265 <colspec colwidth="6*" align="right"/>
22266 <tbody>
22267 <row>
22268 <entry><option>disable_fsync</option></entry>
22269 <entry>Use: <emphasis>main</emphasis></entry>
22270 <entry>Type: <emphasis>boolean</emphasis></entry>
22271 <entry>Default: <emphasis>false</emphasis></entry>
22272 </row>
22273 </tbody>
22274 </tgroup>
22275 </informaltable>
22276 <para>
22277 <indexterm role="concept">
22278 <primary><function>fsync()</function>, disabling</primary>
22279 </indexterm>
22280 This option is available only if Exim was built with the compile-time option
22281 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
22282 a runtime configuration generates an <quote>unknown option</quote> error. You should not
22283 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
22284 really, really, really understand what you are doing. <emphasis>No pre-compiled
22285 distributions of Exim should ever make this option available.</emphasis>
22286 </para>
22287 <para>
22288 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
22289 updated files&#x2019; data to be written to disc before continuing. Unexpected events
22290 such as crashes and power outages may cause data to be lost or scrambled.
22291 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
22292 </para>
22293 <para>
22294 <indexterm role="option">
22295 <primary><option>disable_ipv6</option></primary>
22296 </indexterm>
22297 </para>
22298 <informaltable frame="all">
22299 <tgroup cols="4" colsep="0" rowsep="0">
22300 <colspec colwidth="8*" align="left"/>
22301 <colspec colwidth="6*" align="center"/>
22302 <colspec colwidth="6*" align="center"/>
22303 <colspec colwidth="6*" align="right"/>
22304 <tbody>
22305 <row>
22306 <entry><option>disable_ipv6</option></entry>
22307 <entry>Use: <emphasis>main</emphasis></entry>
22308 <entry>Type: <emphasis>boolean</emphasis></entry>
22309 <entry>Default: <emphasis>false</emphasis></entry>
22310 </row>
22311 </tbody>
22312 </tgroup>
22313 </informaltable>
22314 <para>
22315 <indexterm role="concept">
22316 <primary>IPv6</primary>
22317 <secondary>disabling</secondary>
22318 </indexterm>
22319 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
22320 activities take place. AAAA records are never looked up, and any IPv6 addresses
22321 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
22322 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22323 to handle IPv6 literal addresses.
22324 </para>
22325 <para>
22326 <indexterm role="option">
22327 <primary><option>dns_again_means_nonexist</option></primary>
22328 </indexterm>
22329 </para>
22330 <informaltable frame="all">
22331 <tgroup cols="4" colsep="0" rowsep="0">
22332 <colspec colwidth="8*" align="left"/>
22333 <colspec colwidth="6*" align="center"/>
22334 <colspec colwidth="6*" align="center"/>
22335 <colspec colwidth="6*" align="right"/>
22336 <tbody>
22337 <row>
22338 <entry><option>dns_again_means_nonexist</option></entry>
22339 <entry>Use: <emphasis>main</emphasis></entry>
22340 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22341 <entry>Default: <emphasis>unset</emphasis></entry>
22342 </row>
22343 </tbody>
22344 </tgroup>
22345 </informaltable>
22346 <para>
22347 <indexterm role="concept">
22348 <primary>DNS</primary>
22349 <secondary><quote>try again</quote> response; overriding</secondary>
22350 </indexterm>
22351 DNS lookups give a <quote>try again</quote> response for the DNS errors
22352 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22353 keep trying to deliver a message, or to give repeated temporary errors to
22354 incoming mail. Sometimes the effect is caused by a badly set up name server and
22355 may persist for a long time. If a domain which exhibits this problem matches
22356 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22357 This option should be used with care. You can make it apply to reverse lookups
22358 by a setting such as this:
22359 </para>
22360 <literallayout class="monospaced">
22361 dns_again_means_nonexist = *.in-addr.arpa
22362 </literallayout>
22363 <para>
22364 This option applies to all DNS lookups that Exim does. It also applies when the
22365 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22366 since these are most likely to be caused by DNS lookup problems. The
22367 <command>dnslookup</command> router has some options of its own for controlling what happens
22368 when lookups for MX or SRV records give temporary errors. These more specific
22369 options are applied after this global option.
22370 </para>
22371 <para>
22372 <indexterm role="option">
22373 <primary><option>dns_check_names_pattern</option></primary>
22374 </indexterm>
22375 </para>
22376 <informaltable frame="all">
22377 <tgroup cols="4" colsep="0" rowsep="0">
22378 <colspec colwidth="8*" align="left"/>
22379 <colspec colwidth="6*" align="center"/>
22380 <colspec colwidth="6*" align="center"/>
22381 <colspec colwidth="6*" align="right"/>
22382 <tbody>
22383 <row>
22384 <entry><option>dns_check_names_pattern</option></entry>
22385 <entry>Use: <emphasis>main</emphasis></entry>
22386 <entry>Type: <emphasis>string</emphasis></entry>
22387 <entry>Default: <emphasis>see below</emphasis></entry>
22388 </row>
22389 </tbody>
22390 </tgroup>
22391 </informaltable>
22392 <para>
22393 <indexterm role="concept">
22394 <primary>DNS</primary>
22395 <secondary>pre-check of name syntax</secondary>
22396 </indexterm>
22397 When this option is set to a non-empty string, it causes Exim to check domain
22398 names for characters that are not allowed in host names before handing them to
22399 the DNS resolver, because some resolvers give temporary errors for names that
22400 contain unusual characters. If a domain name contains any unwanted characters,
22401 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22402 done by matching the domain name against a regular expression, which is the
22403 value of this option. The default pattern is
22404 </para>
22405 <literallayout class="monospaced">
22406 dns_check_names_pattern = \
22407   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
22408 </literallayout>
22409 <para>
22410 which permits only letters, digits, slashes, and hyphens in components, but
22411 they must start and end with a letter or digit. Slashes are not, in fact,
22412 permitted in host names, but they are found in certain NS records (which can be
22413 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22414 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22415 empty string.
22416 </para>
22417 <para>
22418 <indexterm role="option">
22419 <primary><option>dns_csa_search_limit</option></primary>
22420 </indexterm>
22421 </para>
22422 <informaltable frame="all">
22423 <tgroup cols="4" colsep="0" rowsep="0">
22424 <colspec colwidth="8*" align="left"/>
22425 <colspec colwidth="6*" align="center"/>
22426 <colspec colwidth="6*" align="center"/>
22427 <colspec colwidth="6*" align="right"/>
22428 <tbody>
22429 <row>
22430 <entry><option>dns_csa_search_limit</option></entry>
22431 <entry>Use: <emphasis>main</emphasis></entry>
22432 <entry>Type: <emphasis>integer</emphasis></entry>
22433 <entry>Default: <emphasis>5</emphasis></entry>
22434 </row>
22435 </tbody>
22436 </tgroup>
22437 </informaltable>
22438 <para>
22439 This option controls the depth of parental searching for CSA SRV records in the
22440 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
22441 </para>
22442 <para>
22443 <indexterm role="option">
22444 <primary><option>dns_csa_use_reverse</option></primary>
22445 </indexterm>
22446 </para>
22447 <informaltable frame="all">
22448 <tgroup cols="4" colsep="0" rowsep="0">
22449 <colspec colwidth="8*" align="left"/>
22450 <colspec colwidth="6*" align="center"/>
22451 <colspec colwidth="6*" align="center"/>
22452 <colspec colwidth="6*" align="right"/>
22453 <tbody>
22454 <row>
22455 <entry><option>dns_csa_use_reverse</option></entry>
22456 <entry>Use: <emphasis>main</emphasis></entry>
22457 <entry>Type: <emphasis>boolean</emphasis></entry>
22458 <entry>Default: <emphasis>true</emphasis></entry>
22459 </row>
22460 </tbody>
22461 </tgroup>
22462 </informaltable>
22463 <para>
22464 This option controls whether or not an IP address, given as a CSA domain, is
22465 reversed and looked up in the reverse DNS, as described in more detail in
22466 section <xref linkend="SECTverifyCSA"/>.
22467 </para>
22468 <para>
22469 <indexterm role="option">
22470 <primary><option>dns_ipv4_lookup</option></primary>
22471 </indexterm>
22472 </para>
22473 <informaltable frame="all">
22474 <tgroup cols="4" colsep="0" rowsep="0">
22475 <colspec colwidth="8*" align="left"/>
22476 <colspec colwidth="6*" align="center"/>
22477 <colspec colwidth="6*" align="center"/>
22478 <colspec colwidth="6*" align="right"/>
22479 <tbody>
22480 <row>
22481 <entry><option>dns_ipv4_lookup</option></entry>
22482 <entry>Use: <emphasis>main</emphasis></entry>
22483 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22484 <entry>Default: <emphasis>unset</emphasis></entry>
22485 </row>
22486 </tbody>
22487 </tgroup>
22488 </informaltable>
22489 <para>
22490 <indexterm role="concept">
22491 <primary>IPv6</primary>
22492 <secondary>DNS lookup for AAAA records</secondary>
22493 </indexterm>
22494 <indexterm role="concept">
22495 <primary>DNS</primary>
22496 <secondary>IPv6 lookup for AAAA records</secondary>
22497 </indexterm>
22498 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22499 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22500 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22501 domain matches this list.
22502 </para>
22503 <para>
22504 This is a fudge to help with name servers that give big delays or otherwise do
22505 not work for the AAAA record type. In due course, when the world&#x2019;s name
22506 servers have all been upgraded, there should be no need for this option.
22507 </para>
22508 <para>
22509 <indexterm role="option">
22510 <primary><option>dns_retrans</option></primary>
22511 </indexterm>
22512 </para>
22513 <informaltable frame="all">
22514 <tgroup cols="4" colsep="0" rowsep="0">
22515 <colspec colwidth="8*" align="left"/>
22516 <colspec colwidth="6*" align="center"/>
22517 <colspec colwidth="6*" align="center"/>
22518 <colspec colwidth="6*" align="right"/>
22519 <tbody>
22520 <row>
22521 <entry><option>dns_retrans</option></entry>
22522 <entry>Use: <emphasis>main</emphasis></entry>
22523 <entry>Type: <emphasis>time</emphasis></entry>
22524 <entry>Default: <emphasis>0s</emphasis></entry>
22525 </row>
22526 </tbody>
22527 </tgroup>
22528 </informaltable>
22529 <para>
22530 <indexterm role="concept">
22531 <primary>DNS</primary>
22532 <secondary>resolver options</secondary>
22533 </indexterm>
22534 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22535 retransmission and retry parameters for DNS lookups. Values of zero (the
22536 defaults) leave the system default settings unchanged. The first value is the
22537 time between retries, and the second is the number of retries. It isn&#x2019;t
22538 totally clear exactly how these settings affect the total time a DNS lookup may
22539 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22540 parameter values are available in the external resolver interface structure,
22541 but nowhere does it seem to describe how they are used or what you might want
22542 to set in them.
22543 </para>
22544 <para>
22545 <indexterm role="option">
22546 <primary><option>dns_retry</option></primary>
22547 </indexterm>
22548 </para>
22549 <informaltable frame="all">
22550 <tgroup cols="4" colsep="0" rowsep="0">
22551 <colspec colwidth="8*" align="left"/>
22552 <colspec colwidth="6*" align="center"/>
22553 <colspec colwidth="6*" align="center"/>
22554 <colspec colwidth="6*" align="right"/>
22555 <tbody>
22556 <row>
22557 <entry><option>dns_retry</option></entry>
22558 <entry>Use: <emphasis>main</emphasis></entry>
22559 <entry>Type: <emphasis>integer</emphasis></entry>
22560 <entry>Default: <emphasis>0</emphasis></entry>
22561 </row>
22562 </tbody>
22563 </tgroup>
22564 </informaltable>
22565 <para>
22566 See <option>dns_retrans</option> above.
22567 </para>
22568 <para revisionflag="changed">
22569 <indexterm role="option">
22570 <primary><option>dns_use_edns0</option></primary>
22571 </indexterm>
22572 </para>
22573 <informaltable frame="all" revisionflag="changed">
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>dns_use_edns0</option></entry>
22582 <entry>Use: <emphasis>main</emphasis></entry>
22583 <entry>Type: <emphasis>integer</emphasis></entry>
22584 <entry>Default: <emphasis>-1</emphasis></entry>
22585 </row>
22586 </tbody>
22587 </tgroup>
22588 </informaltable>
22589 <para revisionflag="changed">
22590 <indexterm role="concept">
22591 <primary>DNS</primary>
22592 <secondary>resolver options</secondary>
22593 </indexterm>
22594 <indexterm role="concept">
22595 <primary>DNS</primary>
22596 <secondary>EDNS0</secondary>
22597 </indexterm>
22598 If this option is set to a non-negative number then Exim will initialise the
22599 DNS resolver library to either use or not use EDNS0 extensions, overriding
22600 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
22601 on.
22602 </para>
22603 <para revisionflag="changed">
22604 If the resolver library does not support EDNS0 then this option has no effect.
22605 </para>
22606 <para>
22607 <indexterm role="option">
22608 <primary><option>drop_cr</option></primary>
22609 </indexterm>
22610 </para>
22611 <informaltable frame="all">
22612 <tgroup cols="4" colsep="0" rowsep="0">
22613 <colspec colwidth="8*" align="left"/>
22614 <colspec colwidth="6*" align="center"/>
22615 <colspec colwidth="6*" align="center"/>
22616 <colspec colwidth="6*" align="right"/>
22617 <tbody>
22618 <row>
22619 <entry><option>drop_cr</option></entry>
22620 <entry>Use: <emphasis>main</emphasis></entry>
22621 <entry>Type: <emphasis>boolean</emphasis></entry>
22622 <entry>Default: <emphasis>false</emphasis></entry>
22623 </row>
22624 </tbody>
22625 </tgroup>
22626 </informaltable>
22627 <para>
22628 This is an obsolete option that is now a no-op. It used to affect the way Exim
22629 handled CR and LF characters in incoming messages. What happens now is
22630 described in section <xref linkend="SECTlineendings"/>.
22631 </para>
22632 <para>
22633 <indexterm role="option">
22634 <primary><option>dsn_from</option></primary>
22635 </indexterm>
22636 </para>
22637 <informaltable frame="all">
22638 <tgroup cols="4" colsep="0" rowsep="0">
22639 <colspec colwidth="8*" align="left"/>
22640 <colspec colwidth="6*" align="center"/>
22641 <colspec colwidth="6*" align="center"/>
22642 <colspec colwidth="6*" align="right"/>
22643 <tbody>
22644 <row>
22645 <entry><option>dsn_from</option></entry>
22646 <entry>Use: <emphasis>main</emphasis></entry>
22647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22648 <entry>Default: <emphasis>see below</emphasis></entry>
22649 </row>
22650 </tbody>
22651 </tgroup>
22652 </informaltable>
22653 <para>
22654 <indexterm role="concept">
22655 <primary><emphasis>From:</emphasis> header line</primary>
22656 <secondary>in bounces</secondary>
22657 </indexterm>
22658 <indexterm role="concept">
22659 <primary>bounce messages</primary>
22660 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22661 </indexterm>
22662 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22663 bounces and other automatically generated messages (<quote>Delivery Status
22664 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22665 </para>
22666 <literallayout class="monospaced">
22667 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22668 </literallayout>
22669 <para>
22670 The value is expanded every time it is needed. If the expansion fails, a
22671 panic is logged, and the default value is used.
22672 </para>
22673 <para>
22674 <indexterm role="option">
22675 <primary><option>envelope_to_remove</option></primary>
22676 </indexterm>
22677 </para>
22678 <informaltable frame="all">
22679 <tgroup cols="4" colsep="0" rowsep="0">
22680 <colspec colwidth="8*" align="left"/>
22681 <colspec colwidth="6*" align="center"/>
22682 <colspec colwidth="6*" align="center"/>
22683 <colspec colwidth="6*" align="right"/>
22684 <tbody>
22685 <row>
22686 <entry><option>envelope_to_remove</option></entry>
22687 <entry>Use: <emphasis>main</emphasis></entry>
22688 <entry>Type: <emphasis>boolean</emphasis></entry>
22689 <entry>Default: <emphasis>true</emphasis></entry>
22690 </row>
22691 </tbody>
22692 </tgroup>
22693 </informaltable>
22694 <para>
22695 <indexterm role="concept">
22696 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22697 </indexterm>
22698 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22699 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22700 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22701 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22702 be present in incoming messages, and this option causes them to be removed at
22703 the time the message is received, to avoid any problems that might occur when a
22704 delivered message is subsequently sent on to some other recipient.
22705 </para>
22706 <para>
22707 <indexterm role="option">
22708 <primary><option>errors_copy</option></primary>
22709 </indexterm>
22710 </para>
22711 <informaltable frame="all">
22712 <tgroup cols="4" colsep="0" rowsep="0">
22713 <colspec colwidth="8*" align="left"/>
22714 <colspec colwidth="6*" align="center"/>
22715 <colspec colwidth="6*" align="center"/>
22716 <colspec colwidth="6*" align="right"/>
22717 <tbody>
22718 <row>
22719 <entry><option>errors_copy</option></entry>
22720 <entry>Use: <emphasis>main</emphasis></entry>
22721 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22722 <entry>Default: <emphasis>unset</emphasis></entry>
22723 </row>
22724 </tbody>
22725 </tgroup>
22726 </informaltable>
22727 <para>
22728 <indexterm role="concept">
22729 <primary>bounce message</primary>
22730 <secondary>copy to other address</secondary>
22731 </indexterm>
22732 <indexterm role="concept">
22733 <primary>copy of bounce message</primary>
22734 </indexterm>
22735 Setting this option causes Exim to send bcc copies of bounce messages that it
22736 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22737 coming from elsewhere. The value of the option is a colon-separated list of
22738 items. Each item consists of a pattern, terminated by white space, followed by
22739 a comma-separated list of email addresses. If a pattern contains spaces, it
22740 must be enclosed in double quotes.
22741 </para>
22742 <para>
22743 Each pattern is processed in the same way as a single item in an address list
22744 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22745 the bounce message, the message is copied to the addresses on the list. The
22746 items are scanned in order, and once a matching one is found, no further items
22747 are examined. For example:
22748 </para>
22749 <literallayout class="monospaced">
22750 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22751               rqps@mydomain   hostmaster@mydomain.example,\
22752                               postmaster@mydomain.example
22753 </literallayout>
22754 <para>
22755 <indexterm role="variable">
22756 <primary><varname>$domain</varname></primary>
22757 </indexterm>
22758 <indexterm role="variable">
22759 <primary><varname>$local_part</varname></primary>
22760 </indexterm>
22761 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22762 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22763 there was any wildcard matching in the pattern, the expansion
22764 <indexterm role="concept">
22765 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22766 <secondary>in <option>errors_copy</option></secondary>
22767 </indexterm>
22768 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22769 </para>
22770 <para>
22771 <indexterm role="option">
22772 <primary><option>errors_reply_to</option></primary>
22773 </indexterm>
22774 </para>
22775 <informaltable frame="all">
22776 <tgroup cols="4" colsep="0" rowsep="0">
22777 <colspec colwidth="8*" align="left"/>
22778 <colspec colwidth="6*" align="center"/>
22779 <colspec colwidth="6*" align="center"/>
22780 <colspec colwidth="6*" align="right"/>
22781 <tbody>
22782 <row>
22783 <entry><option>errors_reply_to</option></entry>
22784 <entry>Use: <emphasis>main</emphasis></entry>
22785 <entry>Type: <emphasis>string</emphasis></entry>
22786 <entry>Default: <emphasis>unset</emphasis></entry>
22787 </row>
22788 </tbody>
22789 </tgroup>
22790 </informaltable>
22791 <para>
22792 <indexterm role="concept">
22793 <primary>bounce message</primary>
22794 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22795 </indexterm>
22796 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22797 </para>
22798 <literallayout>
22799 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22800 </literallayout>
22801 <para>
22802 <indexterm role="option">
22803 <primary><option>quota_warn_message</option></primary>
22804 </indexterm>
22805 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22806 A warning message that is generated by the <option>quota_warn_message</option> option in an
22807 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22808 overrides the default.
22809 </para>
22810 <para>
22811 Experience shows that people reply to bounce messages. If the
22812 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22813 and warning messages. For example:
22814 </para>
22815 <literallayout class="monospaced">
22816 errors_reply_to = postmaster@my.domain.example
22817 </literallayout>
22818 <para>
22819 The value of the option is not expanded. It must specify a valid RFC 2822
22820 address. However, if a warning message that is generated by the
22821 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22822 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22823 not used.
22824 </para>
22825 <para>
22826 <indexterm role="option">
22827 <primary><option>exim_group</option></primary>
22828 </indexterm>
22829 </para>
22830 <informaltable frame="all">
22831 <tgroup cols="4" colsep="0" rowsep="0">
22832 <colspec colwidth="8*" align="left"/>
22833 <colspec colwidth="6*" align="center"/>
22834 <colspec colwidth="6*" align="center"/>
22835 <colspec colwidth="6*" align="right"/>
22836 <tbody>
22837 <row>
22838 <entry><option>exim_group</option></entry>
22839 <entry>Use: <emphasis>main</emphasis></entry>
22840 <entry>Type: <emphasis>string</emphasis></entry>
22841 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22842 </row>
22843 </tbody>
22844 </tgroup>
22845 </informaltable>
22846 <para>
22847 <indexterm role="concept">
22848 <primary>gid (group id)</primary>
22849 <secondary>Exim&#x2019;s own</secondary>
22850 </indexterm>
22851 <indexterm role="concept">
22852 <primary>Exim group</primary>
22853 </indexterm>
22854 This option changes the gid under which Exim runs when it gives up root
22855 privilege. The default value is compiled into the binary. The value of this
22856 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22857 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22858 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22859 security issues.
22860 </para>
22861 <para>
22862 <indexterm role="option">
22863 <primary><option>exim_path</option></primary>
22864 </indexterm>
22865 </para>
22866 <informaltable frame="all">
22867 <tgroup cols="4" colsep="0" rowsep="0">
22868 <colspec colwidth="8*" align="left"/>
22869 <colspec colwidth="6*" align="center"/>
22870 <colspec colwidth="6*" align="center"/>
22871 <colspec colwidth="6*" align="right"/>
22872 <tbody>
22873 <row>
22874 <entry><option>exim_path</option></entry>
22875 <entry>Use: <emphasis>main</emphasis></entry>
22876 <entry>Type: <emphasis>string</emphasis></entry>
22877 <entry>Default: <emphasis>see below</emphasis></entry>
22878 </row>
22879 </tbody>
22880 </tgroup>
22881 </informaltable>
22882 <para>
22883 <indexterm role="concept">
22884 <primary>Exim binary, path name</primary>
22885 </indexterm>
22886 This option specifies the path name of the Exim binary, which is used when Exim
22887 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22888 the directory configured at compile time by the BIN_DIRECTORY setting. It
22889 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22890 other place.
22891 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22892 you will break those Exim utilities that scan the configuration file to find
22893 where the binary is. (They then use the <option>-bP</option> option to extract option
22894 settings such as the value of <option>spool_directory</option>.)
22895 </para>
22896 <para>
22897 <indexterm role="option">
22898 <primary><option>exim_user</option></primary>
22899 </indexterm>
22900 </para>
22901 <informaltable frame="all">
22902 <tgroup cols="4" colsep="0" rowsep="0">
22903 <colspec colwidth="8*" align="left"/>
22904 <colspec colwidth="6*" align="center"/>
22905 <colspec colwidth="6*" align="center"/>
22906 <colspec colwidth="6*" align="right"/>
22907 <tbody>
22908 <row>
22909 <entry><option>exim_user</option></entry>
22910 <entry>Use: <emphasis>main</emphasis></entry>
22911 <entry>Type: <emphasis>string</emphasis></entry>
22912 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22913 </row>
22914 </tbody>
22915 </tgroup>
22916 </informaltable>
22917 <para>
22918 <indexterm role="concept">
22919 <primary>uid (user id)</primary>
22920 <secondary>Exim&#x2019;s own</secondary>
22921 </indexterm>
22922 <indexterm role="concept">
22923 <primary>Exim user</primary>
22924 </indexterm>
22925 This option changes the uid under which Exim runs when it gives up root
22926 privilege. The default value is compiled into the binary. Ownership of the run
22927 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22928 options is checked against the values in the binary, not what is set here.
22929 </para>
22930 <para>
22931 Unless it consists entirely of digits, the string is looked up using
22932 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22933 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22934 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22935 </para>
22936 <para>
22937 <indexterm role="option">
22938 <primary><option>extra_local_interfaces</option></primary>
22939 </indexterm>
22940 </para>
22941 <informaltable frame="all">
22942 <tgroup cols="4" colsep="0" rowsep="0">
22943 <colspec colwidth="8*" align="left"/>
22944 <colspec colwidth="6*" align="center"/>
22945 <colspec colwidth="6*" align="center"/>
22946 <colspec colwidth="6*" align="right"/>
22947 <tbody>
22948 <row>
22949 <entry><option>extra_local_interfaces</option></entry>
22950 <entry>Use: <emphasis>main</emphasis></entry>
22951 <entry>Type: <emphasis>string list</emphasis></entry>
22952 <entry>Default: <emphasis>unset</emphasis></entry>
22953 </row>
22954 </tbody>
22955 </tgroup>
22956 </informaltable>
22957 <para>
22958 This option defines network interfaces that are to be considered local when
22959 routing, but which are not used for listening by the daemon. See section
22960 <xref linkend="SECTreclocipadd"/> for details.
22961 </para>
22962 <para>
22963 <indexterm role="option">
22964 <primary><option>extract_addresses_remove_arguments</option></primary>
22965 </indexterm>
22966 </para>
22967 <informaltable frame="all">
22968 <tgroup cols="4" colsep="0" rowsep="0">
22969 <colspec colwidth="8*" align="left"/>
22970 <colspec colwidth="6*" align="center"/>
22971 <colspec colwidth="6*" align="center"/>
22972 <colspec colwidth="6*" align="right"/>
22973 <tbody>
22974 <row>
22975 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22976 <entry>Use: <emphasis>main</emphasis></entry>
22977 <entry>Type: <emphasis>boolean</emphasis></entry>
22978 <entry>Default: <emphasis>true</emphasis></entry>
22979 </row>
22980 </tbody>
22981 </tgroup>
22982 </informaltable>
22983 <para>
22984 <indexterm role="option">
22985 <primary><option>-t</option></primary>
22986 </indexterm>
22987 <indexterm role="concept">
22988 <primary>command line</primary>
22989 <secondary>addresses with <option>-t</option></secondary>
22990 </indexterm>
22991 <indexterm role="concept">
22992 <primary>Sendmail compatibility</primary>
22993 <secondary><option>-t</option> option</secondary>
22994 </indexterm>
22995 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22996 are present on the command line when the <option>-t</option> option is used to build an
22997 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22998 line addresses are removed from the recipients list. This is also how Smail
22999 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
23000 command line addresses are added to those obtained from the header lines. When
23001 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
23002 argument headers. If it is set false, Exim adds rather than removes argument
23003 addresses.
23004 </para>
23005 <para>
23006 <indexterm role="option">
23007 <primary><option>finduser_retries</option></primary>
23008 </indexterm>
23009 </para>
23010 <informaltable frame="all">
23011 <tgroup cols="4" colsep="0" rowsep="0">
23012 <colspec colwidth="8*" align="left"/>
23013 <colspec colwidth="6*" align="center"/>
23014 <colspec colwidth="6*" align="center"/>
23015 <colspec colwidth="6*" align="right"/>
23016 <tbody>
23017 <row>
23018 <entry><option>finduser_retries</option></entry>
23019 <entry>Use: <emphasis>main</emphasis></entry>
23020 <entry>Type: <emphasis>integer</emphasis></entry>
23021 <entry>Default: <emphasis>0</emphasis></entry>
23022 </row>
23023 </tbody>
23024 </tgroup>
23025 </informaltable>
23026 <para>
23027 <indexterm role="concept">
23028 <primary>NIS, retrying user lookups</primary>
23029 </indexterm>
23030 On systems running NIS or other schemes in which user and group information is
23031 distributed from a remote system, there can be times when <function>getpwnam()</function> and
23032 related functions fail, even when given valid data, because things time out.
23033 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
23034 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
23035 many extra times to find a user or a group, waiting for one second between
23036 retries.
23037 </para>
23038 <para>
23039 <indexterm role="concept">
23040 <primary><filename>/etc/passwd</filename></primary>
23041 <secondary>multiple reading of</secondary>
23042 </indexterm>
23043 You should not set this option greater than zero if your user information is in
23044 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
23045 search the file multiple times for non-existent users, and also cause delay.
23046 </para>
23047 <para>
23048 <indexterm role="option">
23049 <primary><option>freeze_tell</option></primary>
23050 </indexterm>
23051 </para>
23052 <informaltable frame="all">
23053 <tgroup cols="4" colsep="0" rowsep="0">
23054 <colspec colwidth="8*" align="left"/>
23055 <colspec colwidth="6*" align="center"/>
23056 <colspec colwidth="6*" align="center"/>
23057 <colspec colwidth="6*" align="right"/>
23058 <tbody>
23059 <row>
23060 <entry><option>freeze_tell</option></entry>
23061 <entry>Use: <emphasis>main</emphasis></entry>
23062 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
23063 <entry>Default: <emphasis>unset</emphasis></entry>
23064 </row>
23065 </tbody>
23066 </tgroup>
23067 </informaltable>
23068 <para>
23069 <indexterm role="concept">
23070 <primary>freezing messages</primary>
23071 <secondary>sending a message when freezing</secondary>
23072 </indexterm>
23073 On encountering certain errors, or when configured to do so in a system filter,
23074 ACL, or special router, Exim freezes a message. This means that no further
23075 delivery attempts take place until an administrator thaws the message, or the
23076 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
23077 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
23078 warning message whenever it freezes something, unless the message it is
23079 freezing is a locally-generated bounce message. (Without this exception there
23080 is the possibility of looping.) The warning message is sent to the addresses
23081 supplied as the comma-separated value of this option. If several of the
23082 message&#x2019;s addresses cause freezing, only a single message is sent. If the
23083 freezing was automatic, the reason(s) for freezing can be found in the message
23084 log. If you configure freezing in a filter or ACL, you must arrange for any
23085 logging that you require.
23086 </para>
23087 <para>
23088 <indexterm role="option">
23089 <primary><option>gecos_name</option></primary>
23090 </indexterm>
23091 </para>
23092 <informaltable frame="all">
23093 <tgroup cols="4" colsep="0" rowsep="0">
23094 <colspec colwidth="8*" align="left"/>
23095 <colspec colwidth="6*" align="center"/>
23096 <colspec colwidth="6*" align="center"/>
23097 <colspec colwidth="6*" align="right"/>
23098 <tbody>
23099 <row>
23100 <entry><option>gecos_name</option></entry>
23101 <entry>Use: <emphasis>main</emphasis></entry>
23102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23103 <entry>Default: <emphasis>unset</emphasis></entry>
23104 </row>
23105 </tbody>
23106 </tgroup>
23107 </informaltable>
23108 <para>
23109 <indexterm role="concept">
23110 <primary>HP-UX</primary>
23111 </indexterm>
23112 <indexterm role="concept">
23113 <primary><quote>gecos</quote> field, parsing</primary>
23114 </indexterm>
23115 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
23116 password file to hold other information in addition to users&#x2019; real names. Exim
23117 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
23118 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
23119 of the field are used unchanged, except that, if an ampersand is encountered,
23120 it is replaced by the user&#x2019;s login name with the first character forced to
23121 upper case, since this is a convention that is observed on many systems.
23122 </para>
23123 <para>
23124 When these options are set, <option>gecos_pattern</option> is treated as a regular
23125 expression that is to be applied to the field (again with &amp; replaced by the
23126 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
23127 user&#x2019;s name.
23128 </para>
23129 <para>
23130 <indexterm role="concept">
23131 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23132 <secondary>in <option>gecos_name</option></secondary>
23133 </indexterm>
23134 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
23135 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
23136 name terminates at the first comma, the following can be used:
23137 </para>
23138 <literallayout class="monospaced">
23139 gecos_pattern = ([^,]*)
23140 gecos_name = $1
23141 </literallayout>
23142 <para>
23143 <indexterm role="option">
23144 <primary><option>gecos_pattern</option></primary>
23145 </indexterm>
23146 </para>
23147 <informaltable frame="all">
23148 <tgroup cols="4" colsep="0" rowsep="0">
23149 <colspec colwidth="8*" align="left"/>
23150 <colspec colwidth="6*" align="center"/>
23151 <colspec colwidth="6*" align="center"/>
23152 <colspec colwidth="6*" align="right"/>
23153 <tbody>
23154 <row>
23155 <entry><option>gecos_pattern</option></entry>
23156 <entry>Use: <emphasis>main</emphasis></entry>
23157 <entry>Type: <emphasis>string</emphasis></entry>
23158 <entry>Default: <emphasis>unset</emphasis></entry>
23159 </row>
23160 </tbody>
23161 </tgroup>
23162 </informaltable>
23163 <para>
23164 See <option>gecos_name</option> above.
23165 </para>
23166 <para>
23167 <indexterm role="option">
23168 <primary><option>gnutls_compat_mode</option></primary>
23169 </indexterm>
23170 </para>
23171 <informaltable frame="all">
23172 <tgroup cols="4" colsep="0" rowsep="0">
23173 <colspec colwidth="8*" align="left"/>
23174 <colspec colwidth="6*" align="center"/>
23175 <colspec colwidth="6*" align="center"/>
23176 <colspec colwidth="6*" align="right"/>
23177 <tbody>
23178 <row>
23179 <entry><option>gnutls_compat_mode</option></entry>
23180 <entry>Use: <emphasis>main</emphasis></entry>
23181 <entry>Type: <emphasis>boolean</emphasis></entry>
23182 <entry>Default: <emphasis>unset</emphasis></entry>
23183 </row>
23184 </tbody>
23185 </tgroup>
23186 </informaltable>
23187 <para>
23188 This option controls whether GnuTLS is used in compatibility mode in an Exim
23189 server. This reduces security slightly, but improves interworking with older
23190 implementations of TLS.
23191 </para>
23192 <para>
23193 <indexterm role="option">
23194 <primary><option>headers_charset</option></primary>
23195 </indexterm>
23196 </para>
23197 <informaltable frame="all">
23198 <tgroup cols="4" colsep="0" rowsep="0">
23199 <colspec colwidth="8*" align="left"/>
23200 <colspec colwidth="6*" align="center"/>
23201 <colspec colwidth="6*" align="center"/>
23202 <colspec colwidth="6*" align="right"/>
23203 <tbody>
23204 <row>
23205 <entry><option>headers_charset</option></entry>
23206 <entry>Use: <emphasis>main</emphasis></entry>
23207 <entry>Type: <emphasis>string</emphasis></entry>
23208 <entry>Default: <emphasis>see below</emphasis></entry>
23209 </row>
23210 </tbody>
23211 </tgroup>
23212 </informaltable>
23213 <para>
23214 This option sets a default character set for translating from encoded MIME
23215 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
23216 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
23217 ultimate default is ISO-8859-1. For more details see the description of header
23218 insertions in section <xref linkend="SECTexpansionitems"/>.
23219 </para>
23220 <para>
23221 <indexterm role="option">
23222 <primary><option>header_maxsize</option></primary>
23223 </indexterm>
23224 </para>
23225 <informaltable frame="all">
23226 <tgroup cols="4" colsep="0" rowsep="0">
23227 <colspec colwidth="8*" align="left"/>
23228 <colspec colwidth="6*" align="center"/>
23229 <colspec colwidth="6*" align="center"/>
23230 <colspec colwidth="6*" align="right"/>
23231 <tbody>
23232 <row>
23233 <entry><option>header_maxsize</option></entry>
23234 <entry>Use: <emphasis>main</emphasis></entry>
23235 <entry>Type: <emphasis>integer</emphasis></entry>
23236 <entry>Default: <emphasis>see below</emphasis></entry>
23237 </row>
23238 </tbody>
23239 </tgroup>
23240 </informaltable>
23241 <para>
23242 <indexterm role="concept">
23243 <primary>header section</primary>
23244 <secondary>maximum size of</secondary>
23245 </indexterm>
23246 <indexterm role="concept">
23247 <primary>limit</primary>
23248 <secondary>size of message header section</secondary>
23249 </indexterm>
23250 This option controls the overall maximum size of a message&#x2019;s header
23251 section. The default is the value of HEADER_MAXSIZE in
23252 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
23253 sections are rejected.
23254 </para>
23255 <para>
23256 <indexterm role="option">
23257 <primary><option>header_line_maxsize</option></primary>
23258 </indexterm>
23259 </para>
23260 <informaltable frame="all">
23261 <tgroup cols="4" colsep="0" rowsep="0">
23262 <colspec colwidth="8*" align="left"/>
23263 <colspec colwidth="6*" align="center"/>
23264 <colspec colwidth="6*" align="center"/>
23265 <colspec colwidth="6*" align="right"/>
23266 <tbody>
23267 <row>
23268 <entry><option>header_line_maxsize</option></entry>
23269 <entry>Use: <emphasis>main</emphasis></entry>
23270 <entry>Type: <emphasis>integer</emphasis></entry>
23271 <entry>Default: <emphasis>0</emphasis></entry>
23272 </row>
23273 </tbody>
23274 </tgroup>
23275 </informaltable>
23276 <para>
23277 <indexterm role="concept">
23278 <primary>header lines</primary>
23279 <secondary>maximum size of</secondary>
23280 </indexterm>
23281 <indexterm role="concept">
23282 <primary>limit</primary>
23283 <secondary>size of one header line</secondary>
23284 </indexterm>
23285 This option limits the length of any individual header line in a message, after
23286 all the continuations have been joined together. Messages with individual
23287 header lines that are longer than the limit are rejected. The default value of
23288 zero means <quote>no limit</quote>.
23289 </para>
23290 <para>
23291 <indexterm role="option">
23292 <primary><option>helo_accept_junk_hosts</option></primary>
23293 </indexterm>
23294 </para>
23295 <informaltable frame="all">
23296 <tgroup cols="4" colsep="0" rowsep="0">
23297 <colspec colwidth="8*" align="left"/>
23298 <colspec colwidth="6*" align="center"/>
23299 <colspec colwidth="6*" align="center"/>
23300 <colspec colwidth="6*" align="right"/>
23301 <tbody>
23302 <row>
23303 <entry><option>helo_accept_junk_hosts</option></entry>
23304 <entry>Use: <emphasis>main</emphasis></entry>
23305 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23306 <entry>Default: <emphasis>unset</emphasis></entry>
23307 </row>
23308 </tbody>
23309 </tgroup>
23310 </informaltable>
23311 <para>
23312 <indexterm role="concept">
23313 <primary>HELO</primary>
23314 <secondary>accepting junk data</secondary>
23315 </indexterm>
23316 <indexterm role="concept">
23317 <primary>EHLO</primary>
23318 <secondary>accepting junk data</secondary>
23319 </indexterm>
23320 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23321 mail, and gives an error response for invalid data. Unfortunately, there are
23322 some SMTP clients that send syntactic junk. They can be accommodated by setting
23323 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23324 if you want to do semantic checking.
23325 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23326 set.
23327 </para>
23328 <para>
23329 <indexterm role="option">
23330 <primary><option>helo_allow_chars</option></primary>
23331 </indexterm>
23332 </para>
23333 <informaltable frame="all">
23334 <tgroup cols="4" colsep="0" rowsep="0">
23335 <colspec colwidth="8*" align="left"/>
23336 <colspec colwidth="6*" align="center"/>
23337 <colspec colwidth="6*" align="center"/>
23338 <colspec colwidth="6*" align="right"/>
23339 <tbody>
23340 <row>
23341 <entry><option>helo_allow_chars</option></entry>
23342 <entry>Use: <emphasis>main</emphasis></entry>
23343 <entry>Type: <emphasis>string</emphasis></entry>
23344 <entry>Default: <emphasis>unset</emphasis></entry>
23345 </row>
23346 </tbody>
23347 </tgroup>
23348 </informaltable>
23349 <para>
23350 <indexterm role="concept">
23351 <primary>HELO</primary>
23352 <secondary>underscores in</secondary>
23353 </indexterm>
23354 <indexterm role="concept">
23355 <primary>EHLO</primary>
23356 <secondary>underscores in</secondary>
23357 </indexterm>
23358 <indexterm role="concept">
23359 <primary>underscore in EHLO/HELO</primary>
23360 </indexterm>
23361 This option can be set to a string of rogue characters that are permitted in
23362 all EHLO and HELO names in addition to the standard letters, digits,
23363 hyphens, and dots. If you really must allow underscores, you can set
23364 </para>
23365 <literallayout class="monospaced">
23366 helo_allow_chars = _
23367 </literallayout>
23368 <para>
23369 Note that the value is one string, not a list.
23370 </para>
23371 <para>
23372 <indexterm role="option">
23373 <primary><option>helo_lookup_domains</option></primary>
23374 </indexterm>
23375 </para>
23376 <informaltable frame="all">
23377 <tgroup cols="4" colsep="0" rowsep="0">
23378 <colspec colwidth="8*" align="left"/>
23379 <colspec colwidth="6*" align="center"/>
23380 <colspec colwidth="6*" align="center"/>
23381 <colspec colwidth="6*" align="right"/>
23382 <tbody>
23383 <row>
23384 <entry><option>helo_lookup_domains</option></entry>
23385 <entry>Use: <emphasis>main</emphasis></entry>
23386 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23387 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
23388 </row>
23389 </tbody>
23390 </tgroup>
23391 </informaltable>
23392 <para>
23393 <indexterm role="concept">
23394 <primary>HELO</primary>
23395 <secondary>forcing reverse lookup</secondary>
23396 </indexterm>
23397 <indexterm role="concept">
23398 <primary>EHLO</primary>
23399 <secondary>forcing reverse lookup</secondary>
23400 </indexterm>
23401 If the domain given by a client in a HELO or EHLO command matches this
23402 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
23403 default forces a lookup if the client host gives the server&#x2019;s name or any of
23404 its IP addresses (in brackets), something that broken clients have been seen to
23405 do.
23406 </para>
23407 <para>
23408 <indexterm role="option">
23409 <primary><option>helo_try_verify_hosts</option></primary>
23410 </indexterm>
23411 </para>
23412 <informaltable frame="all">
23413 <tgroup cols="4" colsep="0" rowsep="0">
23414 <colspec colwidth="8*" align="left"/>
23415 <colspec colwidth="6*" align="center"/>
23416 <colspec colwidth="6*" align="center"/>
23417 <colspec colwidth="6*" align="right"/>
23418 <tbody>
23419 <row>
23420 <entry><option>helo_try_verify_hosts</option></entry>
23421 <entry>Use: <emphasis>main</emphasis></entry>
23422 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23423 <entry>Default: <emphasis>unset</emphasis></entry>
23424 </row>
23425 </tbody>
23426 </tgroup>
23427 </informaltable>
23428 <para>
23429 <indexterm role="concept">
23430 <primary>HELO verifying</primary>
23431 <secondary>optional</secondary>
23432 </indexterm>
23433 <indexterm role="concept">
23434 <primary>EHLO</primary>
23435 <secondary>verifying, optional</secondary>
23436 </indexterm>
23437 By default, Exim just checks the syntax of HELO and EHLO commands (see
23438 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23439 to do more extensive checking of the data supplied by these commands. The ACL
23440 condition <literal>verify = helo</literal> is provided to make this possible.
23441 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23442 to force the check to occur. From release 4.53 onwards, this is no longer
23443 necessary. If the check has not been done before <literal>verify = helo</literal> is
23444 encountered, it is done at that time. Consequently, this option is obsolete.
23445 Its specification is retained here for backwards compatibility.
23446 </para>
23447 <para>
23448 When an EHLO or HELO command is received, if the calling host matches
23449 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23450 EHLO command either:
23451 </para>
23452 <itemizedlist>
23453 <listitem>
23454 <para>
23455 is an IP literal matching the calling address of the host, or
23456 </para>
23457 </listitem>
23458 <listitem>
23459 <para>
23460 <indexterm role="concept">
23461 <primary>DNS</primary>
23462 <secondary>reverse lookup</secondary>
23463 </indexterm>
23464 <indexterm role="concept">
23465 <primary>reverse DNS lookup</primary>
23466 </indexterm>
23467 matches the host name that Exim obtains by doing a reverse lookup of the
23468 calling host address, or
23469 </para>
23470 </listitem>
23471 <listitem>
23472 <para>
23473 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23474 available) yields the calling host address.
23475 </para>
23476 </listitem>
23477 </itemizedlist>
23478 <para>
23479 However, the EHLO or HELO command is not rejected if any of the checks
23480 fail. Processing continues, but the result of the check is remembered, and can
23481 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23482 </para>
23483 <para>
23484 <indexterm role="option">
23485 <primary><option>helo_verify_hosts</option></primary>
23486 </indexterm>
23487 </para>
23488 <informaltable frame="all">
23489 <tgroup cols="4" colsep="0" rowsep="0">
23490 <colspec colwidth="8*" align="left"/>
23491 <colspec colwidth="6*" align="center"/>
23492 <colspec colwidth="6*" align="center"/>
23493 <colspec colwidth="6*" align="right"/>
23494 <tbody>
23495 <row>
23496 <entry><option>helo_verify_hosts</option></entry>
23497 <entry>Use: <emphasis>main</emphasis></entry>
23498 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23499 <entry>Default: <emphasis>unset</emphasis></entry>
23500 </row>
23501 </tbody>
23502 </tgroup>
23503 </informaltable>
23504 <para>
23505 <indexterm role="concept">
23506 <primary>HELO verifying</primary>
23507 <secondary>mandatory</secondary>
23508 </indexterm>
23509 <indexterm role="concept">
23510 <primary>EHLO</primary>
23511 <secondary>verifying, mandatory</secondary>
23512 </indexterm>
23513 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23514 backwards compatibility. For hosts that match this option, Exim checks the host
23515 name given in the HELO or EHLO in the same way as for
23516 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23517 rejected with a 550 error, and entries are written to the main and reject logs.
23518 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23519 error.
23520 </para>
23521 <para>
23522 <indexterm role="option">
23523 <primary><option>hold_domains</option></primary>
23524 </indexterm>
23525 </para>
23526 <informaltable frame="all">
23527 <tgroup cols="4" colsep="0" rowsep="0">
23528 <colspec colwidth="8*" align="left"/>
23529 <colspec colwidth="6*" align="center"/>
23530 <colspec colwidth="6*" align="center"/>
23531 <colspec colwidth="6*" align="right"/>
23532 <tbody>
23533 <row>
23534 <entry><option>hold_domains</option></entry>
23535 <entry>Use: <emphasis>main</emphasis></entry>
23536 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23537 <entry>Default: <emphasis>unset</emphasis></entry>
23538 </row>
23539 </tbody>
23540 </tgroup>
23541 </informaltable>
23542 <para>
23543 <indexterm role="concept">
23544 <primary>domain</primary>
23545 <secondary>delaying delivery</secondary>
23546 </indexterm>
23547 <indexterm role="concept">
23548 <primary>delivery</primary>
23549 <secondary>delaying certain domains</secondary>
23550 </indexterm>
23551 This option allows mail for particular domains to be held on the queue
23552 manually. The option is overridden if a message delivery is forced with the
23553 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23554 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23555 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23556 it is deferred every time the message is looked at.
23557 </para>
23558 <para>
23559 This option is intended as a temporary operational measure for delaying the
23560 delivery of mail while some problem is being sorted out, or some new
23561 configuration tested. If you just want to delay the processing of some
23562 domains until a queue run occurs, you should use <option>queue_domains</option> or
23563 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23564 </para>
23565 <para>
23566 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23567 messages from the queue if they have been there longer than the longest retry
23568 time in any retry rule. If you want to hold messages for longer than the normal
23569 retry times, insert a dummy retry rule with a long retry time.
23570 </para>
23571 <para>
23572 <indexterm role="option">
23573 <primary><option>host_lookup</option></primary>
23574 </indexterm>
23575 </para>
23576 <informaltable frame="all">
23577 <tgroup cols="4" colsep="0" rowsep="0">
23578 <colspec colwidth="8*" align="left"/>
23579 <colspec colwidth="6*" align="center"/>
23580 <colspec colwidth="6*" align="center"/>
23581 <colspec colwidth="6*" align="right"/>
23582 <tbody>
23583 <row>
23584 <entry><option>host_lookup</option></entry>
23585 <entry>Use: <emphasis>main</emphasis></entry>
23586 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23587 <entry>Default: <emphasis>unset</emphasis></entry>
23588 </row>
23589 </tbody>
23590 </tgroup>
23591 </informaltable>
23592 <para>
23593 <indexterm role="concept">
23594 <primary>host name</primary>
23595 <secondary>lookup, forcing</secondary>
23596 </indexterm>
23597 Exim does not look up the name of a calling host from its IP address unless it
23598 is required to compare against some host list, or the host matches
23599 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23600 option (which normally contains IP addresses rather than host names). The
23601 default configuration file contains
23602 </para>
23603 <literallayout class="monospaced">
23604 host_lookup = *
23605 </literallayout>
23606 <para>
23607 which causes a lookup to happen for all hosts. If the expense of these lookups
23608 is felt to be too great, the setting can be changed or removed.
23609 </para>
23610 <para>
23611 After a successful reverse lookup, Exim does a forward lookup on the name it
23612 has obtained, to verify that it yields the IP address that it started with. If
23613 this check fails, Exim behaves as if the name lookup failed.
23614 </para>
23615 <para>
23616 <indexterm role="variable">
23617 <primary><varname>$host_lookup_failed</varname></primary>
23618 </indexterm>
23619 <indexterm role="variable">
23620 <primary><varname>$sender_host_name</varname></primary>
23621 </indexterm>
23622 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23623 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23624 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23625 <literal>verify = reverse_host_lookup</literal> in ACLs.
23626 </para>
23627 <para>
23628 <indexterm role="option">
23629 <primary><option>host_lookup_order</option></primary>
23630 </indexterm>
23631 </para>
23632 <informaltable frame="all">
23633 <tgroup cols="4" colsep="0" rowsep="0">
23634 <colspec colwidth="8*" align="left"/>
23635 <colspec colwidth="6*" align="center"/>
23636 <colspec colwidth="6*" align="center"/>
23637 <colspec colwidth="6*" align="right"/>
23638 <tbody>
23639 <row>
23640 <entry><option>host_lookup_order</option></entry>
23641 <entry>Use: <emphasis>main</emphasis></entry>
23642 <entry>Type: <emphasis>string list</emphasis></entry>
23643 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23644 </row>
23645 </tbody>
23646 </tgroup>
23647 </informaltable>
23648 <para>
23649 This option specifies the order of different lookup methods when Exim is trying
23650 to find a host name from an IP address. The default is to do a DNS lookup
23651 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23652 if that fails. You can change the order of these lookups, or omit one entirely,
23653 if you want.
23654 </para>
23655 <para>
23656 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23657 multiple PTR records in the DNS and the IP address is not listed in
23658 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23659 case. That is why the default tries a DNS lookup first.
23660 </para>
23661 <para>
23662 <indexterm role="option">
23663 <primary><option>host_reject_connection</option></primary>
23664 </indexterm>
23665 </para>
23666 <informaltable frame="all">
23667 <tgroup cols="4" colsep="0" rowsep="0">
23668 <colspec colwidth="8*" align="left"/>
23669 <colspec colwidth="6*" align="center"/>
23670 <colspec colwidth="6*" align="center"/>
23671 <colspec colwidth="6*" align="right"/>
23672 <tbody>
23673 <row>
23674 <entry><option>host_reject_connection</option></entry>
23675 <entry>Use: <emphasis>main</emphasis></entry>
23676 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23677 <entry>Default: <emphasis>unset</emphasis></entry>
23678 </row>
23679 </tbody>
23680 </tgroup>
23681 </informaltable>
23682 <para>
23683 <indexterm role="concept">
23684 <primary>host</primary>
23685 <secondary>rejecting connections from</secondary>
23686 </indexterm>
23687 If this option is set, incoming SMTP calls from the hosts listed are rejected
23688 as soon as the connection is made.
23689 This option is obsolete, and retained only for backward compatibility, because
23690 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23691 connections immediately.
23692 </para>
23693 <para>
23694 The ability to give an immediate rejection (either by this option or using an
23695 ACL) is provided for use in unusual cases. Many hosts will just try again,
23696 sometimes without much delay. Normally, it is better to use an ACL to reject
23697 incoming messages at a later stage, such as after RCPT commands. See
23698 chapter <xref linkend="CHAPACL"/>.
23699 </para>
23700 <para>
23701 <indexterm role="option">
23702 <primary><option>hosts_connection_nolog</option></primary>
23703 </indexterm>
23704 </para>
23705 <informaltable frame="all">
23706 <tgroup cols="4" colsep="0" rowsep="0">
23707 <colspec colwidth="8*" align="left"/>
23708 <colspec colwidth="6*" align="center"/>
23709 <colspec colwidth="6*" align="center"/>
23710 <colspec colwidth="6*" align="right"/>
23711 <tbody>
23712 <row>
23713 <entry><option>hosts_connection_nolog</option></entry>
23714 <entry>Use: <emphasis>main</emphasis></entry>
23715 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23716 <entry>Default: <emphasis>unset</emphasis></entry>
23717 </row>
23718 </tbody>
23719 </tgroup>
23720 </informaltable>
23721 <para>
23722 <indexterm role="concept">
23723 <primary>host</primary>
23724 <secondary>not logging connections from</secondary>
23725 </indexterm>
23726 This option defines a list of hosts for which connection logging does not
23727 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23728 you might want not to log SMTP connections from local processes, or from
23729 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23730 the daemon; you should therefore strive to restrict its value to a short inline
23731 list of IP addresses and networks. To disable logging SMTP connections from
23732 local processes, you must create a host list with an empty item. For example:
23733 </para>
23734 <literallayout class="monospaced">
23735 hosts_connection_nolog = :
23736 </literallayout>
23737 <para>
23738 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23739 </para>
23740 <para>
23741 <indexterm role="option">
23742 <primary><option>hosts_treat_as_local</option></primary>
23743 </indexterm>
23744 </para>
23745 <informaltable frame="all">
23746 <tgroup cols="4" colsep="0" rowsep="0">
23747 <colspec colwidth="8*" align="left"/>
23748 <colspec colwidth="6*" align="center"/>
23749 <colspec colwidth="6*" align="center"/>
23750 <colspec colwidth="6*" align="right"/>
23751 <tbody>
23752 <row>
23753 <entry><option>hosts_treat_as_local</option></entry>
23754 <entry>Use: <emphasis>main</emphasis></entry>
23755 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23756 <entry>Default: <emphasis>unset</emphasis></entry>
23757 </row>
23758 </tbody>
23759 </tgroup>
23760 </informaltable>
23761 <para>
23762 <indexterm role="concept">
23763 <primary>local host</primary>
23764 <secondary>domains treated as</secondary>
23765 </indexterm>
23766 <indexterm role="concept">
23767 <primary>host</primary>
23768 <secondary>treated as local</secondary>
23769 </indexterm>
23770 If this option is set, any host names that match the domain list are treated as
23771 if they were the local host when Exim is scanning host lists obtained from MX
23772 records
23773 or other sources. Note that the value of this option is a domain list, not a
23774 host list, because it is always used to check host names, not IP addresses.
23775 </para>
23776 <para>
23777 This option also applies when Exim is matching the special items
23778 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23779 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23780 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23781 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23782 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23783 interfaces and recognizing the local host.
23784 </para>
23785 <para>
23786 <indexterm role="option">
23787 <primary><option>ibase_servers</option></primary>
23788 </indexterm>
23789 </para>
23790 <informaltable frame="all">
23791 <tgroup cols="4" colsep="0" rowsep="0">
23792 <colspec colwidth="8*" align="left"/>
23793 <colspec colwidth="6*" align="center"/>
23794 <colspec colwidth="6*" align="center"/>
23795 <colspec colwidth="6*" align="right"/>
23796 <tbody>
23797 <row>
23798 <entry><option>ibase_servers</option></entry>
23799 <entry>Use: <emphasis>main</emphasis></entry>
23800 <entry>Type: <emphasis>string list</emphasis></entry>
23801 <entry>Default: <emphasis>unset</emphasis></entry>
23802 </row>
23803 </tbody>
23804 </tgroup>
23805 </informaltable>
23806 <para>
23807 <indexterm role="concept">
23808 <primary>InterBase</primary>
23809 <secondary>server list</secondary>
23810 </indexterm>
23811 This option provides a list of InterBase servers and associated connection data,
23812 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23813 The option is available only if Exim has been built with InterBase support.
23814 </para>
23815 <para>
23816 <indexterm role="option">
23817 <primary><option>ignore_bounce_errors_after</option></primary>
23818 </indexterm>
23819 </para>
23820 <informaltable frame="all">
23821 <tgroup cols="4" colsep="0" rowsep="0">
23822 <colspec colwidth="8*" align="left"/>
23823 <colspec colwidth="6*" align="center"/>
23824 <colspec colwidth="6*" align="center"/>
23825 <colspec colwidth="6*" align="right"/>
23826 <tbody>
23827 <row>
23828 <entry><option>ignore_bounce_errors_after</option></entry>
23829 <entry>Use: <emphasis>main</emphasis></entry>
23830 <entry>Type: <emphasis>time</emphasis></entry>
23831 <entry>Default: <emphasis>10w</emphasis></entry>
23832 </row>
23833 </tbody>
23834 </tgroup>
23835 </informaltable>
23836 <para>
23837 <indexterm role="concept">
23838 <primary>bounce message</primary>
23839 <secondary>discarding</secondary>
23840 </indexterm>
23841 <indexterm role="concept">
23842 <primary>discarding bounce message</primary>
23843 </indexterm>
23844 This option affects the processing of bounce messages that cannot be delivered,
23845 that is, those that suffer a permanent delivery failure. (Bounce messages that
23846 suffer temporary delivery failures are of course retried in the usual way.)
23847 </para>
23848 <para>
23849 After a permanent delivery failure, bounce messages are frozen,
23850 because there is no sender to whom they can be returned. When a frozen bounce
23851 message has been on the queue for more than the given time, it is unfrozen at
23852 the next queue run, and a further delivery is attempted. If delivery fails
23853 again, the bounce message is discarded. This makes it possible to keep failed
23854 bounce messages around for a shorter time than the normal maximum retry time
23855 for frozen messages. For example,
23856 </para>
23857 <literallayout class="monospaced">
23858 ignore_bounce_errors_after = 12h
23859 </literallayout>
23860 <para>
23861 retries failed bounce message deliveries after 12 hours, discarding any further
23862 failures. If the value of this option is set to a zero time period, bounce
23863 failures are discarded immediately. Setting a very long time (as in the default
23864 value) has the effect of disabling this option. For ways of automatically
23865 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23866 <option>timeout_frozen_after</option>.
23867 </para>
23868 <para>
23869 <indexterm role="option">
23870 <primary><option>ignore_fromline_hosts</option></primary>
23871 </indexterm>
23872 </para>
23873 <informaltable frame="all">
23874 <tgroup cols="4" colsep="0" rowsep="0">
23875 <colspec colwidth="8*" align="left"/>
23876 <colspec colwidth="6*" align="center"/>
23877 <colspec colwidth="6*" align="center"/>
23878 <colspec colwidth="6*" align="right"/>
23879 <tbody>
23880 <row>
23881 <entry><option>ignore_fromline_hosts</option></entry>
23882 <entry>Use: <emphasis>main</emphasis></entry>
23883 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23884 <entry>Default: <emphasis>unset</emphasis></entry>
23885 </row>
23886 </tbody>
23887 </tgroup>
23888 </informaltable>
23889 <para>
23890 <indexterm role="concept">
23891 <primary><quote>From</quote> line</primary>
23892 </indexterm>
23893 <indexterm role="concept">
23894 <primary>UUCP</primary>
23895 <secondary><quote>From</quote> line</secondary>
23896 </indexterm>
23897 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23898 the headers of a message. By default this is treated as the start of the
23899 message&#x2019;s body, which means that any following headers are not recognized as
23900 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23901 match those hosts that insist on sending it. If the sender is actually a local
23902 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23903 <option>ignore_fromline_local</option> must be set to achieve this effect.
23904 </para>
23905 <para>
23906 <indexterm role="option">
23907 <primary><option>ignore_fromline_local</option></primary>
23908 </indexterm>
23909 </para>
23910 <informaltable frame="all">
23911 <tgroup cols="4" colsep="0" rowsep="0">
23912 <colspec colwidth="8*" align="left"/>
23913 <colspec colwidth="6*" align="center"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="right"/>
23916 <tbody>
23917 <row>
23918 <entry><option>ignore_fromline_local</option></entry>
23919 <entry>Use: <emphasis>main</emphasis></entry>
23920 <entry>Type: <emphasis>boolean</emphasis></entry>
23921 <entry>Default: <emphasis>false</emphasis></entry>
23922 </row>
23923 </tbody>
23924 </tgroup>
23925 </informaltable>
23926 <para>
23927 See <option>ignore_fromline_hosts</option> above.
23928 </para>
23929 <para>
23930 <indexterm role="option">
23931 <primary><option>keep_malformed</option></primary>
23932 </indexterm>
23933 </para>
23934 <informaltable frame="all">
23935 <tgroup cols="4" colsep="0" rowsep="0">
23936 <colspec colwidth="8*" align="left"/>
23937 <colspec colwidth="6*" align="center"/>
23938 <colspec colwidth="6*" align="center"/>
23939 <colspec colwidth="6*" align="right"/>
23940 <tbody>
23941 <row>
23942 <entry><option>keep_malformed</option></entry>
23943 <entry>Use: <emphasis>main</emphasis></entry>
23944 <entry>Type: <emphasis>time</emphasis></entry>
23945 <entry>Default: <emphasis>4d</emphasis></entry>
23946 </row>
23947 </tbody>
23948 </tgroup>
23949 </informaltable>
23950 <para>
23951 This option specifies the length of time to keep messages whose spool files
23952 have been corrupted in some way. This should, of course, never happen. At the
23953 next attempt to deliver such a message, it gets removed. The incident is
23954 logged.
23955 </para>
23956 <para>
23957 <indexterm role="option">
23958 <primary><option>ldap_ca_cert_dir</option></primary>
23959 </indexterm>
23960 </para>
23961 <informaltable frame="all">
23962 <tgroup cols="4" colsep="0" rowsep="0">
23963 <colspec colwidth="8*" align="left"/>
23964 <colspec colwidth="6*" align="center"/>
23965 <colspec colwidth="6*" align="center"/>
23966 <colspec colwidth="6*" align="right"/>
23967 <tbody>
23968 <row>
23969 <entry><option>ldap_ca_cert_dir</option></entry>
23970 <entry>Use: <emphasis>main</emphasis></entry>
23971 <entry>Type: <emphasis>string</emphasis></entry>
23972 <entry>Default: <emphasis>unset</emphasis></entry>
23973 </row>
23974 </tbody>
23975 </tgroup>
23976 </informaltable>
23977 <para>
23978 <indexterm role="concept">
23979 <primary>LDAP</primary>
23980 <secondary>,</secondary>
23981 </indexterm>
23982 This option indicates which directory contains CA certificates for verifying
23983 a TLS certificate presented by an LDAP server.
23984 While Exim does not provide a default value, your SSL library may.
23985 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
23986 and constrained to be a directory.
23987 </para>
23988 <para>
23989 <indexterm role="option">
23990 <primary><option>ldap_ca_cert_file</option></primary>
23991 </indexterm>
23992 </para>
23993 <informaltable frame="all">
23994 <tgroup cols="4" colsep="0" rowsep="0">
23995 <colspec colwidth="8*" align="left"/>
23996 <colspec colwidth="6*" align="center"/>
23997 <colspec colwidth="6*" align="center"/>
23998 <colspec colwidth="6*" align="right"/>
23999 <tbody>
24000 <row>
24001 <entry><option>ldap_ca_cert_file</option></entry>
24002 <entry>Use: <emphasis>main</emphasis></entry>
24003 <entry>Type: <emphasis>string</emphasis></entry>
24004 <entry>Default: <emphasis>unset</emphasis></entry>
24005 </row>
24006 </tbody>
24007 </tgroup>
24008 </informaltable>
24009 <para>
24010 <indexterm role="concept">
24011 <primary>LDAP</primary>
24012 <secondary>,</secondary>
24013 </indexterm>
24014 This option indicates which file contains CA certificates for verifying
24015 a TLS certificate presented by an LDAP server.
24016 While Exim does not provide a default value, your SSL library may.
24017 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
24018 and constrained to be a file.
24019 </para>
24020 <para>
24021 <indexterm role="option">
24022 <primary><option>ldap_cert_file</option></primary>
24023 </indexterm>
24024 </para>
24025 <informaltable frame="all">
24026 <tgroup cols="4" colsep="0" rowsep="0">
24027 <colspec colwidth="8*" align="left"/>
24028 <colspec colwidth="6*" align="center"/>
24029 <colspec colwidth="6*" align="center"/>
24030 <colspec colwidth="6*" align="right"/>
24031 <tbody>
24032 <row>
24033 <entry><option>ldap_cert_file</option></entry>
24034 <entry>Use: <emphasis>main</emphasis></entry>
24035 <entry>Type: <emphasis>string</emphasis></entry>
24036 <entry>Default: <emphasis>unset</emphasis></entry>
24037 </row>
24038 </tbody>
24039 </tgroup>
24040 </informaltable>
24041 <para>
24042 <indexterm role="concept">
24043 <primary>LDAP</primary>
24044 <secondary>TLS client certificate file</secondary>
24045 </indexterm>
24046 This option indicates which file contains an TLS client certificate which
24047 Exim should present to the LDAP server during TLS negotiation.
24048 Should be used together with <option>ldap_cert_key</option>.
24049 </para>
24050 <para>
24051 <indexterm role="option">
24052 <primary><option>ldap_cert_key</option></primary>
24053 </indexterm>
24054 </para>
24055 <informaltable frame="all">
24056 <tgroup cols="4" colsep="0" rowsep="0">
24057 <colspec colwidth="8*" align="left"/>
24058 <colspec colwidth="6*" align="center"/>
24059 <colspec colwidth="6*" align="center"/>
24060 <colspec colwidth="6*" align="right"/>
24061 <tbody>
24062 <row>
24063 <entry><option>ldap_cert_key</option></entry>
24064 <entry>Use: <emphasis>main</emphasis></entry>
24065 <entry>Type: <emphasis>string</emphasis></entry>
24066 <entry>Default: <emphasis>unset</emphasis></entry>
24067 </row>
24068 </tbody>
24069 </tgroup>
24070 </informaltable>
24071 <para>
24072 <indexterm role="concept">
24073 <primary>LDAP</primary>
24074 <secondary>TLS client key file</secondary>
24075 </indexterm>
24076 This option indicates which file contains the secret/private key to use
24077 to prove identity to the LDAP server during TLS negotiation.
24078 Should be used together with <option>ldap_cert_file</option>, which contains the
24079 identity to be proven.
24080 </para>
24081 <para>
24082 <indexterm role="option">
24083 <primary><option>ldap_cipher_suite</option></primary>
24084 </indexterm>
24085 </para>
24086 <informaltable frame="all">
24087 <tgroup cols="4" colsep="0" rowsep="0">
24088 <colspec colwidth="8*" align="left"/>
24089 <colspec colwidth="6*" align="center"/>
24090 <colspec colwidth="6*" align="center"/>
24091 <colspec colwidth="6*" align="right"/>
24092 <tbody>
24093 <row>
24094 <entry><option>ldap_cipher_suite</option></entry>
24095 <entry>Use: <emphasis>main</emphasis></entry>
24096 <entry>Type: <emphasis>string</emphasis></entry>
24097 <entry>Default: <emphasis>unset</emphasis></entry>
24098 </row>
24099 </tbody>
24100 </tgroup>
24101 </informaltable>
24102 <para>
24103 <indexterm role="concept">
24104 <primary>LDAP</primary>
24105 <secondary>TLS cipher suite</secondary>
24106 </indexterm>
24107 This controls the TLS cipher-suite negotiation during TLS negotiation with
24108 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
24109 cipher-suite options with OpenSSL (as used by LDAP client libraries).
24110 </para>
24111 <para>
24112 <indexterm role="option">
24113 <primary><option>ldap_default_servers</option></primary>
24114 </indexterm>
24115 </para>
24116 <informaltable frame="all">
24117 <tgroup cols="4" colsep="0" rowsep="0">
24118 <colspec colwidth="8*" align="left"/>
24119 <colspec colwidth="6*" align="center"/>
24120 <colspec colwidth="6*" align="center"/>
24121 <colspec colwidth="6*" align="right"/>
24122 <tbody>
24123 <row>
24124 <entry><option>ldap_default_servers</option></entry>
24125 <entry>Use: <emphasis>main</emphasis></entry>
24126 <entry>Type: <emphasis>string list</emphasis></entry>
24127 <entry>Default: <emphasis>unset</emphasis></entry>
24128 </row>
24129 </tbody>
24130 </tgroup>
24131 </informaltable>
24132 <para>
24133 <indexterm role="concept">
24134 <primary>LDAP</primary>
24135 <secondary>default servers</secondary>
24136 </indexterm>
24137 This option provides a list of LDAP servers which are tried in turn when an
24138 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
24139 details of LDAP queries. This option is available only when Exim has been built
24140 with LDAP support.
24141 </para>
24142 <para>
24143 <indexterm role="option">
24144 <primary><option>ldap_require_cert</option></primary>
24145 </indexterm>
24146 </para>
24147 <informaltable frame="all">
24148 <tgroup cols="4" colsep="0" rowsep="0">
24149 <colspec colwidth="8*" align="left"/>
24150 <colspec colwidth="6*" align="center"/>
24151 <colspec colwidth="6*" align="center"/>
24152 <colspec colwidth="6*" align="right"/>
24153 <tbody>
24154 <row>
24155 <entry><option>ldap_require_cert</option></entry>
24156 <entry>Use: <emphasis>main</emphasis></entry>
24157 <entry>Type: <emphasis>string</emphasis></entry>
24158 <entry>Default: <emphasis>unset.</emphasis></entry>
24159 </row>
24160 </tbody>
24161 </tgroup>
24162 </informaltable>
24163 <para>
24164 <indexterm role="concept">
24165 <primary>LDAP</primary>
24166 <secondary>policy for LDAP server TLS cert presentation</secondary>
24167 </indexterm>
24168 This should be one of the values "hard", "demand", "allow", "try" or "never".
24169 A value other than one of these is interpreted as "never".
24170 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
24171 Although Exim does not set a default, the LDAP library probably defaults
24172 to hard/demand.
24173 </para>
24174 <para>
24175 <indexterm role="option">
24176 <primary><option>ldap_start_tls</option></primary>
24177 </indexterm>
24178 </para>
24179 <informaltable frame="all">
24180 <tgroup cols="4" colsep="0" rowsep="0">
24181 <colspec colwidth="8*" align="left"/>
24182 <colspec colwidth="6*" align="center"/>
24183 <colspec colwidth="6*" align="center"/>
24184 <colspec colwidth="6*" align="right"/>
24185 <tbody>
24186 <row>
24187 <entry><option>ldap_start_tls</option></entry>
24188 <entry>Use: <emphasis>main</emphasis></entry>
24189 <entry>Type: <emphasis>boolean</emphasis></entry>
24190 <entry>Default: <emphasis>false</emphasis></entry>
24191 </row>
24192 </tbody>
24193 </tgroup>
24194 </informaltable>
24195 <para>
24196 <indexterm role="concept">
24197 <primary>LDAP</primary>
24198 <secondary>whether or not to negotiate TLS</secondary>
24199 </indexterm>
24200 If set, Exim will attempt to negotiate TLS with the LDAP server when
24201 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
24202 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
24203 of SSL-on-connect.
24204 In the event of failure to negotiate TLS, the action taken is controlled
24205 by <option>ldap_require_cert</option>.
24206 </para>
24207 <para>
24208 <indexterm role="option">
24209 <primary><option>ldap_version</option></primary>
24210 </indexterm>
24211 </para>
24212 <informaltable frame="all">
24213 <tgroup cols="4" colsep="0" rowsep="0">
24214 <colspec colwidth="8*" align="left"/>
24215 <colspec colwidth="6*" align="center"/>
24216 <colspec colwidth="6*" align="center"/>
24217 <colspec colwidth="6*" align="right"/>
24218 <tbody>
24219 <row>
24220 <entry><option>ldap_version</option></entry>
24221 <entry>Use: <emphasis>main</emphasis></entry>
24222 <entry>Type: <emphasis>integer</emphasis></entry>
24223 <entry>Default: <emphasis>unset</emphasis></entry>
24224 </row>
24225 </tbody>
24226 </tgroup>
24227 </informaltable>
24228 <para>
24229 <indexterm role="concept">
24230 <primary>LDAP</primary>
24231 <secondary>protocol version, forcing</secondary>
24232 </indexterm>
24233 This option can be used to force Exim to set a specific protocol version for
24234 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
24235 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
24236 the LDAP headers; otherwise it is 2. This option is available only when Exim
24237 has been built with LDAP support.
24238 </para>
24239 <para>
24240 <indexterm role="option">
24241 <primary><option>local_from_check</option></primary>
24242 </indexterm>
24243 </para>
24244 <informaltable frame="all">
24245 <tgroup cols="4" colsep="0" rowsep="0">
24246 <colspec colwidth="8*" align="left"/>
24247 <colspec colwidth="6*" align="center"/>
24248 <colspec colwidth="6*" align="center"/>
24249 <colspec colwidth="6*" align="right"/>
24250 <tbody>
24251 <row>
24252 <entry><option>local_from_check</option></entry>
24253 <entry>Use: <emphasis>main</emphasis></entry>
24254 <entry>Type: <emphasis>boolean</emphasis></entry>
24255 <entry>Default: <emphasis>true</emphasis></entry>
24256 </row>
24257 </tbody>
24258 </tgroup>
24259 </informaltable>
24260 <para>
24261 <indexterm role="concept">
24262 <primary><emphasis>Sender:</emphasis> header line</primary>
24263 <secondary>disabling addition of</secondary>
24264 </indexterm>
24265 <indexterm role="concept">
24266 <primary><emphasis>From:</emphasis> header line</primary>
24267 <secondary>disabling checking of</secondary>
24268 </indexterm>
24269 When a message is submitted locally (that is, not over a TCP/IP connection) by
24270 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
24271 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
24272 the domain specified by <option>qualify_domain</option>.
24273 </para>
24274 <para>
24275 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
24276 locally submitted message is automatically qualified by Exim, unless the
24277 <option>-bnq</option> command line option is used.
24278 </para>
24279 <para>
24280 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
24281 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
24282 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
24283 and the default qualify domain.
24284 </para>
24285 <para>
24286 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
24287 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
24288 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
24289 <option>local_sender_retain</option> to be true.
24290 </para>
24291 <para>
24292 <indexterm role="concept">
24293 <primary>envelope sender</primary>
24294 </indexterm>
24295 These options affect only the header lines in the message. The envelope sender
24296 is still forced to be the login id at the qualify domain unless
24297 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
24298 </para>
24299 <para>
24300 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
24301 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
24302 has more details about <emphasis>Sender:</emphasis> processing.
24303 </para>
24304 <para>
24305 <indexterm role="option">
24306 <primary><option>local_from_prefix</option></primary>
24307 </indexterm>
24308 </para>
24309 <informaltable frame="all">
24310 <tgroup cols="4" colsep="0" rowsep="0">
24311 <colspec colwidth="8*" align="left"/>
24312 <colspec colwidth="6*" align="center"/>
24313 <colspec colwidth="6*" align="center"/>
24314 <colspec colwidth="6*" align="right"/>
24315 <tbody>
24316 <row>
24317 <entry><option>local_from_prefix</option></entry>
24318 <entry>Use: <emphasis>main</emphasis></entry>
24319 <entry>Type: <emphasis>string</emphasis></entry>
24320 <entry>Default: <emphasis>unset</emphasis></entry>
24321 </row>
24322 </tbody>
24323 </tgroup>
24324 </informaltable>
24325 <para>
24326 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
24327 matching the login id (see <option>local_from_check</option> above), it can be configured to
24328 ignore certain prefixes and suffixes in the local part of the address. This is
24329 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
24330 appropriate lists, in the same form as the <option>local_part_prefix</option> and
24331 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
24332 example, if
24333 </para>
24334 <literallayout class="monospaced">
24335 local_from_prefix = *-
24336 </literallayout>
24337 <para>
24338 is set, a <emphasis>From:</emphasis> line containing
24339 </para>
24340 <literallayout class="monospaced">
24341 From: anything-user@your.domain.example
24342 </literallayout>
24343 <para>
24344 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
24345 matches the actual sender address that is constructed from the login name and
24346 qualify domain.
24347 </para>
24348 <para>
24349 <indexterm role="option">
24350 <primary><option>local_from_suffix</option></primary>
24351 </indexterm>
24352 </para>
24353 <informaltable frame="all">
24354 <tgroup cols="4" colsep="0" rowsep="0">
24355 <colspec colwidth="8*" align="left"/>
24356 <colspec colwidth="6*" align="center"/>
24357 <colspec colwidth="6*" align="center"/>
24358 <colspec colwidth="6*" align="right"/>
24359 <tbody>
24360 <row>
24361 <entry><option>local_from_suffix</option></entry>
24362 <entry>Use: <emphasis>main</emphasis></entry>
24363 <entry>Type: <emphasis>string</emphasis></entry>
24364 <entry>Default: <emphasis>unset</emphasis></entry>
24365 </row>
24366 </tbody>
24367 </tgroup>
24368 </informaltable>
24369 <para>
24370 See <option>local_from_prefix</option> above.
24371 </para>
24372 <para>
24373 <indexterm role="option">
24374 <primary><option>local_interfaces</option></primary>
24375 </indexterm>
24376 </para>
24377 <informaltable frame="all">
24378 <tgroup cols="4" colsep="0" rowsep="0">
24379 <colspec colwidth="8*" align="left"/>
24380 <colspec colwidth="6*" align="center"/>
24381 <colspec colwidth="6*" align="center"/>
24382 <colspec colwidth="6*" align="right"/>
24383 <tbody>
24384 <row>
24385 <entry><option>local_interfaces</option></entry>
24386 <entry>Use: <emphasis>main</emphasis></entry>
24387 <entry>Type: <emphasis>string list</emphasis></entry>
24388 <entry>Default: <emphasis>see below</emphasis></entry>
24389 </row>
24390 </tbody>
24391 </tgroup>
24392 </informaltable>
24393 <para>
24394 This option controls which network interfaces are used by the daemon for
24395 listening; they are also used to identify the local host when routing. Chapter
24396 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
24397 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
24398 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
24399 <option>local_interfaces</option> is
24400 </para>
24401 <literallayout class="monospaced">
24402 local_interfaces = 0.0.0.0
24403 </literallayout>
24404 <para>
24405 when Exim is built without IPv6 support; otherwise it is
24406 </para>
24407 <literallayout class="monospaced">
24408 local_interfaces = &lt;; ::0 ; 0.0.0.0
24409 </literallayout>
24410 <para>
24411 <indexterm role="option">
24412 <primary><option>local_scan_timeout</option></primary>
24413 </indexterm>
24414 </para>
24415 <informaltable frame="all">
24416 <tgroup cols="4" colsep="0" rowsep="0">
24417 <colspec colwidth="8*" align="left"/>
24418 <colspec colwidth="6*" align="center"/>
24419 <colspec colwidth="6*" align="center"/>
24420 <colspec colwidth="6*" align="right"/>
24421 <tbody>
24422 <row>
24423 <entry><option>local_scan_timeout</option></entry>
24424 <entry>Use: <emphasis>main</emphasis></entry>
24425 <entry>Type: <emphasis>time</emphasis></entry>
24426 <entry>Default: <emphasis>5m</emphasis></entry>
24427 </row>
24428 </tbody>
24429 </tgroup>
24430 </informaltable>
24431 <para>
24432 <indexterm role="concept">
24433 <primary>timeout</primary>
24434 <secondary>for <function>local_scan()</function> function</secondary>
24435 </indexterm>
24436 <indexterm role="concept">
24437 <primary><function>local_scan()</function> function</primary>
24438 <secondary>timeout</secondary>
24439 </indexterm>
24440 This timeout applies to the <function>local_scan()</function> function (see chapter
24441 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
24442 the incoming message is rejected with a temporary error if it is an SMTP
24443 message. For a non-SMTP message, the message is dropped and Exim ends with a
24444 non-zero code. The incident is logged on the main and reject logs.
24445 </para>
24446 <para>
24447 <indexterm role="option">
24448 <primary><option>local_sender_retain</option></primary>
24449 </indexterm>
24450 </para>
24451 <informaltable frame="all">
24452 <tgroup cols="4" colsep="0" rowsep="0">
24453 <colspec colwidth="8*" align="left"/>
24454 <colspec colwidth="6*" align="center"/>
24455 <colspec colwidth="6*" align="center"/>
24456 <colspec colwidth="6*" align="right"/>
24457 <tbody>
24458 <row>
24459 <entry><option>local_sender_retain</option></entry>
24460 <entry>Use: <emphasis>main</emphasis></entry>
24461 <entry>Type: <emphasis>boolean</emphasis></entry>
24462 <entry>Default: <emphasis>false</emphasis></entry>
24463 </row>
24464 </tbody>
24465 </tgroup>
24466 </informaltable>
24467 <para>
24468 <indexterm role="concept">
24469 <primary><emphasis>Sender:</emphasis> header line</primary>
24470 <secondary>retaining from local submission</secondary>
24471 </indexterm>
24472 When a message is submitted locally (that is, not over a TCP/IP connection) by
24473 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
24474 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
24475 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
24476 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
24477 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
24478 </para>
24479 <para>
24480 <indexterm role="option">
24481 <primary><option>localhost_number</option></primary>
24482 </indexterm>
24483 </para>
24484 <informaltable frame="all">
24485 <tgroup cols="4" colsep="0" rowsep="0">
24486 <colspec colwidth="8*" align="left"/>
24487 <colspec colwidth="6*" align="center"/>
24488 <colspec colwidth="6*" align="center"/>
24489 <colspec colwidth="6*" align="right"/>
24490 <tbody>
24491 <row>
24492 <entry><option>localhost_number</option></entry>
24493 <entry>Use: <emphasis>main</emphasis></entry>
24494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24495 <entry>Default: <emphasis>unset</emphasis></entry>
24496 </row>
24497 </tbody>
24498 </tgroup>
24499 </informaltable>
24500 <para>
24501 <indexterm role="concept">
24502 <primary>host</primary>
24503 <secondary>locally unique number for</secondary>
24504 </indexterm>
24505 <indexterm role="concept">
24506 <primary>message ids</primary>
24507 <secondary>with multiple hosts</secondary>
24508 </indexterm>
24509 <indexterm role="variable">
24510 <primary><varname>$localhost_number</varname></primary>
24511 </indexterm>
24512 Exim&#x2019;s message ids are normally unique only within the local host. If
24513 uniqueness among a set of hosts is required, each host must set a different
24514 value for the <option>localhost_number</option> option. The string is expanded immediately
24515 after reading the configuration file (so that a number can be computed from the
24516 host name, for example) and the result of the expansion must be a number in the
24517 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
24518 systems). This is available in subsequent string expansions via the variable
24519 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
24520 characters of the message id, instead of just being a fractional part of the
24521 time, are computed from the time and the local host number as described in
24522 section <xref linkend="SECTmessiden"/>.
24523 </para>
24524 <para>
24525 <indexterm role="option">
24526 <primary><option>log_file_path</option></primary>
24527 </indexterm>
24528 </para>
24529 <informaltable frame="all">
24530 <tgroup cols="4" colsep="0" rowsep="0">
24531 <colspec colwidth="8*" align="left"/>
24532 <colspec colwidth="6*" align="center"/>
24533 <colspec colwidth="6*" align="center"/>
24534 <colspec colwidth="6*" align="right"/>
24535 <tbody>
24536 <row>
24537 <entry><option>log_file_path</option></entry>
24538 <entry>Use: <emphasis>main</emphasis></entry>
24539 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24540 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24541 </row>
24542 </tbody>
24543 </tgroup>
24544 </informaltable>
24545 <para>
24546 <indexterm role="concept">
24547 <primary>log</primary>
24548 <secondary>file path for</secondary>
24549 </indexterm>
24550 This option sets the path which is used to determine the names of Exim&#x2019;s log
24551 files, or indicates that logging is to be to syslog, or both. It is expanded
24552 when Exim is entered, so it can, for example, contain a reference to the host
24553 name. If no specific path is set for the log files at compile or run time, they
24554 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
24555 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
24556 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
24557 used. If this string is fixed at your installation (contains no expansion
24558 variables) it is recommended that you do not set this option in the
24559 configuration file, but instead supply the path using LOG_FILE_PATH in
24560 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
24561 early on &ndash; in particular, failure to read the configuration file.
24562 </para>
24563 <para>
24564 <indexterm role="option">
24565 <primary><option>log_selector</option></primary>
24566 </indexterm>
24567 </para>
24568 <informaltable frame="all">
24569 <tgroup cols="4" colsep="0" rowsep="0">
24570 <colspec colwidth="8*" align="left"/>
24571 <colspec colwidth="6*" align="center"/>
24572 <colspec colwidth="6*" align="center"/>
24573 <colspec colwidth="6*" align="right"/>
24574 <tbody>
24575 <row>
24576 <entry><option>log_selector</option></entry>
24577 <entry>Use: <emphasis>main</emphasis></entry>
24578 <entry>Type: <emphasis>string</emphasis></entry>
24579 <entry>Default: <emphasis>unset</emphasis></entry>
24580 </row>
24581 </tbody>
24582 </tgroup>
24583 </informaltable>
24584 <para>
24585 <indexterm role="concept">
24586 <primary>log</primary>
24587 <secondary>selectors</secondary>
24588 </indexterm>
24589 This option can be used to reduce or increase the number of things that Exim
24590 writes to its log files. Its argument is made up of names preceded by plus or
24591 minus characters. For example:
24592 </para>
24593 <literallayout class="monospaced">
24594 log_selector = +arguments -retry_defer
24595 </literallayout>
24596 <para>
24597 A list of possible names and what they control is given in the chapter on
24598 logging, in section <xref linkend="SECTlogselector"/>.
24599 </para>
24600 <para>
24601 <indexterm role="option">
24602 <primary><option>log_timezone</option></primary>
24603 </indexterm>
24604 </para>
24605 <informaltable frame="all">
24606 <tgroup cols="4" colsep="0" rowsep="0">
24607 <colspec colwidth="8*" align="left"/>
24608 <colspec colwidth="6*" align="center"/>
24609 <colspec colwidth="6*" align="center"/>
24610 <colspec colwidth="6*" align="right"/>
24611 <tbody>
24612 <row>
24613 <entry><option>log_timezone</option></entry>
24614 <entry>Use: <emphasis>main</emphasis></entry>
24615 <entry>Type: <emphasis>boolean</emphasis></entry>
24616 <entry>Default: <emphasis>false</emphasis></entry>
24617 </row>
24618 </tbody>
24619 </tgroup>
24620 </informaltable>
24621 <para>
24622 <indexterm role="concept">
24623 <primary>log</primary>
24624 <secondary>timezone for entries</secondary>
24625 </indexterm>
24626 <indexterm role="variable">
24627 <primary><varname>$tod_log</varname></primary>
24628 </indexterm>
24629 <indexterm role="variable">
24630 <primary><varname>$tod_zone</varname></primary>
24631 </indexterm>
24632 By default, the timestamps on log lines are in local time without the
24633 timezone. This means that if your timezone changes twice a year, the timestamps
24634 in log lines are ambiguous for an hour when the clocks go back. One way of
24635 avoiding this problem is to set the timezone to UTC. An alternative is to set
24636 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
24637 timestamps in log lines. Turning on this option can add quite a lot to the size
24638 of log files because each line is extended by 6 characters. Note that the
24639 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24640 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24641 </para>
24642 <para>
24643 <indexterm role="option">
24644 <primary><option>lookup_open_max</option></primary>
24645 </indexterm>
24646 </para>
24647 <informaltable frame="all">
24648 <tgroup cols="4" colsep="0" rowsep="0">
24649 <colspec colwidth="8*" align="left"/>
24650 <colspec colwidth="6*" align="center"/>
24651 <colspec colwidth="6*" align="center"/>
24652 <colspec colwidth="6*" align="right"/>
24653 <tbody>
24654 <row>
24655 <entry><option>lookup_open_max</option></entry>
24656 <entry>Use: <emphasis>main</emphasis></entry>
24657 <entry>Type: <emphasis>integer</emphasis></entry>
24658 <entry>Default: <emphasis>25</emphasis></entry>
24659 </row>
24660 </tbody>
24661 </tgroup>
24662 </informaltable>
24663 <para>
24664 <indexterm role="concept">
24665 <primary>too many open files</primary>
24666 </indexterm>
24667 <indexterm role="concept">
24668 <primary>open files, too many</primary>
24669 </indexterm>
24670 <indexterm role="concept">
24671 <primary>file</primary>
24672 <secondary>too many open</secondary>
24673 </indexterm>
24674 <indexterm role="concept">
24675 <primary>lookup</primary>
24676 <secondary>maximum open files</secondary>
24677 </indexterm>
24678 <indexterm role="concept">
24679 <primary>limit</primary>
24680 <secondary>open files for lookups</secondary>
24681 </indexterm>
24682 This option limits the number of simultaneously open files for single-key
24683 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24684 Exim normally keeps these files open during routing, because often the same
24685 file is required several times. If the limit is reached, Exim closes the least
24686 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24687 actually opens two files for each logical DBM database, though it still counts
24688 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24689 open files</quote> errors with NDBM, you need to reduce the value of
24690 <option>lookup_open_max</option>.
24691 </para>
24692 <para>
24693 <indexterm role="option">
24694 <primary><option>max_username_length</option></primary>
24695 </indexterm>
24696 </para>
24697 <informaltable frame="all">
24698 <tgroup cols="4" colsep="0" rowsep="0">
24699 <colspec colwidth="8*" align="left"/>
24700 <colspec colwidth="6*" align="center"/>
24701 <colspec colwidth="6*" align="center"/>
24702 <colspec colwidth="6*" align="right"/>
24703 <tbody>
24704 <row>
24705 <entry><option>max_username_length</option></entry>
24706 <entry>Use: <emphasis>main</emphasis></entry>
24707 <entry>Type: <emphasis>integer</emphasis></entry>
24708 <entry>Default: <emphasis>0</emphasis></entry>
24709 </row>
24710 </tbody>
24711 </tgroup>
24712 </informaltable>
24713 <para>
24714 <indexterm role="concept">
24715 <primary>length of login name</primary>
24716 </indexterm>
24717 <indexterm role="concept">
24718 <primary>user name</primary>
24719 <secondary>maximum length</secondary>
24720 </indexterm>
24721 <indexterm role="concept">
24722 <primary>limit</primary>
24723 <secondary>user name length</secondary>
24724 </indexterm>
24725 Some operating systems are broken in that they truncate long arguments to
24726 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24727 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24728 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24729 </para>
24730 <para>
24731 <indexterm role="option">
24732 <primary><option>message_body_newlines</option></primary>
24733 </indexterm>
24734 </para>
24735 <informaltable frame="all">
24736 <tgroup cols="4" colsep="0" rowsep="0">
24737 <colspec colwidth="8*" align="left"/>
24738 <colspec colwidth="6*" align="center"/>
24739 <colspec colwidth="6*" align="center"/>
24740 <colspec colwidth="6*" align="right"/>
24741 <tbody>
24742 <row>
24743 <entry><option>message_body_newlines</option></entry>
24744 <entry>Use: <emphasis>main</emphasis></entry>
24745 <entry>Type: <emphasis>bool</emphasis></entry>
24746 <entry>Default: <emphasis>false</emphasis></entry>
24747 </row>
24748 </tbody>
24749 </tgroup>
24750 </informaltable>
24751 <para>
24752 <indexterm role="concept">
24753 <primary>message body</primary>
24754 <secondary>newlines in variables</secondary>
24755 </indexterm>
24756 <indexterm role="concept">
24757 <primary>newline</primary>
24758 <secondary>in message body variables</secondary>
24759 </indexterm>
24760 <indexterm role="variable">
24761 <primary><varname>$message_body</varname></primary>
24762 </indexterm>
24763 <indexterm role="variable">
24764 <primary><varname>$message_body_end</varname></primary>
24765 </indexterm>
24766 By default, newlines in the message body are replaced by spaces when setting
24767 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24768 option is set true, this no longer happens.
24769 </para>
24770 <para>
24771 <indexterm role="option">
24772 <primary><option>message_body_visible</option></primary>
24773 </indexterm>
24774 </para>
24775 <informaltable frame="all">
24776 <tgroup cols="4" colsep="0" rowsep="0">
24777 <colspec colwidth="8*" align="left"/>
24778 <colspec colwidth="6*" align="center"/>
24779 <colspec colwidth="6*" align="center"/>
24780 <colspec colwidth="6*" align="right"/>
24781 <tbody>
24782 <row>
24783 <entry><option>message_body_visible</option></entry>
24784 <entry>Use: <emphasis>main</emphasis></entry>
24785 <entry>Type: <emphasis>integer</emphasis></entry>
24786 <entry>Default: <emphasis>500</emphasis></entry>
24787 </row>
24788 </tbody>
24789 </tgroup>
24790 </informaltable>
24791 <para>
24792 <indexterm role="concept">
24793 <primary>body of message</primary>
24794 <secondary>visible size</secondary>
24795 </indexterm>
24796 <indexterm role="concept">
24797 <primary>message body</primary>
24798 <secondary>visible size</secondary>
24799 </indexterm>
24800 <indexterm role="variable">
24801 <primary><varname>$message_body</varname></primary>
24802 </indexterm>
24803 <indexterm role="variable">
24804 <primary><varname>$message_body_end</varname></primary>
24805 </indexterm>
24806 This option specifies how much of a message&#x2019;s body is to be included in the
24807 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24808 </para>
24809 <para>
24810 <indexterm role="option">
24811 <primary><option>message_id_header_domain</option></primary>
24812 </indexterm>
24813 </para>
24814 <informaltable frame="all">
24815 <tgroup cols="4" colsep="0" rowsep="0">
24816 <colspec colwidth="8*" align="left"/>
24817 <colspec colwidth="6*" align="center"/>
24818 <colspec colwidth="6*" align="center"/>
24819 <colspec colwidth="6*" align="right"/>
24820 <tbody>
24821 <row>
24822 <entry><option>message_id_header_domain</option></entry>
24823 <entry>Use: <emphasis>main</emphasis></entry>
24824 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24825 <entry>Default: <emphasis>unset</emphasis></entry>
24826 </row>
24827 </tbody>
24828 </tgroup>
24829 </informaltable>
24830 <para>
24831 <indexterm role="concept">
24832 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24833 </indexterm>
24834 If this option is set, the string is expanded and used as the right hand side
24835 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24836 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24837 means <quote>not received over TCP/IP.</quote>
24838 Otherwise, the primary host name is used.
24839 Only letters, digits, dot and hyphen are accepted; any other characters are
24840 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24841 empty string, the option is ignored.
24842 </para>
24843 <para>
24844 <indexterm role="option">
24845 <primary><option>message_id_header_text</option></primary>
24846 </indexterm>
24847 </para>
24848 <informaltable frame="all">
24849 <tgroup cols="4" colsep="0" rowsep="0">
24850 <colspec colwidth="8*" align="left"/>
24851 <colspec colwidth="6*" align="center"/>
24852 <colspec colwidth="6*" align="center"/>
24853 <colspec colwidth="6*" align="right"/>
24854 <tbody>
24855 <row>
24856 <entry><option>message_id_header_text</option></entry>
24857 <entry>Use: <emphasis>main</emphasis></entry>
24858 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24859 <entry>Default: <emphasis>unset</emphasis></entry>
24860 </row>
24861 </tbody>
24862 </tgroup>
24863 </informaltable>
24864 <para>
24865 If this variable is set, the string is expanded and used to augment the text of
24866 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24867 message does not have one. The text of this header is required by RFC 2822 to
24868 take the form of an address. By default, Exim uses its internal message id as
24869 the local part, and the primary host name as the domain. If this option is set,
24870 it is expanded, and provided the expansion is not forced to fail, and does not
24871 yield an empty string, the result is inserted into the header immediately
24872 before the @, separated from the internal message id by a dot. Any characters
24873 that are illegal in an address are automatically converted into hyphens. This
24874 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24875 colons will become hyphens.
24876 </para>
24877 <para>
24878 <indexterm role="option">
24879 <primary><option>message_logs</option></primary>
24880 </indexterm>
24881 </para>
24882 <informaltable frame="all">
24883 <tgroup cols="4" colsep="0" rowsep="0">
24884 <colspec colwidth="8*" align="left"/>
24885 <colspec colwidth="6*" align="center"/>
24886 <colspec colwidth="6*" align="center"/>
24887 <colspec colwidth="6*" align="right"/>
24888 <tbody>
24889 <row>
24890 <entry><option>message_logs</option></entry>
24891 <entry>Use: <emphasis>main</emphasis></entry>
24892 <entry>Type: <emphasis>boolean</emphasis></entry>
24893 <entry>Default: <emphasis>true</emphasis></entry>
24894 </row>
24895 </tbody>
24896 </tgroup>
24897 </informaltable>
24898 <para>
24899 <indexterm role="concept">
24900 <primary>message logs</primary>
24901 <secondary>disabling</secondary>
24902 </indexterm>
24903 <indexterm role="concept">
24904 <primary>log</primary>
24905 <secondary>message log; disabling</secondary>
24906 </indexterm>
24907 If this option is turned off, per-message log files are not created in the
24908 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24909 Exim, by reducing the number of files involved in handling a message from a
24910 minimum of four (header spool file, body spool file, delivery journal, and
24911 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24912 which is not affected by this option.
24913 </para>
24914 <para>
24915 <indexterm role="option">
24916 <primary><option>message_size_limit</option></primary>
24917 </indexterm>
24918 </para>
24919 <informaltable frame="all">
24920 <tgroup cols="4" colsep="0" rowsep="0">
24921 <colspec colwidth="8*" align="left"/>
24922 <colspec colwidth="6*" align="center"/>
24923 <colspec colwidth="6*" align="center"/>
24924 <colspec colwidth="6*" align="right"/>
24925 <tbody>
24926 <row>
24927 <entry><option>message_size_limit</option></entry>
24928 <entry>Use: <emphasis>main</emphasis></entry>
24929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24930 <entry>Default: <emphasis>50M</emphasis></entry>
24931 </row>
24932 </tbody>
24933 </tgroup>
24934 </informaltable>
24935 <para>
24936 <indexterm role="concept">
24937 <primary>message</primary>
24938 <secondary>size limit</secondary>
24939 </indexterm>
24940 <indexterm role="concept">
24941 <primary>limit</primary>
24942 <secondary>message size</secondary>
24943 </indexterm>
24944 <indexterm role="concept">
24945 <primary>size</primary>
24946 <secondary>of message, limit</secondary>
24947 </indexterm>
24948 This option limits the maximum size of message that Exim will process. The
24949 value is expanded for each incoming connection so, for example, it can be made
24950 to depend on the IP address of the remote host for messages arriving via
24951 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24952 optionally followed by K or M.
24953 </para>
24954 <para>
24955 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24956 other properties of an individual message, because it has to be advertised in
24957 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24958 error. A value of zero means no limit, but its use is not recommended. See also
24959 <option>bounce_return_size_limit</option>.
24960 </para>
24961 <para>
24962 Incoming SMTP messages are failed with a 552 error if the limit is
24963 exceeded; locally-generated messages either get a stderr message or a delivery
24964 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24965 an oversized message is logged in both the main and the reject logs. See also
24966 the generic transport option <option>message_size_limit</option>, which limits the size of
24967 message that an individual transport can process.
24968 </para>
24969 <para>
24970 If you use a virus-scanner and set this option to to a value larger than the
24971 maximum size that your virus-scanner is configured to support, you may get
24972 failures triggered by large mails.  The right size to configure for the
24973 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
24974 probably safest to just set it to a little larger than this value.  Eg, with a
24975 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
24976 some problems may result.
24977 </para>
24978 <para>
24979 A value of 0 will disable size limit checking; Exim will still advertise the
24980 SIZE extension in an EHLO response, but without a limit, so as to permit
24981 SMTP clients to still indicate the message size along with the MAIL verb.
24982 </para>
24983 <para>
24984 <indexterm role="option">
24985 <primary><option>move_frozen_messages</option></primary>
24986 </indexterm>
24987 </para>
24988 <informaltable frame="all">
24989 <tgroup cols="4" colsep="0" rowsep="0">
24990 <colspec colwidth="8*" align="left"/>
24991 <colspec colwidth="6*" align="center"/>
24992 <colspec colwidth="6*" align="center"/>
24993 <colspec colwidth="6*" align="right"/>
24994 <tbody>
24995 <row>
24996 <entry><option>move_frozen_messages</option></entry>
24997 <entry>Use: <emphasis>main</emphasis></entry>
24998 <entry>Type: <emphasis>boolean</emphasis></entry>
24999 <entry>Default: <emphasis>false</emphasis></entry>
25000 </row>
25001 </tbody>
25002 </tgroup>
25003 </informaltable>
25004 <para>
25005 <indexterm role="concept">
25006 <primary>frozen messages</primary>
25007 <secondary>moving</secondary>
25008 </indexterm>
25009 This option, which is available only if Exim has been built with the setting
25010 </para>
25011 <literallayout class="monospaced">
25012 SUPPORT_MOVE_FROZEN_MESSAGES=yes
25013 </literallayout>
25014 <para>
25015 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
25016 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
25017 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
25018 standard utilities for handling such moved messages, and they do not show up in
25019 lists generated by <option>-bp</option> or by the Exim monitor.
25020 </para>
25021 <para>
25022 <indexterm role="option">
25023 <primary><option>mua_wrapper</option></primary>
25024 </indexterm>
25025 </para>
25026 <informaltable frame="all">
25027 <tgroup cols="4" colsep="0" rowsep="0">
25028 <colspec colwidth="8*" align="left"/>
25029 <colspec colwidth="6*" align="center"/>
25030 <colspec colwidth="6*" align="center"/>
25031 <colspec colwidth="6*" align="right"/>
25032 <tbody>
25033 <row>
25034 <entry><option>mua_wrapper</option></entry>
25035 <entry>Use: <emphasis>main</emphasis></entry>
25036 <entry>Type: <emphasis>boolean</emphasis></entry>
25037 <entry>Default: <emphasis>false</emphasis></entry>
25038 </row>
25039 </tbody>
25040 </tgroup>
25041 </informaltable>
25042 <para>
25043 Setting this option true causes Exim to run in a very restrictive mode in which
25044 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
25045 contains a full description of this facility.
25046 </para>
25047 <para>
25048 <indexterm role="option">
25049 <primary><option>mysql_servers</option></primary>
25050 </indexterm>
25051 </para>
25052 <informaltable frame="all">
25053 <tgroup cols="4" colsep="0" rowsep="0">
25054 <colspec colwidth="8*" align="left"/>
25055 <colspec colwidth="6*" align="center"/>
25056 <colspec colwidth="6*" align="center"/>
25057 <colspec colwidth="6*" align="right"/>
25058 <tbody>
25059 <row>
25060 <entry><option>mysql_servers</option></entry>
25061 <entry>Use: <emphasis>main</emphasis></entry>
25062 <entry>Type: <emphasis>string list</emphasis></entry>
25063 <entry>Default: <emphasis>unset</emphasis></entry>
25064 </row>
25065 </tbody>
25066 </tgroup>
25067 </informaltable>
25068 <para>
25069 <indexterm role="concept">
25070 <primary>MySQL</primary>
25071 <secondary>server list</secondary>
25072 </indexterm>
25073 This option provides a list of MySQL servers and associated connection data, to
25074 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
25075 option is available only if Exim has been built with MySQL support.
25076 </para>
25077 <para>
25078 <indexterm role="option">
25079 <primary><option>never_users</option></primary>
25080 </indexterm>
25081 </para>
25082 <informaltable frame="all">
25083 <tgroup cols="4" colsep="0" rowsep="0">
25084 <colspec colwidth="8*" align="left"/>
25085 <colspec colwidth="6*" align="center"/>
25086 <colspec colwidth="6*" align="center"/>
25087 <colspec colwidth="6*" align="right"/>
25088 <tbody>
25089 <row>
25090 <entry><option>never_users</option></entry>
25091 <entry>Use: <emphasis>main</emphasis></entry>
25092 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25093 <entry>Default: <emphasis>unset</emphasis></entry>
25094 </row>
25095 </tbody>
25096 </tgroup>
25097 </informaltable>
25098 <para>
25099 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
25100 message deliveries are normally run in processes that are setuid to the
25101 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
25102 It is usually desirable to prevent any deliveries from running as root, as a
25103 safety precaution.
25104 </para>
25105 <para>
25106 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
25107 list of users that must not be used for local deliveries. This list is fixed in
25108 the binary and cannot be overridden by the configuration file. By default, it
25109 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
25110 can be used to add more users to the fixed list.
25111 </para>
25112 <para>
25113 If a message is to be delivered as one of the users on the fixed list or the
25114 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
25115 example is
25116 </para>
25117 <literallayout class="monospaced">
25118 never_users = root:daemon:bin
25119 </literallayout>
25120 <para>
25121 Including root is redundant if it is also on the fixed list, but it does no
25122 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
25123 transport driver.
25124 </para>
25125 <para>
25126 <indexterm role="option">
25127 <primary><option>openssl_options</option></primary>
25128 </indexterm>
25129 </para>
25130 <informaltable frame="all">
25131 <tgroup cols="4" colsep="0" rowsep="0">
25132 <colspec colwidth="8*" align="left"/>
25133 <colspec colwidth="6*" align="center"/>
25134 <colspec colwidth="6*" align="center"/>
25135 <colspec colwidth="6*" align="right"/>
25136 <tbody>
25137 <row>
25138 <entry><option>openssl_options</option></entry>
25139 <entry>Use: <emphasis>main</emphasis></entry>
25140 <entry>Type: <emphasis>string list</emphasis></entry>
25141 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
25142 </row>
25143 </tbody>
25144 </tgroup>
25145 </informaltable>
25146 <para>
25147 <indexterm role="concept">
25148 <primary>OpenSSL </primary>
25149 <secondary>compatibility</secondary>
25150 </indexterm>
25151 This option allows an administrator to adjust the SSL options applied
25152 by OpenSSL to connections.  It is given as a space-separated list of items,
25153 each one to be +added or -subtracted from the current value.
25154 </para>
25155 <para>
25156 This option is only available if Exim is built against OpenSSL.  The values
25157 available for this option vary according to the age of your OpenSSL install.
25158 The <quote>all</quote> value controls a subset of flags which are available, typically
25159 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
25160 list the values known on your system and Exim should support all the
25161 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
25162 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
25163 </para>
25164 <para>
25165 Note that adjusting the options can have severe impact upon the security of
25166 SSL as used by Exim.  It is possible to disable safety checks and shoot
25167 yourself in the foot in various unpleasant ways.  This option should not be
25168 adjusted lightly.  An unrecognised item will be detected at startup, by
25169 invoking Exim with the <option>-bV</option> flag.
25170 </para>
25171 <para revisionflag="changed">
25172 Historical note: prior to release 4.80, Exim defaulted this value to
25173 "+dont_insert_empty_fragments", which may still be needed for compatibility
25174 with some clients, but which lowers security by increasing exposure to
25175 some now infamous attacks.
25176 </para>
25177 <para>
25178 An example:
25179 </para>
25180 <literallayout class="monospaced">
25181 # Make both old MS and old Eudora happy:
25182 openssl_options = -all +microsoft_big_sslv3_buffer \
25183                        +dont_insert_empty_fragments
25184 </literallayout>
25185 <para>
25186 Possible options may include:
25187 </para>
25188 <itemizedlist>
25189 <listitem>
25190 <para>
25191 <literal>all</literal>
25192 </para>
25193 </listitem>
25194 <listitem>
25195 <para>
25196 <literal>allow_unsafe_legacy_renegotiation</literal>
25197 </para>
25198 </listitem>
25199 <listitem>
25200 <para>
25201 <literal>cipher_server_preference</literal>
25202 </para>
25203 </listitem>
25204 <listitem>
25205 <para>
25206 <literal>dont_insert_empty_fragments</literal>
25207 </para>
25208 </listitem>
25209 <listitem>
25210 <para>
25211 <literal>ephemeral_rsa</literal>
25212 </para>
25213 </listitem>
25214 <listitem>
25215 <para>
25216 <literal>legacy_server_connect</literal>
25217 </para>
25218 </listitem>
25219 <listitem>
25220 <para>
25221 <literal>microsoft_big_sslv3_buffer</literal>
25222 </para>
25223 </listitem>
25224 <listitem>
25225 <para>
25226 <literal>microsoft_sess_id_bug</literal>
25227 </para>
25228 </listitem>
25229 <listitem>
25230 <para>
25231 <literal>msie_sslv2_rsa_padding</literal>
25232 </para>
25233 </listitem>
25234 <listitem>
25235 <para>
25236 <literal>netscape_challenge_bug</literal>
25237 </para>
25238 </listitem>
25239 <listitem>
25240 <para>
25241 <literal>netscape_reuse_cipher_change_bug</literal>
25242 </para>
25243 </listitem>
25244 <listitem>
25245 <para>
25246 <literal>no_compression</literal>
25247 </para>
25248 </listitem>
25249 <listitem>
25250 <para>
25251 <literal>no_session_resumption_on_renegotiation</literal>
25252 </para>
25253 </listitem>
25254 <listitem>
25255 <para>
25256 <literal>no_sslv2</literal>
25257 </para>
25258 </listitem>
25259 <listitem>
25260 <para>
25261 <literal>no_sslv3</literal>
25262 </para>
25263 </listitem>
25264 <listitem>
25265 <para>
25266 <literal>no_ticket</literal>
25267 </para>
25268 </listitem>
25269 <listitem>
25270 <para>
25271 <literal>no_tlsv1</literal>
25272 </para>
25273 </listitem>
25274 <listitem>
25275 <para>
25276 <literal>no_tlsv1_1</literal>
25277 </para>
25278 </listitem>
25279 <listitem>
25280 <para>
25281 <literal>no_tlsv1_2</literal>
25282 </para>
25283 </listitem>
25284 <listitem>
25285 <para>
25286 <literal>single_dh_use</literal>
25287 </para>
25288 </listitem>
25289 <listitem>
25290 <para>
25291 <literal>single_ecdh_use</literal>
25292 </para>
25293 </listitem>
25294 <listitem>
25295 <para>
25296 <literal>ssleay_080_client_dh_bug</literal>
25297 </para>
25298 </listitem>
25299 <listitem>
25300 <para>
25301 <literal>sslref2_reuse_cert_type_bug</literal>
25302 </para>
25303 </listitem>
25304 <listitem>
25305 <para>
25306 <literal>tls_block_padding_bug</literal>
25307 </para>
25308 </listitem>
25309 <listitem>
25310 <para>
25311 <literal>tls_d5_bug</literal>
25312 </para>
25313 </listitem>
25314 <listitem>
25315 <para>
25316 <literal>tls_rollback_bug</literal>
25317 </para>
25318 </listitem>
25319 </itemizedlist>
25320 <para>
25321 <indexterm role="option">
25322 <primary><option>oracle_servers</option></primary>
25323 </indexterm>
25324 </para>
25325 <informaltable frame="all">
25326 <tgroup cols="4" colsep="0" rowsep="0">
25327 <colspec colwidth="8*" align="left"/>
25328 <colspec colwidth="6*" align="center"/>
25329 <colspec colwidth="6*" align="center"/>
25330 <colspec colwidth="6*" align="right"/>
25331 <tbody>
25332 <row>
25333 <entry><option>oracle_servers</option></entry>
25334 <entry>Use: <emphasis>main</emphasis></entry>
25335 <entry>Type: <emphasis>string list</emphasis></entry>
25336 <entry>Default: <emphasis>unset</emphasis></entry>
25337 </row>
25338 </tbody>
25339 </tgroup>
25340 </informaltable>
25341 <para>
25342 <indexterm role="concept">
25343 <primary>Oracle</primary>
25344 <secondary>server list</secondary>
25345 </indexterm>
25346 This option provides a list of Oracle servers and associated connection data,
25347 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
25348 The option is available only if Exim has been built with Oracle support.
25349 </para>
25350 <para>
25351 <indexterm role="option">
25352 <primary><option>percent_hack_domains</option></primary>
25353 </indexterm>
25354 </para>
25355 <informaltable frame="all">
25356 <tgroup cols="4" colsep="0" rowsep="0">
25357 <colspec colwidth="8*" align="left"/>
25358 <colspec colwidth="6*" align="center"/>
25359 <colspec colwidth="6*" align="center"/>
25360 <colspec colwidth="6*" align="right"/>
25361 <tbody>
25362 <row>
25363 <entry><option>percent_hack_domains</option></entry>
25364 <entry>Use: <emphasis>main</emphasis></entry>
25365 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25366 <entry>Default: <emphasis>unset</emphasis></entry>
25367 </row>
25368 </tbody>
25369 </tgroup>
25370 </informaltable>
25371 <para>
25372 <indexterm role="concept">
25373 <primary><quote>percent hack</quote></primary>
25374 </indexterm>
25375 <indexterm role="concept">
25376 <primary>source routing</primary>
25377 <secondary>in email address</secondary>
25378 </indexterm>
25379 <indexterm role="concept">
25380 <primary>address</primary>
25381 <secondary>source-routed</secondary>
25382 </indexterm>
25383 The <quote>percent hack</quote> is the convention whereby a local part containing a
25384 percent sign is re-interpreted as a new email address, with the percent
25385 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
25386 also applied to RFC 2822 addresses that begin with an @ character. If this
25387 option is set, Exim implements the percent facility for those domains listed,
25388 but no others. This happens before an incoming SMTP address is tested against
25389 an ACL.
25390 </para>
25391 <para>
25392 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
25393 trying to get round relaying restrictions. For this reason, it is best avoided
25394 if at all possible. Unfortunately, a number of less security-conscious MTAs
25395 implement it unconditionally. If you are running Exim on a gateway host, and
25396 routing mail through to internal MTAs without processing the local parts, it is
25397 a good idea to reject recipient addresses with percent characters in their
25398 local parts. Exim&#x2019;s default configuration does this.
25399 </para>
25400 <para>
25401 <indexterm role="option">
25402 <primary><option>perl_at_start</option></primary>
25403 </indexterm>
25404 </para>
25405 <informaltable frame="all">
25406 <tgroup cols="4" colsep="0" rowsep="0">
25407 <colspec colwidth="8*" align="left"/>
25408 <colspec colwidth="6*" align="center"/>
25409 <colspec colwidth="6*" align="center"/>
25410 <colspec colwidth="6*" align="right"/>
25411 <tbody>
25412 <row>
25413 <entry><option>perl_at_start</option></entry>
25414 <entry>Use: <emphasis>main</emphasis></entry>
25415 <entry>Type: <emphasis>boolean</emphasis></entry>
25416 <entry>Default: <emphasis>false</emphasis></entry>
25417 </row>
25418 </tbody>
25419 </tgroup>
25420 </informaltable>
25421 <para>
25422 This option is available only when Exim is built with an embedded Perl
25423 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25424 </para>
25425 <para>
25426 <indexterm role="option">
25427 <primary><option>perl_startup</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>perl_startup</option></entry>
25439 <entry>Use: <emphasis>main</emphasis></entry>
25440 <entry>Type: <emphasis>string</emphasis></entry>
25441 <entry>Default: <emphasis>unset</emphasis></entry>
25442 </row>
25443 </tbody>
25444 </tgroup>
25445 </informaltable>
25446 <para>
25447 This option is available only when Exim is built with an embedded Perl
25448 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25449 </para>
25450 <para>
25451 <indexterm role="option">
25452 <primary><option>pgsql_servers</option></primary>
25453 </indexterm>
25454 </para>
25455 <informaltable frame="all">
25456 <tgroup cols="4" colsep="0" rowsep="0">
25457 <colspec colwidth="8*" align="left"/>
25458 <colspec colwidth="6*" align="center"/>
25459 <colspec colwidth="6*" align="center"/>
25460 <colspec colwidth="6*" align="right"/>
25461 <tbody>
25462 <row>
25463 <entry><option>pgsql_servers</option></entry>
25464 <entry>Use: <emphasis>main</emphasis></entry>
25465 <entry>Type: <emphasis>string list</emphasis></entry>
25466 <entry>Default: <emphasis>unset</emphasis></entry>
25467 </row>
25468 </tbody>
25469 </tgroup>
25470 </informaltable>
25471 <para>
25472 <indexterm role="concept">
25473 <primary>PostgreSQL lookup type</primary>
25474 <secondary>server list</secondary>
25475 </indexterm>
25476 This option provides a list of PostgreSQL servers and associated connection
25477 data, to be used in conjunction with <command>pgsql</command> lookups (see section
25478 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
25479 PostgreSQL support.
25480 </para>
25481 <para>
25482 <indexterm role="option">
25483 <primary><option>pid_file_path</option></primary>
25484 </indexterm>
25485 </para>
25486 <informaltable frame="all">
25487 <tgroup cols="4" colsep="0" rowsep="0">
25488 <colspec colwidth="8*" align="left"/>
25489 <colspec colwidth="6*" align="center"/>
25490 <colspec colwidth="6*" align="center"/>
25491 <colspec colwidth="6*" align="right"/>
25492 <tbody>
25493 <row>
25494 <entry><option>pid_file_path</option></entry>
25495 <entry>Use: <emphasis>main</emphasis></entry>
25496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25497 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25498 </row>
25499 </tbody>
25500 </tgroup>
25501 </informaltable>
25502 <para>
25503 <indexterm role="concept">
25504 <primary>daemon</primary>
25505 <secondary>pid file path</secondary>
25506 </indexterm>
25507 <indexterm role="concept">
25508 <primary>pid file, path for</primary>
25509 </indexterm>
25510 This option sets the name of the file to which the Exim daemon writes its
25511 process id. The string is expanded, so it can contain, for example, references
25512 to the host name:
25513 </para>
25514 <literallayout class="monospaced">
25515 pid_file_path = /var/log/$primary_hostname/exim.pid
25516 </literallayout>
25517 <para>
25518 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
25519 spool directory.
25520 The value set by the option can be overridden by the <option>-oP</option> command line
25521 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
25522 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
25523 </para>
25524 <para>
25525 <indexterm role="option">
25526 <primary><option>pipelining_advertise_hosts</option></primary>
25527 </indexterm>
25528 </para>
25529 <informaltable frame="all">
25530 <tgroup cols="4" colsep="0" rowsep="0">
25531 <colspec colwidth="8*" align="left"/>
25532 <colspec colwidth="6*" align="center"/>
25533 <colspec colwidth="6*" align="center"/>
25534 <colspec colwidth="6*" align="right"/>
25535 <tbody>
25536 <row>
25537 <entry><option>pipelining_advertise_hosts</option></entry>
25538 <entry>Use: <emphasis>main</emphasis></entry>
25539 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25540 <entry>Default: <emphasis>*</emphasis></entry>
25541 </row>
25542 </tbody>
25543 </tgroup>
25544 </informaltable>
25545 <para>
25546 <indexterm role="concept">
25547 <primary>PIPELINING</primary>
25548 <secondary>suppressing advertising</secondary>
25549 </indexterm>
25550 This option can be used to suppress the advertisement of the SMTP
25551 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
25552 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
25553 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
25554 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
25555 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
25556 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
25557 </para>
25558 <para>
25559 <indexterm role="option">
25560 <primary><option>preserve_message_logs</option></primary>
25561 </indexterm>
25562 </para>
25563 <informaltable frame="all">
25564 <tgroup cols="4" colsep="0" rowsep="0">
25565 <colspec colwidth="8*" align="left"/>
25566 <colspec colwidth="6*" align="center"/>
25567 <colspec colwidth="6*" align="center"/>
25568 <colspec colwidth="6*" align="right"/>
25569 <tbody>
25570 <row>
25571 <entry><option>preserve_message_logs</option></entry>
25572 <entry>Use: <emphasis>main</emphasis></entry>
25573 <entry>Type: <emphasis>boolean</emphasis></entry>
25574 <entry>Default: <emphasis>false</emphasis></entry>
25575 </row>
25576 </tbody>
25577 </tgroup>
25578 </informaltable>
25579 <para>
25580 <indexterm role="concept">
25581 <primary>message logs</primary>
25582 <secondary>preserving</secondary>
25583 </indexterm>
25584 If this option is set, message log files are not deleted when messages are
25585 completed. Instead, they are moved to a sub-directory of the spool directory
25586 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
25587 purposes. This is a dangerous option to set on systems with any appreciable
25588 volume of mail. Use with care!
25589 </para>
25590 <para>
25591 <indexterm role="option">
25592 <primary><option>primary_hostname</option></primary>
25593 </indexterm>
25594 </para>
25595 <informaltable frame="all">
25596 <tgroup cols="4" colsep="0" rowsep="0">
25597 <colspec colwidth="8*" align="left"/>
25598 <colspec colwidth="6*" align="center"/>
25599 <colspec colwidth="6*" align="center"/>
25600 <colspec colwidth="6*" align="right"/>
25601 <tbody>
25602 <row>
25603 <entry><option>primary_hostname</option></entry>
25604 <entry>Use: <emphasis>main</emphasis></entry>
25605 <entry>Type: <emphasis>string</emphasis></entry>
25606 <entry>Default: <emphasis>see below</emphasis></entry>
25607 </row>
25608 </tbody>
25609 </tgroup>
25610 </informaltable>
25611 <para>
25612 <indexterm role="concept">
25613 <primary>name</primary>
25614 <secondary>of local host</secondary>
25615 </indexterm>
25616 <indexterm role="concept">
25617 <primary>host</primary>
25618 <secondary>name of local</secondary>
25619 </indexterm>
25620 <indexterm role="concept">
25621 <primary>local host</primary>
25622 <secondary>name of</secondary>
25623 </indexterm>
25624 <indexterm role="variable">
25625 <primary><varname>$primary_hostname</varname></primary>
25626 </indexterm>
25627 This specifies the name of the current host. It is used in the default EHLO or
25628 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
25629 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
25630 The value is also used by default in some SMTP response messages from an Exim
25631 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
25632 </para>
25633 <para>
25634 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
25635 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
25636 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
25637 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
25638 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
25639 explicitly by this option, or defaulted.
25640 </para>
25641 <para>
25642 <indexterm role="option">
25643 <primary><option>print_topbitchars</option></primary>
25644 </indexterm>
25645 </para>
25646 <informaltable frame="all">
25647 <tgroup cols="4" colsep="0" rowsep="0">
25648 <colspec colwidth="8*" align="left"/>
25649 <colspec colwidth="6*" align="center"/>
25650 <colspec colwidth="6*" align="center"/>
25651 <colspec colwidth="6*" align="right"/>
25652 <tbody>
25653 <row>
25654 <entry><option>print_topbitchars</option></entry>
25655 <entry>Use: <emphasis>main</emphasis></entry>
25656 <entry>Type: <emphasis>boolean</emphasis></entry>
25657 <entry>Default: <emphasis>false</emphasis></entry>
25658 </row>
25659 </tbody>
25660 </tgroup>
25661 </informaltable>
25662 <para>
25663 <indexterm role="concept">
25664 <primary>printing characters</primary>
25665 </indexterm>
25666 <indexterm role="concept">
25667 <primary>8-bit characters</primary>
25668 </indexterm>
25669 By default, Exim considers only those characters whose codes lie in the range
25670 32&ndash;126 to be printing characters. In a number of circumstances (for example,
25671 when writing log entries) non-printing characters are converted into escape
25672 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
25673 is set, code values of 128 and above are also considered to be printing
25674 characters.
25675 </para>
25676 <para>
25677 This option also affects the header syntax checks performed by the
25678 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
25679 the user&#x2019;s full name when constructing From: and Sender: addresses (as
25680 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
25681 Exim to generate eight bit message headers that do not conform to the
25682 standards.
25683 </para>
25684 <para>
25685 <indexterm role="option">
25686 <primary><option>process_log_path</option></primary>
25687 </indexterm>
25688 </para>
25689 <informaltable frame="all">
25690 <tgroup cols="4" colsep="0" rowsep="0">
25691 <colspec colwidth="8*" align="left"/>
25692 <colspec colwidth="6*" align="center"/>
25693 <colspec colwidth="6*" align="center"/>
25694 <colspec colwidth="6*" align="right"/>
25695 <tbody>
25696 <row>
25697 <entry><option>process_log_path</option></entry>
25698 <entry>Use: <emphasis>main</emphasis></entry>
25699 <entry>Type: <emphasis>string</emphasis></entry>
25700 <entry>Default: <emphasis>unset</emphasis></entry>
25701 </row>
25702 </tbody>
25703 </tgroup>
25704 </informaltable>
25705 <para>
25706 <indexterm role="concept">
25707 <primary>process log path</primary>
25708 </indexterm>
25709 <indexterm role="concept">
25710 <primary>log</primary>
25711 <secondary>process log</secondary>
25712 </indexterm>
25713 <indexterm role="concept">
25714 <primary><emphasis>exiwhat</emphasis></primary>
25715 </indexterm>
25716 This option sets the name of the file to which an Exim process writes its
25717 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
25718 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
25719 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
25720 can be useful in environments where two different Exims are running, using
25721 different spool directories.
25722 </para>
25723 <para>
25724 <indexterm role="option">
25725 <primary><option>prod_requires_admin</option></primary>
25726 </indexterm>
25727 </para>
25728 <informaltable frame="all">
25729 <tgroup cols="4" colsep="0" rowsep="0">
25730 <colspec colwidth="8*" align="left"/>
25731 <colspec colwidth="6*" align="center"/>
25732 <colspec colwidth="6*" align="center"/>
25733 <colspec colwidth="6*" align="right"/>
25734 <tbody>
25735 <row>
25736 <entry><option>prod_requires_admin</option></entry>
25737 <entry>Use: <emphasis>main</emphasis></entry>
25738 <entry>Type: <emphasis>boolean</emphasis></entry>
25739 <entry>Default: <emphasis>true</emphasis></entry>
25740 </row>
25741 </tbody>
25742 </tgroup>
25743 </informaltable>
25744 <para>
25745 <indexterm role="option">
25746 <primary><option>-M</option></primary>
25747 </indexterm>
25748 <indexterm role="option">
25749 <primary><option>-R</option></primary>
25750 </indexterm>
25751 <indexterm role="option">
25752 <primary><option>-q</option></primary>
25753 </indexterm>
25754 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
25755 admin user unless <option>prod_requires_admin</option> is set false. See also
25756 <option>queue_list_requires_admin</option>.
25757 </para>
25758 <para>
25759 <indexterm role="option">
25760 <primary><option>qualify_domain</option></primary>
25761 </indexterm>
25762 </para>
25763 <informaltable frame="all">
25764 <tgroup cols="4" colsep="0" rowsep="0">
25765 <colspec colwidth="8*" align="left"/>
25766 <colspec colwidth="6*" align="center"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="right"/>
25769 <tbody>
25770 <row>
25771 <entry><option>qualify_domain</option></entry>
25772 <entry>Use: <emphasis>main</emphasis></entry>
25773 <entry>Type: <emphasis>string</emphasis></entry>
25774 <entry>Default: <emphasis>see below</emphasis></entry>
25775 </row>
25776 </tbody>
25777 </tgroup>
25778 </informaltable>
25779 <para>
25780 <indexterm role="concept">
25781 <primary>domain</primary>
25782 <secondary>for qualifying addresses</secondary>
25783 </indexterm>
25784 <indexterm role="concept">
25785 <primary>address</primary>
25786 <secondary>qualification</secondary>
25787 </indexterm>
25788 This option specifies the domain name that is added to any envelope sender
25789 addresses that do not have a domain qualification. It also applies to
25790 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
25791 are accepted by default only for locally-generated messages. Qualification is
25792 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
25793 locally-generated messages, unless the <option>-bnq</option> command line option is used.
25794 </para>
25795 <para>
25796 Messages from external sources must always contain fully qualified addresses,
25797 unless the sending host matches <option>sender_unqualified_hosts</option> or
25798 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
25799 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
25800 necessary. Internally, Exim always works with fully qualified envelope
25801 addresses. If <option>qualify_domain</option> is not set, it defaults to the
25802 <option>primary_hostname</option> value.
25803 </para>
25804 <para>
25805 <indexterm role="option">
25806 <primary><option>qualify_recipient</option></primary>
25807 </indexterm>
25808 </para>
25809 <informaltable frame="all">
25810 <tgroup cols="4" colsep="0" rowsep="0">
25811 <colspec colwidth="8*" align="left"/>
25812 <colspec colwidth="6*" align="center"/>
25813 <colspec colwidth="6*" align="center"/>
25814 <colspec colwidth="6*" align="right"/>
25815 <tbody>
25816 <row>
25817 <entry><option>qualify_recipient</option></entry>
25818 <entry>Use: <emphasis>main</emphasis></entry>
25819 <entry>Type: <emphasis>string</emphasis></entry>
25820 <entry>Default: <emphasis>see below</emphasis></entry>
25821 </row>
25822 </tbody>
25823 </tgroup>
25824 </informaltable>
25825 <para>
25826 This option allows you to specify a different domain for qualifying recipient
25827 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
25828 </para>
25829 <para>
25830 <indexterm role="option">
25831 <primary><option>queue_domains</option></primary>
25832 </indexterm>
25833 </para>
25834 <informaltable frame="all">
25835 <tgroup cols="4" colsep="0" rowsep="0">
25836 <colspec colwidth="8*" align="left"/>
25837 <colspec colwidth="6*" align="center"/>
25838 <colspec colwidth="6*" align="center"/>
25839 <colspec colwidth="6*" align="right"/>
25840 <tbody>
25841 <row>
25842 <entry><option>queue_domains</option></entry>
25843 <entry>Use: <emphasis>main</emphasis></entry>
25844 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25845 <entry>Default: <emphasis>unset</emphasis></entry>
25846 </row>
25847 </tbody>
25848 </tgroup>
25849 </informaltable>
25850 <para>
25851 <indexterm role="concept">
25852 <primary>domain</primary>
25853 <secondary>specifying non-immediate delivery</secondary>
25854 </indexterm>
25855 <indexterm role="concept">
25856 <primary>queueing incoming messages</primary>
25857 </indexterm>
25858 <indexterm role="concept">
25859 <primary>message</primary>
25860 <secondary>queueing certain domains</secondary>
25861 </indexterm>
25862 This option lists domains for which immediate delivery is not required.
25863 A delivery process is started whenever a message is received, but only those
25864 domains that do not match are processed. All other deliveries wait until the
25865 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25866 </para>
25867 <para>
25868 <indexterm role="option">
25869 <primary><option>queue_list_requires_admin</option></primary>
25870 </indexterm>
25871 </para>
25872 <informaltable frame="all">
25873 <tgroup cols="4" colsep="0" rowsep="0">
25874 <colspec colwidth="8*" align="left"/>
25875 <colspec colwidth="6*" align="center"/>
25876 <colspec colwidth="6*" align="center"/>
25877 <colspec colwidth="6*" align="right"/>
25878 <tbody>
25879 <row>
25880 <entry><option>queue_list_requires_admin</option></entry>
25881 <entry>Use: <emphasis>main</emphasis></entry>
25882 <entry>Type: <emphasis>boolean</emphasis></entry>
25883 <entry>Default: <emphasis>true</emphasis></entry>
25884 </row>
25885 </tbody>
25886 </tgroup>
25887 </informaltable>
25888 <para>
25889 <indexterm role="option">
25890 <primary><option>-bp</option></primary>
25891 </indexterm>
25892 The <option>-bp</option> command-line option, which lists the messages that are on the
25893 queue, requires the caller to be an admin user unless
25894 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25895 </para>
25896 <para>
25897 <indexterm role="option">
25898 <primary><option>queue_only</option></primary>
25899 </indexterm>
25900 </para>
25901 <informaltable frame="all">
25902 <tgroup cols="4" colsep="0" rowsep="0">
25903 <colspec colwidth="8*" align="left"/>
25904 <colspec colwidth="6*" align="center"/>
25905 <colspec colwidth="6*" align="center"/>
25906 <colspec colwidth="6*" align="right"/>
25907 <tbody>
25908 <row>
25909 <entry><option>queue_only</option></entry>
25910 <entry>Use: <emphasis>main</emphasis></entry>
25911 <entry>Type: <emphasis>boolean</emphasis></entry>
25912 <entry>Default: <emphasis>false</emphasis></entry>
25913 </row>
25914 </tbody>
25915 </tgroup>
25916 </informaltable>
25917 <para>
25918 <indexterm role="concept">
25919 <primary>queueing incoming messages</primary>
25920 </indexterm>
25921 <indexterm role="concept">
25922 <primary>message</primary>
25923 <secondary>queueing unconditionally</secondary>
25924 </indexterm>
25925 If <option>queue_only</option> is set, a delivery process is not automatically started
25926 whenever a message is received. Instead, the message waits on the queue for the
25927 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25928 delivered immediately when certain conditions (such as heavy load) occur.
25929 </para>
25930 <para>
25931 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25932 and <option>-odi</option> command line options override <option>queue_only</option> unless
25933 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25934 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25935 </para>
25936 <para>
25937 <indexterm role="option">
25938 <primary><option>queue_only_file</option></primary>
25939 </indexterm>
25940 </para>
25941 <informaltable frame="all">
25942 <tgroup cols="4" colsep="0" rowsep="0">
25943 <colspec colwidth="8*" align="left"/>
25944 <colspec colwidth="6*" align="center"/>
25945 <colspec colwidth="6*" align="center"/>
25946 <colspec colwidth="6*" align="right"/>
25947 <tbody>
25948 <row>
25949 <entry><option>queue_only_file</option></entry>
25950 <entry>Use: <emphasis>main</emphasis></entry>
25951 <entry>Type: <emphasis>string</emphasis></entry>
25952 <entry>Default: <emphasis>unset</emphasis></entry>
25953 </row>
25954 </tbody>
25955 </tgroup>
25956 </informaltable>
25957 <para>
25958 <indexterm role="concept">
25959 <primary>queueing incoming messages</primary>
25960 </indexterm>
25961 <indexterm role="concept">
25962 <primary>message</primary>
25963 <secondary>queueing by file existence</secondary>
25964 </indexterm>
25965 This option can be set to a colon-separated list of absolute path names, each
25966 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25967 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25968 each path that exists, the corresponding queueing option is set.
25969 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25970 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25971 </para>
25972 <literallayout class="monospaced">
25973 queue_only_file = smtp/some/file
25974 </literallayout>
25975 <para>
25976 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25977 <filename>/some/file</filename> exists.
25978 </para>
25979 <para>
25980 <indexterm role="option">
25981 <primary><option>queue_only_load</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>queue_only_load</option></entry>
25993 <entry>Use: <emphasis>main</emphasis></entry>
25994 <entry>Type: <emphasis>fixed-point</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>load average</primary>
26003 </indexterm>
26004 <indexterm role="concept">
26005 <primary>queueing incoming messages</primary>
26006 </indexterm>
26007 <indexterm role="concept">
26008 <primary>message</primary>
26009 <secondary>queueing by load</secondary>
26010 </indexterm>
26011 If the system load average is higher than this value, incoming messages from
26012 all sources are queued, and no automatic deliveries are started. If this
26013 happens during local or remote SMTP input, all subsequent messages received on
26014 the same SMTP connection are queued by default, whatever happens to the load in
26015 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
26016 false.
26017 </para>
26018 <para>
26019 Deliveries will subsequently be performed by queue runner processes. This
26020 option has no effect on ancient operating systems on which Exim cannot
26021 determine the load average. See also <option>deliver_queue_load_max</option> and
26022 <option>smtp_load_reserve</option>.
26023 </para>
26024 <para>
26025 <indexterm role="option">
26026 <primary><option>queue_only_load_latch</option></primary>
26027 </indexterm>
26028 </para>
26029 <informaltable frame="all">
26030 <tgroup cols="4" colsep="0" rowsep="0">
26031 <colspec colwidth="8*" align="left"/>
26032 <colspec colwidth="6*" align="center"/>
26033 <colspec colwidth="6*" align="center"/>
26034 <colspec colwidth="6*" align="right"/>
26035 <tbody>
26036 <row>
26037 <entry><option>queue_only_load_latch</option></entry>
26038 <entry>Use: <emphasis>main</emphasis></entry>
26039 <entry>Type: <emphasis>boolean</emphasis></entry>
26040 <entry>Default: <emphasis>true</emphasis></entry>
26041 </row>
26042 </tbody>
26043 </tgroup>
26044 </informaltable>
26045 <para>
26046 <indexterm role="concept">
26047 <primary>load average</primary>
26048 <secondary>re-evaluating per message</secondary>
26049 </indexterm>
26050 When this option is true (the default), once one message has been queued
26051 because the load average is higher than the value set by <option>queue_only_load</option>,
26052 all subsequent messages received on the same SMTP connection are also queued.
26053 This is a deliberate choice; even though the load average may fall below the
26054 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
26055 connection when not delivering earlier ones. However, there are special
26056 circumstances such as very long-lived connections from scanning appliances
26057 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
26058 should be set false. This causes the value of the load average to be
26059 re-evaluated for each message.
26060 </para>
26061 <para>
26062 <indexterm role="option">
26063 <primary><option>queue_only_override</option></primary>
26064 </indexterm>
26065 </para>
26066 <informaltable frame="all">
26067 <tgroup cols="4" colsep="0" rowsep="0">
26068 <colspec colwidth="8*" align="left"/>
26069 <colspec colwidth="6*" align="center"/>
26070 <colspec colwidth="6*" align="center"/>
26071 <colspec colwidth="6*" align="right"/>
26072 <tbody>
26073 <row>
26074 <entry><option>queue_only_override</option></entry>
26075 <entry>Use: <emphasis>main</emphasis></entry>
26076 <entry>Type: <emphasis>boolean</emphasis></entry>
26077 <entry>Default: <emphasis>true</emphasis></entry>
26078 </row>
26079 </tbody>
26080 </tgroup>
26081 </informaltable>
26082 <para>
26083 <indexterm role="concept">
26084 <primary>queueing incoming messages</primary>
26085 </indexterm>
26086 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
26087 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
26088 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
26089 to override; they are accepted, but ignored.
26090 </para>
26091 <para>
26092 <indexterm role="option">
26093 <primary><option>queue_run_in_order</option></primary>
26094 </indexterm>
26095 </para>
26096 <informaltable frame="all">
26097 <tgroup cols="4" colsep="0" rowsep="0">
26098 <colspec colwidth="8*" align="left"/>
26099 <colspec colwidth="6*" align="center"/>
26100 <colspec colwidth="6*" align="center"/>
26101 <colspec colwidth="6*" align="right"/>
26102 <tbody>
26103 <row>
26104 <entry><option>queue_run_in_order</option></entry>
26105 <entry>Use: <emphasis>main</emphasis></entry>
26106 <entry>Type: <emphasis>boolean</emphasis></entry>
26107 <entry>Default: <emphasis>false</emphasis></entry>
26108 </row>
26109 </tbody>
26110 </tgroup>
26111 </informaltable>
26112 <para>
26113 <indexterm role="concept">
26114 <primary>queue runner</primary>
26115 <secondary>processing messages in order</secondary>
26116 </indexterm>
26117 If this option is set, queue runs happen in order of message arrival instead of
26118 in an arbitrary order. For this to happen, a complete list of the entire queue
26119 must be set up before the deliveries start. When the queue is all held in a
26120 single directory (the default), a single list is created for both the ordered
26121 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
26122 single list is not created when <option>queue_run_in_order</option> is false. In this case,
26123 the sub-directories are processed one at a time (in a random order), and this
26124 avoids setting up one huge list for the whole queue. Thus, setting
26125 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
26126 when the queue is large, because of the extra work in setting up the single,
26127 large list. In most situations, <option>queue_run_in_order</option> should not be set.
26128 </para>
26129 <para>
26130 <indexterm role="option">
26131 <primary><option>queue_run_max</option></primary>
26132 </indexterm>
26133 </para>
26134 <informaltable frame="all">
26135 <tgroup cols="4" colsep="0" rowsep="0">
26136 <colspec colwidth="8*" align="left"/>
26137 <colspec colwidth="6*" align="center"/>
26138 <colspec colwidth="6*" align="center"/>
26139 <colspec colwidth="6*" align="right"/>
26140 <tbody>
26141 <row>
26142 <entry><option>queue_run_max</option></entry>
26143 <entry>Use: <emphasis>main</emphasis></entry>
26144 <entry>Type: <emphasis>integer</emphasis></entry>
26145 <entry>Default: <emphasis>5</emphasis></entry>
26146 </row>
26147 </tbody>
26148 </tgroup>
26149 </informaltable>
26150 <para>
26151 <indexterm role="concept">
26152 <primary>queue runner</primary>
26153 <secondary>maximum number of</secondary>
26154 </indexterm>
26155 This controls the maximum number of queue runner processes that an Exim daemon
26156 can run simultaneously. This does not mean that it starts them all at once,
26157 but rather that if the maximum number are still running when the time comes to
26158 start another one, it refrains from starting another one. This can happen with
26159 very large queues and/or very sluggish deliveries. This option does not,
26160 however, interlock with other processes, so additional queue runners can be
26161 started by other means, or by killing and restarting the daemon.
26162 </para>
26163 <para>
26164 Setting this option to zero does not suppress queue runs; rather, it disables
26165 the limit, allowing any number of simultaneous queue runner processes to be
26166 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
26167 the daemon&#x2019;s command line.
26168 </para>
26169 <para>
26170 <indexterm role="option">
26171 <primary><option>queue_smtp_domains</option></primary>
26172 </indexterm>
26173 </para>
26174 <informaltable frame="all">
26175 <tgroup cols="4" colsep="0" rowsep="0">
26176 <colspec colwidth="8*" align="left"/>
26177 <colspec colwidth="6*" align="center"/>
26178 <colspec colwidth="6*" align="center"/>
26179 <colspec colwidth="6*" align="right"/>
26180 <tbody>
26181 <row>
26182 <entry><option>queue_smtp_domains</option></entry>
26183 <entry>Use: <emphasis>main</emphasis></entry>
26184 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26185 <entry>Default: <emphasis>unset</emphasis></entry>
26186 </row>
26187 </tbody>
26188 </tgroup>
26189 </informaltable>
26190 <para>
26191 <indexterm role="concept">
26192 <primary>queueing incoming messages</primary>
26193 </indexterm>
26194 <indexterm role="concept">
26195 <primary>message</primary>
26196 <secondary>queueing remote deliveries</secondary>
26197 </indexterm>
26198 When this option is set, a delivery process is started whenever a message is
26199 received, routing is performed, and local deliveries take place.
26200 However, if any SMTP deliveries are required for domains that match
26201 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
26202 message waits on the queue for the next queue run. Since routing of the message
26203 has taken place, Exim knows to which remote hosts it must be delivered, and so
26204 when the queue run happens, multiple messages for the same host are delivered
26205 over a single SMTP connection. The <option>-odqs</option> command line option causes all
26206 SMTP deliveries to be queued in this way, and is equivalent to setting
26207 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
26208 <option>queue_domains</option>.
26209 </para>
26210 <para>
26211 <indexterm role="option">
26212 <primary><option>receive_timeout</option></primary>
26213 </indexterm>
26214 </para>
26215 <informaltable frame="all">
26216 <tgroup cols="4" colsep="0" rowsep="0">
26217 <colspec colwidth="8*" align="left"/>
26218 <colspec colwidth="6*" align="center"/>
26219 <colspec colwidth="6*" align="center"/>
26220 <colspec colwidth="6*" align="right"/>
26221 <tbody>
26222 <row>
26223 <entry><option>receive_timeout</option></entry>
26224 <entry>Use: <emphasis>main</emphasis></entry>
26225 <entry>Type: <emphasis>time</emphasis></entry>
26226 <entry>Default: <emphasis>0s</emphasis></entry>
26227 </row>
26228 </tbody>
26229 </tgroup>
26230 </informaltable>
26231 <para>
26232 <indexterm role="concept">
26233 <primary>timeout</primary>
26234 <secondary>for non-SMTP input</secondary>
26235 </indexterm>
26236 This option sets the timeout for accepting a non-SMTP message, that is, the
26237 maximum time that Exim waits when reading a message on the standard input. If
26238 the value is zero, it will wait for ever. This setting is overridden by the
26239 <option>-or</option> command line option. The timeout for incoming SMTP messages is
26240 controlled by <option>smtp_receive_timeout</option>.
26241 </para>
26242 <para>
26243 <indexterm role="option">
26244 <primary><option>received_header_text</option></primary>
26245 </indexterm>
26246 </para>
26247 <informaltable frame="all">
26248 <tgroup cols="4" colsep="0" rowsep="0">
26249 <colspec colwidth="8*" align="left"/>
26250 <colspec colwidth="6*" align="center"/>
26251 <colspec colwidth="6*" align="center"/>
26252 <colspec colwidth="6*" align="right"/>
26253 <tbody>
26254 <row>
26255 <entry><option>received_header_text</option></entry>
26256 <entry>Use: <emphasis>main</emphasis></entry>
26257 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26258 <entry>Default: <emphasis>see below</emphasis></entry>
26259 </row>
26260 </tbody>
26261 </tgroup>
26262 </informaltable>
26263 <para>
26264 <indexterm role="concept">
26265 <primary>customizing</primary>
26266 <secondary><emphasis>Received:</emphasis> header</secondary>
26267 </indexterm>
26268 <indexterm role="concept">
26269 <primary><emphasis>Received:</emphasis> header line</primary>
26270 <secondary>customizing</secondary>
26271 </indexterm>
26272 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
26273 added to each message, except for the timestamp, which is automatically added
26274 on at the end (preceded by a semicolon). The string is expanded each time it is
26275 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
26276 added to the message. Otherwise, the string should start with the text
26277 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
26278 header lines. The default setting is:
26279 </para>
26280 <literallayout class="monospaced">
26281 received_header_text = Received: \
26282   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
26283   {${if def:sender_ident \
26284   {from ${quote_local_part:$sender_ident} }}\
26285   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
26286   by $primary_hostname \
26287   ${if def:received_protocol {with $received_protocol}} \
26288   ${if def:tls_cipher {($tls_cipher)\n\t}}\
26289   (Exim $version_number)\n\t\
26290   ${if def:sender_address \
26291   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
26292   id $message_exim_id\
26293   ${if def:received_for {\n\tfor $received_for}}
26294 </literallayout>
26295 <para>
26296 The reference to the TLS cipher is omitted when Exim is built without TLS
26297 support. The use of conditional expansions ensures that this works for both
26298 locally generated messages and messages received from remote hosts, giving
26299 header lines such as the following:
26300 </para>
26301 <literallayout class="monospaced">
26302 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
26303 by marley.carol.example with esmtp (Exim 4.00)
26304 (envelope-from &lt;bob@carol.example&gt;)
26305 id 16IOWa-00019l-00
26306 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
26307 Received: by scrooge.carol.example with local (Exim 4.00)
26308 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
26309 </literallayout>
26310 <para>
26311 Until the body of the message has been received, the timestamp is the time when
26312 the message started to be received. Once the body has arrived, and all policy
26313 checks have taken place, the timestamp is updated to the time at which the
26314 message was accepted.
26315 </para>
26316 <para>
26317 <indexterm role="option">
26318 <primary><option>received_headers_max</option></primary>
26319 </indexterm>
26320 </para>
26321 <informaltable frame="all">
26322 <tgroup cols="4" colsep="0" rowsep="0">
26323 <colspec colwidth="8*" align="left"/>
26324 <colspec colwidth="6*" align="center"/>
26325 <colspec colwidth="6*" align="center"/>
26326 <colspec colwidth="6*" align="right"/>
26327 <tbody>
26328 <row>
26329 <entry><option>received_headers_max</option></entry>
26330 <entry>Use: <emphasis>main</emphasis></entry>
26331 <entry>Type: <emphasis>integer</emphasis></entry>
26332 <entry>Default: <emphasis>30</emphasis></entry>
26333 </row>
26334 </tbody>
26335 </tgroup>
26336 </informaltable>
26337 <para>
26338 <indexterm role="concept">
26339 <primary>loop</primary>
26340 <secondary>prevention</secondary>
26341 </indexterm>
26342 <indexterm role="concept">
26343 <primary>mail loop prevention</primary>
26344 </indexterm>
26345 <indexterm role="concept">
26346 <primary><emphasis>Received:</emphasis> header line</primary>
26347 <secondary>counting</secondary>
26348 </indexterm>
26349 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
26350 counted, and if it is greater than this parameter, a mail loop is assumed to
26351 have occurred, the delivery is abandoned, and an error message is generated.
26352 This applies to both local and remote deliveries.
26353 </para>
26354 <para>
26355 <indexterm role="option">
26356 <primary><option>recipient_unqualified_hosts</option></primary>
26357 </indexterm>
26358 </para>
26359 <informaltable frame="all">
26360 <tgroup cols="4" colsep="0" rowsep="0">
26361 <colspec colwidth="8*" align="left"/>
26362 <colspec colwidth="6*" align="center"/>
26363 <colspec colwidth="6*" align="center"/>
26364 <colspec colwidth="6*" align="right"/>
26365 <tbody>
26366 <row>
26367 <entry><option>recipient_unqualified_hosts</option></entry>
26368 <entry>Use: <emphasis>main</emphasis></entry>
26369 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26370 <entry>Default: <emphasis>unset</emphasis></entry>
26371 </row>
26372 </tbody>
26373 </tgroup>
26374 </informaltable>
26375 <para>
26376 <indexterm role="concept">
26377 <primary>unqualified addresses</primary>
26378 </indexterm>
26379 <indexterm role="concept">
26380 <primary>host</primary>
26381 <secondary>unqualified addresses from</secondary>
26382 </indexterm>
26383 This option lists those hosts from which Exim is prepared to accept unqualified
26384 recipient addresses in message envelopes. The addresses are made fully
26385 qualified by the addition of the <option>qualify_recipient</option> value. This option also
26386 affects message header lines. Exim does not reject unqualified recipient
26387 addresses in headers, but it qualifies them only if the message came from a
26388 host that matches <option>recipient_unqualified_hosts</option>,
26389 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
26390 option was not set.
26391 </para>
26392 <para>
26393 <indexterm role="option">
26394 <primary><option>recipients_max</option></primary>
26395 </indexterm>
26396 </para>
26397 <informaltable frame="all">
26398 <tgroup cols="4" colsep="0" rowsep="0">
26399 <colspec colwidth="8*" align="left"/>
26400 <colspec colwidth="6*" align="center"/>
26401 <colspec colwidth="6*" align="center"/>
26402 <colspec colwidth="6*" align="right"/>
26403 <tbody>
26404 <row>
26405 <entry><option>recipients_max</option></entry>
26406 <entry>Use: <emphasis>main</emphasis></entry>
26407 <entry>Type: <emphasis>integer</emphasis></entry>
26408 <entry>Default: <emphasis>0</emphasis></entry>
26409 </row>
26410 </tbody>
26411 </tgroup>
26412 </informaltable>
26413 <para>
26414 <indexterm role="concept">
26415 <primary>limit</primary>
26416 <secondary>number of recipients</secondary>
26417 </indexterm>
26418 <indexterm role="concept">
26419 <primary>recipient</primary>
26420 <secondary>maximum number</secondary>
26421 </indexterm>
26422 If this option is set greater than zero, it specifies the maximum number of
26423 original recipients for any message. Additional recipients that are generated
26424 by aliasing or forwarding do not count. SMTP messages get a 452 response for
26425 all recipients over the limit; earlier recipients are delivered as normal.
26426 Non-SMTP messages with too many recipients are failed, and no deliveries are
26427 done.
26428 </para>
26429 <para>
26430 <indexterm role="concept">
26431 <primary>RCPT</primary>
26432 <secondary>maximum number of incoming</secondary>
26433 </indexterm>
26434 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
26435 RCPT commands in a single message.
26436 </para>
26437 <para>
26438 <indexterm role="option">
26439 <primary><option>recipients_max_reject</option></primary>
26440 </indexterm>
26441 </para>
26442 <informaltable frame="all">
26443 <tgroup cols="4" colsep="0" rowsep="0">
26444 <colspec colwidth="8*" align="left"/>
26445 <colspec colwidth="6*" align="center"/>
26446 <colspec colwidth="6*" align="center"/>
26447 <colspec colwidth="6*" align="right"/>
26448 <tbody>
26449 <row>
26450 <entry><option>recipients_max_reject</option></entry>
26451 <entry>Use: <emphasis>main</emphasis></entry>
26452 <entry>Type: <emphasis>boolean</emphasis></entry>
26453 <entry>Default: <emphasis>false</emphasis></entry>
26454 </row>
26455 </tbody>
26456 </tgroup>
26457 </informaltable>
26458 <para>
26459 If this option is set true, Exim rejects SMTP messages containing too many
26460 recipients by giving 552 errors to the surplus RCPT commands, and a 554
26461 error to the eventual DATA command. Otherwise (the default) it gives a 452
26462 error to the surplus RCPT commands and accepts the message on behalf of the
26463 initial set of recipients. The remote server should then re-send the message
26464 for the remaining recipients at a later time.
26465 </para>
26466 <para>
26467 <indexterm role="option">
26468 <primary><option>remote_max_parallel</option></primary>
26469 </indexterm>
26470 </para>
26471 <informaltable frame="all">
26472 <tgroup cols="4" colsep="0" rowsep="0">
26473 <colspec colwidth="8*" align="left"/>
26474 <colspec colwidth="6*" align="center"/>
26475 <colspec colwidth="6*" align="center"/>
26476 <colspec colwidth="6*" align="right"/>
26477 <tbody>
26478 <row>
26479 <entry><option>remote_max_parallel</option></entry>
26480 <entry>Use: <emphasis>main</emphasis></entry>
26481 <entry>Type: <emphasis>integer</emphasis></entry>
26482 <entry>Default: <emphasis>2</emphasis></entry>
26483 </row>
26484 </tbody>
26485 </tgroup>
26486 </informaltable>
26487 <para>
26488 <indexterm role="concept">
26489 <primary>delivery</primary>
26490 <secondary>parallelism for remote</secondary>
26491 </indexterm>
26492 This option controls parallel delivery of one message to a number of remote
26493 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
26494 does all the remote deliveries for a message one by one. Otherwise, if a single
26495 message has to be delivered to more than one remote host, or if several copies
26496 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
26497 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
26498 deliveries are required, the maximum number of processes are started, and as
26499 each one finishes, another is begun. The order of starting processes is the
26500 same as if sequential delivery were being done, and can be controlled by the
26501 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
26502 with debugging turned on, the debugging output from each delivery process is
26503 tagged with its process id.
26504 </para>
26505 <para>
26506 This option controls only the maximum number of parallel deliveries for one
26507 message in one Exim delivery process. Because Exim has no central queue
26508 manager, there is no way of controlling the total number of simultaneous
26509 deliveries if the configuration allows a delivery attempt as soon as a message
26510 is received.
26511 </para>
26512 <para>
26513 <indexterm role="concept">
26514 <primary>number of deliveries</primary>
26515 </indexterm>
26516 <indexterm role="concept">
26517 <primary>delivery</primary>
26518 <secondary>maximum number of</secondary>
26519 </indexterm>
26520 If you want to control the total number of deliveries on the system, you
26521 need to set the <option>queue_only</option> option. This ensures that all incoming messages
26522 are added to the queue without starting a delivery process. Then set up an Exim
26523 daemon to start queue runner processes at appropriate intervals (probably
26524 fairly often, for example, every minute), and limit the total number of queue
26525 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
26526 delivers only one message at a time, the maximum number of deliveries that can
26527 then take place at once is <option>queue_run_max</option> multiplied by
26528 <option>remote_max_parallel</option>.
26529 </para>
26530 <para>
26531 If it is purely remote deliveries you want to control, use
26532 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
26533 doing the SMTP routing before queueing, so that several messages for the same
26534 host will eventually get delivered down the same connection.
26535 </para>
26536 <para>
26537 <indexterm role="option">
26538 <primary><option>remote_sort_domains</option></primary>
26539 </indexterm>
26540 </para>
26541 <informaltable frame="all">
26542 <tgroup cols="4" colsep="0" rowsep="0">
26543 <colspec colwidth="8*" align="left"/>
26544 <colspec colwidth="6*" align="center"/>
26545 <colspec colwidth="6*" align="center"/>
26546 <colspec colwidth="6*" align="right"/>
26547 <tbody>
26548 <row>
26549 <entry><option>remote_sort_domains</option></entry>
26550 <entry>Use: <emphasis>main</emphasis></entry>
26551 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26552 <entry>Default: <emphasis>unset</emphasis></entry>
26553 </row>
26554 </tbody>
26555 </tgroup>
26556 </informaltable>
26557 <para>
26558 <indexterm role="concept">
26559 <primary>sorting remote deliveries</primary>
26560 </indexterm>
26561 <indexterm role="concept">
26562 <primary>delivery</primary>
26563 <secondary>sorting remote</secondary>
26564 </indexterm>
26565 When there are a number of remote deliveries for a message, they are sorted by
26566 domain into the order given by this list. For example,
26567 </para>
26568 <literallayout class="monospaced">
26569 remote_sort_domains = *.cam.ac.uk:*.uk
26570 </literallayout>
26571 <para>
26572 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
26573 then to those in the <option>uk</option> domain, then to any others.
26574 </para>
26575 <para>
26576 <indexterm role="option">
26577 <primary><option>retry_data_expire</option></primary>
26578 </indexterm>
26579 </para>
26580 <informaltable frame="all">
26581 <tgroup cols="4" colsep="0" rowsep="0">
26582 <colspec colwidth="8*" align="left"/>
26583 <colspec colwidth="6*" align="center"/>
26584 <colspec colwidth="6*" align="center"/>
26585 <colspec colwidth="6*" align="right"/>
26586 <tbody>
26587 <row>
26588 <entry><option>retry_data_expire</option></entry>
26589 <entry>Use: <emphasis>main</emphasis></entry>
26590 <entry>Type: <emphasis>time</emphasis></entry>
26591 <entry>Default: <emphasis>7d</emphasis></entry>
26592 </row>
26593 </tbody>
26594 </tgroup>
26595 </informaltable>
26596 <para>
26597 <indexterm role="concept">
26598 <primary>hints database</primary>
26599 <secondary>data expiry</secondary>
26600 </indexterm>
26601 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
26602 database. Any older retry data is ignored. This means that, for example, once a
26603 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
26604 past failures.
26605 </para>
26606 <para>
26607 <indexterm role="option">
26608 <primary><option>retry_interval_max</option></primary>
26609 </indexterm>
26610 </para>
26611 <informaltable frame="all">
26612 <tgroup cols="4" colsep="0" rowsep="0">
26613 <colspec colwidth="8*" align="left"/>
26614 <colspec colwidth="6*" align="center"/>
26615 <colspec colwidth="6*" align="center"/>
26616 <colspec colwidth="6*" align="right"/>
26617 <tbody>
26618 <row>
26619 <entry><option>retry_interval_max</option></entry>
26620 <entry>Use: <emphasis>main</emphasis></entry>
26621 <entry>Type: <emphasis>time</emphasis></entry>
26622 <entry>Default: <emphasis>24h</emphasis></entry>
26623 </row>
26624 </tbody>
26625 </tgroup>
26626 </informaltable>
26627 <para>
26628 <indexterm role="concept">
26629 <primary>retry</primary>
26630 <secondary>limit on interval</secondary>
26631 </indexterm>
26632 <indexterm role="concept">
26633 <primary>limit</primary>
26634 <secondary>on retry interval</secondary>
26635 </indexterm>
26636 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
26637 intervals between delivery attempts for messages that cannot be delivered
26638 straight away. This option sets an overall limit to the length of time between
26639 retries. It cannot be set greater than 24 hours; any attempt to do so forces
26640 the default value.
26641 </para>
26642 <para>
26643 <indexterm role="option">
26644 <primary><option>return_path_remove</option></primary>
26645 </indexterm>
26646 </para>
26647 <informaltable frame="all">
26648 <tgroup cols="4" colsep="0" rowsep="0">
26649 <colspec colwidth="8*" align="left"/>
26650 <colspec colwidth="6*" align="center"/>
26651 <colspec colwidth="6*" align="center"/>
26652 <colspec colwidth="6*" align="right"/>
26653 <tbody>
26654 <row>
26655 <entry><option>return_path_remove</option></entry>
26656 <entry>Use: <emphasis>main</emphasis></entry>
26657 <entry>Type: <emphasis>boolean</emphasis></entry>
26658 <entry>Default: <emphasis>true</emphasis></entry>
26659 </row>
26660 </tbody>
26661 </tgroup>
26662 </informaltable>
26663 <para>
26664 <indexterm role="concept">
26665 <primary><emphasis>Return-path:</emphasis> header line</primary>
26666 <secondary>removing</secondary>
26667 </indexterm>
26668 RFC 2821, section 4.4, states that an SMTP server must insert a
26669 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
26670 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
26671 MAIL command. This description implies that this header should not be present
26672 in an incoming message. If <option>return_path_remove</option> is true, any existing
26673 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
26674 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
26675 the time of delivery. They are normally used only for final local deliveries.
26676 </para>
26677 <para>
26678 <indexterm role="option">
26679 <primary><option>return_size_limit</option></primary>
26680 </indexterm>
26681 </para>
26682 <informaltable frame="all">
26683 <tgroup cols="4" colsep="0" rowsep="0">
26684 <colspec colwidth="8*" align="left"/>
26685 <colspec colwidth="6*" align="center"/>
26686 <colspec colwidth="6*" align="center"/>
26687 <colspec colwidth="6*" align="right"/>
26688 <tbody>
26689 <row>
26690 <entry><option>return_size_limit</option></entry>
26691 <entry>Use: <emphasis>main</emphasis></entry>
26692 <entry>Type: <emphasis>integer</emphasis></entry>
26693 <entry>Default: <emphasis>100K</emphasis></entry>
26694 </row>
26695 </tbody>
26696 </tgroup>
26697 </informaltable>
26698 <para>
26699 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
26700 </para>
26701 <para>
26702 <indexterm role="option">
26703 <primary><option>rfc1413_hosts</option></primary>
26704 </indexterm>
26705 </para>
26706 <informaltable frame="all">
26707 <tgroup cols="4" colsep="0" rowsep="0">
26708 <colspec colwidth="8*" align="left"/>
26709 <colspec colwidth="6*" align="center"/>
26710 <colspec colwidth="6*" align="center"/>
26711 <colspec colwidth="6*" align="right"/>
26712 <tbody>
26713 <row>
26714 <entry><option>rfc1413_hosts</option></entry>
26715 <entry>Use: <emphasis>main</emphasis></entry>
26716 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26717 <entry>Default: <emphasis>*</emphasis></entry>
26718 </row>
26719 </tbody>
26720 </tgroup>
26721 </informaltable>
26722 <para>
26723 <indexterm role="concept">
26724 <primary>RFC 1413</primary>
26725 </indexterm>
26726 <indexterm role="concept">
26727 <primary>host</primary>
26728 <secondary>for RFC 1413 calls</secondary>
26729 </indexterm>
26730 RFC 1413 identification calls are made to any client host which matches an item
26731 in the list.
26732 </para>
26733 <para>
26734 <indexterm role="option">
26735 <primary><option>rfc1413_query_timeout</option></primary>
26736 </indexterm>
26737 </para>
26738 <informaltable frame="all">
26739 <tgroup cols="4" colsep="0" rowsep="0">
26740 <colspec colwidth="8*" align="left"/>
26741 <colspec colwidth="6*" align="center"/>
26742 <colspec colwidth="6*" align="center"/>
26743 <colspec colwidth="6*" align="right"/>
26744 <tbody>
26745 <row>
26746 <entry><option>rfc1413_query_timeout</option></entry>
26747 <entry>Use: <emphasis>main</emphasis></entry>
26748 <entry>Type: <emphasis>time</emphasis></entry>
26749 <entry>Default: <emphasis>5s</emphasis></entry>
26750 </row>
26751 </tbody>
26752 </tgroup>
26753 </informaltable>
26754 <para>
26755 <indexterm role="concept">
26756 <primary>RFC 1413</primary>
26757 <secondary>query timeout</secondary>
26758 </indexterm>
26759 <indexterm role="concept">
26760 <primary>timeout</primary>
26761 <secondary>for RFC 1413 call</secondary>
26762 </indexterm>
26763 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
26764 no RFC 1413 calls are ever made.
26765 </para>
26766 <para>
26767 <indexterm role="option">
26768 <primary><option>sender_unqualified_hosts</option></primary>
26769 </indexterm>
26770 </para>
26771 <informaltable frame="all">
26772 <tgroup cols="4" colsep="0" rowsep="0">
26773 <colspec colwidth="8*" align="left"/>
26774 <colspec colwidth="6*" align="center"/>
26775 <colspec colwidth="6*" align="center"/>
26776 <colspec colwidth="6*" align="right"/>
26777 <tbody>
26778 <row>
26779 <entry><option>sender_unqualified_hosts</option></entry>
26780 <entry>Use: <emphasis>main</emphasis></entry>
26781 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26782 <entry>Default: <emphasis>unset</emphasis></entry>
26783 </row>
26784 </tbody>
26785 </tgroup>
26786 </informaltable>
26787 <para>
26788 <indexterm role="concept">
26789 <primary>unqualified addresses</primary>
26790 </indexterm>
26791 <indexterm role="concept">
26792 <primary>host</primary>
26793 <secondary>unqualified addresses from</secondary>
26794 </indexterm>
26795 This option lists those hosts from which Exim is prepared to accept unqualified
26796 sender addresses. The addresses are made fully qualified by the addition of
26797 <option>qualify_domain</option>. This option also affects message header lines. Exim does
26798 not reject unqualified addresses in headers that contain sender addresses, but
26799 it qualifies them only if the message came from a host that matches
26800 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
26801 using TCP/IP), and the <option>-bnq</option> option was not set.
26802 </para>
26803 <para>
26804 <indexterm role="option">
26805 <primary><option>smtp_accept_keepalive</option></primary>
26806 </indexterm>
26807 </para>
26808 <informaltable frame="all">
26809 <tgroup cols="4" colsep="0" rowsep="0">
26810 <colspec colwidth="8*" align="left"/>
26811 <colspec colwidth="6*" align="center"/>
26812 <colspec colwidth="6*" align="center"/>
26813 <colspec colwidth="6*" align="right"/>
26814 <tbody>
26815 <row>
26816 <entry><option>smtp_accept_keepalive</option></entry>
26817 <entry>Use: <emphasis>main</emphasis></entry>
26818 <entry>Type: <emphasis>boolean</emphasis></entry>
26819 <entry>Default: <emphasis>true</emphasis></entry>
26820 </row>
26821 </tbody>
26822 </tgroup>
26823 </informaltable>
26824 <para>
26825 <indexterm role="concept">
26826 <primary>keepalive</primary>
26827 <secondary>on incoming connection</secondary>
26828 </indexterm>
26829 This option controls the setting of the SO_KEEPALIVE option on incoming
26830 TCP/IP socket connections. When set, it causes the kernel to probe idle
26831 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
26832 other end of the connection should send an acknowledgment if the connection is
26833 still okay or a reset if the connection has been aborted. The reason for doing
26834 this is that it has the beneficial effect of freeing up certain types of
26835 connection that can get stuck when the remote host is disconnected without
26836 tidying up the TCP/IP call properly. The keepalive mechanism takes several
26837 hours to detect unreachable hosts.
26838 </para>
26839 <para>
26840 <indexterm role="option">
26841 <primary><option>smtp_accept_max</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>smtp_accept_max</option></entry>
26853 <entry>Use: <emphasis>main</emphasis></entry>
26854 <entry>Type: <emphasis>integer</emphasis></entry>
26855 <entry>Default: <emphasis>20</emphasis></entry>
26856 </row>
26857 </tbody>
26858 </tgroup>
26859 </informaltable>
26860 <para>
26861 <indexterm role="concept">
26862 <primary>limit</primary>
26863 <secondary>incoming SMTP connections</secondary>
26864 </indexterm>
26865 <indexterm role="concept">
26866 <primary>SMTP</primary>
26867 <secondary>incoming connection count</secondary>
26868 </indexterm>
26869 <indexterm role="concept">
26870 <primary>inetd</primary>
26871 </indexterm>
26872 This option specifies the maximum number of simultaneous incoming SMTP calls
26873 that Exim will accept. It applies only to the listening daemon; there is no
26874 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26875 value is set to zero, no limit is applied. However, it is required to be
26876 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26877 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26878 </para>
26879 <para>
26880 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26881 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26882 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26883 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26884 </para>
26885 <para>
26886 <indexterm role="option">
26887 <primary><option>smtp_accept_max_nonmail</option></primary>
26888 </indexterm>
26889 </para>
26890 <informaltable frame="all">
26891 <tgroup cols="4" colsep="0" rowsep="0">
26892 <colspec colwidth="8*" align="left"/>
26893 <colspec colwidth="6*" align="center"/>
26894 <colspec colwidth="6*" align="center"/>
26895 <colspec colwidth="6*" align="right"/>
26896 <tbody>
26897 <row>
26898 <entry><option>smtp_accept_max_nonmail</option></entry>
26899 <entry>Use: <emphasis>main</emphasis></entry>
26900 <entry>Type: <emphasis>integer</emphasis></entry>
26901 <entry>Default: <emphasis>10</emphasis></entry>
26902 </row>
26903 </tbody>
26904 </tgroup>
26905 </informaltable>
26906 <para>
26907 <indexterm role="concept">
26908 <primary>limit</primary>
26909 <secondary>non-mail SMTP commands</secondary>
26910 </indexterm>
26911 <indexterm role="concept">
26912 <primary>SMTP</primary>
26913 <secondary>limiting non-mail commands</secondary>
26914 </indexterm>
26915 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26916 the connection if there are too many. This option defines <quote>too many</quote>. The
26917 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26918 client looping sending EHLO, for example. The check is applied only if the
26919 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26920 </para>
26921 <para>
26922 When a new message is expected, one occurrence of RSET is not counted. This
26923 allows a client to send one RSET between messages (this is not necessary,
26924 but some clients do it). Exim also allows one uncounted occurrence of HELO
26925 or EHLO, and one occurrence of STARTTLS between messages. After
26926 starting up a TLS session, another EHLO is expected, and so it too is not
26927 counted. The first occurrence of AUTH in a connection, or immediately
26928 following STARTTLS is not counted. Otherwise, all commands other than
26929 MAIL, RCPT, DATA, and QUIT are counted.
26930 </para>
26931 <para>
26932 <indexterm role="option">
26933 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26934 </indexterm>
26935 </para>
26936 <informaltable frame="all">
26937 <tgroup cols="4" colsep="0" rowsep="0">
26938 <colspec colwidth="8*" align="left"/>
26939 <colspec colwidth="6*" align="center"/>
26940 <colspec colwidth="6*" align="center"/>
26941 <colspec colwidth="6*" align="right"/>
26942 <tbody>
26943 <row>
26944 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26945 <entry>Use: <emphasis>main</emphasis></entry>
26946 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26947 <entry>Default: <emphasis>*</emphasis></entry>
26948 </row>
26949 </tbody>
26950 </tgroup>
26951 </informaltable>
26952 <para>
26953 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26954 check by setting this option. The default value makes it apply to all hosts. By
26955 changing the value, you can exclude any badly-behaved hosts that you have to
26956 live with.
26957 </para>
26958 <para>
26959 <indexterm role="option">
26960 <primary><option>smtp_accept_max_per_connection</option></primary>
26961 </indexterm>
26962 </para>
26963 <informaltable frame="all">
26964 <tgroup cols="4" colsep="0" rowsep="0">
26965 <colspec colwidth="8*" align="left"/>
26966 <colspec colwidth="6*" align="center"/>
26967 <colspec colwidth="6*" align="center"/>
26968 <colspec colwidth="6*" align="right"/>
26969 <tbody>
26970 <row>
26971 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26972 <entry>Use: <emphasis>main</emphasis></entry>
26973 <entry>Type: <emphasis>integer</emphasis></entry>
26974 <entry>Default: <emphasis>1000</emphasis></entry>
26975 </row>
26976 </tbody>
26977 </tgroup>
26978 </informaltable>
26979 <para>
26980 <indexterm role="concept">
26981 <primary>SMTP</primary>
26982 <secondary>limiting incoming message count</secondary>
26983 </indexterm>
26984 <indexterm role="concept">
26985 <primary>limit</primary>
26986 <secondary>messages per SMTP connection</secondary>
26987 </indexterm>
26988 The value of this option limits the number of MAIL commands that Exim is
26989 prepared to accept over a single SMTP connection, whether or not each command
26990 results in the transfer of a message. After the limit is reached, a 421
26991 response is given to subsequent MAIL commands. This limit is a safety
26992 precaution against a client that goes mad (incidents of this type have been
26993 seen).
26994 </para>
26995 <para>
26996 <indexterm role="option">
26997 <primary><option>smtp_accept_max_per_host</option></primary>
26998 </indexterm>
26999 </para>
27000 <informaltable frame="all">
27001 <tgroup cols="4" colsep="0" rowsep="0">
27002 <colspec colwidth="8*" align="left"/>
27003 <colspec colwidth="6*" align="center"/>
27004 <colspec colwidth="6*" align="center"/>
27005 <colspec colwidth="6*" align="right"/>
27006 <tbody>
27007 <row>
27008 <entry><option>smtp_accept_max_per_host</option></entry>
27009 <entry>Use: <emphasis>main</emphasis></entry>
27010 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27011 <entry>Default: <emphasis>unset</emphasis></entry>
27012 </row>
27013 </tbody>
27014 </tgroup>
27015 </informaltable>
27016 <para>
27017 <indexterm role="concept">
27018 <primary>limit</primary>
27019 <secondary>SMTP connections from one host</secondary>
27020 </indexterm>
27021 <indexterm role="concept">
27022 <primary>host</primary>
27023 <secondary>limiting SMTP connections from</secondary>
27024 </indexterm>
27025 This option restricts the number of simultaneous IP connections from a single
27026 host (strictly, from a single IP address) to the Exim daemon. The option is
27027 expanded, to enable different limits to be applied to different hosts by
27028 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
27029 connection attempts from the same host are rejected with error code 421. This
27030 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
27031 of zero imposes no limit. If this option is set greater than zero, it is
27032 required that <option>smtp_accept_max</option> be non-zero.
27033 </para>
27034 <para>
27035 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
27036 constructions that take an appreciable amount of time. The expansion and test
27037 happen in the main daemon loop, in order to reject additional connections
27038 without forking additional processes (otherwise a denial-of-service attack
27039 could cause a vast number or processes to be created). While the daemon is
27040 doing this processing, it cannot accept any other incoming connections.
27041 </para>
27042 <para>
27043 <indexterm role="option">
27044 <primary><option>smtp_accept_queue</option></primary>
27045 </indexterm>
27046 </para>
27047 <informaltable frame="all">
27048 <tgroup cols="4" colsep="0" rowsep="0">
27049 <colspec colwidth="8*" align="left"/>
27050 <colspec colwidth="6*" align="center"/>
27051 <colspec colwidth="6*" align="center"/>
27052 <colspec colwidth="6*" align="right"/>
27053 <tbody>
27054 <row>
27055 <entry><option>smtp_accept_queue</option></entry>
27056 <entry>Use: <emphasis>main</emphasis></entry>
27057 <entry>Type: <emphasis>integer</emphasis></entry>
27058 <entry>Default: <emphasis>0</emphasis></entry>
27059 </row>
27060 </tbody>
27061 </tgroup>
27062 </informaltable>
27063 <para>
27064 <indexterm role="concept">
27065 <primary>SMTP</primary>
27066 <secondary>incoming connection count</secondary>
27067 </indexterm>
27068 <indexterm role="concept">
27069 <primary>queueing incoming messages</primary>
27070 </indexterm>
27071 <indexterm role="concept">
27072 <primary>message</primary>
27073 <secondary>queueing by SMTP connection count</secondary>
27074 </indexterm>
27075 If the number of simultaneous incoming SMTP connections being handled via the
27076 listening daemon exceeds this value, messages received by SMTP are just placed
27077 on the queue; no delivery processes are started automatically. The count is
27078 fixed at the start of an SMTP connection. It cannot be updated in the
27079 subprocess that receives messages, and so the queueing or not queueing applies
27080 to all messages received in the same connection.
27081 </para>
27082 <para>
27083 A value of zero implies no limit, and clearly any non-zero value is useful only
27084 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
27085 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
27086 various <option>-od</option><emphasis>x</emphasis> command line options.
27087 </para>
27088 <para>
27089 <indexterm role="option">
27090 <primary><option>smtp_accept_queue_per_connection</option></primary>
27091 </indexterm>
27092 </para>
27093 <informaltable frame="all">
27094 <tgroup cols="4" colsep="0" rowsep="0">
27095 <colspec colwidth="8*" align="left"/>
27096 <colspec colwidth="6*" align="center"/>
27097 <colspec colwidth="6*" align="center"/>
27098 <colspec colwidth="6*" align="right"/>
27099 <tbody>
27100 <row>
27101 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
27102 <entry>Use: <emphasis>main</emphasis></entry>
27103 <entry>Type: <emphasis>integer</emphasis></entry>
27104 <entry>Default: <emphasis>10</emphasis></entry>
27105 </row>
27106 </tbody>
27107 </tgroup>
27108 </informaltable>
27109 <para>
27110 <indexterm role="concept">
27111 <primary>queueing incoming messages</primary>
27112 </indexterm>
27113 <indexterm role="concept">
27114 <primary>message</primary>
27115 <secondary>queueing by message count</secondary>
27116 </indexterm>
27117 This option limits the number of delivery processes that Exim starts
27118 automatically when receiving messages via SMTP, whether via the daemon or by
27119 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
27120 and the number of messages received in a single SMTP session exceeds this
27121 number, subsequent messages are placed on the queue, but no delivery processes
27122 are started. This helps to limit the number of Exim processes when a server
27123 restarts after downtime and there is a lot of mail waiting for it on other
27124 systems. On large systems, the default should probably be increased, and on
27125 dial-in client systems it should probably be set to zero (that is, disabled).
27126 </para>
27127 <para>
27128 <indexterm role="option">
27129 <primary><option>smtp_accept_reserve</option></primary>
27130 </indexterm>
27131 </para>
27132 <informaltable frame="all">
27133 <tgroup cols="4" colsep="0" rowsep="0">
27134 <colspec colwidth="8*" align="left"/>
27135 <colspec colwidth="6*" align="center"/>
27136 <colspec colwidth="6*" align="center"/>
27137 <colspec colwidth="6*" align="right"/>
27138 <tbody>
27139 <row>
27140 <entry><option>smtp_accept_reserve</option></entry>
27141 <entry>Use: <emphasis>main</emphasis></entry>
27142 <entry>Type: <emphasis>integer</emphasis></entry>
27143 <entry>Default: <emphasis>0</emphasis></entry>
27144 </row>
27145 </tbody>
27146 </tgroup>
27147 </informaltable>
27148 <para>
27149 <indexterm role="concept">
27150 <primary>SMTP</primary>
27151 <secondary>incoming call count</secondary>
27152 </indexterm>
27153 <indexterm role="concept">
27154 <primary>host</primary>
27155 <secondary>reserved</secondary>
27156 </indexterm>
27157 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
27158 number of SMTP connections that are reserved for connections from the hosts
27159 that are specified in <option>smtp_reserve_hosts</option>. The value set in
27160 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
27161 restricted to this number of connections; the option specifies a minimum number
27162 of connection slots for them, not a maximum. It is a guarantee that this group
27163 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
27164 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
27165 individual host.
27166 </para>
27167 <para>
27168 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
27169 set to 5, once there are 45 active connections (from any hosts), new
27170 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
27171 provided the other criteria for acceptance are met.
27172 </para>
27173 <para>
27174 <indexterm role="option">
27175 <primary><option>smtp_active_hostname</option></primary>
27176 </indexterm>
27177 </para>
27178 <informaltable frame="all">
27179 <tgroup cols="4" colsep="0" rowsep="0">
27180 <colspec colwidth="8*" align="left"/>
27181 <colspec colwidth="6*" align="center"/>
27182 <colspec colwidth="6*" align="center"/>
27183 <colspec colwidth="6*" align="right"/>
27184 <tbody>
27185 <row>
27186 <entry><option>smtp_active_hostname</option></entry>
27187 <entry>Use: <emphasis>main</emphasis></entry>
27188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27189 <entry>Default: <emphasis>unset</emphasis></entry>
27190 </row>
27191 </tbody>
27192 </tgroup>
27193 </informaltable>
27194 <para>
27195 <indexterm role="concept">
27196 <primary>host</primary>
27197 <secondary>name in SMTP responses</secondary>
27198 </indexterm>
27199 <indexterm role="concept">
27200 <primary>SMTP</primary>
27201 <secondary>host name in responses</secondary>
27202 </indexterm>
27203 <indexterm role="variable">
27204 <primary><varname>$primary_hostname</varname></primary>
27205 </indexterm>
27206 This option is provided for multi-homed servers that want to masquerade as
27207 several different hosts. At the start of an incoming SMTP connection, its value
27208 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
27209 responses. For example, it is used as domain name in the response to an
27210 incoming HELO or EHLO command.
27211 </para>
27212 <para>
27213 <indexterm role="variable">
27214 <primary><varname>$smtp_active_hostname</varname></primary>
27215 </indexterm>
27216 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
27217 is saved with any messages that are received. It is therefore available for use
27218 in routers and transports when the message is later delivered.
27219 </para>
27220 <para>
27221 If this option is unset, or if its expansion is forced to fail, or if the
27222 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
27223 used. Other expansion failures cause a message to be written to the main and
27224 panic logs, and the SMTP command receives a temporary error. Typically, the
27225 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
27226 For example:
27227 </para>
27228 <literallayout class="monospaced">
27229 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
27230   {cox.mydomain}{box.mydomain}}
27231 </literallayout>
27232 <para>
27233 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
27234 messages, it is also used as the default for HELO commands in callout
27235 verification if there is no remote transport from which to obtain a
27236 <option>helo_data</option> value.
27237 </para>
27238 <para>
27239 <indexterm role="option">
27240 <primary><option>smtp_banner</option></primary>
27241 </indexterm>
27242 </para>
27243 <informaltable frame="all">
27244 <tgroup cols="4" colsep="0" rowsep="0">
27245 <colspec colwidth="8*" align="left"/>
27246 <colspec colwidth="6*" align="center"/>
27247 <colspec colwidth="6*" align="center"/>
27248 <colspec colwidth="6*" align="right"/>
27249 <tbody>
27250 <row>
27251 <entry><option>smtp_banner</option></entry>
27252 <entry>Use: <emphasis>main</emphasis></entry>
27253 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27254 <entry>Default: <emphasis>see below</emphasis></entry>
27255 </row>
27256 </tbody>
27257 </tgroup>
27258 </informaltable>
27259 <para>
27260 <indexterm role="concept">
27261 <primary>SMTP</primary>
27262 <secondary>welcome banner</secondary>
27263 </indexterm>
27264 <indexterm role="concept">
27265 <primary>banner for SMTP</primary>
27266 </indexterm>
27267 <indexterm role="concept">
27268 <primary>welcome banner for SMTP</primary>
27269 </indexterm>
27270 <indexterm role="concept">
27271 <primary>customizing</primary>
27272 <secondary>SMTP banner</secondary>
27273 </indexterm>
27274 This string, which is expanded every time it is used, is output as the initial
27275 positive response to an SMTP connection. The default setting is:
27276 </para>
27277 <literallayout class="monospaced">
27278 smtp_banner = $smtp_active_hostname ESMTP Exim \
27279   $version_number $tod_full
27280 </literallayout>
27281 <para>
27282 Failure to expand the string causes a panic error. If you want to create a
27283 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
27284 appropriate points, but not at the end. Note that the 220 code is not included
27285 in this string. Exim adds it automatically (several times in the case of a
27286 multiline response).
27287 </para>
27288 <para>
27289 <indexterm role="option">
27290 <primary><option>smtp_check_spool_space</option></primary>
27291 </indexterm>
27292 </para>
27293 <informaltable frame="all">
27294 <tgroup cols="4" colsep="0" rowsep="0">
27295 <colspec colwidth="8*" align="left"/>
27296 <colspec colwidth="6*" align="center"/>
27297 <colspec colwidth="6*" align="center"/>
27298 <colspec colwidth="6*" align="right"/>
27299 <tbody>
27300 <row>
27301 <entry><option>smtp_check_spool_space</option></entry>
27302 <entry>Use: <emphasis>main</emphasis></entry>
27303 <entry>Type: <emphasis>boolean</emphasis></entry>
27304 <entry>Default: <emphasis>true</emphasis></entry>
27305 </row>
27306 </tbody>
27307 </tgroup>
27308 </informaltable>
27309 <para>
27310 <indexterm role="concept">
27311 <primary>checking disk space</primary>
27312 </indexterm>
27313 <indexterm role="concept">
27314 <primary>disk space, checking</primary>
27315 </indexterm>
27316 <indexterm role="concept">
27317 <primary>spool directory</primary>
27318 <secondary>checking space</secondary>
27319 </indexterm>
27320 When this option is set, if an incoming SMTP session encounters the SIZE
27321 option on a MAIL command, it checks that there is enough space in the
27322 spool directory&#x2019;s partition to accept a message of that size, while still
27323 leaving free the amount specified by <option>check_spool_space</option> (even if that value
27324 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
27325 </para>
27326 <para>
27327 <indexterm role="option">
27328 <primary><option>smtp_connect_backlog</option></primary>
27329 </indexterm>
27330 </para>
27331 <informaltable frame="all">
27332 <tgroup cols="4" colsep="0" rowsep="0">
27333 <colspec colwidth="8*" align="left"/>
27334 <colspec colwidth="6*" align="center"/>
27335 <colspec colwidth="6*" align="center"/>
27336 <colspec colwidth="6*" align="right"/>
27337 <tbody>
27338 <row>
27339 <entry><option>smtp_connect_backlog</option></entry>
27340 <entry>Use: <emphasis>main</emphasis></entry>
27341 <entry>Type: <emphasis>integer</emphasis></entry>
27342 <entry>Default: <emphasis>20</emphasis></entry>
27343 </row>
27344 </tbody>
27345 </tgroup>
27346 </informaltable>
27347 <para>
27348 <indexterm role="concept">
27349 <primary>connection backlog</primary>
27350 </indexterm>
27351 <indexterm role="concept">
27352 <primary>SMTP</primary>
27353 <secondary>connection backlog</secondary>
27354 </indexterm>
27355 <indexterm role="concept">
27356 <primary>backlog of connections</primary>
27357 </indexterm>
27358 This option specifies a maximum number of waiting SMTP connections. Exim passes
27359 this value to the TCP/IP system when it sets up its listener. Once this number
27360 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
27361 attempts are refused at the TCP/IP level. At least, that is what the manuals
27362 say; in some circumstances such connection attempts have been observed to time
27363 out instead. For large systems it is probably a good idea to increase the
27364 value (to 50, say). It also gives some protection against denial-of-service
27365 attacks by SYN flooding.
27366 </para>
27367 <para>
27368 <indexterm role="option">
27369 <primary><option>smtp_enforce_sync</option></primary>
27370 </indexterm>
27371 </para>
27372 <informaltable frame="all">
27373 <tgroup cols="4" colsep="0" rowsep="0">
27374 <colspec colwidth="8*" align="left"/>
27375 <colspec colwidth="6*" align="center"/>
27376 <colspec colwidth="6*" align="center"/>
27377 <colspec colwidth="6*" align="right"/>
27378 <tbody>
27379 <row>
27380 <entry><option>smtp_enforce_sync</option></entry>
27381 <entry>Use: <emphasis>main</emphasis></entry>
27382 <entry>Type: <emphasis>boolean</emphasis></entry>
27383 <entry>Default: <emphasis>true</emphasis></entry>
27384 </row>
27385 </tbody>
27386 </tgroup>
27387 </informaltable>
27388 <para>
27389 <indexterm role="concept">
27390 <primary>SMTP</primary>
27391 <secondary>synchronization checking</secondary>
27392 </indexterm>
27393 <indexterm role="concept">
27394 <primary>synchronization checking in SMTP</primary>
27395 </indexterm>
27396 The SMTP protocol specification requires the client to wait for a response from
27397 the server at certain points in the dialogue. Without PIPELINING these
27398 synchronization points are after every command; with PIPELINING they are
27399 fewer, but they still exist.
27400 </para>
27401 <para>
27402 Some spamming sites send out a complete set of SMTP commands without waiting
27403 for any response. Exim protects against this by rejecting a message if the
27404 client has sent further input when it should not have. The error response <quote>554
27405 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
27406 for this error cannot be perfect because of transmission delays (unexpected
27407 input may be on its way but not yet received when Exim checks). However, it
27408 does detect many instances.
27409 </para>
27410 <para>
27411 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
27412 If you want to disable the check selectively (for example, only for certain
27413 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
27414 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
27415 </para>
27416 <para>
27417 <indexterm role="option">
27418 <primary><option>smtp_etrn_command</option></primary>
27419 </indexterm>
27420 </para>
27421 <informaltable frame="all">
27422 <tgroup cols="4" colsep="0" rowsep="0">
27423 <colspec colwidth="8*" align="left"/>
27424 <colspec colwidth="6*" align="center"/>
27425 <colspec colwidth="6*" align="center"/>
27426 <colspec colwidth="6*" align="right"/>
27427 <tbody>
27428 <row>
27429 <entry><option>smtp_etrn_command</option></entry>
27430 <entry>Use: <emphasis>main</emphasis></entry>
27431 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27432 <entry>Default: <emphasis>unset</emphasis></entry>
27433 </row>
27434 </tbody>
27435 </tgroup>
27436 </informaltable>
27437 <para>
27438 <indexterm role="concept">
27439 <primary>ETRN</primary>
27440 <secondary>command to be run</secondary>
27441 </indexterm>
27442 <indexterm role="variable">
27443 <primary><varname>$domain</varname></primary>
27444 </indexterm>
27445 If this option is set, the given command is run whenever an SMTP ETRN
27446 command is received from a host that is permitted to issue such commands (see
27447 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
27448 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
27449 argument of the ETRN command, and no syntax checking is done on it. For
27450 example:
27451 </para>
27452 <literallayout class="monospaced">
27453 smtp_etrn_command = /etc/etrn_command $domain \
27454                     $sender_host_address
27455 </literallayout>
27456 <para>
27457 A new process is created to run the command, but Exim does not wait for it to
27458 complete. Consequently, its status cannot be checked. If the command cannot be
27459 run, a line is written to the panic log, but the ETRN caller still receives
27460 a 250 success response. Exim is normally running under its own uid when
27461 receiving SMTP, so it is not possible for it to change the uid before running
27462 the command.
27463 </para>
27464 <para>
27465 <indexterm role="option">
27466 <primary><option>smtp_etrn_serialize</option></primary>
27467 </indexterm>
27468 </para>
27469 <informaltable frame="all">
27470 <tgroup cols="4" colsep="0" rowsep="0">
27471 <colspec colwidth="8*" align="left"/>
27472 <colspec colwidth="6*" align="center"/>
27473 <colspec colwidth="6*" align="center"/>
27474 <colspec colwidth="6*" align="right"/>
27475 <tbody>
27476 <row>
27477 <entry><option>smtp_etrn_serialize</option></entry>
27478 <entry>Use: <emphasis>main</emphasis></entry>
27479 <entry>Type: <emphasis>boolean</emphasis></entry>
27480 <entry>Default: <emphasis>true</emphasis></entry>
27481 </row>
27482 </tbody>
27483 </tgroup>
27484 </informaltable>
27485 <para>
27486 <indexterm role="concept">
27487 <primary>ETRN</primary>
27488 <secondary>serializing</secondary>
27489 </indexterm>
27490 When this option is set, it prevents the simultaneous execution of more than
27491 one identical command as a result of ETRN in an SMTP connection. See
27492 section <xref linkend="SECTETRN"/> for details.
27493 </para>
27494 <para>
27495 <indexterm role="option">
27496 <primary><option>smtp_load_reserve</option></primary>
27497 </indexterm>
27498 </para>
27499 <informaltable frame="all">
27500 <tgroup cols="4" colsep="0" rowsep="0">
27501 <colspec colwidth="8*" align="left"/>
27502 <colspec colwidth="6*" align="center"/>
27503 <colspec colwidth="6*" align="center"/>
27504 <colspec colwidth="6*" align="right"/>
27505 <tbody>
27506 <row>
27507 <entry><option>smtp_load_reserve</option></entry>
27508 <entry>Use: <emphasis>main</emphasis></entry>
27509 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27510 <entry>Default: <emphasis>unset</emphasis></entry>
27511 </row>
27512 </tbody>
27513 </tgroup>
27514 </informaltable>
27515 <para>
27516 <indexterm role="concept">
27517 <primary>load average</primary>
27518 </indexterm>
27519 If the system load average ever gets higher than this, incoming SMTP calls are
27520 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
27521 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
27522 the load is over the limit. The option has no effect on ancient operating
27523 systems on which Exim cannot determine the load average. See also
27524 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
27525 </para>
27526 <para>
27527 <indexterm role="option">
27528 <primary><option>smtp_max_synprot_errors</option></primary>
27529 </indexterm>
27530 </para>
27531 <informaltable frame="all">
27532 <tgroup cols="4" colsep="0" rowsep="0">
27533 <colspec colwidth="8*" align="left"/>
27534 <colspec colwidth="6*" align="center"/>
27535 <colspec colwidth="6*" align="center"/>
27536 <colspec colwidth="6*" align="right"/>
27537 <tbody>
27538 <row>
27539 <entry><option>smtp_max_synprot_errors</option></entry>
27540 <entry>Use: <emphasis>main</emphasis></entry>
27541 <entry>Type: <emphasis>integer</emphasis></entry>
27542 <entry>Default: <emphasis>3</emphasis></entry>
27543 </row>
27544 </tbody>
27545 </tgroup>
27546 </informaltable>
27547 <para>
27548 <indexterm role="concept">
27549 <primary>SMTP</primary>
27550 <secondary>limiting syntax and protocol errors</secondary>
27551 </indexterm>
27552 <indexterm role="concept">
27553 <primary>limit</primary>
27554 <secondary>SMTP syntax and protocol errors</secondary>
27555 </indexterm>
27556 Exim rejects SMTP commands that contain syntax or protocol errors. In
27557 particular, a syntactically invalid email address, as in this command:
27558 </para>
27559 <literallayout class="monospaced">
27560 RCPT TO:&lt;abc xyz@a.b.c&gt;
27561 </literallayout>
27562 <para>
27563 causes immediate rejection of the command, before any other tests are done.
27564 (The ACL cannot be run if there is no valid address to set up for it.) An
27565 example of a protocol error is receiving RCPT before MAIL. If there are
27566 too many syntax or protocol errors in one SMTP session, the connection is
27567 dropped. The limit is set by this option.
27568 </para>
27569 <para>
27570 <indexterm role="concept">
27571 <primary>PIPELINING</primary>
27572 <secondary>expected errors</secondary>
27573 </indexterm>
27574 When the PIPELINING extension to SMTP is in use, some protocol errors are
27575 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
27576 Exim assumes that PIPELINING will be used if it advertises it (see
27577 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
27578 not count towards the limit.
27579 </para>
27580 <para>
27581 <indexterm role="option">
27582 <primary><option>smtp_max_unknown_commands</option></primary>
27583 </indexterm>
27584 </para>
27585 <informaltable frame="all">
27586 <tgroup cols="4" colsep="0" rowsep="0">
27587 <colspec colwidth="8*" align="left"/>
27588 <colspec colwidth="6*" align="center"/>
27589 <colspec colwidth="6*" align="center"/>
27590 <colspec colwidth="6*" align="right"/>
27591 <tbody>
27592 <row>
27593 <entry><option>smtp_max_unknown_commands</option></entry>
27594 <entry>Use: <emphasis>main</emphasis></entry>
27595 <entry>Type: <emphasis>integer</emphasis></entry>
27596 <entry>Default: <emphasis>3</emphasis></entry>
27597 </row>
27598 </tbody>
27599 </tgroup>
27600 </informaltable>
27601 <para>
27602 <indexterm role="concept">
27603 <primary>SMTP</primary>
27604 <secondary>limiting unknown commands</secondary>
27605 </indexterm>
27606 <indexterm role="concept">
27607 <primary>limit</primary>
27608 <secondary>unknown SMTP commands</secondary>
27609 </indexterm>
27610 If there are too many unrecognized commands in an incoming SMTP session, an
27611 Exim server drops the connection. This is a defence against some kinds of abuse
27612 that subvert web
27613 clients
27614 into making connections to SMTP ports; in these circumstances, a number of
27615 non-SMTP command lines are sent first.
27616 </para>
27617 <para>
27618 <indexterm role="option">
27619 <primary><option>smtp_ratelimit_hosts</option></primary>
27620 </indexterm>
27621 </para>
27622 <informaltable frame="all">
27623 <tgroup cols="4" colsep="0" rowsep="0">
27624 <colspec colwidth="8*" align="left"/>
27625 <colspec colwidth="6*" align="center"/>
27626 <colspec colwidth="6*" align="center"/>
27627 <colspec colwidth="6*" align="right"/>
27628 <tbody>
27629 <row>
27630 <entry><option>smtp_ratelimit_hosts</option></entry>
27631 <entry>Use: <emphasis>main</emphasis></entry>
27632 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27633 <entry>Default: <emphasis>unset</emphasis></entry>
27634 </row>
27635 </tbody>
27636 </tgroup>
27637 </informaltable>
27638 <para>
27639 <indexterm role="concept">
27640 <primary>SMTP</primary>
27641 <secondary>rate limiting</secondary>
27642 </indexterm>
27643 <indexterm role="concept">
27644 <primary>limit</primary>
27645 <secondary>rate of message arrival</secondary>
27646 </indexterm>
27647 <indexterm role="concept">
27648 <primary>RCPT</primary>
27649 <secondary>rate limiting</secondary>
27650 </indexterm>
27651 Some sites find it helpful to be able to limit the rate at which certain hosts
27652 can send them messages, and the rate at which an individual message can specify
27653 recipients.
27654 </para>
27655 <para>
27656 Exim has two rate-limiting facilities. This section describes the older
27657 facility, which can limit rates within a single connection. The newer
27658 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
27659 <xref linkend="SECTratelimiting"/> for details of the newer facility.
27660 </para>
27661 <para>
27662 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
27663 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
27664 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
27665 respectively. Each option, if set, must contain a set of four comma-separated
27666 values:
27667 </para>
27668 <itemizedlist>
27669 <listitem>
27670 <para>
27671 A threshold, before which there is no rate limiting.
27672 </para>
27673 </listitem>
27674 <listitem>
27675 <para>
27676 An initial time delay. Unlike other times in Exim, numbers with decimal
27677 fractional parts are allowed here.
27678 </para>
27679 </listitem>
27680 <listitem>
27681 <para>
27682 A factor by which to increase the delay each time.
27683 </para>
27684 </listitem>
27685 <listitem>
27686 <para>
27687 A maximum value for the delay. This should normally be less than 5 minutes,
27688 because after that time, the client is liable to timeout the SMTP command.
27689 </para>
27690 </listitem>
27691 </itemizedlist>
27692 <para>
27693 For example, these settings have been used successfully at the site which
27694 first suggested this feature, for controlling mail from their customers:
27695 </para>
27696 <literallayout class="monospaced">
27697 smtp_ratelimit_mail = 2,0.5s,1.05,4m
27698 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
27699 </literallayout>
27700 <para>
27701 The first setting specifies delays that are applied to MAIL commands after
27702 two have been received over a single connection. The initial delay is 0.5
27703 seconds, increasing by a factor of 1.05 each time. The second setting applies
27704 delays to RCPT commands when more than four occur in a single message.
27705 </para>
27706 <para>
27707 <indexterm role="option">
27708 <primary><option>smtp_ratelimit_mail</option></primary>
27709 </indexterm>
27710 </para>
27711 <informaltable frame="all">
27712 <tgroup cols="4" colsep="0" rowsep="0">
27713 <colspec colwidth="8*" align="left"/>
27714 <colspec colwidth="6*" align="center"/>
27715 <colspec colwidth="6*" align="center"/>
27716 <colspec colwidth="6*" align="right"/>
27717 <tbody>
27718 <row>
27719 <entry><option>smtp_ratelimit_mail</option></entry>
27720 <entry>Use: <emphasis>main</emphasis></entry>
27721 <entry>Type: <emphasis>string</emphasis></entry>
27722 <entry>Default: <emphasis>unset</emphasis></entry>
27723 </row>
27724 </tbody>
27725 </tgroup>
27726 </informaltable>
27727 <para>
27728 See <option>smtp_ratelimit_hosts</option> above.
27729 </para>
27730 <para>
27731 <indexterm role="option">
27732 <primary><option>smtp_ratelimit_rcpt</option></primary>
27733 </indexterm>
27734 </para>
27735 <informaltable frame="all">
27736 <tgroup cols="4" colsep="0" rowsep="0">
27737 <colspec colwidth="8*" align="left"/>
27738 <colspec colwidth="6*" align="center"/>
27739 <colspec colwidth="6*" align="center"/>
27740 <colspec colwidth="6*" align="right"/>
27741 <tbody>
27742 <row>
27743 <entry><option>smtp_ratelimit_rcpt</option></entry>
27744 <entry>Use: <emphasis>main</emphasis></entry>
27745 <entry>Type: <emphasis>string</emphasis></entry>
27746 <entry>Default: <emphasis>unset</emphasis></entry>
27747 </row>
27748 </tbody>
27749 </tgroup>
27750 </informaltable>
27751 <para>
27752 See <option>smtp_ratelimit_hosts</option> above.
27753 </para>
27754 <para>
27755 <indexterm role="option">
27756 <primary><option>smtp_receive_timeout</option></primary>
27757 </indexterm>
27758 </para>
27759 <informaltable frame="all">
27760 <tgroup cols="4" colsep="0" rowsep="0">
27761 <colspec colwidth="8*" align="left"/>
27762 <colspec colwidth="6*" align="center"/>
27763 <colspec colwidth="6*" align="center"/>
27764 <colspec colwidth="6*" align="right"/>
27765 <tbody>
27766 <row>
27767 <entry><option>smtp_receive_timeout</option></entry>
27768 <entry>Use: <emphasis>main</emphasis></entry>
27769 <entry>Type: <emphasis>time</emphasis></entry>
27770 <entry>Default: <emphasis>5m</emphasis></entry>
27771 </row>
27772 </tbody>
27773 </tgroup>
27774 </informaltable>
27775 <para>
27776 <indexterm role="concept">
27777 <primary>timeout</primary>
27778 <secondary>for SMTP input</secondary>
27779 </indexterm>
27780 <indexterm role="concept">
27781 <primary>SMTP</primary>
27782 <secondary>input timeout</secondary>
27783 </indexterm>
27784 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
27785 input, including batch SMTP. If a line of input (either an SMTP command or a
27786 data line) is not received within this time, the SMTP connection is dropped and
27787 the message is abandoned.
27788 A line is written to the log containing one of the following messages:
27789 </para>
27790 <literallayout class="monospaced">
27791 SMTP command timeout on connection from...
27792 SMTP data timeout on connection from...
27793 </literallayout>
27794 <para>
27795 The former means that Exim was expecting to read an SMTP command; the latter
27796 means that it was in the DATA phase, reading the contents of a message.
27797 </para>
27798 <para>
27799 <indexterm role="option">
27800 <primary><option>-os</option></primary>
27801 </indexterm>
27802 The value set by this option can be overridden by the
27803 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
27804 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
27805 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
27806 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
27807 </para>
27808 <para>
27809 <indexterm role="option">
27810 <primary><option>smtp_reserve_hosts</option></primary>
27811 </indexterm>
27812 </para>
27813 <informaltable frame="all">
27814 <tgroup cols="4" colsep="0" rowsep="0">
27815 <colspec colwidth="8*" align="left"/>
27816 <colspec colwidth="6*" align="center"/>
27817 <colspec colwidth="6*" align="center"/>
27818 <colspec colwidth="6*" align="right"/>
27819 <tbody>
27820 <row>
27821 <entry><option>smtp_reserve_hosts</option></entry>
27822 <entry>Use: <emphasis>main</emphasis></entry>
27823 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27824 <entry>Default: <emphasis>unset</emphasis></entry>
27825 </row>
27826 </tbody>
27827 </tgroup>
27828 </informaltable>
27829 <para>
27830 This option defines hosts for which SMTP connections are reserved; see
27831 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
27832 </para>
27833 <para>
27834 <indexterm role="option">
27835 <primary><option>smtp_return_error_details</option></primary>
27836 </indexterm>
27837 </para>
27838 <informaltable frame="all">
27839 <tgroup cols="4" colsep="0" rowsep="0">
27840 <colspec colwidth="8*" align="left"/>
27841 <colspec colwidth="6*" align="center"/>
27842 <colspec colwidth="6*" align="center"/>
27843 <colspec colwidth="6*" align="right"/>
27844 <tbody>
27845 <row>
27846 <entry><option>smtp_return_error_details</option></entry>
27847 <entry>Use: <emphasis>main</emphasis></entry>
27848 <entry>Type: <emphasis>boolean</emphasis></entry>
27849 <entry>Default: <emphasis>false</emphasis></entry>
27850 </row>
27851 </tbody>
27852 </tgroup>
27853 </informaltable>
27854 <para>
27855 <indexterm role="concept">
27856 <primary>SMTP</primary>
27857 <secondary>details policy failures</secondary>
27858 </indexterm>
27859 <indexterm role="concept">
27860 <primary>policy control</primary>
27861 <secondary>rejection, returning details</secondary>
27862 </indexterm>
27863 In the default state, Exim uses bland messages such as
27864 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27865 reasons. Many sysadmins like this because it gives away little information
27866 to spammers. However, some other sysadmins who are applying strict checking
27867 policies want to give out much fuller information about failures. Setting
27868 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27869 example, instead of <quote>Administrative prohibition</quote>, it might give:
27870 </para>
27871 <literallayout class="monospaced">
27872 550-Rejected after DATA: '&gt;' missing at end of address:
27873 550 failing address in "From" header is: &lt;user@dom.ain
27874 </literallayout>
27875 <para>
27876 <indexterm role="option">
27877 <primary><option>spamd_address</option></primary>
27878 </indexterm>
27879 </para>
27880 <informaltable frame="all">
27881 <tgroup cols="4" colsep="0" rowsep="0">
27882 <colspec colwidth="8*" align="left"/>
27883 <colspec colwidth="6*" align="center"/>
27884 <colspec colwidth="6*" align="center"/>
27885 <colspec colwidth="6*" align="right"/>
27886 <tbody>
27887 <row>
27888 <entry><option>spamd_address</option></entry>
27889 <entry>Use: <emphasis>main</emphasis></entry>
27890 <entry>Type: <emphasis>string</emphasis></entry>
27891 <entry>Default: <emphasis>see below</emphasis></entry>
27892 </row>
27893 </tbody>
27894 </tgroup>
27895 </informaltable>
27896 <para>
27897 This option is available when Exim is compiled with the content-scanning
27898 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
27899 The default value is
27900 </para>
27901 <literallayout class="monospaced">
27902 127.0.0.1 783
27903 </literallayout>
27904 <para>
27905 See section <xref linkend="SECTscanspamass"/> for more details.
27906 </para>
27907 <para>
27908 <indexterm role="option">
27909 <primary><option>split_spool_directory</option></primary>
27910 </indexterm>
27911 </para>
27912 <informaltable frame="all">
27913 <tgroup cols="4" colsep="0" rowsep="0">
27914 <colspec colwidth="8*" align="left"/>
27915 <colspec colwidth="6*" align="center"/>
27916 <colspec colwidth="6*" align="center"/>
27917 <colspec colwidth="6*" align="right"/>
27918 <tbody>
27919 <row>
27920 <entry><option>split_spool_directory</option></entry>
27921 <entry>Use: <emphasis>main</emphasis></entry>
27922 <entry>Type: <emphasis>boolean</emphasis></entry>
27923 <entry>Default: <emphasis>false</emphasis></entry>
27924 </row>
27925 </tbody>
27926 </tgroup>
27927 </informaltable>
27928 <para>
27929 <indexterm role="concept">
27930 <primary>multiple spool directories</primary>
27931 </indexterm>
27932 <indexterm role="concept">
27933 <primary>spool directory</primary>
27934 <secondary>split</secondary>
27935 </indexterm>
27936 <indexterm role="concept">
27937 <primary>directories, multiple</primary>
27938 </indexterm>
27939 If this option is set, it causes Exim to split its input directory into 62
27940 subdirectories, each with a single alphanumeric character as its name. The
27941 sixth character of the message id is used to allocate messages to
27942 subdirectories; this is the least significant base-62 digit of the time of
27943 arrival of the message.
27944 </para>
27945 <para>
27946 Splitting up the spool in this way may provide better performance on systems
27947 where there are long mail queues, by reducing the number of files in any one
27948 directory. The msglog directory is also split up in a similar way to the input
27949 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27950 are still placed in the single directory <filename>msglog.OLD</filename>.
27951 </para>
27952 <para>
27953 It is not necessary to take any special action for existing messages when
27954 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27955 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27956 after a period of being on, the subdirectories will eventually empty and be
27957 automatically deleted.
27958 </para>
27959 <para>
27960 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27961 changes. Instead of creating a list of all messages in the queue, and then
27962 trying to deliver each one in turn, it constructs a list of those in one
27963 sub-directory and tries to deliver them, before moving on to the next
27964 sub-directory. The sub-directories are processed in a random order. This
27965 spreads out the scanning of the input directories, and uses less memory. It is
27966 particularly beneficial when there are lots of messages on the queue. However,
27967 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27968 entire queue has to be scanned and sorted before any deliveries can start.
27969 </para>
27970 <para>
27971 <indexterm role="option">
27972 <primary><option>spool_directory</option></primary>
27973 </indexterm>
27974 </para>
27975 <informaltable frame="all">
27976 <tgroup cols="4" colsep="0" rowsep="0">
27977 <colspec colwidth="8*" align="left"/>
27978 <colspec colwidth="6*" align="center"/>
27979 <colspec colwidth="6*" align="center"/>
27980 <colspec colwidth="6*" align="right"/>
27981 <tbody>
27982 <row>
27983 <entry><option>spool_directory</option></entry>
27984 <entry>Use: <emphasis>main</emphasis></entry>
27985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27986 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27987 </row>
27988 </tbody>
27989 </tgroup>
27990 </informaltable>
27991 <para>
27992 <indexterm role="concept">
27993 <primary>spool directory</primary>
27994 <secondary>path to</secondary>
27995 </indexterm>
27996 This defines the directory in which Exim keeps its spool, that is, the messages
27997 it is waiting to deliver. The default value is taken from the compile-time
27998 configuration setting, if there is one. If not, this option must be set. The
27999 string is expanded, so it can contain, for example, a reference to
28000 <varname>$primary_hostname</varname>.
28001 </para>
28002 <para>
28003 If the spool directory name is fixed on your installation, it is recommended
28004 that you set it at build time rather than from this option, particularly if the
28005 log files are being written to the spool directory (see <option>log_file_path</option>).
28006 Otherwise log files cannot be used for errors that are detected early on, such
28007 as failures in the configuration file.
28008 </para>
28009 <para>
28010 By using this option to override the compiled-in path, it is possible to run
28011 tests of Exim without using the standard spool.
28012 </para>
28013 <para>
28014 <indexterm role="option">
28015 <primary><option>sqlite_lock_timeout</option></primary>
28016 </indexterm>
28017 </para>
28018 <informaltable frame="all">
28019 <tgroup cols="4" colsep="0" rowsep="0">
28020 <colspec colwidth="8*" align="left"/>
28021 <colspec colwidth="6*" align="center"/>
28022 <colspec colwidth="6*" align="center"/>
28023 <colspec colwidth="6*" align="right"/>
28024 <tbody>
28025 <row>
28026 <entry><option>sqlite_lock_timeout</option></entry>
28027 <entry>Use: <emphasis>main</emphasis></entry>
28028 <entry>Type: <emphasis>time</emphasis></entry>
28029 <entry>Default: <emphasis>5s</emphasis></entry>
28030 </row>
28031 </tbody>
28032 </tgroup>
28033 </informaltable>
28034 <para>
28035 <indexterm role="concept">
28036 <primary>sqlite lookup type</primary>
28037 <secondary>lock timeout</secondary>
28038 </indexterm>
28039 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
28040 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
28041 </para>
28042 <para>
28043 <indexterm role="option">
28044 <primary><option>strict_acl_vars</option></primary>
28045 </indexterm>
28046 </para>
28047 <informaltable frame="all">
28048 <tgroup cols="4" colsep="0" rowsep="0">
28049 <colspec colwidth="8*" align="left"/>
28050 <colspec colwidth="6*" align="center"/>
28051 <colspec colwidth="6*" align="center"/>
28052 <colspec colwidth="6*" align="right"/>
28053 <tbody>
28054 <row>
28055 <entry><option>strict_acl_vars</option></entry>
28056 <entry>Use: <emphasis>main</emphasis></entry>
28057 <entry>Type: <emphasis>boolean</emphasis></entry>
28058 <entry>Default: <emphasis>false</emphasis></entry>
28059 </row>
28060 </tbody>
28061 </tgroup>
28062 </informaltable>
28063 <para>
28064 <indexterm role="concept">
28065 <primary>access control lists (ACLs)</primary>
28066 <secondary>variables, handling unset</secondary>
28067 </indexterm>
28068 This option controls what happens if a syntactically valid but undefined ACL
28069 variable is referenced. If it is false (the default), an empty string
28070 is substituted; if it is true, an error is generated. See section
28071 <xref linkend="SECTaclvariables"/> for details of ACL variables.
28072 </para>
28073 <para>
28074 <indexterm role="option">
28075 <primary><option>strip_excess_angle_brackets</option></primary>
28076 </indexterm>
28077 </para>
28078 <informaltable frame="all">
28079 <tgroup cols="4" colsep="0" rowsep="0">
28080 <colspec colwidth="8*" align="left"/>
28081 <colspec colwidth="6*" align="center"/>
28082 <colspec colwidth="6*" align="center"/>
28083 <colspec colwidth="6*" align="right"/>
28084 <tbody>
28085 <row>
28086 <entry><option>strip_excess_angle_brackets</option></entry>
28087 <entry>Use: <emphasis>main</emphasis></entry>
28088 <entry>Type: <emphasis>boolean</emphasis></entry>
28089 <entry>Default: <emphasis>false</emphasis></entry>
28090 </row>
28091 </tbody>
28092 </tgroup>
28093 </informaltable>
28094 <para>
28095 <indexterm role="concept">
28096 <primary>angle brackets, excess</primary>
28097 </indexterm>
28098 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
28099 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
28100 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
28101 passed on to another MTA, the excess angle brackets are not passed on. If this
28102 option is not set, multiple pairs of angle brackets cause a syntax error.
28103 </para>
28104 <para>
28105 <indexterm role="option">
28106 <primary><option>strip_trailing_dot</option></primary>
28107 </indexterm>
28108 </para>
28109 <informaltable frame="all">
28110 <tgroup cols="4" colsep="0" rowsep="0">
28111 <colspec colwidth="8*" align="left"/>
28112 <colspec colwidth="6*" align="center"/>
28113 <colspec colwidth="6*" align="center"/>
28114 <colspec colwidth="6*" align="right"/>
28115 <tbody>
28116 <row>
28117 <entry><option>strip_trailing_dot</option></entry>
28118 <entry>Use: <emphasis>main</emphasis></entry>
28119 <entry>Type: <emphasis>boolean</emphasis></entry>
28120 <entry>Default: <emphasis>false</emphasis></entry>
28121 </row>
28122 </tbody>
28123 </tgroup>
28124 </informaltable>
28125 <para>
28126 <indexterm role="concept">
28127 <primary>trailing dot on domain</primary>
28128 </indexterm>
28129 <indexterm role="concept">
28130 <primary>dot</primary>
28131 <secondary>trailing on domain</secondary>
28132 </indexterm>
28133 If this option is set, a trailing dot at the end of a domain in an address is
28134 ignored. If this is in the envelope and the message is passed on to another
28135 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
28136 domain causes a syntax error.
28137 However, addresses in header lines are checked only when an ACL requests header
28138 syntax checking.
28139 </para>
28140 <para>
28141 <indexterm role="option">
28142 <primary><option>syslog_duplication</option></primary>
28143 </indexterm>
28144 </para>
28145 <informaltable frame="all">
28146 <tgroup cols="4" colsep="0" rowsep="0">
28147 <colspec colwidth="8*" align="left"/>
28148 <colspec colwidth="6*" align="center"/>
28149 <colspec colwidth="6*" align="center"/>
28150 <colspec colwidth="6*" align="right"/>
28151 <tbody>
28152 <row>
28153 <entry><option>syslog_duplication</option></entry>
28154 <entry>Use: <emphasis>main</emphasis></entry>
28155 <entry>Type: <emphasis>boolean</emphasis></entry>
28156 <entry>Default: <emphasis>true</emphasis></entry>
28157 </row>
28158 </tbody>
28159 </tgroup>
28160 </informaltable>
28161 <para>
28162 <indexterm role="concept">
28163 <primary>syslog</primary>
28164 <secondary>duplicate log lines; suppressing</secondary>
28165 </indexterm>
28166 When Exim is logging to syslog, it writes the log lines for its three
28167 separate logs at different syslog priorities so that they can in principle
28168 be separated on the logging hosts. Some installations do not require this
28169 separation, and in those cases, the duplication of certain log lines is a
28170 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
28171 particular log line is written to syslog. For lines that normally go to
28172 both the main log and the reject log, the reject log version (possibly
28173 containing message header lines) is written, at LOG_NOTICE priority.
28174 Lines that normally go to both the main and the panic log are written at
28175 the LOG_ALERT priority.
28176 </para>
28177 <para>
28178 <indexterm role="option">
28179 <primary><option>syslog_facility</option></primary>
28180 </indexterm>
28181 </para>
28182 <informaltable frame="all">
28183 <tgroup cols="4" colsep="0" rowsep="0">
28184 <colspec colwidth="8*" align="left"/>
28185 <colspec colwidth="6*" align="center"/>
28186 <colspec colwidth="6*" align="center"/>
28187 <colspec colwidth="6*" align="right"/>
28188 <tbody>
28189 <row>
28190 <entry><option>syslog_facility</option></entry>
28191 <entry>Use: <emphasis>main</emphasis></entry>
28192 <entry>Type: <emphasis>string</emphasis></entry>
28193 <entry>Default: <emphasis>unset</emphasis></entry>
28194 </row>
28195 </tbody>
28196 </tgroup>
28197 </informaltable>
28198 <para>
28199 <indexterm role="concept">
28200 <primary>syslog</primary>
28201 <secondary>facility; setting</secondary>
28202 </indexterm>
28203 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
28204 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
28205 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
28206 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
28207 details of Exim&#x2019;s logging.
28208 </para>
28209 <para>
28210 <indexterm role="option">
28211 <primary><option>syslog_processname</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>syslog_processname</option></entry>
28223 <entry>Use: <emphasis>main</emphasis></entry>
28224 <entry>Type: <emphasis>string</emphasis></entry>
28225 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
28226 </row>
28227 </tbody>
28228 </tgroup>
28229 </informaltable>
28230 <para>
28231 <indexterm role="concept">
28232 <primary>syslog</primary>
28233 <secondary>process name; setting</secondary>
28234 </indexterm>
28235 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
28236 syslog. The value must be no longer than 32 characters. See chapter
28237 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
28238 </para>
28239 <para>
28240 <indexterm role="option">
28241 <primary><option>syslog_timestamp</option></primary>
28242 </indexterm>
28243 </para>
28244 <informaltable frame="all">
28245 <tgroup cols="4" colsep="0" rowsep="0">
28246 <colspec colwidth="8*" align="left"/>
28247 <colspec colwidth="6*" align="center"/>
28248 <colspec colwidth="6*" align="center"/>
28249 <colspec colwidth="6*" align="right"/>
28250 <tbody>
28251 <row>
28252 <entry><option>syslog_timestamp</option></entry>
28253 <entry>Use: <emphasis>main</emphasis></entry>
28254 <entry>Type: <emphasis>boolean</emphasis></entry>
28255 <entry>Default: <emphasis>true</emphasis></entry>
28256 </row>
28257 </tbody>
28258 </tgroup>
28259 </informaltable>
28260 <para>
28261 <indexterm role="concept">
28262 <primary>syslog</primary>
28263 <secondary>timestamps</secondary>
28264 </indexterm>
28265 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
28266 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
28267 details of Exim&#x2019;s logging.
28268 </para>
28269 <para>
28270 <indexterm role="option">
28271 <primary><option>system_filter</option></primary>
28272 </indexterm>
28273 </para>
28274 <informaltable frame="all">
28275 <tgroup cols="4" colsep="0" rowsep="0">
28276 <colspec colwidth="8*" align="left"/>
28277 <colspec colwidth="6*" align="center"/>
28278 <colspec colwidth="6*" align="center"/>
28279 <colspec colwidth="6*" align="right"/>
28280 <tbody>
28281 <row>
28282 <entry><option>system_filter</option></entry>
28283 <entry>Use: <emphasis>main</emphasis></entry>
28284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28285 <entry>Default: <emphasis>unset</emphasis></entry>
28286 </row>
28287 </tbody>
28288 </tgroup>
28289 </informaltable>
28290 <para>
28291 <indexterm role="concept">
28292 <primary>filter</primary>
28293 <secondary>system filter</secondary>
28294 </indexterm>
28295 <indexterm role="concept">
28296 <primary>system filter</primary>
28297 <secondary>specifying</secondary>
28298 </indexterm>
28299 <indexterm role="concept">
28300 <primary>Sieve filter</primary>
28301 <secondary>not available for system filter</secondary>
28302 </indexterm>
28303 This option specifies an Exim filter file that is applied to all messages at
28304 the start of each delivery attempt, before any routing is done. System filters
28305 must be Exim filters; they cannot be Sieve filters. If the system filter
28306 generates any deliveries to files or pipes, or any new mail messages, the
28307 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
28308 which transports are to be used. Details of this facility are given in chapter
28309 <xref linkend="CHAPsystemfilter"/>.
28310 </para>
28311 <para>
28312 <indexterm role="option">
28313 <primary><option>system_filter_directory_transport</option></primary>
28314 </indexterm>
28315 </para>
28316 <informaltable frame="all">
28317 <tgroup cols="4" colsep="0" rowsep="0">
28318 <colspec colwidth="8*" align="left"/>
28319 <colspec colwidth="6*" align="center"/>
28320 <colspec colwidth="6*" align="center"/>
28321 <colspec colwidth="6*" align="right"/>
28322 <tbody>
28323 <row>
28324 <entry><option>system_filter_directory_transport</option></entry>
28325 <entry>Use: <emphasis>main</emphasis></entry>
28326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28327 <entry>Default: <emphasis>unset</emphasis></entry>
28328 </row>
28329 </tbody>
28330 </tgroup>
28331 </informaltable>
28332 <para>
28333 <indexterm role="variable">
28334 <primary><varname>$address_file</varname></primary>
28335 </indexterm>
28336 This sets the name of the transport driver that is to be used when the
28337 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
28338 implying delivery of each message into a separate file in some directory.
28339 During the delivery, the variable <varname>$address_file</varname> contains the path name.
28340 </para>
28341 <para>
28342 <indexterm role="option">
28343 <primary><option>system_filter_file_transport</option></primary>
28344 </indexterm>
28345 </para>
28346 <informaltable frame="all">
28347 <tgroup cols="4" colsep="0" rowsep="0">
28348 <colspec colwidth="8*" align="left"/>
28349 <colspec colwidth="6*" align="center"/>
28350 <colspec colwidth="6*" align="center"/>
28351 <colspec colwidth="6*" align="right"/>
28352 <tbody>
28353 <row>
28354 <entry><option>system_filter_file_transport</option></entry>
28355 <entry>Use: <emphasis>main</emphasis></entry>
28356 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28357 <entry>Default: <emphasis>unset</emphasis></entry>
28358 </row>
28359 </tbody>
28360 </tgroup>
28361 </informaltable>
28362 <para>
28363 <indexterm role="concept">
28364 <primary>file</primary>
28365 <secondary>transport for system filter</secondary>
28366 </indexterm>
28367 This sets the name of the transport driver that is to be used when the <option>save</option>
28368 command in a system message filter specifies a path not ending in <quote>/</quote>. During
28369 the delivery, the variable <varname>$address_file</varname> contains the path name.
28370 </para>
28371 <para>
28372 <indexterm role="option">
28373 <primary><option>system_filter_group</option></primary>
28374 </indexterm>
28375 </para>
28376 <informaltable frame="all">
28377 <tgroup cols="4" colsep="0" rowsep="0">
28378 <colspec colwidth="8*" align="left"/>
28379 <colspec colwidth="6*" align="center"/>
28380 <colspec colwidth="6*" align="center"/>
28381 <colspec colwidth="6*" align="right"/>
28382 <tbody>
28383 <row>
28384 <entry><option>system_filter_group</option></entry>
28385 <entry>Use: <emphasis>main</emphasis></entry>
28386 <entry>Type: <emphasis>string</emphasis></entry>
28387 <entry>Default: <emphasis>unset</emphasis></entry>
28388 </row>
28389 </tbody>
28390 </tgroup>
28391 </informaltable>
28392 <para>
28393 <indexterm role="concept">
28394 <primary>gid (group id)</primary>
28395 <secondary>system filter</secondary>
28396 </indexterm>
28397 This option is used only when <option>system_filter_user</option> is also set. It sets the
28398 gid under which the system filter is run, overriding any gid that is associated
28399 with the user. The value may be numerical or symbolic.
28400 </para>
28401 <para>
28402 <indexterm role="option">
28403 <primary><option>system_filter_pipe_transport</option></primary>
28404 </indexterm>
28405 </para>
28406 <informaltable frame="all">
28407 <tgroup cols="4" colsep="0" rowsep="0">
28408 <colspec colwidth="8*" align="left"/>
28409 <colspec colwidth="6*" align="center"/>
28410 <colspec colwidth="6*" align="center"/>
28411 <colspec colwidth="6*" align="right"/>
28412 <tbody>
28413 <row>
28414 <entry><option>system_filter_pipe_transport</option></entry>
28415 <entry>Use: <emphasis>main</emphasis></entry>
28416 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28417 <entry>Default: <emphasis>unset</emphasis></entry>
28418 </row>
28419 </tbody>
28420 </tgroup>
28421 </informaltable>
28422 <para>
28423 <indexterm role="concept">
28424 <primary><command>pipe</command> transport</primary>
28425 <secondary>for system filter</secondary>
28426 </indexterm>
28427 <indexterm role="variable">
28428 <primary><varname>$address_pipe</varname></primary>
28429 </indexterm>
28430 This specifies the transport driver that is to be used when a <option>pipe</option> command
28431 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
28432 contains the pipe command.
28433 </para>
28434 <para>
28435 <indexterm role="option">
28436 <primary><option>system_filter_reply_transport</option></primary>
28437 </indexterm>
28438 </para>
28439 <informaltable frame="all">
28440 <tgroup cols="4" colsep="0" rowsep="0">
28441 <colspec colwidth="8*" align="left"/>
28442 <colspec colwidth="6*" align="center"/>
28443 <colspec colwidth="6*" align="center"/>
28444 <colspec colwidth="6*" align="right"/>
28445 <tbody>
28446 <row>
28447 <entry><option>system_filter_reply_transport</option></entry>
28448 <entry>Use: <emphasis>main</emphasis></entry>
28449 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28450 <entry>Default: <emphasis>unset</emphasis></entry>
28451 </row>
28452 </tbody>
28453 </tgroup>
28454 </informaltable>
28455 <para>
28456 <indexterm role="concept">
28457 <primary><command>autoreply</command> transport</primary>
28458 <secondary>for system filter</secondary>
28459 </indexterm>
28460 This specifies the transport driver that is to be used when a <option>mail</option> command
28461 is used in a system filter.
28462 </para>
28463 <para>
28464 <indexterm role="option">
28465 <primary><option>system_filter_user</option></primary>
28466 </indexterm>
28467 </para>
28468 <informaltable frame="all">
28469 <tgroup cols="4" colsep="0" rowsep="0">
28470 <colspec colwidth="8*" align="left"/>
28471 <colspec colwidth="6*" align="center"/>
28472 <colspec colwidth="6*" align="center"/>
28473 <colspec colwidth="6*" align="right"/>
28474 <tbody>
28475 <row>
28476 <entry><option>system_filter_user</option></entry>
28477 <entry>Use: <emphasis>main</emphasis></entry>
28478 <entry>Type: <emphasis>string</emphasis></entry>
28479 <entry>Default: <emphasis>unset</emphasis></entry>
28480 </row>
28481 </tbody>
28482 </tgroup>
28483 </informaltable>
28484 <para>
28485 <indexterm role="concept">
28486 <primary>uid (user id)</primary>
28487 <secondary>system filter</secondary>
28488 </indexterm>
28489 If this option is set to root, the system filter is run in the main Exim
28490 delivery process, as root.  Otherwise, the system filter runs in a separate
28491 process, as the given user, defaulting to the Exim run-time user.
28492 Unless the string consists entirely of digits, it
28493 is looked up in the password data. Failure to find the named user causes a
28494 configuration error. The gid is either taken from the password data, or
28495 specified by <option>system_filter_group</option>. When the uid is specified numerically,
28496 <option>system_filter_group</option> is required to be set.
28497 </para>
28498 <para>
28499 If the system filter generates any pipe, file, or reply deliveries, the uid
28500 under which the filter is run is used when transporting them, unless a
28501 transport option overrides.
28502 </para>
28503 <para>
28504 <indexterm role="option">
28505 <primary><option>tcp_nodelay</option></primary>
28506 </indexterm>
28507 </para>
28508 <informaltable frame="all">
28509 <tgroup cols="4" colsep="0" rowsep="0">
28510 <colspec colwidth="8*" align="left"/>
28511 <colspec colwidth="6*" align="center"/>
28512 <colspec colwidth="6*" align="center"/>
28513 <colspec colwidth="6*" align="right"/>
28514 <tbody>
28515 <row>
28516 <entry><option>tcp_nodelay</option></entry>
28517 <entry>Use: <emphasis>main</emphasis></entry>
28518 <entry>Type: <emphasis>boolean</emphasis></entry>
28519 <entry>Default: <emphasis>true</emphasis></entry>
28520 </row>
28521 </tbody>
28522 </tgroup>
28523 </informaltable>
28524 <para>
28525 <indexterm role="concept">
28526 <primary>daemon</primary>
28527 <secondary>TCP_NODELAY on sockets</secondary>
28528 </indexterm>
28529 <indexterm role="concept">
28530 <primary>Nagle algorithm</primary>
28531 </indexterm>
28532 <indexterm role="concept">
28533 <primary>TCP_NODELAY on listening sockets</primary>
28534 </indexterm>
28535 If this option is set false, it stops the Exim daemon setting the
28536 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
28537 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
28538 performance in interactive (character-by-character) situations. Turning it off
28539 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
28540 However, it appears that some broken clients cannot cope, and time out. Hence
28541 this option. It affects only those sockets that are set up for listening by the
28542 daemon. Sockets created by the smtp transport for delivering mail always set
28543 TCP_NODELAY.
28544 </para>
28545 <para>
28546 <indexterm role="option">
28547 <primary><option>timeout_frozen_after</option></primary>
28548 </indexterm>
28549 </para>
28550 <informaltable frame="all">
28551 <tgroup cols="4" colsep="0" rowsep="0">
28552 <colspec colwidth="8*" align="left"/>
28553 <colspec colwidth="6*" align="center"/>
28554 <colspec colwidth="6*" align="center"/>
28555 <colspec colwidth="6*" align="right"/>
28556 <tbody>
28557 <row>
28558 <entry><option>timeout_frozen_after</option></entry>
28559 <entry>Use: <emphasis>main</emphasis></entry>
28560 <entry>Type: <emphasis>time</emphasis></entry>
28561 <entry>Default: <emphasis>0s</emphasis></entry>
28562 </row>
28563 </tbody>
28564 </tgroup>
28565 </informaltable>
28566 <para>
28567 <indexterm role="concept">
28568 <primary>frozen messages</primary>
28569 <secondary>timing out</secondary>
28570 </indexterm>
28571 <indexterm role="concept">
28572 <primary>timeout</primary>
28573 <secondary>frozen messages</secondary>
28574 </indexterm>
28575 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
28576 message of any kind that has been on the queue for longer than the given time
28577 is automatically cancelled at the next queue run. If the frozen message is a
28578 bounce message, it is just discarded; otherwise, a bounce is sent to the
28579 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
28580 If you want to timeout frozen bounce messages earlier than other kinds of
28581 frozen message, see <option>ignore_bounce_errors_after</option>.
28582 </para>
28583 <para>
28584 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
28585 frozen messages remain on the queue forever (except for any frozen bounce
28586 messages that are released by <option>ignore_bounce_errors_after</option>).
28587 </para>
28588 <para>
28589 <indexterm role="option">
28590 <primary><option>timezone</option></primary>
28591 </indexterm>
28592 </para>
28593 <informaltable frame="all">
28594 <tgroup cols="4" colsep="0" rowsep="0">
28595 <colspec colwidth="8*" align="left"/>
28596 <colspec colwidth="6*" align="center"/>
28597 <colspec colwidth="6*" align="center"/>
28598 <colspec colwidth="6*" align="right"/>
28599 <tbody>
28600 <row>
28601 <entry><option>timezone</option></entry>
28602 <entry>Use: <emphasis>main</emphasis></entry>
28603 <entry>Type: <emphasis>string</emphasis></entry>
28604 <entry>Default: <emphasis>unset</emphasis></entry>
28605 </row>
28606 </tbody>
28607 </tgroup>
28608 </informaltable>
28609 <para>
28610 <indexterm role="concept">
28611 <primary>timezone, setting</primary>
28612 </indexterm>
28613 The value of <option>timezone</option> is used to set the environment variable TZ while
28614 running Exim (if it is different on entry). This ensures that all timestamps
28615 created by Exim are in the required timezone. If you want all your timestamps
28616 to be in UTC (aka GMT) you should set
28617 </para>
28618 <literallayout class="monospaced">
28619 timezone = UTC
28620 </literallayout>
28621 <para>
28622 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
28623 or, if that is not set, from the value of the TZ environment variable when Exim
28624 is built. If <option>timezone</option> is set to the empty string, either at build or run
28625 time, any existing TZ variable is removed from the environment when Exim
28626 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
28627 unfortunately not all, operating systems.
28628 </para>
28629 <para>
28630 <indexterm role="option">
28631 <primary><option>tls_advertise_hosts</option></primary>
28632 </indexterm>
28633 </para>
28634 <informaltable frame="all">
28635 <tgroup cols="4" colsep="0" rowsep="0">
28636 <colspec colwidth="8*" align="left"/>
28637 <colspec colwidth="6*" align="center"/>
28638 <colspec colwidth="6*" align="center"/>
28639 <colspec colwidth="6*" align="right"/>
28640 <tbody>
28641 <row>
28642 <entry><option>tls_advertise_hosts</option></entry>
28643 <entry>Use: <emphasis>main</emphasis></entry>
28644 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28645 <entry>Default: <emphasis>unset</emphasis></entry>
28646 </row>
28647 </tbody>
28648 </tgroup>
28649 </informaltable>
28650 <para>
28651 <indexterm role="concept">
28652 <primary>TLS</primary>
28653 <secondary>advertising</secondary>
28654 </indexterm>
28655 <indexterm role="concept">
28656 <primary>encryption</primary>
28657 <secondary>on SMTP connection</secondary>
28658 </indexterm>
28659 <indexterm role="concept">
28660 <primary>SMTP</primary>
28661 <secondary>encrypted connection</secondary>
28662 </indexterm>
28663 When Exim is built with support for TLS encrypted connections, the availability
28664 of the STARTTLS command to set up an encrypted session is advertised in
28665 response to EHLO only to those client hosts that match this option. See
28666 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
28667 </para>
28668 <para>
28669 <indexterm role="option">
28670 <primary><option>tls_certificate</option></primary>
28671 </indexterm>
28672 </para>
28673 <informaltable frame="all">
28674 <tgroup cols="4" colsep="0" rowsep="0">
28675 <colspec colwidth="8*" align="left"/>
28676 <colspec colwidth="6*" align="center"/>
28677 <colspec colwidth="6*" align="center"/>
28678 <colspec colwidth="6*" align="right"/>
28679 <tbody>
28680 <row>
28681 <entry><option>tls_certificate</option></entry>
28682 <entry>Use: <emphasis>main</emphasis></entry>
28683 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28684 <entry>Default: <emphasis>unset</emphasis></entry>
28685 </row>
28686 </tbody>
28687 </tgroup>
28688 </informaltable>
28689 <para>
28690 <indexterm role="concept">
28691 <primary>TLS</primary>
28692 <secondary>server certificate; location of</secondary>
28693 </indexterm>
28694 <indexterm role="concept">
28695 <primary>certificate</primary>
28696 <secondary>server, location of</secondary>
28697 </indexterm>
28698 The value of this option is expanded, and must then be the absolute path to a
28699 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
28700 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
28701 <xref linkend="CHAPTLS"/> for further details.
28702 </para>
28703 <para>
28704 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
28705 receiving incoming messages as a server. If you want to supply certificates for
28706 use when sending messages as a client, you must set the <option>tls_certificate</option>
28707 option in the relevant <command>smtp</command> transport.
28708 </para>
28709 <para revisionflag="changed">
28710 If the option contains <varname>$tls_sni</varname> and Exim is built against OpenSSL, then
28711 if the OpenSSL build supports TLS extensions and the TLS client sends the
28712 Server Name Indication extension, then this option and others documented in
28713 <xref linkend="SECTtlssni"/> will be re-expanded.
28714 </para>
28715 <para>
28716 <indexterm role="option">
28717 <primary><option>tls_crl</option></primary>
28718 </indexterm>
28719 </para>
28720 <informaltable frame="all">
28721 <tgroup cols="4" colsep="0" rowsep="0">
28722 <colspec colwidth="8*" align="left"/>
28723 <colspec colwidth="6*" align="center"/>
28724 <colspec colwidth="6*" align="center"/>
28725 <colspec colwidth="6*" align="right"/>
28726 <tbody>
28727 <row>
28728 <entry><option>tls_crl</option></entry>
28729 <entry>Use: <emphasis>main</emphasis></entry>
28730 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28731 <entry>Default: <emphasis>unset</emphasis></entry>
28732 </row>
28733 </tbody>
28734 </tgroup>
28735 </informaltable>
28736 <para>
28737 <indexterm role="concept">
28738 <primary>TLS</primary>
28739 <secondary>server certificate revocation list</secondary>
28740 </indexterm>
28741 <indexterm role="concept">
28742 <primary>certificate</primary>
28743 <secondary>revocation list for server</secondary>
28744 </indexterm>
28745 This option specifies a certificate revocation list. The expanded value must
28746 be the name of a file that contains a CRL in PEM format.
28747 </para>
28748 <para revisionflag="changed">
28749 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
28750 </para>
28751 <para revisionflag="changed">
28752 <indexterm role="option">
28753 <primary><option>tls_dh_max_bits</option></primary>
28754 </indexterm>
28755 </para>
28756 <informaltable frame="all" revisionflag="changed">
28757 <tgroup cols="4" colsep="0" rowsep="0">
28758 <colspec colwidth="8*" align="left"/>
28759 <colspec colwidth="6*" align="center"/>
28760 <colspec colwidth="6*" align="center"/>
28761 <colspec colwidth="6*" align="right"/>
28762 <tbody>
28763 <row>
28764 <entry><option>tls_dh_max_bits</option></entry>
28765 <entry>Use: <emphasis>main</emphasis></entry>
28766 <entry>Type: <emphasis>integer</emphasis></entry>
28767 <entry>Default: <emphasis>2236</emphasis></entry>
28768 </row>
28769 </tbody>
28770 </tgroup>
28771 </informaltable>
28772 <para revisionflag="changed">
28773 <indexterm role="concept">
28774 <primary>TLS</primary>
28775 <secondary>D-H bit count</secondary>
28776 </indexterm>
28777 The number of bits used for Diffie-Hellman key-exchange may be suggested by
28778 the chosen TLS library.  That value might prove to be too high for
28779 interoperability.  This option provides a maximum clamp on the value
28780 suggested, trading off security for interoperability.
28781 </para>
28782 <para revisionflag="changed">
28783 The value must be at least 1024.
28784 </para>
28785 <para revisionflag="changed">
28786 The value 2236 was chosen because, at time of adding the option, it was the
28787 hard-coded maximum value supported by the NSS cryptographic library, as used
28788 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
28789 </para>
28790 <para revisionflag="changed">
28791 If you prefer more security and are willing to break some clients, raise this
28792 number.
28793 </para>
28794 <para revisionflag="changed">
28795 Note that the value passed to GnuTLS for *generating* a new prime may be a
28796 little less than this figure, because GnuTLS is inexact and may produce a
28797 larger prime than requested.
28798 </para>
28799 <para>
28800 <indexterm role="option">
28801 <primary><option>tls_dhparam</option></primary>
28802 </indexterm>
28803 </para>
28804 <informaltable frame="all">
28805 <tgroup cols="4" colsep="0" rowsep="0">
28806 <colspec colwidth="8*" align="left"/>
28807 <colspec colwidth="6*" align="center"/>
28808 <colspec colwidth="6*" align="center"/>
28809 <colspec colwidth="6*" align="right"/>
28810 <tbody>
28811 <row>
28812 <entry><option>tls_dhparam</option></entry>
28813 <entry>Use: <emphasis>main</emphasis></entry>
28814 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28815 <entry>Default: <emphasis>unset</emphasis></entry>
28816 </row>
28817 </tbody>
28818 </tgroup>
28819 </informaltable>
28820 <para>
28821 <indexterm role="concept">
28822 <primary>TLS</primary>
28823 <secondary>D-H parameters for server</secondary>
28824 </indexterm>
28825 </para>
28826 <para revisionflag="changed">
28827 The value of this option is expanded and indicates the source of DH parameters
28828 to be used by Exim.
28829 </para>
28830 <para revisionflag="changed">
28831 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
28832 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
28833 PKCS#3 representation of the DH prime.  If the file does not exist, for
28834 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
28835 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
28836 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
28837 and treated as though the <option>tls_dhparam</option> were set to "none".
28838 </para>
28839 <para revisionflag="changed">
28840 If this option expands to the string "none", then no DH parameters will be
28841 loaded by Exim.
28842 </para>
28843 <para revisionflag="changed">
28844 If this option expands to the string "historic" and Exim is using GnuTLS, then
28845 Exim will attempt to load a file from inside the spool directory.  If the file
28846 does not exist, Exim will attempt to create it.
28847 See section <xref linkend="SECTgnutlsparam"/> for further details.
28848 </para>
28849 <para revisionflag="changed">
28850 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
28851 a default DH prime; the default is the 2048 bit prime described in section
28852 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
28853 in IKE is assigned number 23.
28854 </para>
28855 <para revisionflag="changed">
28856 Otherwise, the option must expand to the name used by Exim for any of a number
28857 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
28858 "ike" followed by the number used by IKE, of "default" which corresponds to
28859 "ike23".
28860 </para>
28861 <para revisionflag="changed">
28862 The available primes are:
28863 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
28864 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
28865 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
28866 </para>
28867 <para revisionflag="changed">
28868 Some of these will be too small to be accepted by clients.
28869 Some may be too large to be accepted by clients.
28870 </para>
28871 <para>
28872 <indexterm role="option">
28873 <primary><option>tls_on_connect_ports</option></primary>
28874 </indexterm>
28875 </para>
28876 <informaltable frame="all">
28877 <tgroup cols="4" colsep="0" rowsep="0">
28878 <colspec colwidth="8*" align="left"/>
28879 <colspec colwidth="6*" align="center"/>
28880 <colspec colwidth="6*" align="center"/>
28881 <colspec colwidth="6*" align="right"/>
28882 <tbody>
28883 <row>
28884 <entry><option>tls_on_connect_ports</option></entry>
28885 <entry>Use: <emphasis>main</emphasis></entry>
28886 <entry>Type: <emphasis>string list</emphasis></entry>
28887 <entry>Default: <emphasis>unset</emphasis></entry>
28888 </row>
28889 </tbody>
28890 </tgroup>
28891 </informaltable>
28892 <para>
28893 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
28894 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
28895 set up without waiting for the client to issue a STARTTLS command. For
28896 further details, see section <xref linkend="SECTsupobssmt"/>.
28897 </para>
28898 <para>
28899 <indexterm role="option">
28900 <primary><option>tls_privatekey</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>tls_privatekey</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>TLS</primary>
28922 <secondary>server private key; location of</secondary>
28923 </indexterm>
28924 The value of this option is expanded, and must then be the absolute path to a
28925 file which contains the server&#x2019;s private key. If this option is unset, or if
28926 the expansion is forced to fail, or the result is an empty string, the private
28927 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
28928 <xref linkend="CHAPTLS"/> for further details.
28929 </para>
28930 <para revisionflag="changed">
28931 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
28932 </para>
28933 <para>
28934 <indexterm role="option">
28935 <primary><option>tls_remember_esmtp</option></primary>
28936 </indexterm>
28937 </para>
28938 <informaltable frame="all">
28939 <tgroup cols="4" colsep="0" rowsep="0">
28940 <colspec colwidth="8*" align="left"/>
28941 <colspec colwidth="6*" align="center"/>
28942 <colspec colwidth="6*" align="center"/>
28943 <colspec colwidth="6*" align="right"/>
28944 <tbody>
28945 <row>
28946 <entry><option>tls_remember_esmtp</option></entry>
28947 <entry>Use: <emphasis>main</emphasis></entry>
28948 <entry>Type: <emphasis>boolean</emphasis></entry>
28949 <entry>Default: <emphasis>false</emphasis></entry>
28950 </row>
28951 </tbody>
28952 </tgroup>
28953 </informaltable>
28954 <para>
28955 <indexterm role="concept">
28956 <primary>TLS</primary>
28957 <secondary>esmtp state; remembering</secondary>
28958 </indexterm>
28959 <indexterm role="concept">
28960 <primary>TLS</primary>
28961 <secondary>broken clients</secondary>
28962 </indexterm>
28963 If this option is set true, Exim violates the RFCs by remembering that it is in
28964 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28965 support for broken clients that fail to send a new EHLO after starting a
28966 TLS session.
28967 </para>
28968 <para>
28969 <indexterm role="option">
28970 <primary><option>tls_require_ciphers</option></primary>
28971 </indexterm>
28972 </para>
28973 <informaltable frame="all">
28974 <tgroup cols="4" colsep="0" rowsep="0">
28975 <colspec colwidth="8*" align="left"/>
28976 <colspec colwidth="6*" align="center"/>
28977 <colspec colwidth="6*" align="center"/>
28978 <colspec colwidth="6*" align="right"/>
28979 <tbody>
28980 <row>
28981 <entry><option>tls_require_ciphers</option></entry>
28982 <entry>Use: <emphasis>main</emphasis></entry>
28983 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28984 <entry>Default: <emphasis>unset</emphasis></entry>
28985 </row>
28986 </tbody>
28987 </tgroup>
28988 </informaltable>
28989 <para>
28990 <indexterm role="concept">
28991 <primary>TLS</primary>
28992 <secondary>requiring specific ciphers</secondary>
28993 </indexterm>
28994 <indexterm role="concept">
28995 <primary>cipher</primary>
28996 <secondary>requiring specific</secondary>
28997 </indexterm>
28998 This option controls which ciphers can be used for incoming TLS connections.
28999 The <command>smtp</command> transport has an option of the same name for controlling outgoing
29000 connections. This option is expanded for each connection, so can be varied for
29001 different clients if required. The value of this option must be a list of
29002 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
29003 in somewhat different ways. If GnuTLS is being used, the client controls the
29004 preference order of the available ciphers. Details are given in sections
29005 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
29006 </para>
29007 <para>
29008 <indexterm role="option">
29009 <primary><option>tls_try_verify_hosts</option></primary>
29010 </indexterm>
29011 </para>
29012 <informaltable frame="all">
29013 <tgroup cols="4" colsep="0" rowsep="0">
29014 <colspec colwidth="8*" align="left"/>
29015 <colspec colwidth="6*" align="center"/>
29016 <colspec colwidth="6*" align="center"/>
29017 <colspec colwidth="6*" align="right"/>
29018 <tbody>
29019 <row>
29020 <entry><option>tls_try_verify_hosts</option></entry>
29021 <entry>Use: <emphasis>main</emphasis></entry>
29022 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29023 <entry>Default: <emphasis>unset</emphasis></entry>
29024 </row>
29025 </tbody>
29026 </tgroup>
29027 </informaltable>
29028 <para>
29029 <indexterm role="concept">
29030 <primary>TLS</primary>
29031 <secondary>client certificate verification</secondary>
29032 </indexterm>
29033 <indexterm role="concept">
29034 <primary>certificate</primary>
29035 <secondary>verification of client</secondary>
29036 </indexterm>
29037 See <option>tls_verify_hosts</option> below.
29038 </para>
29039 <para>
29040 <indexterm role="option">
29041 <primary><option>tls_verify_certificates</option></primary>
29042 </indexterm>
29043 </para>
29044 <informaltable frame="all">
29045 <tgroup cols="4" colsep="0" rowsep="0">
29046 <colspec colwidth="8*" align="left"/>
29047 <colspec colwidth="6*" align="center"/>
29048 <colspec colwidth="6*" align="center"/>
29049 <colspec colwidth="6*" align="right"/>
29050 <tbody>
29051 <row>
29052 <entry><option>tls_verify_certificates</option></entry>
29053 <entry>Use: <emphasis>main</emphasis></entry>
29054 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29055 <entry>Default: <emphasis>unset</emphasis></entry>
29056 </row>
29057 </tbody>
29058 </tgroup>
29059 </informaltable>
29060 <para>
29061 <indexterm role="concept">
29062 <primary>TLS</primary>
29063 <secondary>client certificate verification</secondary>
29064 </indexterm>
29065 <indexterm role="concept">
29066 <primary>certificate</primary>
29067 <secondary>verification of client</secondary>
29068 </indexterm>
29069 The value of this option is expanded, and must then be the absolute path to
29070 a file containing permitted certificates for clients that
29071 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
29072 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
29073 directory containing certificate files. This does not work with GnuTLS; the
29074 option must be set to the name of a single file if you are using GnuTLS.
29075 </para>
29076 <para>
29077 These certificates should be for the certificate authorities trusted, rather
29078 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
29079 the value is a file then the certificates are sent by Exim as a server to
29080 connecting clients, defining the list of accepted certificate authorities.
29081 Thus the values defined should be considered public data.  To avoid this,
29082 use OpenSSL with a directory.
29083 </para>
29084 <para revisionflag="changed">
29085 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29086 </para>
29087 <para>
29088 <indexterm role="option">
29089 <primary><option>tls_verify_hosts</option></primary>
29090 </indexterm>
29091 </para>
29092 <informaltable frame="all">
29093 <tgroup cols="4" colsep="0" rowsep="0">
29094 <colspec colwidth="8*" align="left"/>
29095 <colspec colwidth="6*" align="center"/>
29096 <colspec colwidth="6*" align="center"/>
29097 <colspec colwidth="6*" align="right"/>
29098 <tbody>
29099 <row>
29100 <entry><option>tls_verify_hosts</option></entry>
29101 <entry>Use: <emphasis>main</emphasis></entry>
29102 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29103 <entry>Default: <emphasis>unset</emphasis></entry>
29104 </row>
29105 </tbody>
29106 </tgroup>
29107 </informaltable>
29108 <para>
29109 <indexterm role="concept">
29110 <primary>TLS</primary>
29111 <secondary>client certificate verification</secondary>
29112 </indexterm>
29113 <indexterm role="concept">
29114 <primary>certificate</primary>
29115 <secondary>verification of client</secondary>
29116 </indexterm>
29117 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
29118 certificates from clients. The expected certificates are defined by
29119 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
29120 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
29121 <option>tls_verify_certificates</option> is not set.
29122 </para>
29123 <para>
29124 Any client that matches <option>tls_verify_hosts</option> is constrained by
29125 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
29126 present one of the listed certificates. If it does not, the connection is
29127 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
29128 the host to use TLS. It can still send SMTP commands through unencrypted
29129 connections. Forcing a client to use TLS has to be done separately using an
29130 ACL to reject inappropriate commands when the connection is not encrypted.
29131 </para>
29132 <para>
29133 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
29134 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
29135 certificate and checks it against <option>tls_verify_certificates</option>, but does not
29136 abort the connection if there is no certificate or if it does not match. This
29137 state can be detected in an ACL, which makes it possible to implement policies
29138 such as <quote>accept for relay only if a verified certificate has been received,
29139 but accept for local delivery if encrypted, even without a verified
29140 certificate</quote>.
29141 </para>
29142 <para>
29143 Client hosts that match neither of these lists are not asked to present
29144 certificates.
29145 </para>
29146 <para>
29147 <indexterm role="option">
29148 <primary><option>trusted_groups</option></primary>
29149 </indexterm>
29150 </para>
29151 <informaltable frame="all">
29152 <tgroup cols="4" colsep="0" rowsep="0">
29153 <colspec colwidth="8*" align="left"/>
29154 <colspec colwidth="6*" align="center"/>
29155 <colspec colwidth="6*" align="center"/>
29156 <colspec colwidth="6*" align="right"/>
29157 <tbody>
29158 <row>
29159 <entry><option>trusted_groups</option></entry>
29160 <entry>Use: <emphasis>main</emphasis></entry>
29161 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29162 <entry>Default: <emphasis>unset</emphasis></entry>
29163 </row>
29164 </tbody>
29165 </tgroup>
29166 </informaltable>
29167 <para>
29168 <indexterm role="concept">
29169 <primary>trusted groups</primary>
29170 </indexterm>
29171 <indexterm role="concept">
29172 <primary>groups</primary>
29173 <secondary>trusted</secondary>
29174 </indexterm>
29175 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
29176 option is set, any process that is running in one of the listed groups, or
29177 which has one of them as a supplementary group, is trusted. The groups can be
29178 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
29179 details of what trusted callers are permitted to do. If neither
29180 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
29181 are trusted.
29182 </para>
29183 <para>
29184 <indexterm role="option">
29185 <primary><option>trusted_users</option></primary>
29186 </indexterm>
29187 </para>
29188 <informaltable frame="all">
29189 <tgroup cols="4" colsep="0" rowsep="0">
29190 <colspec colwidth="8*" align="left"/>
29191 <colspec colwidth="6*" align="center"/>
29192 <colspec colwidth="6*" align="center"/>
29193 <colspec colwidth="6*" align="right"/>
29194 <tbody>
29195 <row>
29196 <entry><option>trusted_users</option></entry>
29197 <entry>Use: <emphasis>main</emphasis></entry>
29198 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29199 <entry>Default: <emphasis>unset</emphasis></entry>
29200 </row>
29201 </tbody>
29202 </tgroup>
29203 </informaltable>
29204 <para>
29205 <indexterm role="concept">
29206 <primary>trusted users</primary>
29207 </indexterm>
29208 <indexterm role="concept">
29209 <primary>user</primary>
29210 <secondary>trusted</secondary>
29211 </indexterm>
29212 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
29213 option is set, any process that is running as one of the listed users is
29214 trusted. The users can be specified numerically or by name. See section
29215 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
29216 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
29217 Exim user are trusted.
29218 </para>
29219 <para>
29220 <indexterm role="option">
29221 <primary><option>unknown_login</option></primary>
29222 </indexterm>
29223 </para>
29224 <informaltable frame="all">
29225 <tgroup cols="4" colsep="0" rowsep="0">
29226 <colspec colwidth="8*" align="left"/>
29227 <colspec colwidth="6*" align="center"/>
29228 <colspec colwidth="6*" align="center"/>
29229 <colspec colwidth="6*" align="right"/>
29230 <tbody>
29231 <row>
29232 <entry><option>unknown_login</option></entry>
29233 <entry>Use: <emphasis>main</emphasis></entry>
29234 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29235 <entry>Default: <emphasis>unset</emphasis></entry>
29236 </row>
29237 </tbody>
29238 </tgroup>
29239 </informaltable>
29240 <para>
29241 <indexterm role="concept">
29242 <primary>uid (user id)</primary>
29243 <secondary>unknown caller</secondary>
29244 </indexterm>
29245 <indexterm role="variable">
29246 <primary><varname>$caller_uid</varname></primary>
29247 </indexterm>
29248 This is a specialized feature for use in unusual configurations. By default, if
29249 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
29250 gives up. The <option>unknown_login</option> option can be used to set a login name to be
29251 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
29252 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
29253 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
29254 <option>-F</option> option.
29255 </para>
29256 <para>
29257 <indexterm role="option">
29258 <primary><option>unknown_username</option></primary>
29259 </indexterm>
29260 </para>
29261 <informaltable frame="all">
29262 <tgroup cols="4" colsep="0" rowsep="0">
29263 <colspec colwidth="8*" align="left"/>
29264 <colspec colwidth="6*" align="center"/>
29265 <colspec colwidth="6*" align="center"/>
29266 <colspec colwidth="6*" align="right"/>
29267 <tbody>
29268 <row>
29269 <entry><option>unknown_username</option></entry>
29270 <entry>Use: <emphasis>main</emphasis></entry>
29271 <entry>Type: <emphasis>string</emphasis></entry>
29272 <entry>Default: <emphasis>unset</emphasis></entry>
29273 </row>
29274 </tbody>
29275 </tgroup>
29276 </informaltable>
29277 <para>
29278 See <option>unknown_login</option>.
29279 </para>
29280 <para>
29281 <indexterm role="option">
29282 <primary><option>untrusted_set_sender</option></primary>
29283 </indexterm>
29284 </para>
29285 <informaltable frame="all">
29286 <tgroup cols="4" colsep="0" rowsep="0">
29287 <colspec colwidth="8*" align="left"/>
29288 <colspec colwidth="6*" align="center"/>
29289 <colspec colwidth="6*" align="center"/>
29290 <colspec colwidth="6*" align="right"/>
29291 <tbody>
29292 <row>
29293 <entry><option>untrusted_set_sender</option></entry>
29294 <entry>Use: <emphasis>main</emphasis></entry>
29295 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
29296 <entry>Default: <emphasis>unset</emphasis></entry>
29297 </row>
29298 </tbody>
29299 </tgroup>
29300 </informaltable>
29301 <para>
29302 <indexterm role="concept">
29303 <primary>trusted users</primary>
29304 </indexterm>
29305 <indexterm role="concept">
29306 <primary>sender</primary>
29307 <secondary>setting by untrusted user</secondary>
29308 </indexterm>
29309 <indexterm role="concept">
29310 <primary>untrusted user setting sender</primary>
29311 </indexterm>
29312 <indexterm role="concept">
29313 <primary>user</primary>
29314 <secondary>untrusted setting sender</secondary>
29315 </indexterm>
29316 <indexterm role="concept">
29317 <primary>envelope sender</primary>
29318 </indexterm>
29319 When an untrusted user submits a message to Exim using the standard input, Exim
29320 normally creates an envelope sender address from the user&#x2019;s login and the
29321 default qualification domain. Data from the <option>-f</option> option (for setting envelope
29322 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
29323 is used) is ignored.
29324 </para>
29325 <para>
29326 However, untrusted users are permitted to set an empty envelope sender address,
29327 to declare that a message should never generate any bounces. For example:
29328 </para>
29329 <literallayout class="monospaced">
29330 exim -f '&lt;&gt;' user@domain.example
29331 </literallayout>
29332 <para>
29333 <indexterm role="variable">
29334 <primary><varname>$sender_ident</varname></primary>
29335 </indexterm>
29336 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
29337 other envelope sender addresses in a controlled way. When it is set, untrusted
29338 users are allowed to set envelope sender addresses that match any of the
29339 patterns in the list. Like all address lists, the string is expanded. The
29340 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
29341 users to setting senders that start with their login ids
29342 followed by a hyphen
29343 by a setting like this:
29344 </para>
29345 <literallayout class="monospaced">
29346 untrusted_set_sender = ^$sender_ident-
29347 </literallayout>
29348 <para>
29349 If you want to allow untrusted users to set envelope sender addresses without
29350 restriction, you can use
29351 </para>
29352 <literallayout class="monospaced">
29353 untrusted_set_sender = *
29354 </literallayout>
29355 <para>
29356 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
29357 only to the setting of the envelope sender. It does not permit untrusted users
29358 to use the other options which trusted user can use to override message
29359 parameters. Furthermore, it does not stop Exim from removing an existing
29360 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
29361 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
29362 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
29363 described in section <xref linkend="SECTthesenhea"/>.
29364 </para>
29365 <para>
29366 The log line for a message&#x2019;s arrival shows the envelope sender following
29367 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
29368 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
29369 envelope sender address, the user&#x2019;s login is shown in parentheses after the
29370 sender address.
29371 </para>
29372 <para>
29373 <indexterm role="option">
29374 <primary><option>uucp_from_pattern</option></primary>
29375 </indexterm>
29376 </para>
29377 <informaltable frame="all">
29378 <tgroup cols="4" colsep="0" rowsep="0">
29379 <colspec colwidth="8*" align="left"/>
29380 <colspec colwidth="6*" align="center"/>
29381 <colspec colwidth="6*" align="center"/>
29382 <colspec colwidth="6*" align="right"/>
29383 <tbody>
29384 <row>
29385 <entry><option>uucp_from_pattern</option></entry>
29386 <entry>Use: <emphasis>main</emphasis></entry>
29387 <entry>Type: <emphasis>string</emphasis></entry>
29388 <entry>Default: <emphasis>see below</emphasis></entry>
29389 </row>
29390 </tbody>
29391 </tgroup>
29392 </informaltable>
29393 <para>
29394 <indexterm role="concept">
29395 <primary><quote>From</quote> line</primary>
29396 </indexterm>
29397 <indexterm role="concept">
29398 <primary>UUCP</primary>
29399 <secondary><quote>From</quote> line</secondary>
29400 </indexterm>
29401 Some applications that pass messages to an MTA via a command line interface use
29402 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
29403 particular, this is used by UUCP software. Exim recognizes such a line by means
29404 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
29405 matches, the sender address is constructed by expanding the contents of
29406 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
29407 default pattern recognizes lines in the following two forms:
29408 </para>
29409 <literallayout class="monospaced">
29410 From ph10 Fri Jan  5 12:35 GMT 1996
29411 From ph10 Fri, 7 Jan 97 14:00:00 GMT
29412 </literallayout>
29413 <para>
29414 The pattern can be seen by running
29415 </para>
29416 <literallayout class="monospaced">
29417 exim -bP uucp_from_pattern
29418 </literallayout>
29419 <para>
29420 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
29421 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
29422 regular expression by a parenthesized subpattern. The default value for
29423 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
29424 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
29425 <option>ignore_fromline_hosts</option>.
29426 </para>
29427 <para>
29428 <indexterm role="option">
29429 <primary><option>uucp_from_sender</option></primary>
29430 </indexterm>
29431 </para>
29432 <informaltable frame="all">
29433 <tgroup cols="4" colsep="0" rowsep="0">
29434 <colspec colwidth="8*" align="left"/>
29435 <colspec colwidth="6*" align="center"/>
29436 <colspec colwidth="6*" align="center"/>
29437 <colspec colwidth="6*" align="right"/>
29438 <tbody>
29439 <row>
29440 <entry><option>uucp_from_sender</option></entry>
29441 <entry>Use: <emphasis>main</emphasis></entry>
29442 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29443 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
29444 </row>
29445 </tbody>
29446 </tgroup>
29447 </informaltable>
29448 <para>
29449 See <option>uucp_from_pattern</option> above.
29450 </para>
29451 <para>
29452 <indexterm role="option">
29453 <primary><option>warn_message_file</option></primary>
29454 </indexterm>
29455 </para>
29456 <informaltable frame="all">
29457 <tgroup cols="4" colsep="0" rowsep="0">
29458 <colspec colwidth="8*" align="left"/>
29459 <colspec colwidth="6*" align="center"/>
29460 <colspec colwidth="6*" align="center"/>
29461 <colspec colwidth="6*" align="right"/>
29462 <tbody>
29463 <row>
29464 <entry><option>warn_message_file</option></entry>
29465 <entry>Use: <emphasis>main</emphasis></entry>
29466 <entry>Type: <emphasis>string</emphasis></entry>
29467 <entry>Default: <emphasis>unset</emphasis></entry>
29468 </row>
29469 </tbody>
29470 </tgroup>
29471 </informaltable>
29472 <para>
29473 <indexterm role="concept">
29474 <primary>warning of delay</primary>
29475 <secondary>customizing the message</secondary>
29476 </indexterm>
29477 <indexterm role="concept">
29478 <primary>customizing</primary>
29479 <secondary>warning message</secondary>
29480 </indexterm>
29481 This option defines a template file containing paragraphs of text to be used
29482 for constructing the warning message which is sent by Exim when a message has
29483 been on the queue for a specified amount of time, as specified by
29484 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
29485 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
29486 </para>
29487 <para>
29488 <indexterm role="option">
29489 <primary><option>write_rejectlog</option></primary>
29490 </indexterm>
29491 </para>
29492 <informaltable frame="all">
29493 <tgroup cols="4" colsep="0" rowsep="0">
29494 <colspec colwidth="8*" align="left"/>
29495 <colspec colwidth="6*" align="center"/>
29496 <colspec colwidth="6*" align="center"/>
29497 <colspec colwidth="6*" align="right"/>
29498 <tbody>
29499 <row>
29500 <entry><option>write_rejectlog</option></entry>
29501 <entry>Use: <emphasis>main</emphasis></entry>
29502 <entry>Type: <emphasis>boolean</emphasis></entry>
29503 <entry>Default: <emphasis>true</emphasis></entry>
29504 </row>
29505 </tbody>
29506 </tgroup>
29507 </informaltable>
29508 <para>
29509 <indexterm role="concept">
29510 <primary>reject log</primary>
29511 <secondary>disabling</secondary>
29512 </indexterm>
29513 If this option is set false, Exim no longer writes anything to the reject log.
29514 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
29515 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
29516 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
29517 </para>
29518 </section>
29519 </chapter>
29520
29521 <chapter id="CHAProutergeneric">
29522 <title>Generic options for routers</title>
29523 <para>
29524 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
29525 <primary>options</primary>
29526 <secondary>generic; for routers</secondary>
29527 </indexterm>
29528 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
29529 <primary>generic options</primary>
29530 <secondary>router</secondary>
29531 </indexterm>
29532 This chapter describes the generic options that apply to all routers.
29533 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
29534 </para>
29535 <para>
29536 For a general description of how a router operates, see sections
29537 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
29538 which the preconditions are tested. The order of expansion of the options that
29539 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
29540 <option>headers_remove</option>, <option>transport</option>.
29541 </para>
29542 <para>
29543 <indexterm role="option">
29544 <primary><option>address_data</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>address_data</option></entry>
29556 <entry>Use: <emphasis>routers</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>router</primary>
29566 <secondary>data attached to address</secondary>
29567 </indexterm>
29568 The string is expanded just before the router is run, that is, after all the
29569 precondition tests have succeeded. If the expansion is forced to fail, the
29570 router declines, the value of <option>address_data</option> remains unchanged, and the
29571 <option>more</option> option controls what happens next. Other expansion failures cause
29572 delivery of the address to be deferred.
29573 </para>
29574 <para>
29575 <indexterm role="variable">
29576 <primary><varname>$address_data</varname></primary>
29577 </indexterm>
29578 When the expansion succeeds, the value is retained with the address, and can be
29579 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
29580 routers, and the eventual transport.
29581 </para>
29582 <para>
29583 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
29584 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
29585 in the filter. This is not normally a problem, because such data is usually
29586 either not confidential or it <quote>belongs</quote> to the current user, but if you do
29587 put confidential data into <varname>$address_data</varname> you need to remember this point.
29588 </para>
29589 <para>
29590 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
29591 with the address, though it can be changed by another <option>address_data</option> setting
29592 on a subsequent router. If a router generates child addresses, the value of
29593 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
29594 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
29595 </para>
29596 <para>
29597 The idea of <option>address_data</option> is that you can use it to look up a lot of data
29598 for the address once, and then pick out parts of the data later. For example,
29599 you could use a single LDAP lookup to return a string of the form
29600 </para>
29601 <literallayout class="monospaced">
29602 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
29603 </literallayout>
29604 <para>
29605 In the transport you could pick out the mailbox by a setting such as
29606 </para>
29607 <literallayout class="monospaced">
29608 file = ${extract{mailbox}{$address_data}}
29609 </literallayout>
29610 <para>
29611 This makes the configuration file less messy, and also reduces the number of
29612 lookups (though Exim does cache lookups).
29613 </para>
29614 <para>
29615 <indexterm role="variable">
29616 <primary><varname>$sender_address_data</varname></primary>
29617 </indexterm>
29618 <indexterm role="variable">
29619 <primary><varname>$address_data</varname></primary>
29620 </indexterm>
29621 The <option>address_data</option> facility is also useful as a means of passing information
29622 from one router to another, and from a router to a transport. In addition, if
29623 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
29624 ACL, it remains available for use in the rest of the ACL statement. After
29625 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
29626 </para>
29627 <para>
29628 <indexterm role="option">
29629 <primary><option>address_test</option></primary>
29630 </indexterm>
29631 </para>
29632 <informaltable frame="all">
29633 <tgroup cols="4" colsep="0" rowsep="0">
29634 <colspec colwidth="8*" align="left"/>
29635 <colspec colwidth="6*" align="center"/>
29636 <colspec colwidth="6*" align="center"/>
29637 <colspec colwidth="6*" align="right"/>
29638 <tbody>
29639 <row>
29640 <entry><option>address_test</option></entry>
29641 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29642 <entry>Type: <emphasis>boolean</emphasis></entry>
29643 <entry>Default: <emphasis>true</emphasis></entry>
29644 </row>
29645 </tbody>
29646 </tgroup>
29647 </informaltable>
29648 <para>
29649 <indexterm role="option">
29650 <primary><option>-bt</option></primary>
29651 </indexterm>
29652 <indexterm role="concept">
29653 <primary>router</primary>
29654 <secondary>skipping when address testing</secondary>
29655 </indexterm>
29656 If this option is set false, the router is skipped when routing is being tested
29657 by means of the <option>-bt</option> command line option. This can be a convenience when
29658 your first router sends messages to an external scanner, because it saves you
29659 having to set the <quote>already scanned</quote> indicator when testing real address
29660 routing.
29661 </para>
29662 <para>
29663 <indexterm role="option">
29664 <primary><option>cannot_route_message</option></primary>
29665 </indexterm>
29666 </para>
29667 <informaltable frame="all">
29668 <tgroup cols="4" colsep="0" rowsep="0">
29669 <colspec colwidth="8*" align="left"/>
29670 <colspec colwidth="6*" align="center"/>
29671 <colspec colwidth="6*" align="center"/>
29672 <colspec colwidth="6*" align="right"/>
29673 <tbody>
29674 <row>
29675 <entry><option>cannot_route_message</option></entry>
29676 <entry>Use: <emphasis>routers</emphasis></entry>
29677 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29678 <entry>Default: <emphasis>unset</emphasis></entry>
29679 </row>
29680 </tbody>
29681 </tgroup>
29682 </informaltable>
29683 <para>
29684 <indexterm role="concept">
29685 <primary>router</primary>
29686 <secondary>customizing <quote>cannot route</quote> message</secondary>
29687 </indexterm>
29688 <indexterm role="concept">
29689 <primary>customizing</primary>
29690 <secondary><quote>cannot route</quote> message</secondary>
29691 </indexterm>
29692 This option specifies a text message that is used when an address cannot be
29693 routed because Exim has run out of routers. The default message is
29694 <quote>Unrouteable address</quote>. This option is useful only on routers that have
29695 <option>more</option> set false, or on the very last router in a configuration, because the
29696 value that is used is taken from the last router that is considered. This
29697 includes a router that is skipped because its preconditions are not met, as
29698 well as a router that declines. For example, using the default configuration,
29699 you could put:
29700 </para>
29701 <literallayout class="monospaced">
29702 cannot_route_message = Remote domain not found in DNS
29703 </literallayout>
29704 <para>
29705 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
29706 and
29707 </para>
29708 <literallayout class="monospaced">
29709 cannot_route_message = Unknown local user
29710 </literallayout>
29711 <para>
29712 on the final router that checks for local users. If string expansion fails for
29713 this option, the default message is used. Unless the expansion failure was
29714 explicitly forced, a message about the failure is written to the main and panic
29715 logs, in addition to the normal message about the routing failure.
29716 </para>
29717 <para>
29718 <indexterm role="option">
29719 <primary><option>caseful_local_part</option></primary>
29720 </indexterm>
29721 </para>
29722 <informaltable frame="all">
29723 <tgroup cols="4" colsep="0" rowsep="0">
29724 <colspec colwidth="8*" align="left"/>
29725 <colspec colwidth="6*" align="center"/>
29726 <colspec colwidth="6*" align="center"/>
29727 <colspec colwidth="6*" align="right"/>
29728 <tbody>
29729 <row>
29730 <entry><option>caseful_local_part</option></entry>
29731 <entry>Use: <emphasis>routers</emphasis></entry>
29732 <entry>Type: <emphasis>boolean</emphasis></entry>
29733 <entry>Default: <emphasis>false</emphasis></entry>
29734 </row>
29735 </tbody>
29736 </tgroup>
29737 </informaltable>
29738 <para>
29739 <indexterm role="concept">
29740 <primary>case of local parts</primary>
29741 </indexterm>
29742 <indexterm role="concept">
29743 <primary>router</primary>
29744 <secondary>case of local parts</secondary>
29745 </indexterm>
29746 By default, routers handle the local parts of addresses in a case-insensitive
29747 manner, though the actual case is preserved for transmission with the message.
29748 If you want the case of letters to be significant in a router, you must set
29749 this option true. For individual router options that contain address or local
29750 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
29751 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
29752 more details.
29753 </para>
29754 <para>
29755 <indexterm role="variable">
29756 <primary><varname>$local_part</varname></primary>
29757 </indexterm>
29758 <indexterm role="variable">
29759 <primary><varname>$original_local_part</varname></primary>
29760 </indexterm>
29761 <indexterm role="variable">
29762 <primary><varname>$parent_local_part</varname></primary>
29763 </indexterm>
29764 The value of the <varname>$local_part</varname> variable is forced to lower case while a
29765 router is running unless <option>caseful_local_part</option> is set. When a router assigns
29766 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
29767 is the same as it was in the router. Similarly, when a router generates child
29768 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
29769 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
29770 </para>
29771 <para>
29772 This option applies to the processing of an address by a router. When a
29773 recipient address is being processed in an ACL, there is a separate <option>control</option>
29774 modifier that can be used to specify case-sensitive processing within the ACL
29775 (see section <xref linkend="SECTcontrols"/>).
29776 </para>
29777 <para>
29778 <indexterm role="option">
29779 <primary><option>check_local_user</option></primary>
29780 </indexterm>
29781 </para>
29782 <informaltable frame="all">
29783 <tgroup cols="4" colsep="0" rowsep="0">
29784 <colspec colwidth="8*" align="left"/>
29785 <colspec colwidth="6*" align="center"/>
29786 <colspec colwidth="6*" align="center"/>
29787 <colspec colwidth="6*" align="right"/>
29788 <tbody>
29789 <row>
29790 <entry><option>check_local_user</option></entry>
29791 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29792 <entry>Type: <emphasis>boolean</emphasis></entry>
29793 <entry>Default: <emphasis>false</emphasis></entry>
29794 </row>
29795 </tbody>
29796 </tgroup>
29797 </informaltable>
29798 <para>
29799 <indexterm role="concept">
29800 <primary>local user, checking in router</primary>
29801 </indexterm>
29802 <indexterm role="concept">
29803 <primary>router</primary>
29804 <secondary>checking for local user</secondary>
29805 </indexterm>
29806 <indexterm role="concept">
29807 <primary><filename>/etc/passwd</filename></primary>
29808 </indexterm>
29809 <indexterm role="variable">
29810 <primary><varname>$home</varname></primary>
29811 </indexterm>
29812 When this option is true, Exim checks that the local part of the recipient
29813 address (with affixes removed if relevant) is the name of an account on the
29814 local system. The check is done by calling the <function>getpwnam()</function> function rather
29815 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
29816 holding password data (such as NIS) are supported. If the local part is a local
29817 user, <varname>$home</varname> is set from the password data, and can be tested in other
29818 preconditions that are evaluated after this one (the order of evaluation is
29819 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
29820 overridden by <option>router_home_directory</option>. If the local part is not a local user,
29821 the router is skipped.
29822 </para>
29823 <para>
29824 If you want to check that the local part is either the name of a local user
29825 or matches something else, you cannot combine <option>check_local_user</option> with a
29826 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
29827 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
29828 setting to achieve this. For example:
29829 </para>
29830 <literallayout class="monospaced">
29831 local_parts = passwd;$local_part : lsearch;/etc/other/users
29832 </literallayout>
29833 <para>
29834 Note, however, that the side effects of <option>check_local_user</option> (such as setting
29835 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
29836 <option>local_parts</option> (or any other) precondition.
29837 </para>
29838 <para>
29839 <indexterm role="option">
29840 <primary><option>condition</option></primary>
29841 </indexterm>
29842 </para>
29843 <informaltable frame="all">
29844 <tgroup cols="4" colsep="0" rowsep="0">
29845 <colspec colwidth="8*" align="left"/>
29846 <colspec colwidth="6*" align="center"/>
29847 <colspec colwidth="6*" align="center"/>
29848 <colspec colwidth="6*" align="right"/>
29849 <tbody>
29850 <row>
29851 <entry><option>condition</option></entry>
29852 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29853 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29854 <entry>Default: <emphasis>unset</emphasis></entry>
29855 </row>
29856 </tbody>
29857 </tgroup>
29858 </informaltable>
29859 <para>
29860 <indexterm role="concept">
29861 <primary>router</primary>
29862 <secondary>customized precondition</secondary>
29863 </indexterm>
29864 This option specifies a general precondition test that has to succeed for the
29865 router to be called. The <option>condition</option> option is the last precondition to be
29866 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
29867 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
29868 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
29869 router is skipped, and the address is offered to the next one.
29870 </para>
29871 <para>
29872 If the result is any other value, the router is run (as this is the last
29873 precondition to be evaluated, all the other preconditions must be true).
29874 </para>
29875 <para>
29876 This option is unique in that multiple <option>condition</option> options may be present.
29877 All <option>condition</option> options must succeed.
29878 </para>
29879 <para>
29880 The <option>condition</option> option provides a means of applying custom conditions to the
29881 running of routers. Note that in the case of a simple conditional expansion,
29882 the default expansion values are exactly what is wanted. For example:
29883 </para>
29884 <literallayout class="monospaced">
29885 condition = ${if &gt;{$message_age}{600}}
29886 </literallayout>
29887 <para>
29888 Because of the default behaviour of the string expansion, this is equivalent to
29889 </para>
29890 <literallayout class="monospaced">
29891 condition = ${if &gt;{$message_age}{600}{true}{}}
29892 </literallayout>
29893 <para>
29894 A multiple condition example, which succeeds:
29895 </para>
29896 <literallayout class="monospaced">
29897 condition = ${if &gt;{$message_age}{600}}
29898 condition = ${if !eq{${lc:$local_part}}{postmaster}}
29899 condition = foobar
29900 </literallayout>
29901 <para>
29902 If the expansion fails (other than forced failure) delivery is deferred. Some
29903 of the other precondition options are common special cases that could in fact
29904 be specified using <option>condition</option>.
29905 </para>
29906 <para>
29907 <indexterm role="option">
29908 <primary><option>debug_print</option></primary>
29909 </indexterm>
29910 </para>
29911 <informaltable frame="all">
29912 <tgroup cols="4" colsep="0" rowsep="0">
29913 <colspec colwidth="8*" align="left"/>
29914 <colspec colwidth="6*" align="center"/>
29915 <colspec colwidth="6*" align="center"/>
29916 <colspec colwidth="6*" align="right"/>
29917 <tbody>
29918 <row>
29919 <entry><option>debug_print</option></entry>
29920 <entry>Use: <emphasis>routers</emphasis></entry>
29921 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29922 <entry>Default: <emphasis>unset</emphasis></entry>
29923 </row>
29924 </tbody>
29925 </tgroup>
29926 </informaltable>
29927 <para>
29928 <indexterm role="concept">
29929 <primary>testing</primary>
29930 <secondary>variables in drivers</secondary>
29931 </indexterm>
29932 If this option is set and debugging is enabled (see the <option>-d</option> command line
29933 option), the string is expanded and included in the debugging output.
29934 If expansion of the string fails, the error message is written to the debugging
29935 output, and Exim carries on processing.
29936 This option is provided to help with checking out the values of variables and
29937 so on when debugging router configurations. For example, if a <option>condition</option>
29938 option appears not to be working, <option>debug_print</option> can be used to output the
29939 variables it references. The output happens after checks for <option>domains</option>,
29940 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
29941 are tested. A newline is added to the text if it does not end with one.
29942 </para>
29943 <para>
29944 <indexterm role="option">
29945 <primary><option>disable_logging</option></primary>
29946 </indexterm>
29947 </para>
29948 <informaltable frame="all">
29949 <tgroup cols="4" colsep="0" rowsep="0">
29950 <colspec colwidth="8*" align="left"/>
29951 <colspec colwidth="6*" align="center"/>
29952 <colspec colwidth="6*" align="center"/>
29953 <colspec colwidth="6*" align="right"/>
29954 <tbody>
29955 <row>
29956 <entry><option>disable_logging</option></entry>
29957 <entry>Use: <emphasis>routers</emphasis></entry>
29958 <entry>Type: <emphasis>boolean</emphasis></entry>
29959 <entry>Default: <emphasis>false</emphasis></entry>
29960 </row>
29961 </tbody>
29962 </tgroup>
29963 </informaltable>
29964 <para>
29965 If this option is set true, nothing is logged for any routing errors
29966 or for any deliveries caused by this router. You should not set this option
29967 unless you really, really know what you are doing. See also the generic
29968 transport option of the same name.
29969 </para>
29970 <para>
29971 <indexterm role="option">
29972 <primary><option>domains</option></primary>
29973 </indexterm>
29974 </para>
29975 <informaltable frame="all">
29976 <tgroup cols="4" colsep="0" rowsep="0">
29977 <colspec colwidth="8*" align="left"/>
29978 <colspec colwidth="6*" align="center"/>
29979 <colspec colwidth="6*" align="center"/>
29980 <colspec colwidth="6*" align="right"/>
29981 <tbody>
29982 <row>
29983 <entry><option>domains</option></entry>
29984 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29985 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29986 <entry>Default: <emphasis>unset</emphasis></entry>
29987 </row>
29988 </tbody>
29989 </tgroup>
29990 </informaltable>
29991 <para>
29992 <indexterm role="concept">
29993 <primary>router</primary>
29994 <secondary>restricting to specific domains</secondary>
29995 </indexterm>
29996 <indexterm role="variable">
29997 <primary><varname>$domain_data</varname></primary>
29998 </indexterm>
29999 If this option is set, the router is skipped unless the current domain matches
30000 the list. If the match is achieved by means of a file lookup, the data that the
30001 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
30002 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
30003 a list of the order in which preconditions are evaluated.
30004 </para>
30005 <para>
30006 <indexterm role="option">
30007 <primary><option>driver</option></primary>
30008 </indexterm>
30009 </para>
30010 <informaltable frame="all">
30011 <tgroup cols="4" colsep="0" rowsep="0">
30012 <colspec colwidth="8*" align="left"/>
30013 <colspec colwidth="6*" align="center"/>
30014 <colspec colwidth="6*" align="center"/>
30015 <colspec colwidth="6*" align="right"/>
30016 <tbody>
30017 <row>
30018 <entry><option>driver</option></entry>
30019 <entry>Use: <emphasis>routers</emphasis></entry>
30020 <entry>Type: <emphasis>string</emphasis></entry>
30021 <entry>Default: <emphasis>unset</emphasis></entry>
30022 </row>
30023 </tbody>
30024 </tgroup>
30025 </informaltable>
30026 <para>
30027 This option must always be set. It specifies which of the available routers is
30028 to be used.
30029 </para>
30030 <para>
30031 <indexterm role="option">
30032 <primary><option>errors_to</option></primary>
30033 </indexterm>
30034 </para>
30035 <informaltable frame="all">
30036 <tgroup cols="4" colsep="0" rowsep="0">
30037 <colspec colwidth="8*" align="left"/>
30038 <colspec colwidth="6*" align="center"/>
30039 <colspec colwidth="6*" align="center"/>
30040 <colspec colwidth="6*" align="right"/>
30041 <tbody>
30042 <row>
30043 <entry><option>errors_to</option></entry>
30044 <entry>Use: <emphasis>routers</emphasis></entry>
30045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30046 <entry>Default: <emphasis>unset</emphasis></entry>
30047 </row>
30048 </tbody>
30049 </tgroup>
30050 </informaltable>
30051 <para>
30052 <indexterm role="concept">
30053 <primary>envelope sender</primary>
30054 </indexterm>
30055 <indexterm role="concept">
30056 <primary>router</primary>
30057 <secondary>changing address for errors</secondary>
30058 </indexterm>
30059 If a router successfully handles an address, it may assign the address to a
30060 transport for delivery or it may generate child addresses. In both cases, if
30061 there is a delivery problem during later processing, the resulting bounce
30062 message is sent to the address that results from expanding this string,
30063 provided that the address verifies successfully. The <option>errors_to</option> option is
30064 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
30065 </para>
30066 <para>
30067 The <option>errors_to</option> setting associated with an address can be overridden if it
30068 subsequently passes through other routers that have their own <option>errors_to</option>
30069 settings, or if the message is delivered by a transport with a <option>return_path</option>
30070 setting.
30071 </para>
30072 <para>
30073 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
30074 the expansion fails to verify, the errors address associated with the incoming
30075 address is used. At top level, this is the envelope sender. A non-forced
30076 expansion failure causes delivery to be deferred.
30077 </para>
30078 <para>
30079 If an address for which <option>errors_to</option> has been set ends up being delivered over
30080 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
30081 any bounces that are generated by other MTAs on the delivery route are also
30082 sent there. You can set <option>errors_to</option> to the empty string by either of these
30083 settings:
30084 </para>
30085 <literallayout class="monospaced">
30086 errors_to =
30087 errors_to = ""
30088 </literallayout>
30089 <para>
30090 An expansion item that yields an empty string has the same effect. If you do
30091 this, a locally detected delivery error for addresses processed by this router
30092 no longer gives rise to a bounce message; the error is discarded. If the
30093 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
30094 overridden by the <option>return_path</option> option on the transport.
30095 </para>
30096 <para>
30097 <indexterm role="variable">
30098 <primary><varname>$address_data</varname></primary>
30099 </indexterm>
30100 If for some reason you want to discard local errors, but use a non-empty
30101 MAIL command for remote delivery, you can preserve the original return
30102 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
30103 setting <option>return_path</option>.
30104 </para>
30105 <para>
30106 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
30107 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
30108 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
30109 </para>
30110 <para>
30111 <indexterm role="option">
30112 <primary><option>expn</option></primary>
30113 </indexterm>
30114 </para>
30115 <informaltable frame="all">
30116 <tgroup cols="4" colsep="0" rowsep="0">
30117 <colspec colwidth="8*" align="left"/>
30118 <colspec colwidth="6*" align="center"/>
30119 <colspec colwidth="6*" align="center"/>
30120 <colspec colwidth="6*" align="right"/>
30121 <tbody>
30122 <row>
30123 <entry><option>expn</option></entry>
30124 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30125 <entry>Type: <emphasis>boolean</emphasis></entry>
30126 <entry>Default: <emphasis>true</emphasis></entry>
30127 </row>
30128 </tbody>
30129 </tgroup>
30130 </informaltable>
30131 <para>
30132 <indexterm role="concept">
30133 <primary>address</primary>
30134 <secondary>testing</secondary>
30135 </indexterm>
30136 <indexterm role="concept">
30137 <primary>testing</primary>
30138 <secondary>addresses</secondary>
30139 </indexterm>
30140 <indexterm role="concept">
30141 <primary>EXPN</primary>
30142 <secondary>router skipping</secondary>
30143 </indexterm>
30144 <indexterm role="concept">
30145 <primary>router</primary>
30146 <secondary>skipping for EXPN</secondary>
30147 </indexterm>
30148 If this option is turned off, the router is skipped when testing an address
30149 as a result of processing an SMTP EXPN command. You might, for example,
30150 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
30151 on for the system alias file.
30152 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30153 are evaluated.
30154 </para>
30155 <para>
30156 The use of the SMTP EXPN command is controlled by an ACL (see chapter
30157 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
30158 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
30159 </para>
30160 <para>
30161 <indexterm role="option">
30162 <primary><option>fail_verify</option></primary>
30163 </indexterm>
30164 </para>
30165 <informaltable frame="all">
30166 <tgroup cols="4" colsep="0" rowsep="0">
30167 <colspec colwidth="8*" align="left"/>
30168 <colspec colwidth="6*" align="center"/>
30169 <colspec colwidth="6*" align="center"/>
30170 <colspec colwidth="6*" align="right"/>
30171 <tbody>
30172 <row>
30173 <entry><option>fail_verify</option></entry>
30174 <entry>Use: <emphasis>routers</emphasis></entry>
30175 <entry>Type: <emphasis>boolean</emphasis></entry>
30176 <entry>Default: <emphasis>false</emphasis></entry>
30177 </row>
30178 </tbody>
30179 </tgroup>
30180 </informaltable>
30181 <para>
30182 <indexterm role="concept">
30183 <primary>router</primary>
30184 <secondary>forcing verification failure</secondary>
30185 </indexterm>
30186 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
30187 <option>fail_verify_recipient</option> to the same value.
30188 </para>
30189 <para>
30190 <indexterm role="option">
30191 <primary><option>fail_verify_recipient</option></primary>
30192 </indexterm>
30193 </para>
30194 <informaltable frame="all">
30195 <tgroup cols="4" colsep="0" rowsep="0">
30196 <colspec colwidth="8*" align="left"/>
30197 <colspec colwidth="6*" align="center"/>
30198 <colspec colwidth="6*" align="center"/>
30199 <colspec colwidth="6*" align="right"/>
30200 <tbody>
30201 <row>
30202 <entry><option>fail_verify_recipient</option></entry>
30203 <entry>Use: <emphasis>routers</emphasis></entry>
30204 <entry>Type: <emphasis>boolean</emphasis></entry>
30205 <entry>Default: <emphasis>false</emphasis></entry>
30206 </row>
30207 </tbody>
30208 </tgroup>
30209 </informaltable>
30210 <para>
30211 If this option is true and an address is accepted by this router when
30212 verifying a recipient, verification fails.
30213 </para>
30214 <para>
30215 <indexterm role="option">
30216 <primary><option>fail_verify_sender</option></primary>
30217 </indexterm>
30218 </para>
30219 <informaltable frame="all">
30220 <tgroup cols="4" colsep="0" rowsep="0">
30221 <colspec colwidth="8*" align="left"/>
30222 <colspec colwidth="6*" align="center"/>
30223 <colspec colwidth="6*" align="center"/>
30224 <colspec colwidth="6*" align="right"/>
30225 <tbody>
30226 <row>
30227 <entry><option>fail_verify_sender</option></entry>
30228 <entry>Use: <emphasis>routers</emphasis></entry>
30229 <entry>Type: <emphasis>boolean</emphasis></entry>
30230 <entry>Default: <emphasis>false</emphasis></entry>
30231 </row>
30232 </tbody>
30233 </tgroup>
30234 </informaltable>
30235 <para>
30236 If this option is true and an address is accepted by this router when
30237 verifying a sender, verification fails.
30238 </para>
30239 <para>
30240 <indexterm role="option">
30241 <primary><option>fallback_hosts</option></primary>
30242 </indexterm>
30243 </para>
30244 <informaltable frame="all">
30245 <tgroup cols="4" colsep="0" rowsep="0">
30246 <colspec colwidth="8*" align="left"/>
30247 <colspec colwidth="6*" align="center"/>
30248 <colspec colwidth="6*" align="center"/>
30249 <colspec colwidth="6*" align="right"/>
30250 <tbody>
30251 <row>
30252 <entry><option>fallback_hosts</option></entry>
30253 <entry>Use: <emphasis>routers</emphasis></entry>
30254 <entry>Type: <emphasis>string list</emphasis></entry>
30255 <entry>Default: <emphasis>unset</emphasis></entry>
30256 </row>
30257 </tbody>
30258 </tgroup>
30259 </informaltable>
30260 <para>
30261 <indexterm role="concept">
30262 <primary>router</primary>
30263 <secondary>fallback hosts</secondary>
30264 </indexterm>
30265 <indexterm role="concept">
30266 <primary>fallback</primary>
30267 <secondary>hosts specified on router</secondary>
30268 </indexterm>
30269 String expansion is not applied to this option. The argument must be a
30270 colon-separated list of host names or IP addresses. The list separator can be
30271 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
30272 each name or address. In fact, the format of each item is exactly the same as
30273 defined for the list of hosts in a <command>manualroute</command> router (see section
30274 <xref linkend="SECTformatonehostitem"/>).
30275 </para>
30276 <para>
30277 If a router queues an address for a remote transport, this host list is
30278 associated with the address, and used instead of the transport&#x2019;s fallback host
30279 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
30280 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
30281 transport for further details.
30282 </para>
30283 <para>
30284 <indexterm role="option">
30285 <primary><option>group</option></primary>
30286 </indexterm>
30287 </para>
30288 <informaltable frame="all">
30289 <tgroup cols="4" colsep="0" rowsep="0">
30290 <colspec colwidth="8*" align="left"/>
30291 <colspec colwidth="6*" align="center"/>
30292 <colspec colwidth="6*" align="center"/>
30293 <colspec colwidth="6*" align="right"/>
30294 <tbody>
30295 <row>
30296 <entry><option>group</option></entry>
30297 <entry>Use: <emphasis>routers</emphasis></entry>
30298 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30299 <entry>Default: <emphasis>see below</emphasis></entry>
30300 </row>
30301 </tbody>
30302 </tgroup>
30303 </informaltable>
30304 <para>
30305 <indexterm role="concept">
30306 <primary>gid (group id)</primary>
30307 <secondary>local delivery</secondary>
30308 </indexterm>
30309 <indexterm role="concept">
30310 <primary>local transports</primary>
30311 <secondary>uid and gid</secondary>
30312 </indexterm>
30313 <indexterm role="concept">
30314 <primary>transport</primary>
30315 <secondary>local</secondary>
30316 </indexterm>
30317 <indexterm role="concept">
30318 <primary>router</primary>
30319 <secondary>setting group</secondary>
30320 </indexterm>
30321 When a router queues an address for a transport, and the transport does not
30322 specify a group, the group given here is used when running the delivery
30323 process.
30324 The group may be specified numerically or by name. If expansion fails, the
30325 error is logged and delivery is deferred.
30326 The default is unset, unless <option>check_local_user</option> is set, when the default
30327 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
30328 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
30329 </para>
30330 <para>
30331 <indexterm role="option">
30332 <primary><option>headers_add</option></primary>
30333 </indexterm>
30334 </para>
30335 <informaltable frame="all">
30336 <tgroup cols="4" colsep="0" rowsep="0">
30337 <colspec colwidth="8*" align="left"/>
30338 <colspec colwidth="6*" align="center"/>
30339 <colspec colwidth="6*" align="center"/>
30340 <colspec colwidth="6*" align="right"/>
30341 <tbody>
30342 <row>
30343 <entry><option>headers_add</option></entry>
30344 <entry>Use: <emphasis>routers</emphasis></entry>
30345 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30346 <entry>Default: <emphasis>unset</emphasis></entry>
30347 </row>
30348 </tbody>
30349 </tgroup>
30350 </informaltable>
30351 <para>
30352 <indexterm role="concept">
30353 <primary>header lines</primary>
30354 <secondary>adding</secondary>
30355 </indexterm>
30356 <indexterm role="concept">
30357 <primary>router</primary>
30358 <secondary>adding header lines</secondary>
30359 </indexterm>
30360 This option specifies a string of text that is expanded at routing time, and
30361 associated with any addresses that are accepted by the router. However, this
30362 option has no effect when an address is just being verified. The way in which
30363 the text is used to add header lines at transport time is described in section
30364 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
30365 message is in the process of being transported. This means that references to
30366 header lines in string expansions in the transport&#x2019;s configuration do not
30367 <quote>see</quote> the added header lines.
30368 </para>
30369 <para>
30370 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
30371 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
30372 the expansion is forced to fail, the option has no effect. Other expansion
30373 failures are treated as configuration errors.
30374 </para>
30375 <para>
30376 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
30377 router that has the <option>one_time</option> option set.
30378 </para>
30379 <para>
30380 <indexterm role="concept">
30381 <primary>duplicate addresses</primary>
30382 </indexterm>
30383 <indexterm role="option">
30384 <primary><option>unseen</option></primary>
30385 </indexterm>
30386 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
30387 additions are deleted when the address is passed on to subsequent routers.
30388 For a <option>redirect</option> router, if a generated address is the same as the incoming
30389 address, this can lead to duplicate addresses with different header
30390 modifications. Exim does not do duplicate deliveries (except, in certain
30391 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
30392 which of the duplicates is discarded, so this ambiguous situation should be
30393 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
30394 </para>
30395 <para>
30396 <indexterm role="option">
30397 <primary><option>headers_remove</option></primary>
30398 </indexterm>
30399 </para>
30400 <informaltable frame="all">
30401 <tgroup cols="4" colsep="0" rowsep="0">
30402 <colspec colwidth="8*" align="left"/>
30403 <colspec colwidth="6*" align="center"/>
30404 <colspec colwidth="6*" align="center"/>
30405 <colspec colwidth="6*" align="right"/>
30406 <tbody>
30407 <row>
30408 <entry><option>headers_remove</option></entry>
30409 <entry>Use: <emphasis>routers</emphasis></entry>
30410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30411 <entry>Default: <emphasis>unset</emphasis></entry>
30412 </row>
30413 </tbody>
30414 </tgroup>
30415 </informaltable>
30416 <para>
30417 <indexterm role="concept">
30418 <primary>header lines</primary>
30419 <secondary>removing</secondary>
30420 </indexterm>
30421 <indexterm role="concept">
30422 <primary>router</primary>
30423 <secondary>removing header lines</secondary>
30424 </indexterm>
30425 This option specifies a string of text that is expanded at routing time, and
30426 associated with any addresses that are accepted by the router. However, this
30427 option has no effect when an address is just being verified. The way in which
30428 the text is used to remove header lines at transport time is described in
30429 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
30430 the message is in the process of being transported. This means that references
30431 to header lines in string expansions in the transport&#x2019;s configuration still
30432 <quote>see</quote> the original header lines.
30433 </para>
30434 <para>
30435 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
30436 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
30437 the option has no effect. Other expansion failures are treated as configuration
30438 errors.
30439 </para>
30440 <para>
30441 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
30442 router that has the <option>one_time</option> option set.
30443 </para>
30444 <para>
30445 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
30446 removal requests are deleted when the address is passed on to subsequent
30447 routers, and this can lead to problems with duplicates -- see the similar
30448 warning for <option>headers_add</option> above.
30449 </para>
30450 <para>
30451 <indexterm role="option">
30452 <primary><option>ignore_target_hosts</option></primary>
30453 </indexterm>
30454 </para>
30455 <informaltable frame="all">
30456 <tgroup cols="4" colsep="0" rowsep="0">
30457 <colspec colwidth="8*" align="left"/>
30458 <colspec colwidth="6*" align="center"/>
30459 <colspec colwidth="6*" align="center"/>
30460 <colspec colwidth="6*" align="right"/>
30461 <tbody>
30462 <row>
30463 <entry><option>ignore_target_hosts</option></entry>
30464 <entry>Use: <emphasis>routers</emphasis></entry>
30465 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30466 <entry>Default: <emphasis>unset</emphasis></entry>
30467 </row>
30468 </tbody>
30469 </tgroup>
30470 </informaltable>
30471 <para>
30472 <indexterm role="concept">
30473 <primary>IP address</primary>
30474 <secondary>discarding</secondary>
30475 </indexterm>
30476 <indexterm role="concept">
30477 <primary>router</primary>
30478 <secondary>discarding IP addresses</secondary>
30479 </indexterm>
30480 Although this option is a host list, it should normally contain IP address
30481 entries rather than names. If any host that is looked up by the router has an
30482 IP address that matches an item in this list, Exim behaves as if that IP
30483 address did not exist. This option allows you to cope with rogue DNS entries
30484 like
30485 </para>
30486 <literallayout class="monospaced">
30487 remote.domain.example.  A  127.0.0.1
30488 </literallayout>
30489 <para>
30490 by setting
30491 </para>
30492 <literallayout class="monospaced">
30493 ignore_target_hosts = 127.0.0.1
30494 </literallayout>
30495 <para>
30496 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
30497 discarded in this way, the router declines. In a conventional configuration, an
30498 attempt to mail to such a domain would normally provoke the <quote>unrouteable
30499 domain</quote> error, and an attempt to verify an address in the domain would fail.
30500 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
30501 router declines if presented with one of the listed addresses.
30502 </para>
30503 <para>
30504 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
30505 means of the first or the second of the following settings, respectively:
30506 </para>
30507 <literallayout class="monospaced">
30508 ignore_target_hosts = 0.0.0.0/0
30509 ignore_target_hosts = &lt;; 0::0/0
30510 </literallayout>
30511 <para>
30512 The pattern in the first line matches all IPv4 addresses, whereas the pattern
30513 in the second line matches all IPv6 addresses.
30514 </para>
30515 <para>
30516 This option may also be useful for ignoring link-local and site-local IPv6
30517 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
30518 is expanded before use as a list, it is possible to make it dependent on the
30519 domain that is being routed.
30520 </para>
30521 <para>
30522 <indexterm role="variable">
30523 <primary><varname>$host_address</varname></primary>
30524 </indexterm>
30525 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
30526 checked.
30527 </para>
30528 <para>
30529 <indexterm role="option">
30530 <primary><option>initgroups</option></primary>
30531 </indexterm>
30532 </para>
30533 <informaltable frame="all">
30534 <tgroup cols="4" colsep="0" rowsep="0">
30535 <colspec colwidth="8*" align="left"/>
30536 <colspec colwidth="6*" align="center"/>
30537 <colspec colwidth="6*" align="center"/>
30538 <colspec colwidth="6*" align="right"/>
30539 <tbody>
30540 <row>
30541 <entry><option>initgroups</option></entry>
30542 <entry>Use: <emphasis>routers</emphasis></entry>
30543 <entry>Type: <emphasis>boolean</emphasis></entry>
30544 <entry>Default: <emphasis>false</emphasis></entry>
30545 </row>
30546 </tbody>
30547 </tgroup>
30548 </informaltable>
30549 <para>
30550 <indexterm role="concept">
30551 <primary>additional groups</primary>
30552 </indexterm>
30553 <indexterm role="concept">
30554 <primary>groups</primary>
30555 <secondary>additional</secondary>
30556 </indexterm>
30557 <indexterm role="concept">
30558 <primary>local transports</primary>
30559 <secondary>uid and gid</secondary>
30560 </indexterm>
30561 <indexterm role="concept">
30562 <primary>transport</primary>
30563 <secondary>local</secondary>
30564 </indexterm>
30565 If the router queues an address for a transport, and this option is true, and
30566 the uid supplied by the router is not overridden by the transport, the
30567 <function>initgroups()</function> function is called when running the transport to ensure that
30568 any additional groups associated with the uid are set up. See also <option>group</option>
30569 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
30570 </para>
30571 <para>
30572 <indexterm role="option">
30573 <primary><option>local_part_prefix</option></primary>
30574 </indexterm>
30575 </para>
30576 <informaltable frame="all">
30577 <tgroup cols="4" colsep="0" rowsep="0">
30578 <colspec colwidth="8*" align="left"/>
30579 <colspec colwidth="6*" align="center"/>
30580 <colspec colwidth="6*" align="center"/>
30581 <colspec colwidth="6*" align="right"/>
30582 <tbody>
30583 <row>
30584 <entry><option>local_part_prefix</option></entry>
30585 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30586 <entry>Type: <emphasis>string list</emphasis></entry>
30587 <entry>Default: <emphasis>unset</emphasis></entry>
30588 </row>
30589 </tbody>
30590 </tgroup>
30591 </informaltable>
30592 <para>
30593 <indexterm role="concept">
30594 <primary>router</primary>
30595 <secondary>prefix for local part</secondary>
30596 </indexterm>
30597 <indexterm role="concept">
30598 <primary>prefix</primary>
30599 <secondary>for local part, used in router</secondary>
30600 </indexterm>
30601 If this option is set, the router is skipped unless the local part starts with
30602 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
30603 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
30604 evaluated.
30605 </para>
30606 <para>
30607 The list is scanned from left to right, and the first prefix that matches is
30608 used. A limited form of wildcard is available; if the prefix begins with an
30609 asterisk, it matches the longest possible sequence of arbitrary characters at
30610 the start of the local part. An asterisk should therefore always be followed by
30611 some character that does not occur in normal local parts.
30612 <indexterm role="concept">
30613 <primary>multiple mailboxes</primary>
30614 </indexterm>
30615 <indexterm role="concept">
30616 <primary>mailbox</primary>
30617 <secondary>multiple</secondary>
30618 </indexterm>
30619 Wildcarding can be used to set up multiple user mailboxes, as described in
30620 section <xref linkend="SECTmulbox"/>.
30621 </para>
30622 <para>
30623 <indexterm role="variable">
30624 <primary><varname>$local_part</varname></primary>
30625 </indexterm>
30626 <indexterm role="variable">
30627 <primary><varname>$local_part_prefix</varname></primary>
30628 </indexterm>
30629 During the testing of the <option>local_parts</option> option, and while the router is
30630 running, the prefix is removed from the local part, and is available in the
30631 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
30632 the router accepts the address, this remains true during subsequent delivery by
30633 a transport. In particular, the local part that is transmitted in the RCPT
30634 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
30635 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
30636 the relevant transport.
30637 </para>
30638 <para>
30639 When an address is being verified, <option>local_part_prefix</option> affects only the
30640 behaviour of the router. If the callout feature of verification is in use, this
30641 means that the full address, including the prefix, will be used during the
30642 callout.
30643 </para>
30644 <para>
30645 The prefix facility is commonly used to handle local parts of the form
30646 <option>owner-something</option>. Another common use is to support local parts of the form
30647 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
30648 to tell a user their forwarding is broken &ndash; by placing a router like this one
30649 immediately before the router that handles <filename>.forward</filename> files:
30650 </para>
30651 <literallayout class="monospaced">
30652 real_localuser:
30653   driver = accept
30654   local_part_prefix = real-
30655   check_local_user
30656   transport = local_delivery
30657 </literallayout>
30658 <para>
30659 For security, it would probably be a good idea to restrict the use of this
30660 router to locally-generated messages, using a condition such as this:
30661 </para>
30662 <literallayout class="monospaced">
30663   condition = ${if match {$sender_host_address}\
30664                          {\N^(|127\.0\.0\.1)$\N}}
30665 </literallayout>
30666 <para>
30667 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
30668 both conditions must be met if not optional. Care must be taken if wildcards
30669 are used in both a prefix and a suffix on the same router. Different
30670 separator characters must be used to avoid ambiguity.
30671 </para>
30672 <para>
30673 <indexterm role="option">
30674 <primary><option>local_part_prefix_optional</option></primary>
30675 </indexterm>
30676 </para>
30677 <informaltable frame="all">
30678 <tgroup cols="4" colsep="0" rowsep="0">
30679 <colspec colwidth="8*" align="left"/>
30680 <colspec colwidth="6*" align="center"/>
30681 <colspec colwidth="6*" align="center"/>
30682 <colspec colwidth="6*" align="right"/>
30683 <tbody>
30684 <row>
30685 <entry><option>local_part_prefix_optional</option></entry>
30686 <entry>Use: <emphasis>routers</emphasis></entry>
30687 <entry>Type: <emphasis>boolean</emphasis></entry>
30688 <entry>Default: <emphasis>false</emphasis></entry>
30689 </row>
30690 </tbody>
30691 </tgroup>
30692 </informaltable>
30693 <para>
30694 See <option>local_part_prefix</option> above.
30695 </para>
30696 <para>
30697 <indexterm role="option">
30698 <primary><option>local_part_suffix</option></primary>
30699 </indexterm>
30700 </para>
30701 <informaltable frame="all">
30702 <tgroup cols="4" colsep="0" rowsep="0">
30703 <colspec colwidth="8*" align="left"/>
30704 <colspec colwidth="6*" align="center"/>
30705 <colspec colwidth="6*" align="center"/>
30706 <colspec colwidth="6*" align="right"/>
30707 <tbody>
30708 <row>
30709 <entry><option>local_part_suffix</option></entry>
30710 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30711 <entry>Type: <emphasis>string list</emphasis></entry>
30712 <entry>Default: <emphasis>unset</emphasis></entry>
30713 </row>
30714 </tbody>
30715 </tgroup>
30716 </informaltable>
30717 <para>
30718 <indexterm role="concept">
30719 <primary>router</primary>
30720 <secondary>suffix for local part</secondary>
30721 </indexterm>
30722 <indexterm role="concept">
30723 <primary>suffix for local part</primary>
30724 <secondary>used in router</secondary>
30725 </indexterm>
30726 This option operates in the same way as <option>local_part_prefix</option>, except that the
30727 local part must end (rather than start) with the given string, the
30728 <option>local_part_suffix_optional</option> option determines whether the suffix is
30729 mandatory, and the wildcard * character, if present, must be the last
30730 character of the suffix. This option facility is commonly used to handle local
30731 parts of the form <option>something-request</option> and multiple user mailboxes of the form
30732 <option>username-foo</option>.
30733 </para>
30734 <para>
30735 <indexterm role="option">
30736 <primary><option>local_part_suffix_optional</option></primary>
30737 </indexterm>
30738 </para>
30739 <informaltable frame="all">
30740 <tgroup cols="4" colsep="0" rowsep="0">
30741 <colspec colwidth="8*" align="left"/>
30742 <colspec colwidth="6*" align="center"/>
30743 <colspec colwidth="6*" align="center"/>
30744 <colspec colwidth="6*" align="right"/>
30745 <tbody>
30746 <row>
30747 <entry><option>local_part_suffix_optional</option></entry>
30748 <entry>Use: <emphasis>routers</emphasis></entry>
30749 <entry>Type: <emphasis>boolean</emphasis></entry>
30750 <entry>Default: <emphasis>false</emphasis></entry>
30751 </row>
30752 </tbody>
30753 </tgroup>
30754 </informaltable>
30755 <para>
30756 See <option>local_part_suffix</option> above.
30757 </para>
30758 <para>
30759 <indexterm role="option">
30760 <primary><option>local_parts</option></primary>
30761 </indexterm>
30762 </para>
30763 <informaltable frame="all">
30764 <tgroup cols="4" colsep="0" rowsep="0">
30765 <colspec colwidth="8*" align="left"/>
30766 <colspec colwidth="6*" align="center"/>
30767 <colspec colwidth="6*" align="center"/>
30768 <colspec colwidth="6*" align="right"/>
30769 <tbody>
30770 <row>
30771 <entry><option>local_parts</option></entry>
30772 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30773 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
30774 <entry>Default: <emphasis>unset</emphasis></entry>
30775 </row>
30776 </tbody>
30777 </tgroup>
30778 </informaltable>
30779 <para>
30780 <indexterm role="concept">
30781 <primary>router</primary>
30782 <secondary>restricting to specific local parts</secondary>
30783 </indexterm>
30784 <indexterm role="concept">
30785 <primary>local part</primary>
30786 <secondary>checking in router</secondary>
30787 </indexterm>
30788 The router is run only if the local part of the address matches the list.
30789 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30790 are evaluated, and
30791 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
30792 string is expanded, it is possible to make it depend on the domain, for
30793 example:
30794 </para>
30795 <literallayout class="monospaced">
30796 local_parts = dbm;/usr/local/specials/$domain
30797 </literallayout>
30798 <para>
30799 <indexterm role="variable">
30800 <primary><varname>$local_part_data</varname></primary>
30801 </indexterm>
30802 If the match is achieved by a lookup, the data that the lookup returned
30803 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
30804 expansions of the router&#x2019;s private options. You might use this option, for
30805 example, if you have a large number of local virtual domains, and you want to
30806 send all postmaster mail to the same place without having to set up an alias in
30807 each virtual domain:
30808 </para>
30809 <literallayout class="monospaced">
30810 postmaster:
30811   driver = redirect
30812   local_parts = postmaster
30813   data = postmaster@real.domain.example
30814 </literallayout>
30815 <para>
30816 <indexterm role="option">
30817 <primary><option>log_as_local</option></primary>
30818 </indexterm>
30819 </para>
30820 <informaltable frame="all">
30821 <tgroup cols="4" colsep="0" rowsep="0">
30822 <colspec colwidth="8*" align="left"/>
30823 <colspec colwidth="6*" align="center"/>
30824 <colspec colwidth="6*" align="center"/>
30825 <colspec colwidth="6*" align="right"/>
30826 <tbody>
30827 <row>
30828 <entry><option>log_as_local</option></entry>
30829 <entry>Use: <emphasis>routers</emphasis></entry>
30830 <entry>Type: <emphasis>boolean</emphasis></entry>
30831 <entry>Default: <emphasis>see below</emphasis></entry>
30832 </row>
30833 </tbody>
30834 </tgroup>
30835 </informaltable>
30836 <para>
30837 <indexterm role="concept">
30838 <primary>log</primary>
30839 <secondary>delivery line</secondary>
30840 </indexterm>
30841 <indexterm role="concept">
30842 <primary>delivery</primary>
30843 <secondary>log line format</secondary>
30844 </indexterm>
30845 Exim has two logging styles for delivery, the idea being to make local
30846 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
30847 recipient address is given just as the local part, without a domain. The use of
30848 this style is controlled by this option. It defaults to true for the <command>accept</command>
30849 router, and false for all the others. This option applies only when a
30850 router assigns an address to a transport. It has no effect on routers that
30851 redirect addresses.
30852 </para>
30853 <para>
30854 <indexterm role="option">
30855 <primary><option>more</option></primary>
30856 </indexterm>
30857 </para>
30858 <informaltable frame="all">
30859 <tgroup cols="4" colsep="0" rowsep="0">
30860 <colspec colwidth="8*" align="left"/>
30861 <colspec colwidth="6*" align="center"/>
30862 <colspec colwidth="6*" align="center"/>
30863 <colspec colwidth="6*" align="right"/>
30864 <tbody>
30865 <row>
30866 <entry><option>more</option></entry>
30867 <entry>Use: <emphasis>routers</emphasis></entry>
30868 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30869 <entry>Default: <emphasis>true</emphasis></entry>
30870 </row>
30871 </tbody>
30872 </tgroup>
30873 </informaltable>
30874 <para>
30875 The result of string expansion for this option must be a valid boolean value,
30876 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30877 result causes an error, and delivery is deferred. If the expansion is forced to
30878 fail, the default value for the option (true) is used. Other failures cause
30879 delivery to be deferred.
30880 </para>
30881 <para>
30882 If this option is set false, and the router declines to handle the address, no
30883 further routers are tried, routing fails, and the address is bounced.
30884 <indexterm role="option">
30885 <primary><option>self</option></primary>
30886 </indexterm>
30887 However, if the router explicitly passes an address to the following router by
30888 means of the setting
30889 </para>
30890 <literallayout class="monospaced">
30891 self = pass
30892 </literallayout>
30893 <para>
30894 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
30895 does not affect the behaviour if one of the precondition tests fails. In that
30896 case, the address is always passed to the next router.
30897 </para>
30898 <para>
30899 Note that <option>address_data</option> is not considered to be a precondition. If its
30900 expansion is forced to fail, the router declines, and the value of <option>more</option>
30901 controls what happens next.
30902 </para>
30903 <para>
30904 <indexterm role="option">
30905 <primary><option>pass_on_timeout</option></primary>
30906 </indexterm>
30907 </para>
30908 <informaltable frame="all">
30909 <tgroup cols="4" colsep="0" rowsep="0">
30910 <colspec colwidth="8*" align="left"/>
30911 <colspec colwidth="6*" align="center"/>
30912 <colspec colwidth="6*" align="center"/>
30913 <colspec colwidth="6*" align="right"/>
30914 <tbody>
30915 <row>
30916 <entry><option>pass_on_timeout</option></entry>
30917 <entry>Use: <emphasis>routers</emphasis></entry>
30918 <entry>Type: <emphasis>boolean</emphasis></entry>
30919 <entry>Default: <emphasis>false</emphasis></entry>
30920 </row>
30921 </tbody>
30922 </tgroup>
30923 </informaltable>
30924 <para>
30925 <indexterm role="concept">
30926 <primary>timeout</primary>
30927 <secondary>of router</secondary>
30928 </indexterm>
30929 <indexterm role="concept">
30930 <primary>router</primary>
30931 <secondary>timeout</secondary>
30932 </indexterm>
30933 If a router times out during a host lookup, it normally causes deferral of the
30934 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
30935 router, overriding <option>no_more</option>. This may be helpful for systems that are
30936 intermittently connected to the Internet, or those that want to pass to a smart
30937 host any messages that cannot immediately be delivered.
30938 </para>
30939 <para>
30940 There are occasional other temporary errors that can occur while doing DNS
30941 lookups. They are treated in the same way as a timeout, and this option
30942 applies to all of them.
30943 </para>
30944 <para>
30945 <indexterm role="option">
30946 <primary><option>pass_router</option></primary>
30947 </indexterm>
30948 </para>
30949 <informaltable frame="all">
30950 <tgroup cols="4" colsep="0" rowsep="0">
30951 <colspec colwidth="8*" align="left"/>
30952 <colspec colwidth="6*" align="center"/>
30953 <colspec colwidth="6*" align="center"/>
30954 <colspec colwidth="6*" align="right"/>
30955 <tbody>
30956 <row>
30957 <entry><option>pass_router</option></entry>
30958 <entry>Use: <emphasis>routers</emphasis></entry>
30959 <entry>Type: <emphasis>string</emphasis></entry>
30960 <entry>Default: <emphasis>unset</emphasis></entry>
30961 </row>
30962 </tbody>
30963 </tgroup>
30964 </informaltable>
30965 <para>
30966 <indexterm role="concept">
30967 <primary>router</primary>
30968 <secondary>go to after <quote>pass</quote></secondary>
30969 </indexterm>
30970 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
30971 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
30972 routing to continue, and overriding a false setting of <option>more</option>. When one of
30973 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30974 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30975 of another router. However (unlike <option>redirect_router</option>) the named router must
30976 be below the current router, to avoid loops. Note that this option applies only
30977 to the special case of <quote>pass</quote>. It does not apply when a router returns
30978 <quote>decline</quote> because it cannot handle an address.
30979 </para>
30980 <para>
30981 <indexterm role="option">
30982 <primary><option>redirect_router</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>redirect_router</option></entry>
30994 <entry>Use: <emphasis>routers</emphasis></entry>
30995 <entry>Type: <emphasis>string</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>router</primary>
31004 <secondary>start at after redirection</secondary>
31005 </indexterm>
31006 Sometimes an administrator knows that it is pointless to reprocess addresses
31007 generated from alias or forward files with the same router again. For
31008 example, if an alias file translates real names into login ids there is no
31009 point searching the alias file a second time, especially if it is a large file.
31010 </para>
31011 <para>
31012 The <option>redirect_router</option> option can be set to the name of any router instance.
31013 It causes the routing of any generated addresses to start at the named router
31014 instead of at the first router. This option has no effect if the router in
31015 which it is set does not generate new addresses.
31016 </para>
31017 <para>
31018 <indexterm role="option">
31019 <primary><option>require_files</option></primary>
31020 </indexterm>
31021 </para>
31022 <informaltable frame="all">
31023 <tgroup cols="4" colsep="0" rowsep="0">
31024 <colspec colwidth="8*" align="left"/>
31025 <colspec colwidth="6*" align="center"/>
31026 <colspec colwidth="6*" align="center"/>
31027 <colspec colwidth="6*" align="right"/>
31028 <tbody>
31029 <row>
31030 <entry><option>require_files</option></entry>
31031 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31032 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31033 <entry>Default: <emphasis>unset</emphasis></entry>
31034 </row>
31035 </tbody>
31036 </tgroup>
31037 </informaltable>
31038 <para>
31039 <indexterm role="concept">
31040 <primary>file</primary>
31041 <secondary>requiring for router</secondary>
31042 </indexterm>
31043 <indexterm role="concept">
31044 <primary>router</primary>
31045 <secondary>requiring file existence</secondary>
31046 </indexterm>
31047 This option provides a general mechanism for predicating the running of a
31048 router on the existence or non-existence of certain files or directories.
31049 Before running a router, as one of its precondition tests, Exim works its way
31050 through the <option>require_files</option> list, expanding each item separately.
31051 </para>
31052 <para>
31053 Because the list is split before expansion, any colons in expansion items must
31054 be doubled, or the facility for using a different list separator must be used.
31055 If any expansion is forced to fail, the item is ignored. Other expansion
31056 failures cause routing of the address to be deferred.
31057 </para>
31058 <para>
31059 If any expanded string is empty, it is ignored. Otherwise, except as described
31060 below, each string must be a fully qualified file path, optionally preceded by
31061 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
31062 existence of the files or directories. The router is skipped if any paths not
31063 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
31064 </para>
31065 <para>
31066 <indexterm role="concept">
31067 <primary>NFS</primary>
31068 </indexterm>
31069 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
31070 the message is deferred. This can happen when NFS-mounted filesystems are
31071 unavailable.
31072 </para>
31073 <para>
31074 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
31075 options, so you cannot use it to check for the existence of a file in which to
31076 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
31077 full list of the order in which preconditions are evaluated.) However, as
31078 these options are all expanded, you can use the <option>exists</option> expansion condition
31079 to make such tests. The <option>require_files</option> option is intended for checking files
31080 that the router may be going to use internally, or which are needed by a
31081 transport (for example <filename>.procmailrc</filename>).
31082 </para>
31083 <para>
31084 During delivery, the <function>stat()</function> function is run as root, but there is a
31085 facility for some checking of the accessibility of a file by another user.
31086 This is not a proper permissions check, but just a <quote>rough</quote> check that
31087 operates as follows:
31088 </para>
31089 <para>
31090 If an item in a <option>require_files</option> list does not contain any forward slash
31091 characters, it is taken to be the user (and optional group, separated by a
31092 comma) to be checked for subsequent files in the list. If no group is specified
31093 but the user is specified symbolically, the gid associated with the uid is
31094 used. For example:
31095 </para>
31096 <literallayout class="monospaced">
31097 require_files = mail:/some/file
31098 require_files = $local_part:$home/.procmailrc
31099 </literallayout>
31100 <para>
31101 If a user or group name in a <option>require_files</option> list does not exist, the
31102 <option>require_files</option> condition fails.
31103 </para>
31104 <para>
31105 Exim performs the check by scanning along the components of the file path, and
31106 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
31107 directories, and <quote>r</quote> access on the final file. Note that this means that file
31108 access control lists, if the operating system has them, are ignored.
31109 </para>
31110 <para>
31111 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
31112 incoming SMTP message, Exim is not running as root, but under its own uid. This
31113 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
31114 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
31115 user is not permitted to read one of the directories on the file&#x2019;s path.
31116 </para>
31117 <para>
31118 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
31119 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
31120 without root access. In this case, if a check for access by a particular user
31121 is requested, Exim creates a subprocess that runs as that user, and tries the
31122 check again in that process.
31123 </para>
31124 <para>
31125 The default action for handling an unresolved EACCES is to consider it to
31126 be caused by a configuration error, and routing is deferred because the
31127 existence or non-existence of the file cannot be determined. However, in some
31128 circumstances it may be desirable to treat this condition as if the file did
31129 not exist. If the file name (or the exclamation mark that precedes the file
31130 name for non-existence) is preceded by a plus sign, the EACCES error is treated
31131 as if the file did not exist. For example:
31132 </para>
31133 <literallayout class="monospaced">
31134 require_files = +/some/file
31135 </literallayout>
31136 <para>
31137 If the router is not an essential part of verification (for example, it
31138 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
31139 option false so that the router is skipped when verifying.
31140 </para>
31141 <para>
31142 <indexterm role="option">
31143 <primary><option>retry_use_local_part</option></primary>
31144 </indexterm>
31145 </para>
31146 <informaltable frame="all">
31147 <tgroup cols="4" colsep="0" rowsep="0">
31148 <colspec colwidth="8*" align="left"/>
31149 <colspec colwidth="6*" align="center"/>
31150 <colspec colwidth="6*" align="center"/>
31151 <colspec colwidth="6*" align="right"/>
31152 <tbody>
31153 <row>
31154 <entry><option>retry_use_local_part</option></entry>
31155 <entry>Use: <emphasis>routers</emphasis></entry>
31156 <entry>Type: <emphasis>boolean</emphasis></entry>
31157 <entry>Default: <emphasis>see below</emphasis></entry>
31158 </row>
31159 </tbody>
31160 </tgroup>
31161 </informaltable>
31162 <para>
31163 <indexterm role="concept">
31164 <primary>hints database</primary>
31165 <secondary>retry keys</secondary>
31166 </indexterm>
31167 <indexterm role="concept">
31168 <primary>local part</primary>
31169 <secondary>in retry keys</secondary>
31170 </indexterm>
31171 When a delivery suffers a temporary routing failure, a retry record is created
31172 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
31173 domain, the key for the retry record should not involve the local part, but for
31174 other addresses, both the domain and the local part should be included.
31175 Usually, remote routing is of the former kind, and local routing is of the
31176 latter kind.
31177 </para>
31178 <para>
31179 This option controls whether the local part is used to form the key for retry
31180 hints for addresses that suffer temporary errors while being handled by this
31181 router. The default value is true for any router that has <option>check_local_user</option>
31182 set, and false otherwise. Note that this option does not apply to hints keys
31183 for transport delays; they are controlled by a generic transport option of the
31184 same name.
31185 </para>
31186 <para>
31187 The setting of <option>retry_use_local_part</option> applies only to the router on which it
31188 appears. If the router generates child addresses, they are routed
31189 independently; this setting does not become attached to them.
31190 </para>
31191 <para>
31192 <indexterm role="option">
31193 <primary><option>router_home_directory</option></primary>
31194 </indexterm>
31195 </para>
31196 <informaltable frame="all">
31197 <tgroup cols="4" colsep="0" rowsep="0">
31198 <colspec colwidth="8*" align="left"/>
31199 <colspec colwidth="6*" align="center"/>
31200 <colspec colwidth="6*" align="center"/>
31201 <colspec colwidth="6*" align="right"/>
31202 <tbody>
31203 <row>
31204 <entry><option>router_home_directory</option></entry>
31205 <entry>Use: <emphasis>routers</emphasis></entry>
31206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31207 <entry>Default: <emphasis>unset</emphasis></entry>
31208 </row>
31209 </tbody>
31210 </tgroup>
31211 </informaltable>
31212 <para>
31213 <indexterm role="concept">
31214 <primary>router</primary>
31215 <secondary>home directory for</secondary>
31216 </indexterm>
31217 <indexterm role="concept">
31218 <primary>home directory</primary>
31219 <secondary>for router</secondary>
31220 </indexterm>
31221 <indexterm role="variable">
31222 <primary><varname>$home</varname></primary>
31223 </indexterm>
31224 This option sets a home directory for use while the router is running. (Compare
31225 <option>transport_home_directory</option>, which sets a home directory for later
31226 transporting.) In particular, if used on a <command>redirect</command> router, this option
31227 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
31228 forced expansion failure causes the option to be ignored &ndash; other failures
31229 cause the router to defer.
31230 </para>
31231 <para>
31232 Expansion of <option>router_home_directory</option> happens immediately after the
31233 <option>check_local_user</option> test (if configured), before any further expansions take
31234 place.
31235 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31236 are evaluated.)
31237 While the router is running, <option>router_home_directory</option> overrides the value of
31238 <varname>$home</varname> that came from <option>check_local_user</option>.
31239 </para>
31240 <para>
31241 When a router accepts an address and assigns it to a local transport (including
31242 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
31243 delivery), the home directory setting for the transport is taken from the first
31244 of these values that is set:
31245 </para>
31246 <itemizedlist>
31247 <listitem>
31248 <para>
31249 The <option>home_directory</option> option on the transport;
31250 </para>
31251 </listitem>
31252 <listitem>
31253 <para>
31254 The <option>transport_home_directory</option> option on the router;
31255 </para>
31256 </listitem>
31257 <listitem>
31258 <para>
31259 The password data if <option>check_local_user</option> is set on the router;
31260 </para>
31261 </listitem>
31262 <listitem>
31263 <para>
31264 The <option>router_home_directory</option> option on the router.
31265 </para>
31266 </listitem>
31267 </itemizedlist>
31268 <para>
31269 In other words, <option>router_home_directory</option> overrides the password data for the
31270 router, but not for the transport.
31271 </para>
31272 <para>
31273 <indexterm role="option">
31274 <primary><option>self</option></primary>
31275 </indexterm>
31276 </para>
31277 <informaltable frame="all">
31278 <tgroup cols="4" colsep="0" rowsep="0">
31279 <colspec colwidth="8*" align="left"/>
31280 <colspec colwidth="6*" align="center"/>
31281 <colspec colwidth="6*" align="center"/>
31282 <colspec colwidth="6*" align="right"/>
31283 <tbody>
31284 <row>
31285 <entry><option>self</option></entry>
31286 <entry>Use: <emphasis>routers</emphasis></entry>
31287 <entry>Type: <emphasis>string</emphasis></entry>
31288 <entry>Default: <emphasis>freeze</emphasis></entry>
31289 </row>
31290 </tbody>
31291 </tgroup>
31292 </informaltable>
31293 <para>
31294 <indexterm role="concept">
31295 <primary>MX record</primary>
31296 <secondary>pointing to local host</secondary>
31297 </indexterm>
31298 <indexterm role="concept">
31299 <primary>local host</primary>
31300 <secondary>MX pointing to</secondary>
31301 </indexterm>
31302 This option applies to those routers that use a recipient address to find a
31303 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
31304 and <command>manualroute</command> routers.
31305 Certain configurations of the <command>queryprogram</command> router can also specify a list
31306 of remote hosts.
31307 Usually such routers are configured to send the message to a remote host via an
31308 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
31309 host on the list turns out to be the local host.
31310 The way in which Exim checks for the local host is described in section
31311 <xref linkend="SECTreclocipadd"/>.
31312 </para>
31313 <para>
31314 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
31315 example, the router should be configured not to process this domain), or an
31316 error in the DNS (for example, the MX should not point to this host). For this
31317 reason, the default action is to log the incident, defer the address, and
31318 freeze the message. The following alternatives are provided for use in special
31319 cases:
31320 </para>
31321 <variablelist>
31322 <varlistentry>
31323 <term><option>defer</option></term>
31324 <listitem>
31325 <para>
31326 Delivery of the message is tried again later, but the message is not frozen.
31327 </para>
31328 </listitem></varlistentry>
31329 <varlistentry>
31330 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
31331 <listitem>
31332 <para>
31333 The domain is changed to the given domain, and the address is passed back to
31334 be reprocessed by the routers. No rewriting of headers takes place. This
31335 behaviour is essentially a redirection.
31336 </para>
31337 </listitem></varlistentry>
31338 <varlistentry>
31339 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
31340 <listitem>
31341 <para>
31342 The domain is changed to the given domain, and the address is passed back to be
31343 reprocessed by the routers. Any headers that contain the original domain are
31344 rewritten.
31345 </para>
31346 </listitem></varlistentry>
31347 <varlistentry>
31348 <term><option>pass</option></term>
31349 <listitem>
31350 <para>
31351 <indexterm role="option">
31352 <primary><option>more</option></primary>
31353 </indexterm>
31354 <indexterm role="variable">
31355 <primary><varname>$self_hostname</varname></primary>
31356 </indexterm>
31357 The router passes the address to the next router, or to the router named in the
31358 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
31359 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
31360 name of the local host that the router encountered. This can be used to
31361 distinguish between different cases for hosts with multiple names. The
31362 combination
31363 </para>
31364 <literallayout class="monospaced">
31365 self = pass
31366 no_more
31367 </literallayout>
31368 <para>
31369 ensures that only those addresses that routed to the local host are passed on.
31370 Without <option>no_more</option>, addresses that were declined for other reasons would also
31371 be passed to the next router.
31372 </para>
31373 </listitem></varlistentry>
31374 <varlistentry>
31375 <term><option>fail</option></term>
31376 <listitem>
31377 <para>
31378 Delivery fails and an error report is generated.
31379 </para>
31380 </listitem></varlistentry>
31381 <varlistentry>
31382 <term><option>send</option></term>
31383 <listitem>
31384 <para>
31385 <indexterm role="concept">
31386 <primary>local host</primary>
31387 <secondary>sending to</secondary>
31388 </indexterm>
31389 The anomaly is ignored and the address is queued for the transport. This
31390 setting should be used with extreme caution. For an <command>smtp</command> transport, it
31391 makes sense only in cases where the program that is listening on the SMTP port
31392 is not this version of Exim. That is, it must be some other MTA, or Exim with a
31393 different configuration file that handles the domain in another way.
31394 </para>
31395 </listitem></varlistentry>
31396 </variablelist>
31397 <para>
31398 <indexterm role="option">
31399 <primary><option>senders</option></primary>
31400 </indexterm>
31401 </para>
31402 <informaltable frame="all">
31403 <tgroup cols="4" colsep="0" rowsep="0">
31404 <colspec colwidth="8*" align="left"/>
31405 <colspec colwidth="6*" align="center"/>
31406 <colspec colwidth="6*" align="center"/>
31407 <colspec colwidth="6*" align="right"/>
31408 <tbody>
31409 <row>
31410 <entry><option>senders</option></entry>
31411 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31412 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
31413 <entry>Default: <emphasis>unset</emphasis></entry>
31414 </row>
31415 </tbody>
31416 </tgroup>
31417 </informaltable>
31418 <para>
31419 <indexterm role="concept">
31420 <primary>router</primary>
31421 <secondary>checking senders</secondary>
31422 </indexterm>
31423 If this option is set, the router is skipped unless the message&#x2019;s sender
31424 address matches something on the list.
31425 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31426 are evaluated.
31427 </para>
31428 <para>
31429 There are issues concerning verification when the running of routers is
31430 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
31431 setting, it sets the sender to the null string. When using the <option>-bt</option> option
31432 to check a configuration file, it is necessary also to use the <option>-f</option> option to
31433 set an appropriate sender. For incoming mail, the sender is unset when
31434 verifying the sender, but is available when verifying any recipients. If the
31435 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
31436 matters.
31437 </para>
31438 <para>
31439 <indexterm role="option">
31440 <primary><option>translate_ip_address</option></primary>
31441 </indexterm>
31442 </para>
31443 <informaltable frame="all">
31444 <tgroup cols="4" colsep="0" rowsep="0">
31445 <colspec colwidth="8*" align="left"/>
31446 <colspec colwidth="6*" align="center"/>
31447 <colspec colwidth="6*" align="center"/>
31448 <colspec colwidth="6*" align="right"/>
31449 <tbody>
31450 <row>
31451 <entry><option>translate_ip_address</option></entry>
31452 <entry>Use: <emphasis>routers</emphasis></entry>
31453 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31454 <entry>Default: <emphasis>unset</emphasis></entry>
31455 </row>
31456 </tbody>
31457 </tgroup>
31458 </informaltable>
31459 <para>
31460 <indexterm role="concept">
31461 <primary>IP address</primary>
31462 <secondary>translating</secondary>
31463 </indexterm>
31464 <indexterm role="concept">
31465 <primary>packet radio</primary>
31466 </indexterm>
31467 <indexterm role="concept">
31468 <primary>router</primary>
31469 <secondary>IP address translation</secondary>
31470 </indexterm>
31471 There exist some rare networking situations (for example, packet radio) where
31472 it is helpful to be able to translate IP addresses generated by normal routing
31473 mechanisms into other IP addresses, thus performing a kind of manual IP
31474 routing. This should be done only if the normal IP routing of the TCP/IP stack
31475 is inadequate or broken. Because this is an extremely uncommon requirement, the
31476 code to support this option is not included in the Exim binary unless
31477 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
31478 </para>
31479 <para>
31480 <indexterm role="variable">
31481 <primary><varname>$host_address</varname></primary>
31482 </indexterm>
31483 The <option>translate_ip_address</option> string is expanded for every IP address generated
31484 by the router, with the generated address set in <varname>$host_address</varname>. If the
31485 expansion is forced to fail, no action is taken.
31486 For any other expansion error, delivery of the message is deferred.
31487 If the result of the expansion is an IP address, that replaces the original
31488 address; otherwise the result is assumed to be a host name &ndash; this is looked
31489 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
31490 produce one or more replacement IP addresses. For example, to subvert all IP
31491 addresses in some specific networks, this could be added to a router:
31492 </para>
31493 <literallayout class="monospaced">
31494 translate_ip_address = \
31495   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
31496     {$value}fail}}
31497 </literallayout>
31498 <para>
31499 The file would contain lines like
31500 </para>
31501 <literallayout class="monospaced">
31502 10.2.3.128/26    some.host
31503 10.8.4.34/26     10.44.8.15
31504 </literallayout>
31505 <para>
31506 You should not make use of this facility unless you really understand what you
31507 are doing.
31508 </para>
31509 <para>
31510 <indexterm role="option">
31511 <primary><option>transport</option></primary>
31512 </indexterm>
31513 </para>
31514 <informaltable frame="all">
31515 <tgroup cols="4" colsep="0" rowsep="0">
31516 <colspec colwidth="8*" align="left"/>
31517 <colspec colwidth="6*" align="center"/>
31518 <colspec colwidth="6*" align="center"/>
31519 <colspec colwidth="6*" align="right"/>
31520 <tbody>
31521 <row>
31522 <entry><option>transport</option></entry>
31523 <entry>Use: <emphasis>routers</emphasis></entry>
31524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31525 <entry>Default: <emphasis>unset</emphasis></entry>
31526 </row>
31527 </tbody>
31528 </tgroup>
31529 </informaltable>
31530 <para>
31531 This option specifies the transport to be used when a router accepts an address
31532 and sets it up for delivery. A transport is never needed if a router is used
31533 only for verification. The value of the option is expanded at routing time,
31534 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
31535 and result must be the name of one of the configured transports. If it is not,
31536 delivery is deferred.
31537 </para>
31538 <para>
31539 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
31540 have some private options that set up transports for pipe and file deliveries
31541 (see chapter <xref linkend="CHAPredirect"/>).
31542 </para>
31543 <para>
31544 <indexterm role="option">
31545 <primary><option>transport_current_directory</option></primary>
31546 </indexterm>
31547 </para>
31548 <informaltable frame="all">
31549 <tgroup cols="4" colsep="0" rowsep="0">
31550 <colspec colwidth="8*" align="left"/>
31551 <colspec colwidth="6*" align="center"/>
31552 <colspec colwidth="6*" align="center"/>
31553 <colspec colwidth="6*" align="right"/>
31554 <tbody>
31555 <row>
31556 <entry><option>transport_current_directory</option></entry>
31557 <entry>Use: <emphasis>routers</emphasis></entry>
31558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31559 <entry>Default: <emphasis>unset</emphasis></entry>
31560 </row>
31561 </tbody>
31562 </tgroup>
31563 </informaltable>
31564 <para>
31565 <indexterm role="concept">
31566 <primary>current directory for local transport</primary>
31567 </indexterm>
31568 This option associates a current directory with any address that is routed
31569 to a local transport. This can happen either because a transport is
31570 explicitly configured for the router, or because it generates a delivery to a
31571 file or a pipe. During the delivery process (that is, at transport time), this
31572 option string is expanded and is set as the current directory, unless
31573 overridden by a setting on the transport.
31574 If the expansion fails for any reason, including forced failure, an error is
31575 logged, and delivery is deferred.
31576 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
31577 environment.
31578 </para>
31579 <para>
31580 <indexterm role="option">
31581 <primary><option>transport_home_directory</option></primary>
31582 </indexterm>
31583 </para>
31584 <informaltable frame="all">
31585 <tgroup cols="4" colsep="0" rowsep="0">
31586 <colspec colwidth="8*" align="left"/>
31587 <colspec colwidth="6*" align="center"/>
31588 <colspec colwidth="6*" align="center"/>
31589 <colspec colwidth="6*" align="right"/>
31590 <tbody>
31591 <row>
31592 <entry><option>transport_home_directory</option></entry>
31593 <entry>Use: <emphasis>routers</emphasis></entry>
31594 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31595 <entry>Default: <emphasis>see below</emphasis></entry>
31596 </row>
31597 </tbody>
31598 </tgroup>
31599 </informaltable>
31600 <para>
31601 <indexterm role="concept">
31602 <primary>home directory</primary>
31603 <secondary>for local transport</secondary>
31604 </indexterm>
31605 This option associates a home directory with any address that is routed to a
31606 local transport. This can happen either because a transport is explicitly
31607 configured for the router, or because it generates a delivery to a file or a
31608 pipe. During the delivery process (that is, at transport time), the option
31609 string is expanded and is set as the home directory, unless overridden by a
31610 setting of <option>home_directory</option> on the transport.
31611 If the expansion fails for any reason, including forced failure, an error is
31612 logged, and delivery is deferred.
31613 </para>
31614 <para>
31615 If the transport does not specify a home directory, and
31616 <option>transport_home_directory</option> is not set for the router, the home directory for
31617 the transport is taken from the password data if <option>check_local_user</option> is set for
31618 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
31619 is set; if not, no home directory is set for the transport.
31620 </para>
31621 <para>
31622 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
31623 environment.
31624 </para>
31625 <para>
31626 <indexterm role="option">
31627 <primary><option>unseen</option></primary>
31628 </indexterm>
31629 </para>
31630 <informaltable frame="all">
31631 <tgroup cols="4" colsep="0" rowsep="0">
31632 <colspec colwidth="8*" align="left"/>
31633 <colspec colwidth="6*" align="center"/>
31634 <colspec colwidth="6*" align="center"/>
31635 <colspec colwidth="6*" align="right"/>
31636 <tbody>
31637 <row>
31638 <entry><option>unseen</option></entry>
31639 <entry>Use: <emphasis>routers</emphasis></entry>
31640 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
31641 <entry>Default: <emphasis>false</emphasis></entry>
31642 </row>
31643 </tbody>
31644 </tgroup>
31645 </informaltable>
31646 <para>
31647 <indexterm role="concept">
31648 <primary>router</primary>
31649 <secondary>carrying on after success</secondary>
31650 </indexterm>
31651 The result of string expansion for this option must be a valid boolean value,
31652 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
31653 result causes an error, and delivery is deferred. If the expansion is forced to
31654 fail, the default value for the option (false) is used. Other failures cause
31655 delivery to be deferred.
31656 </para>
31657 <para>
31658 When this option is set true, routing does not cease if the router accepts the
31659 address. Instead, a copy of the incoming address is passed to the next router,
31660 overriding a false setting of <option>more</option>. There is little point in setting
31661 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
31662 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
31663 sometimes true and sometimes false).
31664 </para>
31665 <para>
31666 <indexterm role="concept">
31667 <primary>copy of message (<option>unseen</option> option)</primary>
31668 </indexterm>
31669 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
31670 qualifier in filter files. It can be used to cause copies of messages to be
31671 delivered to some other destination, while also carrying out a normal delivery.
31672 In effect, the current address is made into a <quote>parent</quote> that has two children
31673 &ndash; one that is delivered as specified by this router, and a clone that goes on
31674 to be routed further. For this reason, <option>unseen</option> may not be combined with the
31675 <option>one_time</option> option in a <command>redirect</command> router.
31676 </para>
31677 <para>
31678 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
31679 this router or by previous routers affect the <quote>unseen</quote> copy of the message
31680 only. The clone that continues to be processed by further routers starts with
31681 no added headers and none specified for removal. For a <option>redirect</option> router, if
31682 a generated address is the same as the incoming address, this can lead to
31683 duplicate addresses with different header modifications. Exim does not do
31684 duplicate deliveries (except, in certain circumstances, to pipes -- see section
31685 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
31686 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
31687 <option>redirect</option> router may be of help.
31688 </para>
31689 <para>
31690 Unlike the handling of header modifications, any data that was set by the
31691 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
31692 subsequent routers.
31693 </para>
31694 <para>
31695 <indexterm role="option">
31696 <primary><option>user</option></primary>
31697 </indexterm>
31698 </para>
31699 <informaltable frame="all">
31700 <tgroup cols="4" colsep="0" rowsep="0">
31701 <colspec colwidth="8*" align="left"/>
31702 <colspec colwidth="6*" align="center"/>
31703 <colspec colwidth="6*" align="center"/>
31704 <colspec colwidth="6*" align="right"/>
31705 <tbody>
31706 <row>
31707 <entry><option>user</option></entry>
31708 <entry>Use: <emphasis>routers</emphasis></entry>
31709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31710 <entry>Default: <emphasis>see below</emphasis></entry>
31711 </row>
31712 </tbody>
31713 </tgroup>
31714 </informaltable>
31715 <para>
31716 <indexterm role="concept">
31717 <primary>uid (user id)</primary>
31718 <secondary>local delivery</secondary>
31719 </indexterm>
31720 <indexterm role="concept">
31721 <primary>local transports</primary>
31722 <secondary>uid and gid</secondary>
31723 </indexterm>
31724 <indexterm role="concept">
31725 <primary>transport</primary>
31726 <secondary>local</secondary>
31727 </indexterm>
31728 <indexterm role="concept">
31729 <primary>router</primary>
31730 <secondary>user for filter processing</secondary>
31731 </indexterm>
31732 <indexterm role="concept">
31733 <primary>filter</primary>
31734 <secondary>user for processing</secondary>
31735 </indexterm>
31736 When a router queues an address for a transport, and the transport does not
31737 specify a user, the user given here is used when running the delivery process.
31738 The user may be specified numerically or by name. If expansion fails, the
31739 error is logged and delivery is deferred.
31740 This user is also used by the <command>redirect</command> router when running a filter file.
31741 The default is unset, except when <option>check_local_user</option> is set. In this case,
31742 the default is taken from the password information. If the user is specified as
31743 a name, and <option>group</option> is not set, the group associated with the user is used.
31744 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
31745 <xref linkend="CHAPenvironment"/>.
31746 </para>
31747 <para>
31748 <indexterm role="option">
31749 <primary><option>verify</option></primary>
31750 </indexterm>
31751 </para>
31752 <informaltable frame="all">
31753 <tgroup cols="4" colsep="0" rowsep="0">
31754 <colspec colwidth="8*" align="left"/>
31755 <colspec colwidth="6*" align="center"/>
31756 <colspec colwidth="6*" align="center"/>
31757 <colspec colwidth="6*" align="right"/>
31758 <tbody>
31759 <row>
31760 <entry><option>verify</option></entry>
31761 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31762 <entry>Type: <emphasis>boolean</emphasis></entry>
31763 <entry>Default: <emphasis>true</emphasis></entry>
31764 </row>
31765 </tbody>
31766 </tgroup>
31767 </informaltable>
31768 <para>
31769 Setting this option has the effect of setting <option>verify_sender</option> and
31770 <option>verify_recipient</option> to the same value.
31771 </para>
31772 <para>
31773 <indexterm role="option">
31774 <primary><option>verify_only</option></primary>
31775 </indexterm>
31776 </para>
31777 <informaltable frame="all">
31778 <tgroup cols="4" colsep="0" rowsep="0">
31779 <colspec colwidth="8*" align="left"/>
31780 <colspec colwidth="6*" align="center"/>
31781 <colspec colwidth="6*" align="center"/>
31782 <colspec colwidth="6*" align="right"/>
31783 <tbody>
31784 <row>
31785 <entry><option>verify_only</option></entry>
31786 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31787 <entry>Type: <emphasis>boolean</emphasis></entry>
31788 <entry>Default: <emphasis>false</emphasis></entry>
31789 </row>
31790 </tbody>
31791 </tgroup>
31792 </informaltable>
31793 <para>
31794 <indexterm role="concept">
31795 <primary>EXPN</primary>
31796 <secondary>with <option>verify_only</option></secondary>
31797 </indexterm>
31798 <indexterm role="option">
31799 <primary><option>-bv</option></primary>
31800 </indexterm>
31801 <indexterm role="concept">
31802 <primary>router</primary>
31803 <secondary>used only when verifying</secondary>
31804 </indexterm>
31805 If this option is set, the router is used only when verifying an address or
31806 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
31807 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
31808 restricted to verifying only senders or recipients by means of
31809 <option>verify_sender</option> and <option>verify_recipient</option>.
31810 </para>
31811 <para>
31812 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
31813 SMTP message, Exim is not running as root, but under its own uid. If the router
31814 accesses any files, you need to make sure that they are accessible to the Exim
31815 user or group.
31816 </para>
31817 <para>
31818 <indexterm role="option">
31819 <primary><option>verify_recipient</option></primary>
31820 </indexterm>
31821 </para>
31822 <informaltable frame="all">
31823 <tgroup cols="4" colsep="0" rowsep="0">
31824 <colspec colwidth="8*" align="left"/>
31825 <colspec colwidth="6*" align="center"/>
31826 <colspec colwidth="6*" align="center"/>
31827 <colspec colwidth="6*" align="right"/>
31828 <tbody>
31829 <row>
31830 <entry><option>verify_recipient</option></entry>
31831 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31832 <entry>Type: <emphasis>boolean</emphasis></entry>
31833 <entry>Default: <emphasis>true</emphasis></entry>
31834 </row>
31835 </tbody>
31836 </tgroup>
31837 </informaltable>
31838 <para>
31839 If this option is false, the router is skipped when verifying recipient
31840 addresses
31841 or testing recipient verification using <option>-bv</option>.
31842 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31843 are evaluated.
31844 </para>
31845 <para>
31846 <indexterm role="option">
31847 <primary><option>verify_sender</option></primary>
31848 </indexterm>
31849 </para>
31850 <informaltable frame="all">
31851 <tgroup cols="4" colsep="0" rowsep="0">
31852 <colspec colwidth="8*" align="left"/>
31853 <colspec colwidth="6*" align="center"/>
31854 <colspec colwidth="6*" align="center"/>
31855 <colspec colwidth="6*" align="right"/>
31856 <tbody>
31857 <row>
31858 <entry><option>verify_sender</option></entry>
31859 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31860 <entry>Type: <emphasis>boolean</emphasis></entry>
31861 <entry>Default: <emphasis>true</emphasis></entry>
31862 </row>
31863 </tbody>
31864 </tgroup>
31865 </informaltable>
31866 <para>
31867 If this option is false, the router is skipped when verifying sender addresses
31868 or testing sender verification using <option>-bvs</option>.
31869 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31870 are evaluated.
31871 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
31872 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
31873 </para>
31874 </chapter>
31875
31876 <chapter id="CHID4">
31877 <title>The accept router</title>
31878 <para>
31879 <indexterm role="concept">
31880 <primary><command>accept</command> router</primary>
31881 </indexterm>
31882 <indexterm role="concept">
31883 <primary>routers</primary>
31884 <secondary><command>accept</command></secondary>
31885 </indexterm>
31886 The <command>accept</command> router has no private options of its own. Unless it is being
31887 used purely for verification (see <option>verify_only</option>) a transport is required to
31888 be defined by the generic <option>transport</option> option. If the preconditions that are
31889 specified by generic options are met, the router accepts the address and queues
31890 it for the given transport. The most common use of this router is for setting
31891 up deliveries to local mailboxes. For example:
31892 </para>
31893 <literallayout class="monospaced">
31894 localusers:
31895   driver = accept
31896   domains = mydomain.example
31897   check_local_user
31898   transport = local_delivery
31899 </literallayout>
31900 <para>
31901 The <option>domains</option> condition in this example checks the domain of the address, and
31902 <option>check_local_user</option> checks that the local part is the login of a local user.
31903 When both preconditions are met, the <command>accept</command> router runs, and queues the
31904 address for the <command>local_delivery</command> transport.
31905 </para>
31906 </chapter>
31907
31908 <chapter id="CHAPdnslookup">
31909 <title>The dnslookup router</title>
31910 <para>
31911 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
31912 <primary><command>dnslookup</command> router</primary>
31913 </indexterm>
31914 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
31915 <primary>routers</primary>
31916 <secondary><command>dnslookup</command></secondary>
31917 </indexterm>
31918 The <command>dnslookup</command> router looks up the hosts that handle mail for the
31919 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
31920 unless <option>verify_only</option> is set.
31921 </para>
31922 <para>
31923 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
31924 SRV records. If none are found, or if SRV support is not configured,
31925 MX records are looked up. If no MX records exist, address records are sought.
31926 However, <option>mx_domains</option> can be set to disable the direct use of address
31927 records.
31928 </para>
31929 <para>
31930 MX records of equal priority are sorted by Exim into a random order. Exim then
31931 looks for address records for the host names obtained from MX or SRV records.
31932 When a host has more than one IP address, they are sorted into a random order,
31933 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
31934 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
31935 generic option, the router declines.
31936 </para>
31937 <para>
31938 Unless they have the highest priority (lowest MX value), MX records that point
31939 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
31940 are discarded, together with any other MX records of equal or lower priority.
31941 </para>
31942 <para>
31943 <indexterm role="concept">
31944 <primary>MX record</primary>
31945 <secondary>pointing to local host</secondary>
31946 </indexterm>
31947 <indexterm role="concept">
31948 <primary>local host</primary>
31949 <secondary>MX pointing to</secondary>
31950 </indexterm>
31951 <indexterm role="option">
31952 <primary><option>self</option></primary>
31953 <secondary>in <command>dnslookup</command> router</secondary>
31954 </indexterm>
31955 If the host pointed to by the highest priority MX record, or looked up as an
31956 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
31957 happens is controlled by the generic <option>self</option> option.
31958 </para>
31959 <section id="SECTprowitdnsloo">
31960 <title>Problems with DNS lookups</title>
31961 <para>
31962 There have been problems with DNS servers when SRV records are looked up.
31963 Some mis-behaving servers return a DNS error or timeout when a non-existent
31964 SRV record is sought. Similar problems have in the past been reported for
31965 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
31966 problem, but it is heavy-handed because it is a global option.
31967 </para>
31968 <para>
31969 For this reason, there are two options, <option>srv_fail_domains</option> and
31970 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
31971 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
31972 an attempt to look up an SRV or MX record causes one of these results, and the
31973 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31974 such record</quote>. In the case of an SRV lookup, this means that the router
31975 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31976 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31977 case routing fails.
31978 </para>
31979 </section>
31980 <section id="SECTdnslookupdecline" revisionflag="changed">
31981 <title>Declining addresses by dnslookup</title>
31982 <para revisionflag="changed">
31983 <indexterm role="concept">
31984 <primary><command>dnslookup</command> router</primary>
31985 <secondary>declines</secondary>
31986 </indexterm>
31987 There are a few cases where a <command>dnslookup</command> router will decline to accept
31988 an address; if such a router is expected to handle "all remaining non-local
31989 domains", then it is important to set <option>no_more</option>.
31990 </para>
31991 <para revisionflag="changed">
31992 Reasons for a <command>dnslookup</command> router to decline currently include:
31993 </para>
31994 <itemizedlist revisionflag="changed">
31995 <listitem>
31996 <para revisionflag="changed">
31997 The domain does not exist in DNS
31998 </para>
31999 </listitem>
32000 <listitem>
32001 <para revisionflag="changed">
32002 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
32003 convention (borrowed from SRV) used to indicate that there is no such service
32004 for this domain and to not fall back to trying A/AAAA records.
32005 </para>
32006 </listitem>
32007 <listitem>
32008 <para revisionflag="changed">
32009 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
32010 </para>
32011 </listitem>
32012 <listitem>
32013 <para revisionflag="changed">
32014 MX record points to a non-existent host.
32015 </para>
32016 </listitem>
32017 <listitem>
32018 <para revisionflag="changed">
32019 MX record points to an IP address and the main section option
32020 <option>allow_mx_to_ip</option> is not set.
32021 </para>
32022 </listitem>
32023 <listitem>
32024 <para revisionflag="changed">
32025 MX records exist and point to valid hosts, but all hosts resolve only to
32026 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
32027 </para>
32028 </listitem>
32029 <listitem>
32030 <para revisionflag="changed">
32031 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
32032 <option>dns_check_names_pattern</option> for handling one variant of this)
32033 </para>
32034 </listitem>
32035 <listitem>
32036 <para revisionflag="changed">
32037 <option>check_secondary_mx</option> is set on this router but the local host can
32038 not be found in the MX records (see below)
32039 </para>
32040 </listitem>
32041 </itemizedlist>
32042 </section>
32043 <section id="SECID118">
32044 <title>Private options for dnslookup</title>
32045 <para>
32046 <indexterm role="concept">
32047 <primary>options</primary>
32048 <secondary><command>dnslookup</command> router</secondary>
32049 </indexterm>
32050 The private options for the <command>dnslookup</command> router are as follows:
32051 </para>
32052 <para>
32053 <indexterm role="option">
32054 <primary><option>check_secondary_mx</option></primary>
32055 </indexterm>
32056 </para>
32057 <informaltable frame="all">
32058 <tgroup cols="4" colsep="0" rowsep="0">
32059 <colspec colwidth="8*" align="left"/>
32060 <colspec colwidth="6*" align="center"/>
32061 <colspec colwidth="6*" align="center"/>
32062 <colspec colwidth="6*" align="right"/>
32063 <tbody>
32064 <row>
32065 <entry><option>check_secondary_mx</option></entry>
32066 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32067 <entry>Type: <emphasis>boolean</emphasis></entry>
32068 <entry>Default: <emphasis>false</emphasis></entry>
32069 </row>
32070 </tbody>
32071 </tgroup>
32072 </informaltable>
32073 <para>
32074 <indexterm role="concept">
32075 <primary>MX record</primary>
32076 <secondary>checking for secondary</secondary>
32077 </indexterm>
32078 If this option is set, the router declines unless the local host is found in
32079 (and removed from) the list of hosts obtained by MX lookup. This can be used to
32080 process domains for which the local host is a secondary mail exchanger
32081 differently to other domains. The way in which Exim decides whether a host is
32082 the local host is described in section <xref linkend="SECTreclocipadd"/>.
32083 </para>
32084 <para>
32085 <indexterm role="option">
32086 <primary><option>check_srv</option></primary>
32087 </indexterm>
32088 </para>
32089 <informaltable frame="all">
32090 <tgroup cols="4" colsep="0" rowsep="0">
32091 <colspec colwidth="8*" align="left"/>
32092 <colspec colwidth="6*" align="center"/>
32093 <colspec colwidth="6*" align="center"/>
32094 <colspec colwidth="6*" align="right"/>
32095 <tbody>
32096 <row>
32097 <entry><option>check_srv</option></entry>
32098 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32100 <entry>Default: <emphasis>unset</emphasis></entry>
32101 </row>
32102 </tbody>
32103 </tgroup>
32104 </informaltable>
32105 <para>
32106 <indexterm role="concept">
32107 <primary>SRV record</primary>
32108 <secondary>enabling use of</secondary>
32109 </indexterm>
32110 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
32111 addition to MX and address records. The support is disabled by default. To
32112 enable SRV support, set the <option>check_srv</option> option to the name of the service
32113 required. For example,
32114 </para>
32115 <literallayout class="monospaced">
32116 check_srv = smtp
32117 </literallayout>
32118 <para>
32119 looks for SRV records that refer to the normal smtp service. The option is
32120 expanded, so the service name can vary from message to message or address
32121 to address. This might be helpful if SRV records are being used for a
32122 submission service. If the expansion is forced to fail, the <option>check_srv</option>
32123 option is ignored, and the router proceeds to look for MX records in the
32124 normal way.
32125 </para>
32126 <para>
32127 When the expansion succeeds, the router searches first for SRV records for
32128 the given service (it assumes TCP protocol). A single SRV record with a
32129 host name that consists of just a single dot indicates <quote>no such service for
32130 this domain</quote>; if this is encountered, the router declines. If other kinds of
32131 SRV record are found, they are used to construct a host list for delivery
32132 according to the rules of RFC 2782. MX records are not sought in this case.
32133 </para>
32134 <para>
32135 When no SRV records are found, MX records (and address records) are sought in
32136 the traditional way. In other words, SRV records take precedence over MX
32137 records, just as MX records take precedence over address records. Note that
32138 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
32139 defined it. It is apparently believed that MX records are sufficient for email
32140 and that SRV records should not be used for this purpose. However, SRV records
32141 have an additional <quote>weight</quote> feature which some people might find useful when
32142 trying to split an SMTP load between hosts of different power.
32143 </para>
32144 <para>
32145 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
32146 when there is a DNS lookup error.
32147 </para>
32148 <para>
32149 <indexterm role="option">
32150 <primary><option>mx_domains</option></primary>
32151 </indexterm>
32152 </para>
32153 <informaltable frame="all">
32154 <tgroup cols="4" colsep="0" rowsep="0">
32155 <colspec colwidth="8*" align="left"/>
32156 <colspec colwidth="6*" align="center"/>
32157 <colspec colwidth="6*" align="center"/>
32158 <colspec colwidth="6*" align="right"/>
32159 <tbody>
32160 <row>
32161 <entry><option>mx_domains</option></entry>
32162 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32163 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32164 <entry>Default: <emphasis>unset</emphasis></entry>
32165 </row>
32166 </tbody>
32167 </tgroup>
32168 </informaltable>
32169 <para>
32170 <indexterm role="concept">
32171 <primary>MX record</primary>
32172 <secondary>required to exist</secondary>
32173 </indexterm>
32174 <indexterm role="concept">
32175 <primary>SRV record</primary>
32176 <secondary>required to exist</secondary>
32177 </indexterm>
32178 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
32179 record in order to be recognized. (The name of this option could be improved.)
32180 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
32181 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
32182 setting:
32183 </para>
32184 <literallayout class="monospaced">
32185 mx_domains = ! *.discworld.fict.example : *.fict.example
32186 </literallayout>
32187 <para>
32188 This specifies that messages addressed to a domain that matches the list but
32189 has no MX record should be bounced immediately instead of being routed using
32190 the address record.
32191 </para>
32192 <para>
32193 <indexterm role="option">
32194 <primary><option>mx_fail_domains</option></primary>
32195 </indexterm>
32196 </para>
32197 <informaltable frame="all">
32198 <tgroup cols="4" colsep="0" rowsep="0">
32199 <colspec colwidth="8*" align="left"/>
32200 <colspec colwidth="6*" align="center"/>
32201 <colspec colwidth="6*" align="center"/>
32202 <colspec colwidth="6*" align="right"/>
32203 <tbody>
32204 <row>
32205 <entry><option>mx_fail_domains</option></entry>
32206 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32207 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32208 <entry>Default: <emphasis>unset</emphasis></entry>
32209 </row>
32210 </tbody>
32211 </tgroup>
32212 </informaltable>
32213 <para>
32214 If the DNS lookup for MX records for one of the domains in this list causes a
32215 DNS lookup error, Exim behaves as if no MX records were found. See section
32216 <xref linkend="SECTprowitdnsloo"/> for more discussion.
32217 </para>
32218 <para>
32219 <indexterm role="option">
32220 <primary><option>qualify_single</option></primary>
32221 </indexterm>
32222 </para>
32223 <informaltable frame="all">
32224 <tgroup cols="4" colsep="0" rowsep="0">
32225 <colspec colwidth="8*" align="left"/>
32226 <colspec colwidth="6*" align="center"/>
32227 <colspec colwidth="6*" align="center"/>
32228 <colspec colwidth="6*" align="right"/>
32229 <tbody>
32230 <row>
32231 <entry><option>qualify_single</option></entry>
32232 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32233 <entry>Type: <emphasis>boolean</emphasis></entry>
32234 <entry>Default: <emphasis>true</emphasis></entry>
32235 </row>
32236 </tbody>
32237 </tgroup>
32238 </informaltable>
32239 <para>
32240 <indexterm role="concept">
32241 <primary>DNS</primary>
32242 <secondary>resolver options</secondary>
32243 </indexterm>
32244 <indexterm role="concept">
32245 <primary>DNS</primary>
32246 <secondary>qualifying single-component names</secondary>
32247 </indexterm>
32248 When this option is true, the resolver option RES_DEFNAMES is set for DNS
32249 lookups. Typically, but not standardly, this causes the resolver to qualify
32250 single-component names with the default domain. For example, on a machine
32251 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
32252 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
32253 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
32254 <emphasis>resolv.conf</emphasis>.
32255 </para>
32256 <para>
32257 <indexterm role="option">
32258 <primary><option>rewrite_headers</option></primary>
32259 </indexterm>
32260 </para>
32261 <informaltable frame="all">
32262 <tgroup cols="4" colsep="0" rowsep="0">
32263 <colspec colwidth="8*" align="left"/>
32264 <colspec colwidth="6*" align="center"/>
32265 <colspec colwidth="6*" align="center"/>
32266 <colspec colwidth="6*" align="right"/>
32267 <tbody>
32268 <row>
32269 <entry><option>rewrite_headers</option></entry>
32270 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32271 <entry>Type: <emphasis>boolean</emphasis></entry>
32272 <entry>Default: <emphasis>true</emphasis></entry>
32273 </row>
32274 </tbody>
32275 </tgroup>
32276 </informaltable>
32277 <para>
32278 <indexterm role="concept">
32279 <primary>rewriting</primary>
32280 <secondary>header lines</secondary>
32281 </indexterm>
32282 <indexterm role="concept">
32283 <primary>header lines</primary>
32284 <secondary>rewriting</secondary>
32285 </indexterm>
32286 If the domain name in the address that is being processed is not fully
32287 qualified, it may be expanded to its full form by a DNS lookup. For example, if
32288 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
32289 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
32290 occur as a result of setting the <option>widen_domains</option> option. If
32291 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
32292 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
32293 header lines of the message are rewritten with the full domain name.
32294 </para>
32295 <para>
32296 This option should be turned off only when it is known that no message is
32297 ever going to be sent outside an environment where the abbreviation makes
32298 sense.
32299 </para>
32300 <para>
32301 When an MX record is looked up in the DNS and matches a wildcard record, name
32302 servers normally return a record containing the name that has been looked up,
32303 making it impossible to detect whether a wildcard was present or not. However,
32304 some name servers have recently been seen to return the wildcard entry. If the
32305 name returned by a DNS lookup begins with an asterisk, it is not used for
32306 header rewriting.
32307 </para>
32308 <para>
32309 <indexterm role="option">
32310 <primary><option>same_domain_copy_routing</option></primary>
32311 </indexterm>
32312 </para>
32313 <informaltable frame="all">
32314 <tgroup cols="4" colsep="0" rowsep="0">
32315 <colspec colwidth="8*" align="left"/>
32316 <colspec colwidth="6*" align="center"/>
32317 <colspec colwidth="6*" align="center"/>
32318 <colspec colwidth="6*" align="right"/>
32319 <tbody>
32320 <row>
32321 <entry><option>same_domain_copy_routing</option></entry>
32322 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32323 <entry>Type: <emphasis>boolean</emphasis></entry>
32324 <entry>Default: <emphasis>false</emphasis></entry>
32325 </row>
32326 </tbody>
32327 </tgroup>
32328 </informaltable>
32329 <para>
32330 <indexterm role="concept">
32331 <primary>address</primary>
32332 <secondary>copying routing</secondary>
32333 </indexterm>
32334 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
32335 to the same list of hosts. However, this cannot be presumed, because the router
32336 options and preconditions may refer to the local part of the address. By
32337 default, therefore, Exim routes each address in a message independently. DNS
32338 servers run caches, so repeated DNS lookups are not normally expensive, and in
32339 any case, personal messages rarely have more than a few recipients.
32340 </para>
32341 <para>
32342 If you are running mailing lists with large numbers of subscribers at the same
32343 domain, and you are using a <command>dnslookup</command> router which is independent of the
32344 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32345 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
32346 routes an address to a remote transport, any other unrouted addresses in the
32347 message that have the same domain are automatically given the same routing
32348 without processing them independently,
32349 provided the following conditions are met:
32350 </para>
32351 <itemizedlist>
32352 <listitem>
32353 <para>
32354 No router that processed the address specified <option>headers_add</option> or
32355 <option>headers_remove</option>.
32356 </para>
32357 </listitem>
32358 <listitem>
32359 <para>
32360 The router did not change the address in any way, for example, by <quote>widening</quote>
32361 the domain.
32362 </para>
32363 </listitem>
32364 </itemizedlist>
32365 <para>
32366 <indexterm role="option">
32367 <primary><option>search_parents</option></primary>
32368 </indexterm>
32369 </para>
32370 <informaltable frame="all">
32371 <tgroup cols="4" colsep="0" rowsep="0">
32372 <colspec colwidth="8*" align="left"/>
32373 <colspec colwidth="6*" align="center"/>
32374 <colspec colwidth="6*" align="center"/>
32375 <colspec colwidth="6*" align="right"/>
32376 <tbody>
32377 <row>
32378 <entry><option>search_parents</option></entry>
32379 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32380 <entry>Type: <emphasis>boolean</emphasis></entry>
32381 <entry>Default: <emphasis>false</emphasis></entry>
32382 </row>
32383 </tbody>
32384 </tgroup>
32385 </informaltable>
32386 <para>
32387 <indexterm role="concept">
32388 <primary>DNS</primary>
32389 <secondary>resolver options</secondary>
32390 </indexterm>
32391 When this option is true, the resolver option RES_DNSRCH is set for DNS
32392 lookups. This is different from the <option>qualify_single</option> option in that it
32393 applies to domains containing dots. Typically, but not standardly, it causes
32394 the resolver to search for the name in the current domain and in parent
32395 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
32396 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
32397 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
32398 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
32399 </para>
32400 <para>
32401 Setting this option true can cause problems in domains that have a wildcard MX
32402 record, because any domain that does not have its own MX record matches the
32403 local wildcard.
32404 </para>
32405 <para>
32406 <indexterm role="option">
32407 <primary><option>srv_fail_domains</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>srv_fail_domains</option></entry>
32419 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32420 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32421 <entry>Default: <emphasis>unset</emphasis></entry>
32422 </row>
32423 </tbody>
32424 </tgroup>
32425 </informaltable>
32426 <para>
32427 If the DNS lookup for SRV records for one of the domains in this list causes a
32428 DNS lookup error, Exim behaves as if no SRV records were found. See section
32429 <xref linkend="SECTprowitdnsloo"/> for more discussion.
32430 </para>
32431 <para>
32432 <indexterm role="option">
32433 <primary><option>widen_domains</option></primary>
32434 </indexterm>
32435 </para>
32436 <informaltable frame="all">
32437 <tgroup cols="4" colsep="0" rowsep="0">
32438 <colspec colwidth="8*" align="left"/>
32439 <colspec colwidth="6*" align="center"/>
32440 <colspec colwidth="6*" align="center"/>
32441 <colspec colwidth="6*" align="right"/>
32442 <tbody>
32443 <row>
32444 <entry><option>widen_domains</option></entry>
32445 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32446 <entry>Type: <emphasis>string list</emphasis></entry>
32447 <entry>Default: <emphasis>unset</emphasis></entry>
32448 </row>
32449 </tbody>
32450 </tgroup>
32451 </informaltable>
32452 <para>
32453 <indexterm role="concept">
32454 <primary>domain</primary>
32455 <secondary>partial; widening</secondary>
32456 </indexterm>
32457 If a DNS lookup fails and this option is set, each of its strings in turn is
32458 added onto the end of the domain, and the lookup is tried again. For example,
32459 if
32460 </para>
32461 <literallayout class="monospaced">
32462 widen_domains = fict.example:ref.example
32463 </literallayout>
32464 <para>
32465 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
32466 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
32467 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
32468 and <option>search_parents</option> options can cause some widening to be undertaken inside
32469 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
32470 when verifying, unless <option>rewrite_headers</option> is false (not the default).
32471 </para>
32472 </section>
32473 <section id="SECID119">
32474 <title>Effect of qualify_single and search_parents</title>
32475 <para>
32476 When a domain from an envelope recipient is changed by the resolver as a result
32477 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
32478 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
32479 is set false. Exim then re-routes the address, using the full domain.
32480 </para>
32481 <para>
32482 These two options affect only the DNS lookup that takes place inside the router
32483 for the domain of the address that is being routed. They do not affect lookups
32484 such as that implied by
32485 </para>
32486 <literallayout class="monospaced">
32487 domains = @mx_any
32488 </literallayout>
32489 <para>
32490 that may happen while processing a router precondition before the router is
32491 entered. No widening ever takes place for these lookups.
32492 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
32493 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
32494 </para>
32495 </section>
32496 </chapter>
32497
32498 <chapter id="CHID5">
32499 <title>The ipliteral router</title>
32500 <para>
32501 <indexterm role="concept">
32502 <primary><command>ipliteral</command> router</primary>
32503 </indexterm>
32504 <indexterm role="concept">
32505 <primary>domain literal</primary>
32506 <secondary>routing</secondary>
32507 </indexterm>
32508 <indexterm role="concept">
32509 <primary>routers</primary>
32510 <secondary><command>ipliteral</command></secondary>
32511 </indexterm>
32512 This router has no private options. Unless it is being used purely for
32513 verification (see <option>verify_only</option>) a transport is required to be defined by the
32514 generic <option>transport</option> option. The router accepts the address if its domain part
32515 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
32516 router handles the address
32517 </para>
32518 <literallayout class="monospaced">
32519 root@[192.168.1.1]
32520 </literallayout>
32521 <para>
32522 by setting up delivery to the host with that IP address. IPv4 domain literals
32523 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
32524 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
32525 </para>
32526 <literallayout class="monospaced">
32527 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
32528 </literallayout>
32529 <para>
32530 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
32531 grounds that sooner or later somebody will try it.
32532 </para>
32533 <para>
32534 <indexterm role="option">
32535 <primary><option>self</option></primary>
32536 <secondary>in <command>ipliteral</command> router</secondary>
32537 </indexterm>
32538 If the IP address matches something in <option>ignore_target_hosts</option>, the router
32539 declines. If an IP literal turns out to refer to the local host, the generic
32540 <option>self</option> option determines what happens.
32541 </para>
32542 <para>
32543 The RFCs require support for domain literals; however, their use is
32544 controversial in today&#x2019;s Internet. If you want to use this router, you must
32545 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
32546 Exim will not recognize the domain literal syntax in addresses.
32547 </para>
32548 </chapter>
32549
32550 <chapter id="CHID6">
32551 <title>The iplookup router</title>
32552 <para>
32553 <indexterm role="concept">
32554 <primary><command>iplookup</command> router</primary>
32555 </indexterm>
32556 <indexterm role="concept">
32557 <primary>routers</primary>
32558 <secondary><command>iplookup</command></secondary>
32559 </indexterm>
32560 The <command>iplookup</command> router was written to fulfil a specific requirement in
32561 Cambridge University (which in fact no longer exists). For this reason, it is
32562 not included in the binary of Exim by default. If you want to include it, you
32563 must set
32564 </para>
32565 <literallayout class="monospaced">
32566 ROUTER_IPLOOKUP=yes
32567 </literallayout>
32568 <para>
32569 in your <filename>Local/Makefile</filename> configuration file.
32570 </para>
32571 <para>
32572 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
32573 connection to one or more specific hosts. The host can then return the same or
32574 a different address &ndash; in effect rewriting the recipient address in the
32575 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
32576 this process fails, the address can be passed on to other routers, or delivery
32577 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
32578 must not be specified for it.
32579 </para>
32580 <para>
32581 <indexterm role="concept">
32582 <primary>options</primary>
32583 <secondary><command>iplookup</command> router</secondary>
32584 </indexterm>
32585 <indexterm role="option">
32586 <primary><option>hosts</option></primary>
32587 </indexterm>
32588 </para>
32589 <informaltable frame="all">
32590 <tgroup cols="4" colsep="0" rowsep="0">
32591 <colspec colwidth="8*" align="left"/>
32592 <colspec colwidth="6*" align="center"/>
32593 <colspec colwidth="6*" align="center"/>
32594 <colspec colwidth="6*" align="right"/>
32595 <tbody>
32596 <row>
32597 <entry><option>hosts</option></entry>
32598 <entry>Use: <emphasis>iplookup</emphasis></entry>
32599 <entry>Type: <emphasis>string</emphasis></entry>
32600 <entry>Default: <emphasis>unset</emphasis></entry>
32601 </row>
32602 </tbody>
32603 </tgroup>
32604 </informaltable>
32605 <para>
32606 This option must be supplied. Its value is a colon-separated list of host
32607 names. The hosts are looked up using <function>gethostbyname()</function>
32608 (or <function>getipnodebyname()</function> when available)
32609 and are tried in order until one responds to the query. If none respond, what
32610 happens is controlled by <option>optional</option>.
32611 </para>
32612 <para>
32613 <indexterm role="option">
32614 <primary><option>optional</option></primary>
32615 </indexterm>
32616 </para>
32617 <informaltable frame="all">
32618 <tgroup cols="4" colsep="0" rowsep="0">
32619 <colspec colwidth="8*" align="left"/>
32620 <colspec colwidth="6*" align="center"/>
32621 <colspec colwidth="6*" align="center"/>
32622 <colspec colwidth="6*" align="right"/>
32623 <tbody>
32624 <row>
32625 <entry><option>optional</option></entry>
32626 <entry>Use: <emphasis>iplookup</emphasis></entry>
32627 <entry>Type: <emphasis>boolean</emphasis></entry>
32628 <entry>Default: <emphasis>false</emphasis></entry>
32629 </row>
32630 </tbody>
32631 </tgroup>
32632 </informaltable>
32633 <para>
32634 If <option>optional</option> is true, if no response is obtained from any host, the address
32635 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
32636 delivery to the address is deferred.
32637 </para>
32638 <para>
32639 <indexterm role="option">
32640 <primary><option>port</option></primary>
32641 </indexterm>
32642 </para>
32643 <informaltable frame="all">
32644 <tgroup cols="4" colsep="0" rowsep="0">
32645 <colspec colwidth="8*" align="left"/>
32646 <colspec colwidth="6*" align="center"/>
32647 <colspec colwidth="6*" align="center"/>
32648 <colspec colwidth="6*" align="right"/>
32649 <tbody>
32650 <row>
32651 <entry><option>port</option></entry>
32652 <entry>Use: <emphasis>iplookup</emphasis></entry>
32653 <entry>Type: <emphasis>integer</emphasis></entry>
32654 <entry>Default: <emphasis>0</emphasis></entry>
32655 </row>
32656 </tbody>
32657 </tgroup>
32658 </informaltable>
32659 <para>
32660 <indexterm role="concept">
32661 <primary>port</primary>
32662 <secondary><command>iplookup</command> router</secondary>
32663 </indexterm>
32664 This option must be supplied. It specifies the port number for the TCP or UDP
32665 call.
32666 </para>
32667 <para>
32668 <indexterm role="option">
32669 <primary><option>protocol</option></primary>
32670 </indexterm>
32671 </para>
32672 <informaltable frame="all">
32673 <tgroup cols="4" colsep="0" rowsep="0">
32674 <colspec colwidth="8*" align="left"/>
32675 <colspec colwidth="6*" align="center"/>
32676 <colspec colwidth="6*" align="center"/>
32677 <colspec colwidth="6*" align="right"/>
32678 <tbody>
32679 <row>
32680 <entry><option>protocol</option></entry>
32681 <entry>Use: <emphasis>iplookup</emphasis></entry>
32682 <entry>Type: <emphasis>string</emphasis></entry>
32683 <entry>Default: <emphasis>udp</emphasis></entry>
32684 </row>
32685 </tbody>
32686 </tgroup>
32687 </informaltable>
32688 <para>
32689 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
32690 protocols is to be used.
32691 </para>
32692 <para>
32693 <indexterm role="option">
32694 <primary><option>query</option></primary>
32695 </indexterm>
32696 </para>
32697 <informaltable frame="all">
32698 <tgroup cols="4" colsep="0" rowsep="0">
32699 <colspec colwidth="8*" align="left"/>
32700 <colspec colwidth="6*" align="center"/>
32701 <colspec colwidth="6*" align="center"/>
32702 <colspec colwidth="6*" align="right"/>
32703 <tbody>
32704 <row>
32705 <entry><option>query</option></entry>
32706 <entry>Use: <emphasis>iplookup</emphasis></entry>
32707 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32708 <entry>Default: <emphasis>see below</emphasis></entry>
32709 </row>
32710 </tbody>
32711 </tgroup>
32712 </informaltable>
32713 <para>
32714 This defines the content of the query that is sent to the remote hosts. The
32715 default value is:
32716 </para>
32717 <literallayout class="monospaced">
32718 $local_part@$domain $local_part@$domain
32719 </literallayout>
32720 <para>
32721 The repetition serves as a way of checking that a response is to the correct
32722 query in the default case (see <option>response_pattern</option> below).
32723 </para>
32724 <para>
32725 <indexterm role="option">
32726 <primary><option>reroute</option></primary>
32727 </indexterm>
32728 </para>
32729 <informaltable frame="all">
32730 <tgroup cols="4" colsep="0" rowsep="0">
32731 <colspec colwidth="8*" align="left"/>
32732 <colspec colwidth="6*" align="center"/>
32733 <colspec colwidth="6*" align="center"/>
32734 <colspec colwidth="6*" align="right"/>
32735 <tbody>
32736 <row>
32737 <entry><option>reroute</option></entry>
32738 <entry>Use: <emphasis>iplookup</emphasis></entry>
32739 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32740 <entry>Default: <emphasis>unset</emphasis></entry>
32741 </row>
32742 </tbody>
32743 </tgroup>
32744 </informaltable>
32745 <para>
32746 If this option is not set, the rerouted address is precisely the byte string
32747 returned by the remote host, up to the first white space, if any. If set, the
32748 string is expanded to form the rerouted address. It can include parts matched
32749 in the response by <option>response_pattern</option> by means of numeric variables such as
32750 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
32751 whether or not a pattern is in use. In all cases, the rerouted address must end
32752 up in the form <emphasis>local_part@domain</emphasis>.
32753 </para>
32754 <para>
32755 <indexterm role="option">
32756 <primary><option>response_pattern</option></primary>
32757 </indexterm>
32758 </para>
32759 <informaltable frame="all">
32760 <tgroup cols="4" colsep="0" rowsep="0">
32761 <colspec colwidth="8*" align="left"/>
32762 <colspec colwidth="6*" align="center"/>
32763 <colspec colwidth="6*" align="center"/>
32764 <colspec colwidth="6*" align="right"/>
32765 <tbody>
32766 <row>
32767 <entry><option>response_pattern</option></entry>
32768 <entry>Use: <emphasis>iplookup</emphasis></entry>
32769 <entry>Type: <emphasis>string</emphasis></entry>
32770 <entry>Default: <emphasis>unset</emphasis></entry>
32771 </row>
32772 </tbody>
32773 </tgroup>
32774 </informaltable>
32775 <para>
32776 This option can be set to a regular expression that is applied to the string
32777 returned from the remote host. If the pattern does not match the response, the
32778 router declines. If <option>response_pattern</option> is not set, no checking of the
32779 response is done, unless the query was defaulted, in which case there is a
32780 check that the text returned after the first white space is the original
32781 address. This checks that the answer that has been received is in response to
32782 the correct question. For example, if the response is just a new domain, the
32783 following could be used:
32784 </para>
32785 <literallayout class="monospaced">
32786 response_pattern = ^([^@]+)$
32787 reroute = $local_part@$1
32788 </literallayout>
32789 <para>
32790 <indexterm role="option">
32791 <primary><option>timeout</option></primary>
32792 </indexterm>
32793 </para>
32794 <informaltable frame="all">
32795 <tgroup cols="4" colsep="0" rowsep="0">
32796 <colspec colwidth="8*" align="left"/>
32797 <colspec colwidth="6*" align="center"/>
32798 <colspec colwidth="6*" align="center"/>
32799 <colspec colwidth="6*" align="right"/>
32800 <tbody>
32801 <row>
32802 <entry><option>timeout</option></entry>
32803 <entry>Use: <emphasis>iplookup</emphasis></entry>
32804 <entry>Type: <emphasis>time</emphasis></entry>
32805 <entry>Default: <emphasis>5s</emphasis></entry>
32806 </row>
32807 </tbody>
32808 </tgroup>
32809 </informaltable>
32810 <para>
32811 This specifies the amount of time to wait for a response from the remote
32812 machine. The same timeout is used for the <function>connect()</function> function for a TCP
32813 call. It does not apply to UDP.
32814 </para>
32815 </chapter>
32816
32817 <chapter id="CHID7">
32818 <title>The manualroute router</title>
32819 <para>
32820 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
32821 <primary><command>manualroute</command> router</primary>
32822 </indexterm>
32823 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
32824 <primary>routers</primary>
32825 <secondary><command>manualroute</command></secondary>
32826 </indexterm>
32827 <indexterm role="concept">
32828 <primary>domain</primary>
32829 <secondary>manually routing</secondary>
32830 </indexterm>
32831 The <command>manualroute</command> router is so-called because it provides a way of manually
32832 routing an address according to its domain. It is mainly used when you want to
32833 route addresses to remote hosts according to your own rules, bypassing the
32834 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
32835 route to local transports, a facility that may be useful if you want to save
32836 messages for dial-in hosts in local files.
32837 </para>
32838 <para>
32839 The <command>manualroute</command> router compares a list of domain patterns with the domain
32840 it is trying to route. If there is no match, the router declines. Each pattern
32841 has associated with it a list of hosts and some other optional data, which may
32842 include a transport. The combination of a pattern and its data is called a
32843 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
32844 generic <option>transport</option> option must specify a transport, unless the router is
32845 being used purely for verification (see <option>verify_only</option>).
32846 </para>
32847 <para>
32848 <indexterm role="variable">
32849 <primary><varname>$host</varname></primary>
32850 </indexterm>
32851 In the case of verification, matching the domain pattern is sufficient for the
32852 router to accept the address. When actually routing an address for delivery,
32853 an address that matches a domain pattern is queued for the associated
32854 transport. If the transport is not a local one, a host list must be associated
32855 with the pattern; IP addresses are looked up for the hosts, and these are
32856 passed to the transport along with the mail address. For local transports, a
32857 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
32858 text string.
32859 </para>
32860 <para>
32861 The list of routing rules can be provided as an inline string in
32862 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
32863 or database by setting <option>route_data</option>. Only one of these settings may appear in
32864 any one instance of <command>manualroute</command>. The format of routing rules is described
32865 below, following the list of private options.
32866 </para>
32867 <section id="SECTprioptman">
32868 <title>Private options for manualroute</title>
32869 <para>
32870 <indexterm role="concept">
32871 <primary>options</primary>
32872 <secondary><command>manualroute</command> router</secondary>
32873 </indexterm>
32874 The private options for the <command>manualroute</command> router are as follows:
32875 </para>
32876 <para>
32877 <indexterm role="option">
32878 <primary><option>host_all_ignored</option></primary>
32879 </indexterm>
32880 </para>
32881 <informaltable frame="all">
32882 <tgroup cols="4" colsep="0" rowsep="0">
32883 <colspec colwidth="8*" align="left"/>
32884 <colspec colwidth="6*" align="center"/>
32885 <colspec colwidth="6*" align="center"/>
32886 <colspec colwidth="6*" align="right"/>
32887 <tbody>
32888 <row>
32889 <entry><option>host_all_ignored</option></entry>
32890 <entry>Use: <emphasis>manualroute</emphasis></entry>
32891 <entry>Type: <emphasis>string</emphasis></entry>
32892 <entry>Default: <emphasis>defer</emphasis></entry>
32893 </row>
32894 </tbody>
32895 </tgroup>
32896 </informaltable>
32897 <para>
32898 See <option>host_find_failed</option>.
32899 </para>
32900 <para>
32901 <indexterm role="option">
32902 <primary><option>host_find_failed</option></primary>
32903 </indexterm>
32904 </para>
32905 <informaltable frame="all">
32906 <tgroup cols="4" colsep="0" rowsep="0">
32907 <colspec colwidth="8*" align="left"/>
32908 <colspec colwidth="6*" align="center"/>
32909 <colspec colwidth="6*" align="center"/>
32910 <colspec colwidth="6*" align="right"/>
32911 <tbody>
32912 <row>
32913 <entry><option>host_find_failed</option></entry>
32914 <entry>Use: <emphasis>manualroute</emphasis></entry>
32915 <entry>Type: <emphasis>string</emphasis></entry>
32916 <entry>Default: <emphasis>freeze</emphasis></entry>
32917 </row>
32918 </tbody>
32919 </tgroup>
32920 </informaltable>
32921 <para>
32922 This option controls what happens when <command>manualroute</command> tries to find an IP
32923 address for a host, and the host does not exist. The option can be set to one
32924 of the following values:
32925 </para>
32926 <literallayout class="monospaced">
32927 decline
32928 defer
32929 fail
32930 freeze
32931 ignore
32932 pass
32933 </literallayout>
32934 <para>
32935 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
32936 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
32937 forces the address to be passed to the next router (or the router defined by
32938 <option>pass_router</option>),
32939 <indexterm role="option">
32940 <primary><option>more</option></primary>
32941 </indexterm>
32942 overriding <option>no_more</option>, whereas the latter passes the address to the next
32943 router only if <option>more</option> is true.
32944 </para>
32945 <para>
32946 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
32947 cannot be found. If all the hosts in the list are ignored, the behaviour is
32948 controlled by the <option>host_all_ignored</option> option. This takes the same values
32949 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
32950 </para>
32951 <para>
32952 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
32953 state; if a host lookup gets a temporary error, delivery is deferred unless the
32954 generic <option>pass_on_timeout</option> option is set.
32955 </para>
32956 <para>
32957 <indexterm role="option">
32958 <primary><option>hosts_randomize</option></primary>
32959 </indexterm>
32960 </para>
32961 <informaltable frame="all">
32962 <tgroup cols="4" colsep="0" rowsep="0">
32963 <colspec colwidth="8*" align="left"/>
32964 <colspec colwidth="6*" align="center"/>
32965 <colspec colwidth="6*" align="center"/>
32966 <colspec colwidth="6*" align="right"/>
32967 <tbody>
32968 <row>
32969 <entry><option>hosts_randomize</option></entry>
32970 <entry>Use: <emphasis>manualroute</emphasis></entry>
32971 <entry>Type: <emphasis>boolean</emphasis></entry>
32972 <entry>Default: <emphasis>false</emphasis></entry>
32973 </row>
32974 </tbody>
32975 </tgroup>
32976 </informaltable>
32977 <para>
32978 <indexterm role="concept">
32979 <primary>randomized host list</primary>
32980 </indexterm>
32981 <indexterm role="concept">
32982 <primary>host</primary>
32983 <secondary>list of; randomized</secondary>
32984 </indexterm>
32985 If this option is set, the order of the items in a host list in a routing rule
32986 is randomized each time the list is used, unless an option in the routing rule
32987 overrides (see below). Randomizing the order of a host list can be used to do
32988 crude load sharing. However, if more than one mail address is routed by the
32989 same router to the same host list, the host lists are considered to be the same
32990 (even though they may be randomized into different orders) for the purpose of
32991 deciding whether to batch the deliveries into a single SMTP transaction.
32992 </para>
32993 <para>
32994 When <option>hosts_randomize</option> is true, a host list may be split
32995 into groups whose order is separately randomized. This makes it possible to
32996 set up MX-like behaviour. The boundaries between groups are indicated by an
32997 item that is just <literal>+</literal> in the host list. For example:
32998 </para>
32999 <literallayout class="monospaced">
33000 route_list = * host1:host2:host3:+:host4:host5
33001 </literallayout>
33002 <para>
33003 The order of the first three hosts and the order of the last two hosts is
33004 randomized for each use, but the first three always end up before the last two.
33005 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
33006 randomized host list is passed to an <command>smtp</command> transport that also has
33007 <option>hosts_randomize set</option>, the list is not re-randomized.
33008 </para>
33009 <para>
33010 <indexterm role="option">
33011 <primary><option>route_data</option></primary>
33012 </indexterm>
33013 </para>
33014 <informaltable frame="all">
33015 <tgroup cols="4" colsep="0" rowsep="0">
33016 <colspec colwidth="8*" align="left"/>
33017 <colspec colwidth="6*" align="center"/>
33018 <colspec colwidth="6*" align="center"/>
33019 <colspec colwidth="6*" align="right"/>
33020 <tbody>
33021 <row>
33022 <entry><option>route_data</option></entry>
33023 <entry>Use: <emphasis>manualroute</emphasis></entry>
33024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33025 <entry>Default: <emphasis>unset</emphasis></entry>
33026 </row>
33027 </tbody>
33028 </tgroup>
33029 </informaltable>
33030 <para>
33031 If this option is set, it must expand to yield the data part of a routing rule.
33032 Typically, the expansion string includes a lookup based on the domain. For
33033 example:
33034 </para>
33035 <literallayout class="monospaced">
33036 route_data = ${lookup{$domain}dbm{/etc/routes}}
33037 </literallayout>
33038 <para>
33039 If the expansion is forced to fail, or the result is an empty string, the
33040 router declines. Other kinds of expansion failure cause delivery to be
33041 deferred.
33042 </para>
33043 <para>
33044 <indexterm role="option">
33045 <primary><option>route_list</option></primary>
33046 </indexterm>
33047 </para>
33048 <informaltable frame="all">
33049 <tgroup cols="4" colsep="0" rowsep="0">
33050 <colspec colwidth="8*" align="left"/>
33051 <colspec colwidth="6*" align="center"/>
33052 <colspec colwidth="6*" align="center"/>
33053 <colspec colwidth="6*" align="right"/>
33054 <tbody>
33055 <row>
33056 <entry><option>route_list</option></entry>
33057 <entry>Use: <emphasis>manualroute</emphasis></entry>
33058 <entry>Type: <emphasis>string list</emphasis></entry>
33059 <entry>Default: <emphasis>unset</emphasis></entry>
33060 </row>
33061 </tbody>
33062 </tgroup>
33063 </informaltable>
33064 <para>
33065 This string is a list of routing rules, in the form defined below. Note that,
33066 unlike most string lists, the items are separated by semicolons. This is so
33067 that they may contain colon-separated host lists.
33068 </para>
33069 <para>
33070 <indexterm role="option">
33071 <primary><option>same_domain_copy_routing</option></primary>
33072 </indexterm>
33073 </para>
33074 <informaltable frame="all">
33075 <tgroup cols="4" colsep="0" rowsep="0">
33076 <colspec colwidth="8*" align="left"/>
33077 <colspec colwidth="6*" align="center"/>
33078 <colspec colwidth="6*" align="center"/>
33079 <colspec colwidth="6*" align="right"/>
33080 <tbody>
33081 <row>
33082 <entry><option>same_domain_copy_routing</option></entry>
33083 <entry>Use: <emphasis>manualroute</emphasis></entry>
33084 <entry>Type: <emphasis>boolean</emphasis></entry>
33085 <entry>Default: <emphasis>false</emphasis></entry>
33086 </row>
33087 </tbody>
33088 </tgroup>
33089 </informaltable>
33090 <para>
33091 <indexterm role="concept">
33092 <primary>address</primary>
33093 <secondary>copying routing</secondary>
33094 </indexterm>
33095 Addresses with the same domain are normally routed by the <command>manualroute</command>
33096 router to the same list of hosts. However, this cannot be presumed, because the
33097 router options and preconditions may refer to the local part of the address. By
33098 default, therefore, Exim routes each address in a message independently. DNS
33099 servers run caches, so repeated DNS lookups are not normally expensive, and in
33100 any case, personal messages rarely have more than a few recipients.
33101 </para>
33102 <para>
33103 If you are running mailing lists with large numbers of subscribers at the same
33104 domain, and you are using a <command>manualroute</command> router which is independent of the
33105 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33106 lookups for identical domains in one message. In this case, when
33107 <command>manualroute</command> routes an address to a remote transport, any other unrouted
33108 addresses in the message that have the same domain are automatically given the
33109 same routing without processing them independently. However, this is only done
33110 if <option>headers_add</option> and <option>headers_remove</option> are unset.
33111 </para>
33112 </section>
33113 <section id="SECID120">
33114 <title>Routing rules in route_list</title>
33115 <para>
33116 The value of <option>route_list</option> is a string consisting of a sequence of routing
33117 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
33118 entered as two semicolons. Alternatively, the list separator can be changed as
33119 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
33120 Empty rules are ignored. The format of each rule is
33121 </para>
33122 <literallayout>
33123 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
33124 </literallayout>
33125 <para>
33126 The following example contains two rules, each with a simple domain pattern and
33127 no options:
33128 </para>
33129 <literallayout class="monospaced">
33130 route_list = \
33131   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
33132   thes.ref.example  mail-3.ref.example:mail-4.ref.example
33133 </literallayout>
33134 <para>
33135 The three parts of a rule are separated by white space. The pattern and the
33136 list of hosts can be enclosed in quotes if necessary, and if they are, the
33137 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
33138 single domain pattern, which is the only mandatory item in the rule. The
33139 pattern is in the same format as one item in a domain list (see section
33140 <xref linkend="SECTdomainlist"/>),
33141 except that it may not be the name of an interpolated file.
33142 That is, it may be wildcarded, or a regular expression, or a file or database
33143 lookup (with semicolons doubled, because of the use of semicolon as a separator
33144 in a <option>route_list</option>).
33145 </para>
33146 <para>
33147 The rules in <option>route_list</option> are searched in order until one of the patterns
33148 matches the domain that is being routed. The list of hosts and then options are
33149 then used as described below. If there is no match, the router declines. When
33150 <option>route_list</option> is set, <option>route_data</option> must not be set.
33151 </para>
33152 </section>
33153 <section id="SECID121">
33154 <title>Routing rules in route_data</title>
33155 <para>
33156 The use of <option>route_list</option> is convenient when there are only a small number of
33157 routing rules. For larger numbers, it is easier to use a file or database to
33158 hold the routing information, and use the <option>route_data</option> option instead.
33159 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
33160 Most commonly, <option>route_data</option> is set as a string that contains an
33161 expansion lookup. For example, suppose we place two routing rules in a file
33162 like this:
33163 </para>
33164 <literallayout class="monospaced">
33165 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
33166 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
33167 </literallayout>
33168 <para>
33169 This data can be accessed by setting
33170 </para>
33171 <literallayout class="monospaced">
33172 route_data = ${lookup{$domain}lsearch{/the/file/name}}
33173 </literallayout>
33174 <para>
33175 Failure of the lookup results in an empty string, causing the router to
33176 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
33177 requirement is that the result of expanding the string is a list of hosts,
33178 possibly followed by options, separated by white space. The list of hosts must
33179 be enclosed in quotes if it contains white space.
33180 </para>
33181 </section>
33182 <section id="SECID122">
33183 <title>Format of the list of hosts</title>
33184 <para>
33185 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
33186 always separately expanded before use. If the expansion fails, the router
33187 declines. The result of the expansion must be a colon-separated list of names
33188 and/or IP addresses, optionally also including ports. The format of each item
33189 in the list is described in the next section. The list separator can be changed
33190 as described in section <xref linkend="SECTlistconstruct"/>.
33191 </para>
33192 <para>
33193 If the list of hosts was obtained from a <option>route_list</option> item, the following
33194 variables are set during its expansion:
33195 </para>
33196 <itemizedlist>
33197 <listitem>
33198 <para>
33199 <indexterm role="concept">
33200 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
33201 <secondary>in <command>manualroute</command> router</secondary>
33202 </indexterm>
33203 If the domain was matched against a regular expression, the numeric variables
33204 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
33205 </para>
33206 <literallayout class="monospaced">
33207 route_list = ^domain(\d+)   host-$1.text.example
33208 </literallayout>
33209 </listitem>
33210 <listitem>
33211 <para>
33212 <varname>$0</varname> is always set to the entire domain.
33213 </para>
33214 </listitem>
33215 <listitem>
33216 <para>
33217 <varname>$1</varname> is also set when partial matching is done in a file lookup.
33218 </para>
33219 </listitem>
33220 <listitem>
33221 <para>
33222 <indexterm role="variable">
33223 <primary><varname>$value</varname></primary>
33224 </indexterm>
33225 If the pattern that matched the domain was a lookup item, the data that was
33226 looked up is available in the expansion variable <varname>$value</varname>. For example:
33227 </para>
33228 <literallayout class="monospaced">
33229 route_list = lsearch;;/some/file.routes  $value
33230 </literallayout>
33231 </listitem>
33232 </itemizedlist>
33233 <para>
33234 Note the doubling of the semicolon in the pattern that is necessary because
33235 semicolon is the default route list separator.
33236 </para>
33237 </section>
33238 <section id="SECTformatonehostitem">
33239 <title>Format of one host item</title>
33240 <para>
33241 Each item in the list of hosts is either a host name or an IP address,
33242 optionally with an attached port number. When no port is given, an IP address
33243 is not enclosed in brackets. When a port is specified, it overrides the port
33244 specification on the transport. The port is separated from the name or address
33245 by a colon. This leads to some complications:
33246 </para>
33247 <itemizedlist>
33248 <listitem>
33249 <para>
33250 Because colon is the default separator for the list of hosts, either
33251 the colon that specifies a port must be doubled, or the list separator must
33252 be changed. The following two examples have the same effect:
33253 </para>
33254 <literallayout class="monospaced">
33255 route_list = * "host1.tld::1225 : host2.tld::1226"
33256 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
33257 </literallayout>
33258 </listitem>
33259 <listitem>
33260 <para>
33261 When IPv6 addresses are involved, it gets worse, because they contain
33262 colons of their own. To make this case easier, it is permitted to
33263 enclose an IP address (either v4 or v6) in square brackets if a port
33264 number follows. For example:
33265 </para>
33266 <literallayout class="monospaced">
33267 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
33268 </literallayout>
33269 </listitem>
33270 </itemizedlist>
33271 </section>
33272 <section id="SECThostshowused">
33273 <title>How the list of hosts is used</title>
33274 <para>
33275 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
33276 the hosts is tried, in the order specified, when carrying out the SMTP
33277 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
33278 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
33279 transport.
33280 </para>
33281 <para>
33282 Hosts may be listed by name or by IP address. An unadorned name in the list of
33283 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
33284 interpreted as an indirection to a sublist of hosts obtained by looking up MX
33285 records in the DNS. For example:
33286 </para>
33287 <literallayout class="monospaced">
33288 route_list = *  x.y.z:p.q.r/MX:e.f.g
33289 </literallayout>
33290 <para>
33291 If this feature is used with a port specifier, the port must come last. For
33292 example:
33293 </para>
33294 <literallayout class="monospaced">
33295 route_list = *  dom1.tld/mx::1225
33296 </literallayout>
33297 <para>
33298 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
33299 randomized before any lookups are done. Exim then scans the list; for any name
33300 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
33301 be an interface on the local host and the item is not the first in the list,
33302 Exim discards it and any subsequent items. If it is the first item, what
33303 happens is controlled by the
33304 <indexterm role="option">
33305 <primary><option>self</option></primary>
33306 <secondary>in <command>manualroute</command> router</secondary>
33307 </indexterm>
33308 <option>self</option> option of the router.
33309 </para>
33310 <para>
33311 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
33312 hosts obtained by looking up MX records for the name. This is always a DNS
33313 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
33314 below) are not relevant here. The order of these hosts is determined by the
33315 preference values in the MX records, according to the usual rules. Because
33316 randomizing happens before the MX lookup, it does not affect the order that is
33317 defined by MX preferences.
33318 </para>
33319 <para>
33320 If the local host is present in the sublist obtained from MX records, but is
33321 not the most preferred host in that list, it and any equally or less
33322 preferred hosts are removed before the sublist is inserted into the main list.
33323 </para>
33324 <para>
33325 If the local host is the most preferred host in the MX list, what happens
33326 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
33327 is not the first item (that is, there are previous hosts in the main list),
33328 Exim discards this name and any subsequent items in the main list.
33329 </para>
33330 <para>
33331 If the MX item is first in the list of hosts, and the local host is the
33332 most preferred host, what happens is controlled by the <option>self</option> option of the
33333 router.
33334 </para>
33335 <para>
33336 DNS failures when lookup up the MX records are treated in the same way as DNS
33337 failures when looking up IP addresses: <option>pass_on_timeout</option> and
33338 <option>host_find_failed</option> are used when relevant.
33339 </para>
33340 <para>
33341 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
33342 whether obtained from an MX lookup or not.
33343 </para>
33344 </section>
33345 <section id="SECThowoptused">
33346 <title>How the options are used</title>
33347 <para>
33348 The options are a sequence of words; in practice no more than three are ever
33349 present. One of the words can be the name of a transport; this overrides the
33350 <option>transport</option> option on the router for this particular routing rule only. The
33351 other words (if present) control randomization of the list of hosts on a
33352 per-rule basis, and how the IP addresses of the hosts are to be found when
33353 routing to a remote transport. These options are as follows:
33354 </para>
33355 <itemizedlist>
33356 <listitem>
33357 <para>
33358 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
33359 setting of <option>hosts_randomize</option> for this routing rule only.
33360 </para>
33361 </listitem>
33362 <listitem>
33363 <para>
33364 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
33365 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
33366 </para>
33367 </listitem>
33368 <listitem>
33369 <para>
33370 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
33371 find IP addresses. This function may ultimately cause a DNS lookup, but it may
33372 also look in <filename>/etc/hosts</filename> or other sources of information.
33373 </para>
33374 </listitem>
33375 <listitem>
33376 <para>
33377 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
33378 no address records are found. If there is a temporary DNS error (such as a
33379 timeout), delivery is deferred.
33380 </para>
33381 </listitem>
33382 </itemizedlist>
33383 <para>
33384 For example:
33385 </para>
33386 <literallayout class="monospaced">
33387 route_list = domain1  host1:host2:host3  randomize bydns;\
33388              domain2  host4:host5
33389 </literallayout>
33390 <para>
33391 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
33392 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
33393 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
33394 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
33395 call.
33396 </para>
33397 <para>
33398 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
33399 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
33400 instead of TRY_AGAIN. That is why the default action is to try a DNS
33401 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
33402 function called.
33403 </para>
33404 <para>
33405 If no IP address for a host can be found, what happens is controlled by the
33406 <option>host_find_failed</option> option.
33407 </para>
33408 <para>
33409 <indexterm role="variable">
33410 <primary><varname>$host</varname></primary>
33411 </indexterm>
33412 When an address is routed to a local transport, IP addresses are not looked up.
33413 The host list is passed to the transport in the <varname>$host</varname> variable.
33414 </para>
33415 </section>
33416 <section id="SECID123">
33417 <title>Manualroute examples</title>
33418 <para>
33419 In some of the examples that follow, the presence of the <option>remote_smtp</option>
33420 transport, as defined in the default configuration file, is assumed:
33421 </para>
33422 <itemizedlist>
33423 <listitem>
33424 <para>
33425 <indexterm role="concept">
33426 <primary>smart host</primary>
33427 <secondary>example router</secondary>
33428 </indexterm>
33429 The <command>manualroute</command> router can be used to forward all external mail to a
33430 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
33431 named domain list that contains your local domains, for example:
33432 </para>
33433 <literallayout class="monospaced">
33434 domainlist local_domains = my.domain.example
33435 </literallayout>
33436 <para>
33437 You can arrange for all other domains to be routed to a smart host by making
33438 your first router something like this:
33439 </para>
33440 <literallayout class="monospaced">
33441 smart_route:
33442   driver = manualroute
33443   domains = !+local_domains
33444   transport = remote_smtp
33445   route_list = * smarthost.ref.example
33446 </literallayout>
33447 <para>
33448 This causes all non-local addresses to be sent to the single host
33449 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
33450 they are tried in order
33451 (but you can use <option>hosts_randomize</option> to vary the order each time).
33452 Another way of configuring the same thing is this:
33453 </para>
33454 <literallayout class="monospaced">
33455 smart_route:
33456   driver = manualroute
33457   transport = remote_smtp
33458   route_list = !+local_domains  smarthost.ref.example
33459 </literallayout>
33460 <para>
33461 There is no difference in behaviour between these two routers as they stand.
33462 However, they behave differently if <option>no_more</option> is added to them. In the first
33463 example, the router is skipped if the domain does not match the <option>domains</option>
33464 precondition; the following router is always tried. If the router runs, it
33465 always matches the domain and so can never decline. Therefore, <option>no_more</option>
33466 would have no effect. In the second case, the router is never skipped; it
33467 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
33468 <option>no_more</option> would prevent subsequent routers from running.
33469 </para>
33470 </listitem>
33471 <listitem>
33472 <para>
33473 <indexterm role="concept">
33474 <primary>mail hub example</primary>
33475 </indexterm>
33476 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
33477 records in the DNS and delivers it via its own private routing mechanism. Often
33478 the final destinations are behind a firewall, with the mail hub being the one
33479 machine that can connect to machines both inside and outside the firewall. The
33480 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
33481 to the correct hosts. For a small number of domains, the routing can be inline,
33482 using the <option>route_list</option> option, but for a larger number a file or database
33483 lookup is easier to manage.
33484 </para>
33485 <para>
33486 If the domain names are in fact the names of the machines to which the mail is
33487 to be sent by the mail hub, the configuration can be quite simple. For
33488 example:
33489 </para>
33490 <literallayout class="monospaced">
33491 hub_route:
33492   driver = manualroute
33493   transport = remote_smtp
33494   route_list = *.rhodes.tvs.example  $domain
33495 </literallayout>
33496 <para>
33497 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
33498 whose names are the same as the mail domains. A similar approach can be taken
33499 if the host name can be obtained from the domain name by a string manipulation
33500 that the expansion facilities can handle. Otherwise, a lookup based on the
33501 domain can be used to find the host:
33502 </para>
33503 <literallayout class="monospaced">
33504 through_firewall:
33505   driver = manualroute
33506   transport = remote_smtp
33507   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
33508 </literallayout>
33509 <para>
33510 The result of the lookup must be the name or IP address of the host (or
33511 hosts) to which the address is to be routed. If the lookup fails, the route
33512 data is empty, causing the router to decline. The address then passes to the
33513 next router.
33514 </para>
33515 </listitem>
33516 <listitem>
33517 <para>
33518 <indexterm role="concept">
33519 <primary>batched SMTP output example</primary>
33520 </indexterm>
33521 <indexterm role="concept">
33522 <primary>SMTP</primary>
33523 <secondary>batched outgoing; example</secondary>
33524 </indexterm>
33525 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
33526 SMTP format for onward transportation by some other means. This is one way of
33527 storing mail for a dial-up host when it is not connected. The route list entry
33528 can be as simple as a single domain name in a configuration like this:
33529 </para>
33530 <literallayout class="monospaced">
33531 save_in_file:
33532   driver = manualroute
33533   transport = batchsmtp_appendfile
33534   route_list = saved.domain.example
33535 </literallayout>
33536 <para>
33537 though often a pattern is used to pick up more than one domain. If there are
33538 several domains or groups of domains with different transport requirements,
33539 different transports can be listed in the routing information:
33540 </para>
33541 <literallayout class="monospaced">
33542 save_in_file:
33543   driver = manualroute
33544   route_list = \
33545     *.saved.domain1.example  $domain  batch_appendfile; \
33546     *.saved.domain2.example  \
33547       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
33548       batch_pipe
33549 </literallayout>
33550 <para>
33551 <indexterm role="variable">
33552 <primary><varname>$domain</varname></primary>
33553 </indexterm>
33554 <indexterm role="variable">
33555 <primary><varname>$host</varname></primary>
33556 </indexterm>
33557 The first of these just passes the domain in the <varname>$host</varname> variable, which
33558 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
33559 file lookup to find a value to pass, causing the router to decline to handle
33560 the address if the lookup fails.
33561 </para>
33562 </listitem>
33563 <listitem>
33564 <para>
33565 <indexterm role="concept">
33566 <primary>UUCP</primary>
33567 <secondary>example of router for</secondary>
33568 </indexterm>
33569 Routing mail directly to UUCP software is a specific case of the use of
33570 <command>manualroute</command> in a gateway to another mail environment. This is an example of
33571 one way it can be done:
33572 </para>
33573 <literallayout class="monospaced">
33574 # Transport
33575 uucp:
33576   driver = pipe
33577   user = nobody
33578   command = /usr/local/bin/uux -r - \
33579     ${substr_-5:$host}!rmail ${local_part}
33580   return_fail_output = true
33581
33582 # Router
33583 uucphost:
33584   transport = uucp
33585   driver = manualroute
33586   route_data = \
33587     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
33588 </literallayout>
33589 <para>
33590 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
33591 </para>
33592 <literallayout class="monospaced">
33593 darksite.ethereal.example:           darksite.UUCP
33594 </literallayout>
33595 <para>
33596 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
33597 makes clear the distinction between the domain name
33598 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
33599 </para>
33600 </listitem>
33601 </itemizedlist>
33602 <para>
33603 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
33604 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
33605 </para>
33606 </section>
33607 </chapter>
33608
33609 <chapter id="CHAPdriverlast">
33610 <title>The queryprogram router</title>
33611 <para>
33612 <indexterm role="concept" id="IIDquerou1" class="startofrange">
33613 <primary><command>queryprogram</command> router</primary>
33614 </indexterm>
33615 <indexterm role="concept" id="IIDquerou2" class="startofrange">
33616 <primary>routers</primary>
33617 <secondary><command>queryprogram</command></secondary>
33618 </indexterm>
33619 <indexterm role="concept">
33620 <primary>routing</primary>
33621 <secondary>by external program</secondary>
33622 </indexterm>
33623 The <command>queryprogram</command> router routes an address by running an external command
33624 and acting on its output. This is an expensive way to route, and is intended
33625 mainly for use in lightly-loaded systems, or for performing experiments.
33626 However, if it is possible to use the precondition options (<option>domains</option>,
33627 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
33628 be used in special cases, even on a busy host. There are the following private
33629 options:
33630 <indexterm role="concept">
33631 <primary>options</primary>
33632 <secondary><command>queryprogram</command> router</secondary>
33633 </indexterm>
33634 </para>
33635 <para>
33636 <indexterm role="option">
33637 <primary><option>command</option></primary>
33638 </indexterm>
33639 </para>
33640 <informaltable frame="all">
33641 <tgroup cols="4" colsep="0" rowsep="0">
33642 <colspec colwidth="8*" align="left"/>
33643 <colspec colwidth="6*" align="center"/>
33644 <colspec colwidth="6*" align="center"/>
33645 <colspec colwidth="6*" align="right"/>
33646 <tbody>
33647 <row>
33648 <entry><option>command</option></entry>
33649 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33651 <entry>Default: <emphasis>unset</emphasis></entry>
33652 </row>
33653 </tbody>
33654 </tgroup>
33655 </informaltable>
33656 <para>
33657 This option must be set. It specifies the command that is to be run. The
33658 command is split up into a command name and arguments, and then each is
33659 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
33660 <xref linkend="CHAPpipetransport"/>).
33661 </para>
33662 <para>
33663 <indexterm role="option">
33664 <primary><option>command_group</option></primary>
33665 </indexterm>
33666 </para>
33667 <informaltable frame="all">
33668 <tgroup cols="4" colsep="0" rowsep="0">
33669 <colspec colwidth="8*" align="left"/>
33670 <colspec colwidth="6*" align="center"/>
33671 <colspec colwidth="6*" align="center"/>
33672 <colspec colwidth="6*" align="right"/>
33673 <tbody>
33674 <row>
33675 <entry><option>command_group</option></entry>
33676 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33677 <entry>Type: <emphasis>string</emphasis></entry>
33678 <entry>Default: <emphasis>unset</emphasis></entry>
33679 </row>
33680 </tbody>
33681 </tgroup>
33682 </informaltable>
33683 <para>
33684 <indexterm role="concept">
33685 <primary>gid (group id)</primary>
33686 <secondary>in <command>queryprogram</command> router</secondary>
33687 </indexterm>
33688 This option specifies a gid to be set when running the command while routing an
33689 address for deliver. It must be set if <option>command_user</option> specifies a numerical
33690 uid. If it begins with a digit, it is interpreted as the numerical value of the
33691 gid. Otherwise it is looked up using <function>getgrnam()</function>.
33692 </para>
33693 <para>
33694 <indexterm role="option">
33695 <primary><option>command_user</option></primary>
33696 </indexterm>
33697 </para>
33698 <informaltable frame="all">
33699 <tgroup cols="4" colsep="0" rowsep="0">
33700 <colspec colwidth="8*" align="left"/>
33701 <colspec colwidth="6*" align="center"/>
33702 <colspec colwidth="6*" align="center"/>
33703 <colspec colwidth="6*" align="right"/>
33704 <tbody>
33705 <row>
33706 <entry><option>command_user</option></entry>
33707 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33708 <entry>Type: <emphasis>string</emphasis></entry>
33709 <entry>Default: <emphasis>unset</emphasis></entry>
33710 </row>
33711 </tbody>
33712 </tgroup>
33713 </informaltable>
33714 <para>
33715 <indexterm role="concept">
33716 <primary>uid (user id)</primary>
33717 <secondary>for <command>queryprogram</command></secondary>
33718 </indexterm>
33719 This option must be set. It specifies the uid which is set when running the
33720 command while routing an address for delivery. If the value begins with a digit,
33721 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
33722 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
33723 not set, a value for the gid also.
33724 </para>
33725 <para>
33726 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
33727 root, which it does during a normal delivery in a conventional configuration.
33728 However, when an address is being verified during message reception, Exim is
33729 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
33730 is called from a non-root process, Exim cannot change uid or gid before running
33731 the command. In this circumstance the command runs under the current uid and
33732 gid.
33733 </para>
33734 <para>
33735 <indexterm role="option">
33736 <primary><option>current_directory</option></primary>
33737 </indexterm>
33738 </para>
33739 <informaltable frame="all">
33740 <tgroup cols="4" colsep="0" rowsep="0">
33741 <colspec colwidth="8*" align="left"/>
33742 <colspec colwidth="6*" align="center"/>
33743 <colspec colwidth="6*" align="center"/>
33744 <colspec colwidth="6*" align="right"/>
33745 <tbody>
33746 <row>
33747 <entry><option>current_directory</option></entry>
33748 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33749 <entry>Type: <emphasis>string</emphasis></entry>
33750 <entry>Default: <emphasis>/</emphasis></entry>
33751 </row>
33752 </tbody>
33753 </tgroup>
33754 </informaltable>
33755 <para>
33756 This option specifies an absolute path which is made the current directory
33757 before running the command.
33758 </para>
33759 <para>
33760 <indexterm role="option">
33761 <primary><option>timeout</option></primary>
33762 </indexterm>
33763 </para>
33764 <informaltable frame="all">
33765 <tgroup cols="4" colsep="0" rowsep="0">
33766 <colspec colwidth="8*" align="left"/>
33767 <colspec colwidth="6*" align="center"/>
33768 <colspec colwidth="6*" align="center"/>
33769 <colspec colwidth="6*" align="right"/>
33770 <tbody>
33771 <row>
33772 <entry><option>timeout</option></entry>
33773 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33774 <entry>Type: <emphasis>time</emphasis></entry>
33775 <entry>Default: <emphasis>1h</emphasis></entry>
33776 </row>
33777 </tbody>
33778 </tgroup>
33779 </informaltable>
33780 <para>
33781 If the command does not complete within the timeout period, its process group
33782 is killed and the message is frozen. A value of zero time specifies no
33783 timeout.
33784 </para>
33785 <para>
33786 The standard output of the command is connected to a pipe, which is read when
33787 the command terminates. It should consist of a single line of output,
33788 containing up to five fields, separated by white space. The maximum length of
33789 the line is 1023 characters. Longer lines are silently truncated. The first
33790 field is one of the following words (case-insensitive):
33791 </para>
33792 <itemizedlist>
33793 <listitem>
33794 <para>
33795 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
33796 below).
33797 </para>
33798 </listitem>
33799 <listitem>
33800 <para>
33801 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
33802 <option>no_more</option> is set.
33803 </para>
33804 </listitem>
33805 <listitem>
33806 <para>
33807 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
33808 subsequent text on the line is an error message. If the router is run as part
33809 of address verification during an incoming SMTP message, the message is
33810 included in the SMTP response.
33811 </para>
33812 </listitem>
33813 <listitem>
33814 <para>
33815 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
33816 subsequent text on the line is an error message which is logged. It is not
33817 included in any SMTP response.
33818 </para>
33819 </listitem>
33820 <listitem>
33821 <para>
33822 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
33823 </para>
33824 </listitem>
33825 <listitem>
33826 <para>
33827 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
33828 <option>pass_router</option>), overriding <option>no_more</option>.
33829 </para>
33830 </listitem>
33831 <listitem>
33832 <para>
33833 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
33834 new addresses, which are routed independently, starting with the first router,
33835 or the router specified by <option>redirect_router</option>, if set.
33836 </para>
33837 </listitem>
33838 </itemizedlist>
33839 <para>
33840 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
33841 number of keyed data values, as follows (split into two lines here, to fit on
33842 the page):
33843 </para>
33844 <literallayout class="monospaced">
33845 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
33846 LOOKUP=byname|bydns DATA=&lt;text&gt;
33847 </literallayout>
33848 <para>
33849 The data items can be given in any order, and all are optional. If no transport
33850 is included, the transport specified by the generic <option>transport</option> option is
33851 used. The list of hosts and the lookup type are needed only if the transport is
33852 an <command>smtp</command> transport that does not itself supply a list of hosts.
33853 </para>
33854 <para>
33855 The format of the list of hosts is the same as for the <command>manualroute</command> router.
33856 As well as host names and IP addresses with optional port numbers, as described
33857 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
33858 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
33859 (see section <xref linkend="SECThostshowused"/>).
33860 </para>
33861 <para>
33862 If the lookup type is not specified, Exim behaves as follows when trying to
33863 find an IP address for each host: First, a DNS lookup is done. If this yields
33864 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
33865 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
33866 result of the lookup is the result of that call.
33867 </para>
33868 <para>
33869 <indexterm role="variable">
33870 <primary><varname>$address_data</varname></primary>
33871 </indexterm>
33872 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
33873 variable. For example, this return line
33874 </para>
33875 <literallayout class="monospaced">
33876 accept hosts=x1.y.example:x2.y.example data="rule1"
33877 </literallayout>
33878 <para>
33879 routes the address to the default transport, passing a list of two hosts. When
33880 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
33881 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
33882 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
33883 </para>
33884 </chapter>
33885
33886 <chapter id="CHAPredirect">
33887 <title>The redirect router</title>
33888 <para>
33889 <indexterm role="concept" id="IIDredrou1" class="startofrange">
33890 <primary><command>redirect</command> router</primary>
33891 </indexterm>
33892 <indexterm role="concept" id="IIDredrou2" class="startofrange">
33893 <primary>routers</primary>
33894 <secondary><command>redirect</command></secondary>
33895 </indexterm>
33896 <indexterm role="concept">
33897 <primary>alias file</primary>
33898 <secondary>in a <command>redirect</command> router</secondary>
33899 </indexterm>
33900 <indexterm role="concept">
33901 <primary>address redirection</primary>
33902 <secondary><command>redirect</command> router</secondary>
33903 </indexterm>
33904 The <command>redirect</command> router handles several kinds of address redirection. Its most
33905 common uses are for resolving local part aliases from a central alias file
33906 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
33907 files, but it has many other potential uses. The incoming address can be
33908 redirected in several different ways:
33909 </para>
33910 <itemizedlist>
33911 <listitem>
33912 <para>
33913 It can be replaced by one or more new addresses which are themselves routed
33914 independently.
33915 </para>
33916 </listitem>
33917 <listitem>
33918 <para>
33919 It can be routed to be delivered to a given file or directory.
33920 </para>
33921 </listitem>
33922 <listitem>
33923 <para>
33924 It can be routed to be delivered to a specified pipe command.
33925 </para>
33926 </listitem>
33927 <listitem>
33928 <para>
33929 It can cause an automatic reply to be generated.
33930 </para>
33931 </listitem>
33932 <listitem>
33933 <para>
33934 It can be forced to fail, optionally with a custom error message.
33935 </para>
33936 </listitem>
33937 <listitem>
33938 <para>
33939 It can be temporarily deferred, optionally with a custom message.
33940 </para>
33941 </listitem>
33942 <listitem>
33943 <para>
33944 It can be discarded.
33945 </para>
33946 </listitem>
33947 </itemizedlist>
33948 <para>
33949 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
33950 However, there are some private options which define transports for delivery to
33951 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
33952 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
33953 </para>
33954 <section id="SECID124">
33955 <title>Redirection data</title>
33956 <para>
33957 The router operates by interpreting a text string which it obtains either by
33958 expanding the contents of the <option>data</option> option, or by reading the entire
33959 contents of a file whose name is given in the <option>file</option> option. These two
33960 options are mutually exclusive. The first is commonly used for handling system
33961 aliases, in a configuration like this:
33962 </para>
33963 <literallayout class="monospaced">
33964 system_aliases:
33965   driver = redirect
33966   data = ${lookup{$local_part}lsearch{/etc/aliases}}
33967 </literallayout>
33968 <para>
33969 If the lookup fails, the expanded string in this example is empty. When the
33970 expansion of <option>data</option> results in an empty string, the router declines. A forced
33971 expansion failure also causes the router to decline; other expansion failures
33972 cause delivery to be deferred.
33973 </para>
33974 <para>
33975 A configuration using <option>file</option> is commonly used for handling users&#x2019;
33976 <filename>.forward</filename> files, like this:
33977 </para>
33978 <literallayout class="monospaced">
33979 userforward:
33980   driver = redirect
33981   check_local_user
33982   file = $home/.forward
33983   no_verify
33984 </literallayout>
33985 <para>
33986 If the file does not exist, or causes no action to be taken (for example, it is
33987 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
33988 is not the case when the file contains syntactically valid items that happen to
33989 yield empty addresses, for example, items containing only RFC 2822 address
33990 comments.
33991 </para>
33992 </section>
33993 <section id="SECID125">
33994 <title>Forward files and address verification</title>
33995 <para>
33996 <indexterm role="concept">
33997 <primary>address redirection</primary>
33998 <secondary>while verifying</secondary>
33999 </indexterm>
34000 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
34001 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
34002 </para>
34003 <itemizedlist>
34004 <listitem>
34005 <para>
34006 When Exim is receiving an incoming SMTP message from a remote host, it is
34007 running under the Exim uid, not as root. Exim is unable to change uid to read
34008 the file as the user, and it may not be able to read it as the Exim user. So in
34009 practice the router may not be able to operate.
34010 </para>
34011 </listitem>
34012 <listitem>
34013 <para>
34014 However, even when the router can operate, the existence of a <filename>.forward</filename> file
34015 is unimportant when verifying an address. What should be checked is whether the
34016 local part is a valid user name or not. Cutting out the redirection processing
34017 saves some resources.
34018 </para>
34019 </listitem>
34020 </itemizedlist>
34021 </section>
34022 <section id="SECID126">
34023 <title>Interpreting redirection data</title>
34024 <para>
34025 <indexterm role="concept">
34026 <primary>Sieve filter</primary>
34027 <secondary>specifying in redirection data</secondary>
34028 </indexterm>
34029 <indexterm role="concept">
34030 <primary>filter</primary>
34031 <secondary>specifying in redirection data</secondary>
34032 </indexterm>
34033 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
34034 can be interpreted in two different ways:
34035 </para>
34036 <itemizedlist>
34037 <listitem>
34038 <para>
34039 If the <option>allow_filter</option> option is set true, and the data begins with the text
34040 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
34041 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
34042 respectively. Details of the syntax and semantics of filter files are described
34043 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
34044 document is intended for use by end users.
34045 </para>
34046 </listitem>
34047 <listitem>
34048 <para>
34049 Otherwise, the data must be a comma-separated list of redirection items, as
34050 described in the next section.
34051 </para>
34052 </listitem>
34053 </itemizedlist>
34054 <para>
34055 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
34056 in a non-filter redirection list must always be an absolute path. A filter may
34057 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
34058 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
34059 for the <command>appendfile</command> transport.
34060 </para>
34061 </section>
34062 <section id="SECTitenonfilred">
34063 <title>Items in a non-filter redirection list</title>
34064 <para>
34065 <indexterm role="concept">
34066 <primary>address redirection</primary>
34067 <secondary>non-filter list items</secondary>
34068 </indexterm>
34069 When the redirection data is not an Exim or Sieve filter, for example, if it
34070 comes from a conventional alias or forward file, it consists of a list of
34071 addresses, file names, pipe commands, or certain special items (see section
34072 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
34073 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
34074 depending on their default values. The items in the list are separated by
34075 commas or newlines.
34076 If a comma is required in an item, the entire item must be enclosed in double
34077 quotes.
34078 </para>
34079 <para>
34080 Lines starting with a # character are comments, and are ignored, and # may
34081 also appear following a comma, in which case everything between the # and the
34082 next newline character is ignored.
34083 </para>
34084 <para>
34085 If an item is entirely enclosed in double quotes, these are removed. Otherwise
34086 double quotes are retained because some forms of mail address require their use
34087 (but never to enclose the entire address). In the following description,
34088 <quote>item</quote> refers to what remains after any surrounding double quotes have been
34089 removed.
34090 </para>
34091 <para>
34092 <indexterm role="variable">
34093 <primary><varname>$local_part</varname></primary>
34094 </indexterm>
34095 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
34096 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
34097 of the <option>quote_local_part</option> expansion operator, in case the local part contains
34098 special characters. For example, to redirect all mail for the domain
34099 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
34100 setting:
34101 </para>
34102 <literallayout class="monospaced">
34103 data = ${quote_local_part:$local_part}@newdomain.example
34104 </literallayout>
34105 </section>
34106 <section id="SECTredlocmai">
34107 <title>Redirecting to a local mailbox</title>
34108 <para>
34109 <indexterm role="concept">
34110 <primary>routing</primary>
34111 <secondary>loops in</secondary>
34112 </indexterm>
34113 <indexterm role="concept">
34114 <primary>loop</primary>
34115 <secondary>while routing, avoidance of</secondary>
34116 </indexterm>
34117 <indexterm role="concept">
34118 <primary>address redirection</primary>
34119 <secondary>to local mailbox</secondary>
34120 </indexterm>
34121 A redirection item may safely be the same as the address currently under
34122 consideration. This does not cause a routing loop, because a router is
34123 automatically skipped if any ancestor of the address that is being processed
34124 is the same as the current address and was processed by the current router.
34125 Such an address is therefore passed to the following routers, so it is handled
34126 as if there were no redirection. When making this loop-avoidance test, the
34127 complete local part, including any prefix or suffix, is used.
34128 </para>
34129 <para>
34130 <indexterm role="concept">
34131 <primary>address redirection</primary>
34132 <secondary>local part without domain</secondary>
34133 </indexterm>
34134 Specifying the same local part without a domain is a common usage in personal
34135 filter files when the user wants to have messages delivered to the local
34136 mailbox and also forwarded elsewhere. For example, the user whose login is
34137 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
34138 </para>
34139 <literallayout class="monospaced">
34140 cleo, cleopatra@egypt.example
34141 </literallayout>
34142 <para>
34143 <indexterm role="concept">
34144 <primary>backslash in alias file</primary>
34145 </indexterm>
34146 <indexterm role="concept">
34147 <primary>alias file</primary>
34148 <secondary>backslash in</secondary>
34149 </indexterm>
34150 For compatibility with other MTAs, such unqualified local parts may be
34151 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
34152 it does make a difference if more than one domain is being handled
34153 synonymously.
34154 </para>
34155 <para>
34156 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
34157 2822 address that does not include a domain, the item is qualified using the
34158 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
34159 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
34160 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
34161 </para>
34162 <para>
34163 Care must be taken if there are alias names for local users.
34164 Consider an MTA handling a single local domain where the system alias file
34165 contains:
34166 </para>
34167 <literallayout class="monospaced">
34168 Sam.Reman: spqr
34169 </literallayout>
34170 <para>
34171 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
34172 messages in the local mailbox, and also forward copies elsewhere. He creates
34173 this forward file:
34174 </para>
34175 <literallayout class="monospaced">
34176 Sam.Reman, spqr@reme.elsewhere.example
34177 </literallayout>
34178 <para>
34179 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
34180 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
34181 second time round, because it has previously routed it,
34182 and the following routers presumably cannot handle the alias. The forward file
34183 should really contain
34184 </para>
34185 <literallayout class="monospaced">
34186 spqr, spqr@reme.elsewhere.example
34187 </literallayout>
34188 <para>
34189 but because this is such a common error, the <option>check_ancestor</option> option (see
34190 below) exists to provide a way to get round it. This is normally set on a
34191 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
34192 </para>
34193 </section>
34194 <section id="SECTspecitredli">
34195 <title>Special items in redirection lists</title>
34196 <para>
34197 In addition to addresses, the following types of item may appear in redirection
34198 lists (that is, in non-filter redirection data):
34199 </para>
34200 <itemizedlist>
34201 <listitem>
34202 <para>
34203 <indexterm role="concept">
34204 <primary>pipe</primary>
34205 <secondary>in redirection list</secondary>
34206 </indexterm>
34207 <indexterm role="concept">
34208 <primary>address redirection</primary>
34209 <secondary>to pipe</secondary>
34210 </indexterm>
34211 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
34212 as a valid RFC 2822 address that includes a domain. A transport for running the
34213 command must be specified by the <option>pipe_transport</option> option.
34214 Normally, either the router or the transport specifies a user and a group under
34215 which to run the delivery. The default is to use the Exim user and group.
34216 </para>
34217 <para>
34218 Single or double quotes can be used for enclosing the individual arguments of
34219 the pipe command; no interpretation of escapes is done for single quotes. If
34220 the command contains a comma character, it is necessary to put the whole item
34221 in double quotes, for example:
34222 </para>
34223 <literallayout class="monospaced">
34224 "|/some/command ready,steady,go"
34225 </literallayout>
34226 <para>
34227 since items in redirection lists are terminated by commas. Do not, however,
34228 quote just the command. An item such as
34229 </para>
34230 <literallayout class="monospaced">
34231 |"/some/command ready,steady,go"
34232 </literallayout>
34233 <para>
34234 is interpreted as a pipe with a rather strange command name, and no arguments.
34235 </para>
34236 </listitem>
34237 <listitem>
34238 <para>
34239 <indexterm role="concept">
34240 <primary>file</primary>
34241 <secondary>in redirection list</secondary>
34242 </indexterm>
34243 <indexterm role="concept">
34244 <primary>address redirection</primary>
34245 <secondary>to file</secondary>
34246 </indexterm>
34247 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
34248 parse as a valid RFC 2822 address that includes a domain. For example,
34249 </para>
34250 <literallayout class="monospaced">
34251 /home/world/minbari
34252 </literallayout>
34253 <para>
34254 is treated as a file name, but
34255 </para>
34256 <literallayout class="monospaced">
34257 /s=molari/o=babylon/@x400gate.way
34258 </literallayout>
34259 <para>
34260 is treated as an address. For a file name, a transport must be specified using
34261 the <option>file_transport</option> option. However, if the generated path name ends with a
34262 forward slash character, it is interpreted as a directory name rather than a
34263 file name, and <option>directory_transport</option> is used instead.
34264 </para>
34265 <para>
34266 Normally, either the router or the transport specifies a user and a group under
34267 which to run the delivery. The default is to use the Exim user and group.
34268 </para>
34269 <para>
34270 <indexterm role="concept">
34271 <primary><filename>/dev/null</filename></primary>
34272 </indexterm>
34273 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
34274 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
34275 instead of a transport name. In this case the user and group are not used.
34276 </para>
34277 </listitem>
34278 <listitem>
34279 <para>
34280 <indexterm role="concept">
34281 <primary>included address list</primary>
34282 </indexterm>
34283 <indexterm role="concept">
34284 <primary>address redirection</primary>
34285 <secondary>included external list</secondary>
34286 </indexterm>
34287 If an item is of the form
34288 </para>
34289 <literallayout class="monospaced">
34290 :include:&lt;path name&gt;
34291 </literallayout>
34292 <para>
34293 a list of further items is taken from the given file and included at that
34294 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
34295 out-of-line addition to the list. The items in the included list are separated
34296 by commas or newlines and are not subject to expansion. If this is the first
34297 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
34298 the alias name. This example is incorrect:
34299 </para>
34300 <literallayout class="monospaced">
34301 list1    :include:/opt/lists/list1
34302 </literallayout>
34303 <para>
34304 It must be given as
34305 </para>
34306 <literallayout class="monospaced">
34307 list1:   :include:/opt/lists/list1
34308 </literallayout>
34309 </listitem>
34310 <listitem>
34311 <para>
34312 <indexterm role="concept">
34313 <primary>address redirection</primary>
34314 <secondary>to black hole</secondary>
34315 </indexterm>
34316 Sometimes you want to throw away mail to a particular local part. Making the
34317 <option>data</option> option expand to an empty string does not work, because that causes
34318 the router to decline. Instead, the alias item
34319 <indexterm role="concept">
34320 <primary>black hole</primary>
34321 </indexterm>
34322 <indexterm role="concept">
34323 <primary>abandoning mail</primary>
34324 </indexterm>
34325 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
34326 done, and no error message is generated. This has the same effect as specifing
34327 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
34328 </para>
34329 <para>
34330 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
34331 delivery is done for the original local part, even if other redirection items
34332 are present. If you are generating a multi-item list (for example, by reading a
34333 database) and need the ability to provide a no-op item, you must use
34334 <filename>/dev/null</filename>.
34335 </para>
34336 </listitem>
34337 <listitem>
34338 <para>
34339 <indexterm role="concept">
34340 <primary>delivery</primary>
34341 <secondary>forcing failure</secondary>
34342 </indexterm>
34343 <indexterm role="concept">
34344 <primary>delivery</primary>
34345 <secondary>forcing deferral</secondary>
34346 </indexterm>
34347 <indexterm role="concept">
34348 <primary>failing delivery</primary>
34349 <secondary>forcing</secondary>
34350 </indexterm>
34351 <indexterm role="concept">
34352 <primary>deferred delivery, forcing</primary>
34353 </indexterm>
34354 <indexterm role="concept">
34355 <primary>customizing</primary>
34356 <secondary>failure message</secondary>
34357 </indexterm>
34358 An attempt to deliver a particular address can be deferred or forced to fail by
34359 redirection items of the form
34360 </para>
34361 <literallayout class="monospaced">
34362 :defer:
34363 :fail:
34364 </literallayout>
34365 <para>
34366 respectively. When a redirection list contains such an item, it applies
34367 to the entire redirection; any other items in the list are ignored. Any
34368 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
34369 associated with the failure. For example, an alias file might contain:
34370 </para>
34371 <literallayout class="monospaced">
34372 X.Employee:  :fail: Gone away, no forwarding address
34373 </literallayout>
34374 <para>
34375 In the case of an address that is being verified from an ACL or as the subject
34376 of a
34377 <indexterm role="concept">
34378 <primary>VRFY</primary>
34379 <secondary>error text, display of</secondary>
34380 </indexterm>
34381 VRFY command, the text is included in the SMTP error response by
34382 default.
34383 <indexterm role="concept">
34384 <primary>EXPN</primary>
34385 <secondary>error text, display of</secondary>
34386 </indexterm>
34387 The text is not included in the response to an EXPN command. In non-SMTP cases
34388 the text is included in the error message that Exim generates.
34389 </para>
34390 <para>
34391 <indexterm role="concept">
34392 <primary>SMTP</primary>
34393 <secondary>error codes</secondary>
34394 </indexterm>
34395 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
34396 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
34397 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
34398 followed by a space, and the very first digit is the same as the default error
34399 code, the code from the message is used instead. If the very first digit is
34400 incorrect, a panic error is logged, and the default code is used. You can
34401 suppress the use of the supplied code in a redirect router by setting the
34402 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
34403 ignored.
34404 </para>
34405 <para>
34406 <indexterm role="variable">
34407 <primary><varname>$acl_verify_message</varname></primary>
34408 </indexterm>
34409 In an ACL, an explicitly provided message overrides the default, but the
34410 default message is available in the variable <varname>$acl_verify_message</varname> and can
34411 therefore be included in a custom message if this is desired.
34412 </para>
34413 <para>
34414 Normally the error text is the rest of the redirection list &ndash; a comma does
34415 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
34416 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
34417 as part of the continuation process, but they may exist in other kinds of
34418 lookup and in <emphasis>:include:</emphasis> files.
34419 </para>
34420 <para>
34421 During routing for message delivery (as opposed to verification), a redirection
34422 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
34423 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
34424 subsequent delivery attempt can happen at a later time. If an address is
34425 deferred for too long, it will ultimately fail, because the normal retry
34426 rules still apply.
34427 </para>
34428 </listitem>
34429 <listitem>
34430 <para>
34431 <indexterm role="concept">
34432 <primary>alias file</primary>
34433 <secondary>exception to default</secondary>
34434 </indexterm>
34435 Sometimes it is useful to use a single-key search type with a default (see
34436 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
34437 for exceptions to the default. These can be handled by aliasing them to
34438 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
34439 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
34440 results in an empty redirection list has the same effect.
34441 </para>
34442 </listitem>
34443 </itemizedlist>
34444 </section>
34445 <section id="SECTdupaddr">
34446 <title>Duplicate addresses</title>
34447 <para>
34448 <indexterm role="concept">
34449 <primary>duplicate addresses</primary>
34450 </indexterm>
34451 <indexterm role="concept">
34452 <primary>address duplicate, discarding</primary>
34453 </indexterm>
34454 <indexterm role="concept">
34455 <primary>pipe</primary>
34456 <secondary>duplicated</secondary>
34457 </indexterm>
34458 Exim removes duplicate addresses from the list to which it is delivering, so as
34459 to deliver just one copy to each address. This does not apply to deliveries
34460 routed to pipes by different immediate parent addresses, but an indirect
34461 aliasing scheme of the type
34462 </para>
34463 <literallayout class="monospaced">
34464 pipe:       |/some/command $local_part
34465 localpart1: pipe
34466 localpart2: pipe
34467 </literallayout>
34468 <para>
34469 does not work with a message that is addressed to both local parts, because
34470 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
34471 discarded as being the same as a previously handled address. However, a scheme
34472 such as
34473 </para>
34474 <literallayout class="monospaced">
34475 localpart1: |/some/command $local_part
34476 localpart2: |/some/command $local_part
34477 </literallayout>
34478 <para>
34479 does result in two different pipe deliveries, because the immediate parents of
34480 the pipes are distinct.
34481 </para>
34482 </section>
34483 <section id="SECID128">
34484 <title>Repeated redirection expansion</title>
34485 <para>
34486 <indexterm role="concept">
34487 <primary>repeated redirection expansion</primary>
34488 </indexterm>
34489 <indexterm role="concept">
34490 <primary>address redirection</primary>
34491 <secondary>repeated for each delivery attempt</secondary>
34492 </indexterm>
34493 When a message cannot be delivered to all of its recipients immediately,
34494 leading to two or more delivery attempts, redirection expansion is carried out
34495 afresh each time for those addresses whose children were not all previously
34496 delivered. If redirection is being used as a mailing list, this can lead to new
34497 members of the list receiving copies of old messages. The <option>one_time</option> option
34498 can be used to avoid this.
34499 </para>
34500 </section>
34501 <section id="SECID129">
34502 <title>Errors in redirection lists</title>
34503 <para>
34504 <indexterm role="concept">
34505 <primary>address redirection</primary>
34506 <secondary>errors</secondary>
34507 </indexterm>
34508 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
34509 error is skipped, and an entry is written to the main log. This may be useful
34510 for mailing lists that are automatically managed. Otherwise, if an error is
34511 detected while generating the list of new addresses, the original address is
34512 deferred. See also <option>syntax_errors_to</option>.
34513 </para>
34514 </section>
34515 <section id="SECID130">
34516 <title>Private options for the redirect router</title>
34517 <para>
34518 <indexterm role="concept">
34519 <primary>options</primary>
34520 <secondary><command>redirect</command> router</secondary>
34521 </indexterm>
34522 The private options for the <command>redirect</command> router are as follows:
34523 </para>
34524 <para>
34525 <indexterm role="option">
34526 <primary><option>allow_defer</option></primary>
34527 </indexterm>
34528 </para>
34529 <informaltable frame="all">
34530 <tgroup cols="4" colsep="0" rowsep="0">
34531 <colspec colwidth="8*" align="left"/>
34532 <colspec colwidth="6*" align="center"/>
34533 <colspec colwidth="6*" align="center"/>
34534 <colspec colwidth="6*" align="right"/>
34535 <tbody>
34536 <row>
34537 <entry><option>allow_defer</option></entry>
34538 <entry>Use: <emphasis>redirect</emphasis></entry>
34539 <entry>Type: <emphasis>boolean</emphasis></entry>
34540 <entry>Default: <emphasis>false</emphasis></entry>
34541 </row>
34542 </tbody>
34543 </tgroup>
34544 </informaltable>
34545 <para>
34546 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
34547 data, or the <option>defer</option> command in an Exim filter file.
34548 </para>
34549 <para>
34550 <indexterm role="option">
34551 <primary><option>allow_fail</option></primary>
34552 </indexterm>
34553 </para>
34554 <informaltable frame="all">
34555 <tgroup cols="4" colsep="0" rowsep="0">
34556 <colspec colwidth="8*" align="left"/>
34557 <colspec colwidth="6*" align="center"/>
34558 <colspec colwidth="6*" align="center"/>
34559 <colspec colwidth="6*" align="right"/>
34560 <tbody>
34561 <row>
34562 <entry><option>allow_fail</option></entry>
34563 <entry>Use: <emphasis>redirect</emphasis></entry>
34564 <entry>Type: <emphasis>boolean</emphasis></entry>
34565 <entry>Default: <emphasis>false</emphasis></entry>
34566 </row>
34567 </tbody>
34568 </tgroup>
34569 </informaltable>
34570 <para>
34571 <indexterm role="concept">
34572 <primary>failing delivery</primary>
34573 <secondary>from filter</secondary>
34574 </indexterm>
34575 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
34576 and the <option>fail</option> command may be used in an Exim filter file.
34577 </para>
34578 <para>
34579 <indexterm role="option">
34580 <primary><option>allow_filter</option></primary>
34581 </indexterm>
34582 </para>
34583 <informaltable frame="all">
34584 <tgroup cols="4" colsep="0" rowsep="0">
34585 <colspec colwidth="8*" align="left"/>
34586 <colspec colwidth="6*" align="center"/>
34587 <colspec colwidth="6*" align="center"/>
34588 <colspec colwidth="6*" align="right"/>
34589 <tbody>
34590 <row>
34591 <entry><option>allow_filter</option></entry>
34592 <entry>Use: <emphasis>redirect</emphasis></entry>
34593 <entry>Type: <emphasis>boolean</emphasis></entry>
34594 <entry>Default: <emphasis>false</emphasis></entry>
34595 </row>
34596 </tbody>
34597 </tgroup>
34598 </informaltable>
34599 <para>
34600 <indexterm role="concept">
34601 <primary>filter</primary>
34602 <secondary>enabling use of</secondary>
34603 </indexterm>
34604 <indexterm role="concept">
34605 <primary>Sieve filter</primary>
34606 <secondary>enabling use of</secondary>
34607 </indexterm>
34608 Setting this option allows Exim to interpret redirection data that starts with
34609 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
34610 are some features of Exim filter files that some administrators may wish to
34611 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
34612 </para>
34613 <para>
34614 It is also possible to lock out Exim filters or Sieve filters while allowing
34615 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
34616 </para>
34617 <para>
34618 The filter is run using the uid and gid set by the generic <option>user</option> and
34619 <option>group</option> options. These take their defaults from the password data if
34620 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
34621 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
34622 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
34623 </para>
34624 <para>
34625 <indexterm role="option">
34626 <primary><option>allow_freeze</option></primary>
34627 </indexterm>
34628 </para>
34629 <informaltable frame="all">
34630 <tgroup cols="4" colsep="0" rowsep="0">
34631 <colspec colwidth="8*" align="left"/>
34632 <colspec colwidth="6*" align="center"/>
34633 <colspec colwidth="6*" align="center"/>
34634 <colspec colwidth="6*" align="right"/>
34635 <tbody>
34636 <row>
34637 <entry><option>allow_freeze</option></entry>
34638 <entry>Use: <emphasis>redirect</emphasis></entry>
34639 <entry>Type: <emphasis>boolean</emphasis></entry>
34640 <entry>Default: <emphasis>false</emphasis></entry>
34641 </row>
34642 </tbody>
34643 </tgroup>
34644 </informaltable>
34645 <para>
34646 <indexterm role="concept">
34647 <primary>freezing messages</primary>
34648 <secondary>allowing in filter</secondary>
34649 </indexterm>
34650 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
34651 This command is more normally encountered in system filters, and is disabled by
34652 default for redirection filters because it isn&#x2019;t something you usually want to
34653 let ordinary users do.
34654 </para>
34655 <para>
34656 <indexterm role="option">
34657 <primary><option>check_ancestor</option></primary>
34658 </indexterm>
34659 </para>
34660 <informaltable frame="all">
34661 <tgroup cols="4" colsep="0" rowsep="0">
34662 <colspec colwidth="8*" align="left"/>
34663 <colspec colwidth="6*" align="center"/>
34664 <colspec colwidth="6*" align="center"/>
34665 <colspec colwidth="6*" align="right"/>
34666 <tbody>
34667 <row>
34668 <entry><option>check_ancestor</option></entry>
34669 <entry>Use: <emphasis>redirect</emphasis></entry>
34670 <entry>Type: <emphasis>boolean</emphasis></entry>
34671 <entry>Default: <emphasis>false</emphasis></entry>
34672 </row>
34673 </tbody>
34674 </tgroup>
34675 </informaltable>
34676 <para>
34677 This option is concerned with handling generated addresses that are the same
34678 as some address in the list of redirection ancestors of the current address.
34679 Although it is turned off by default in the code, it is set in the default
34680 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
34681 for this use of the <command>redirect</command> router.
34682 </para>
34683 <para>
34684 When <option>check_ancestor</option> is set, if a generated address (including the domain)
34685 is the same as any ancestor of the current address, it is replaced by a copy of
34686 the current address. This helps in the case where local part A is aliased to B,
34687 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
34688 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
34689 <filename>&nbsp;jb/.forward</filename> contains:
34690 </para>
34691 <literallayout class="monospaced">
34692 \Joe.Bloggs, &lt;other item(s)&gt;
34693 </literallayout>
34694 <para>
34695 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
34696 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
34697 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
34698 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
34699 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
34700 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
34701 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
34702 original address. See also the <option>repeat_use</option> option below.
34703 </para>
34704 <para>
34705 <indexterm role="option">
34706 <primary><option>check_group</option></primary>
34707 </indexterm>
34708 </para>
34709 <informaltable frame="all">
34710 <tgroup cols="4" colsep="0" rowsep="0">
34711 <colspec colwidth="8*" align="left"/>
34712 <colspec colwidth="6*" align="center"/>
34713 <colspec colwidth="6*" align="center"/>
34714 <colspec colwidth="6*" align="right"/>
34715 <tbody>
34716 <row>
34717 <entry><option>check_group</option></entry>
34718 <entry>Use: <emphasis>redirect</emphasis></entry>
34719 <entry>Type: <emphasis>boolean</emphasis></entry>
34720 <entry>Default: <emphasis>see below</emphasis></entry>
34721 </row>
34722 </tbody>
34723 </tgroup>
34724 </informaltable>
34725 <para>
34726 When the <option>file</option> option is used, the group owner of the file is checked only
34727 when this option is set. The permitted groups are those listed in the
34728 <option>owngroups</option> option, together with the user&#x2019;s default group if
34729 <option>check_local_user</option> is set. If the file has the wrong group, routing is
34730 deferred. The default setting for this option is true if <option>check_local_user</option>
34731 is set and the <option>modemask</option> option permits the group write bit, or if the
34732 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
34733 </para>
34734 <para>
34735 <indexterm role="option">
34736 <primary><option>check_owner</option></primary>
34737 </indexterm>
34738 </para>
34739 <informaltable frame="all">
34740 <tgroup cols="4" colsep="0" rowsep="0">
34741 <colspec colwidth="8*" align="left"/>
34742 <colspec colwidth="6*" align="center"/>
34743 <colspec colwidth="6*" align="center"/>
34744 <colspec colwidth="6*" align="right"/>
34745 <tbody>
34746 <row>
34747 <entry><option>check_owner</option></entry>
34748 <entry>Use: <emphasis>redirect</emphasis></entry>
34749 <entry>Type: <emphasis>boolean</emphasis></entry>
34750 <entry>Default: <emphasis>see below</emphasis></entry>
34751 </row>
34752 </tbody>
34753 </tgroup>
34754 </informaltable>
34755 <para>
34756 When the <option>file</option> option is used, the owner of the file is checked only when
34757 this option is set. If <option>check_local_user</option> is set, the local user is
34758 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
34759 option. The default value for this option is true if <option>check_local_user</option> or
34760 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
34761 </para>
34762 <para>
34763 <indexterm role="option">
34764 <primary><option>data</option></primary>
34765 </indexterm>
34766 </para>
34767 <informaltable frame="all">
34768 <tgroup cols="4" colsep="0" rowsep="0">
34769 <colspec colwidth="8*" align="left"/>
34770 <colspec colwidth="6*" align="center"/>
34771 <colspec colwidth="6*" align="center"/>
34772 <colspec colwidth="6*" align="right"/>
34773 <tbody>
34774 <row>
34775 <entry><option>data</option></entry>
34776 <entry>Use: <emphasis>redirect</emphasis></entry>
34777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34778 <entry>Default: <emphasis>unset</emphasis></entry>
34779 </row>
34780 </tbody>
34781 </tgroup>
34782 </informaltable>
34783 <para>
34784 This option is mutually exclusive with <option>file</option>. One or other of them must be
34785 set, but not both. The contents of <option>data</option> are expanded, and then used as the
34786 list of forwarding items, or as a set of filtering instructions. If the
34787 expansion is forced to fail, or the result is an empty string or a string that
34788 has no effect (consists entirely of comments), the router declines.
34789 </para>
34790 <para>
34791 When filtering instructions are used, the string must begin with <quote>#Exim
34792 filter</quote>, and all comments in the string, including this initial one, must be
34793 terminated with newline characters. For example:
34794 </para>
34795 <literallayout class="monospaced">
34796 data = #Exim filter\n\
34797        if $h_to: contains Exim then save $home/mail/exim endif
34798 </literallayout>
34799 <para>
34800 If you are reading the data from a database where newlines cannot be included,
34801 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
34802 choice into a newline.
34803 </para>
34804 <para>
34805 <indexterm role="option">
34806 <primary><option>directory_transport</option></primary>
34807 </indexterm>
34808 </para>
34809 <informaltable frame="all">
34810 <tgroup cols="4" colsep="0" rowsep="0">
34811 <colspec colwidth="8*" align="left"/>
34812 <colspec colwidth="6*" align="center"/>
34813 <colspec colwidth="6*" align="center"/>
34814 <colspec colwidth="6*" align="right"/>
34815 <tbody>
34816 <row>
34817 <entry><option>directory_transport</option></entry>
34818 <entry>Use: <emphasis>redirect</emphasis></entry>
34819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34820 <entry>Default: <emphasis>unset</emphasis></entry>
34821 </row>
34822 </tbody>
34823 </tgroup>
34824 </informaltable>
34825 <para>
34826 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
34827 ending with a slash is specified as a new <quote>address</quote>. The transport used is
34828 specified by this option, which, after expansion, must be the name of a
34829 configured transport. This should normally be an <command>appendfile</command> transport.
34830 </para>
34831 <para>
34832 <indexterm role="option">
34833 <primary><option>file</option></primary>
34834 </indexterm>
34835 </para>
34836 <informaltable frame="all">
34837 <tgroup cols="4" colsep="0" rowsep="0">
34838 <colspec colwidth="8*" align="left"/>
34839 <colspec colwidth="6*" align="center"/>
34840 <colspec colwidth="6*" align="center"/>
34841 <colspec colwidth="6*" align="right"/>
34842 <tbody>
34843 <row>
34844 <entry><option>file</option></entry>
34845 <entry>Use: <emphasis>redirect</emphasis></entry>
34846 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34847 <entry>Default: <emphasis>unset</emphasis></entry>
34848 </row>
34849 </tbody>
34850 </tgroup>
34851 </informaltable>
34852 <para>
34853 This option specifies the name of a file that contains the redirection data. It
34854 is mutually exclusive with the <option>data</option> option. The string is expanded before
34855 use; if the expansion is forced to fail, the router declines. Other expansion
34856 failures cause delivery to be deferred. The result of a successful expansion
34857 must be an absolute path. The entire file is read and used as the redirection
34858 data. If the data is an empty string or a string that has no effect (consists
34859 entirely of comments), the router declines.
34860 </para>
34861 <para>
34862 <indexterm role="concept">
34863 <primary>NFS</primary>
34864 <secondary>checking for file existence</secondary>
34865 </indexterm>
34866 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
34867 runs a check on the containing directory,
34868 unless <option>ignore_enotdir</option> is true (see below).
34869 If the directory does not appear to exist, delivery is deferred. This can
34870 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
34871 is a mount problem. If the containing directory does exist, but the file does
34872 not, the router declines.
34873 </para>
34874 <para>
34875 <indexterm role="option">
34876 <primary><option>file_transport</option></primary>
34877 </indexterm>
34878 </para>
34879 <informaltable frame="all">
34880 <tgroup cols="4" colsep="0" rowsep="0">
34881 <colspec colwidth="8*" align="left"/>
34882 <colspec colwidth="6*" align="center"/>
34883 <colspec colwidth="6*" align="center"/>
34884 <colspec colwidth="6*" align="right"/>
34885 <tbody>
34886 <row>
34887 <entry><option>file_transport</option></entry>
34888 <entry>Use: <emphasis>redirect</emphasis></entry>
34889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34890 <entry>Default: <emphasis>unset</emphasis></entry>
34891 </row>
34892 </tbody>
34893 </tgroup>
34894 </informaltable>
34895 <para>
34896 <indexterm role="variable">
34897 <primary><varname>$address_file</varname></primary>
34898 </indexterm>
34899 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
34900 ending in a slash is specified as a new <quote>address</quote>. The transport used is
34901 specified by this option, which, after expansion, must be the name of a
34902 configured transport. This should normally be an <command>appendfile</command> transport. When
34903 it is running, the file name is in <varname>$address_file</varname>.
34904 </para>
34905 <para>
34906 <indexterm role="option">
34907 <primary><option>filter_prepend_home</option></primary>
34908 </indexterm>
34909 </para>
34910 <informaltable frame="all">
34911 <tgroup cols="4" colsep="0" rowsep="0">
34912 <colspec colwidth="8*" align="left"/>
34913 <colspec colwidth="6*" align="center"/>
34914 <colspec colwidth="6*" align="center"/>
34915 <colspec colwidth="6*" align="right"/>
34916 <tbody>
34917 <row>
34918 <entry><option>filter_prepend_home</option></entry>
34919 <entry>Use: <emphasis>redirect</emphasis></entry>
34920 <entry>Type: <emphasis>boolean</emphasis></entry>
34921 <entry>Default: <emphasis>true</emphasis></entry>
34922 </row>
34923 </tbody>
34924 </tgroup>
34925 </informaltable>
34926 <para>
34927 When this option is true, if a <command>save</command> command in an Exim filter specifies a
34928 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
34929 relative path. If this option is set false, this action does not happen. The
34930 relative path is then passed to the transport unmodified.
34931 </para>
34932 <para>
34933 <indexterm role="option">
34934 <primary><option>forbid_blackhole</option></primary>
34935 </indexterm>
34936 </para>
34937 <informaltable frame="all">
34938 <tgroup cols="4" colsep="0" rowsep="0">
34939 <colspec colwidth="8*" align="left"/>
34940 <colspec colwidth="6*" align="center"/>
34941 <colspec colwidth="6*" align="center"/>
34942 <colspec colwidth="6*" align="right"/>
34943 <tbody>
34944 <row>
34945 <entry><option>forbid_blackhole</option></entry>
34946 <entry>Use: <emphasis>redirect</emphasis></entry>
34947 <entry>Type: <emphasis>boolean</emphasis></entry>
34948 <entry>Default: <emphasis>false</emphasis></entry>
34949 </row>
34950 </tbody>
34951 </tgroup>
34952 </informaltable>
34953 <para>
34954 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
34955 redirection list.
34956 </para>
34957 <para>
34958 <indexterm role="option">
34959 <primary><option>forbid_exim_filter</option></primary>
34960 </indexterm>
34961 </para>
34962 <informaltable frame="all">
34963 <tgroup cols="4" colsep="0" rowsep="0">
34964 <colspec colwidth="8*" align="left"/>
34965 <colspec colwidth="6*" align="center"/>
34966 <colspec colwidth="6*" align="center"/>
34967 <colspec colwidth="6*" align="right"/>
34968 <tbody>
34969 <row>
34970 <entry><option>forbid_exim_filter</option></entry>
34971 <entry>Use: <emphasis>redirect</emphasis></entry>
34972 <entry>Type: <emphasis>boolean</emphasis></entry>
34973 <entry>Default: <emphasis>false</emphasis></entry>
34974 </row>
34975 </tbody>
34976 </tgroup>
34977 </informaltable>
34978 <para>
34979 If this option is set true, only Sieve filters are permitted when
34980 <option>allow_filter</option> is true.
34981 </para>
34982 <para>
34983 <indexterm role="option">
34984 <primary><option>forbid_file</option></primary>
34985 </indexterm>
34986 </para>
34987 <informaltable frame="all">
34988 <tgroup cols="4" colsep="0" rowsep="0">
34989 <colspec colwidth="8*" align="left"/>
34990 <colspec colwidth="6*" align="center"/>
34991 <colspec colwidth="6*" align="center"/>
34992 <colspec colwidth="6*" align="right"/>
34993 <tbody>
34994 <row>
34995 <entry><option>forbid_file</option></entry>
34996 <entry>Use: <emphasis>redirect</emphasis></entry>
34997 <entry>Type: <emphasis>boolean</emphasis></entry>
34998 <entry>Default: <emphasis>false</emphasis></entry>
34999 </row>
35000 </tbody>
35001 </tgroup>
35002 </informaltable>
35003 <para>
35004 <indexterm role="concept">
35005 <primary>delivery</primary>
35006 <secondary>to file; forbidding</secondary>
35007 </indexterm>
35008 <indexterm role="concept">
35009 <primary>Sieve filter</primary>
35010 <secondary>forbidding delivery to a file</secondary>
35011 </indexterm>
35012 <indexterm role="concept">
35013 <primary>Sieve filter</primary>
35014 <secondary><quote>keep</quote> facility; disabling</secondary>
35015 </indexterm>
35016 If this option is true, this router may not generate a new address that
35017 specifies delivery to a local file or directory, either from a filter or from a
35018 conventional forward file. This option is forced to be true if <option>one_time</option> is
35019 set. It applies to Sieve filters as well as to Exim filters, but if true, it
35020 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
35021 </para>
35022 <para>
35023 <indexterm role="option">
35024 <primary><option>forbid_filter_dlfunc</option></primary>
35025 </indexterm>
35026 </para>
35027 <informaltable frame="all">
35028 <tgroup cols="4" colsep="0" rowsep="0">
35029 <colspec colwidth="8*" align="left"/>
35030 <colspec colwidth="6*" align="center"/>
35031 <colspec colwidth="6*" align="center"/>
35032 <colspec colwidth="6*" align="right"/>
35033 <tbody>
35034 <row>
35035 <entry><option>forbid_filter_dlfunc</option></entry>
35036 <entry>Use: <emphasis>redirect</emphasis></entry>
35037 <entry>Type: <emphasis>boolean</emphasis></entry>
35038 <entry>Default: <emphasis>false</emphasis></entry>
35039 </row>
35040 </tbody>
35041 </tgroup>
35042 </informaltable>
35043 <para>
35044 <indexterm role="concept">
35045 <primary>filter</primary>
35046 <secondary>locking out certain features</secondary>
35047 </indexterm>
35048 If this option is true, string expansions in Exim filters are not allowed to
35049 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
35050 functions.
35051 </para>
35052 <para>
35053 <indexterm role="option">
35054 <primary><option>forbid_filter_existstest</option></primary>
35055 </indexterm>
35056 </para>
35057 <informaltable frame="all">
35058 <tgroup cols="4" colsep="0" rowsep="0">
35059 <colspec colwidth="8*" align="left"/>
35060 <colspec colwidth="6*" align="center"/>
35061 <colspec colwidth="6*" align="center"/>
35062 <colspec colwidth="6*" align="right"/>
35063 <tbody>
35064 <row>
35065 <entry><option>forbid_filter_existstest</option></entry>
35066 <entry>Use: <emphasis>redirect</emphasis></entry>
35067 <entry>Type: <emphasis>boolean</emphasis></entry>
35068 <entry>Default: <emphasis>false</emphasis></entry>
35069 </row>
35070 </tbody>
35071 </tgroup>
35072 </informaltable>
35073 <para>
35074 <indexterm role="concept">
35075 <primary>expansion</primary>
35076 <secondary>statting a file</secondary>
35077 </indexterm>
35078 If this option is true, string expansions in Exim filters are not allowed to
35079 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
35080 </para>
35081 <para>
35082 <indexterm role="option">
35083 <primary><option>forbid_filter_logwrite</option></primary>
35084 </indexterm>
35085 </para>
35086 <informaltable frame="all">
35087 <tgroup cols="4" colsep="0" rowsep="0">
35088 <colspec colwidth="8*" align="left"/>
35089 <colspec colwidth="6*" align="center"/>
35090 <colspec colwidth="6*" align="center"/>
35091 <colspec colwidth="6*" align="right"/>
35092 <tbody>
35093 <row>
35094 <entry><option>forbid_filter_logwrite</option></entry>
35095 <entry>Use: <emphasis>redirect</emphasis></entry>
35096 <entry>Type: <emphasis>boolean</emphasis></entry>
35097 <entry>Default: <emphasis>false</emphasis></entry>
35098 </row>
35099 </tbody>
35100 </tgroup>
35101 </informaltable>
35102 <para>
35103 If this option is true, use of the logging facility in Exim filters is not
35104 permitted. Logging is in any case available only if the filter is being run
35105 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
35106 <filename>.forward</filename> files).
35107 </para>
35108 <para>
35109 <indexterm role="option">
35110 <primary><option>forbid_filter_lookup</option></primary>
35111 </indexterm>
35112 </para>
35113 <informaltable frame="all">
35114 <tgroup cols="4" colsep="0" rowsep="0">
35115 <colspec colwidth="8*" align="left"/>
35116 <colspec colwidth="6*" align="center"/>
35117 <colspec colwidth="6*" align="center"/>
35118 <colspec colwidth="6*" align="right"/>
35119 <tbody>
35120 <row>
35121 <entry><option>forbid_filter_lookup</option></entry>
35122 <entry>Use: <emphasis>redirect</emphasis></entry>
35123 <entry>Type: <emphasis>boolean</emphasis></entry>
35124 <entry>Default: <emphasis>false</emphasis></entry>
35125 </row>
35126 </tbody>
35127 </tgroup>
35128 </informaltable>
35129 <para>
35130 If this option is true, string expansions in Exim filter files are not allowed
35131 to make use of <option>lookup</option> items.
35132 </para>
35133 <para>
35134 <indexterm role="option">
35135 <primary><option>forbid_filter_perl</option></primary>
35136 </indexterm>
35137 </para>
35138 <informaltable frame="all">
35139 <tgroup cols="4" colsep="0" rowsep="0">
35140 <colspec colwidth="8*" align="left"/>
35141 <colspec colwidth="6*" align="center"/>
35142 <colspec colwidth="6*" align="center"/>
35143 <colspec colwidth="6*" align="right"/>
35144 <tbody>
35145 <row>
35146 <entry><option>forbid_filter_perl</option></entry>
35147 <entry>Use: <emphasis>redirect</emphasis></entry>
35148 <entry>Type: <emphasis>boolean</emphasis></entry>
35149 <entry>Default: <emphasis>false</emphasis></entry>
35150 </row>
35151 </tbody>
35152 </tgroup>
35153 </informaltable>
35154 <para>
35155 This option has an effect only if Exim is built with embedded Perl support. If
35156 it is true, string expansions in Exim filter files are not allowed to make use
35157 of the embedded Perl support.
35158 </para>
35159 <para>
35160 <indexterm role="option">
35161 <primary><option>forbid_filter_readfile</option></primary>
35162 </indexterm>
35163 </para>
35164 <informaltable frame="all">
35165 <tgroup cols="4" colsep="0" rowsep="0">
35166 <colspec colwidth="8*" align="left"/>
35167 <colspec colwidth="6*" align="center"/>
35168 <colspec colwidth="6*" align="center"/>
35169 <colspec colwidth="6*" align="right"/>
35170 <tbody>
35171 <row>
35172 <entry><option>forbid_filter_readfile</option></entry>
35173 <entry>Use: <emphasis>redirect</emphasis></entry>
35174 <entry>Type: <emphasis>boolean</emphasis></entry>
35175 <entry>Default: <emphasis>false</emphasis></entry>
35176 </row>
35177 </tbody>
35178 </tgroup>
35179 </informaltable>
35180 <para>
35181 If this option is true, string expansions in Exim filter files are not allowed
35182 to make use of <option>readfile</option> items.
35183 </para>
35184 <para>
35185 <indexterm role="option">
35186 <primary><option>forbid_filter_readsocket</option></primary>
35187 </indexterm>
35188 </para>
35189 <informaltable frame="all">
35190 <tgroup cols="4" colsep="0" rowsep="0">
35191 <colspec colwidth="8*" align="left"/>
35192 <colspec colwidth="6*" align="center"/>
35193 <colspec colwidth="6*" align="center"/>
35194 <colspec colwidth="6*" align="right"/>
35195 <tbody>
35196 <row>
35197 <entry><option>forbid_filter_readsocket</option></entry>
35198 <entry>Use: <emphasis>redirect</emphasis></entry>
35199 <entry>Type: <emphasis>boolean</emphasis></entry>
35200 <entry>Default: <emphasis>false</emphasis></entry>
35201 </row>
35202 </tbody>
35203 </tgroup>
35204 </informaltable>
35205 <para>
35206 If this option is true, string expansions in Exim filter files are not allowed
35207 to make use of <option>readsocket</option> items.
35208 </para>
35209 <para>
35210 <indexterm role="option">
35211 <primary><option>forbid_filter_reply</option></primary>
35212 </indexterm>
35213 </para>
35214 <informaltable frame="all">
35215 <tgroup cols="4" colsep="0" rowsep="0">
35216 <colspec colwidth="8*" align="left"/>
35217 <colspec colwidth="6*" align="center"/>
35218 <colspec colwidth="6*" align="center"/>
35219 <colspec colwidth="6*" align="right"/>
35220 <tbody>
35221 <row>
35222 <entry><option>forbid_filter_reply</option></entry>
35223 <entry>Use: <emphasis>redirect</emphasis></entry>
35224 <entry>Type: <emphasis>boolean</emphasis></entry>
35225 <entry>Default: <emphasis>false</emphasis></entry>
35226 </row>
35227 </tbody>
35228 </tgroup>
35229 </informaltable>
35230 <para>
35231 If this option is true, this router may not generate an automatic reply
35232 message. Automatic replies can be generated only from Exim or Sieve filter
35233 files, not from traditional forward files. This option is forced to be true if
35234 <option>one_time</option> is set.
35235 </para>
35236 <para>
35237 <indexterm role="option">
35238 <primary><option>forbid_filter_run</option></primary>
35239 </indexterm>
35240 </para>
35241 <informaltable frame="all">
35242 <tgroup cols="4" colsep="0" rowsep="0">
35243 <colspec colwidth="8*" align="left"/>
35244 <colspec colwidth="6*" align="center"/>
35245 <colspec colwidth="6*" align="center"/>
35246 <colspec colwidth="6*" align="right"/>
35247 <tbody>
35248 <row>
35249 <entry><option>forbid_filter_run</option></entry>
35250 <entry>Use: <emphasis>redirect</emphasis></entry>
35251 <entry>Type: <emphasis>boolean</emphasis></entry>
35252 <entry>Default: <emphasis>false</emphasis></entry>
35253 </row>
35254 </tbody>
35255 </tgroup>
35256 </informaltable>
35257 <para>
35258 If this option is true, string expansions in Exim filter files are not allowed
35259 to make use of <option>run</option> items.
35260 </para>
35261 <para>
35262 <indexterm role="option">
35263 <primary><option>forbid_include</option></primary>
35264 </indexterm>
35265 </para>
35266 <informaltable frame="all">
35267 <tgroup cols="4" colsep="0" rowsep="0">
35268 <colspec colwidth="8*" align="left"/>
35269 <colspec colwidth="6*" align="center"/>
35270 <colspec colwidth="6*" align="center"/>
35271 <colspec colwidth="6*" align="right"/>
35272 <tbody>
35273 <row>
35274 <entry><option>forbid_include</option></entry>
35275 <entry>Use: <emphasis>redirect</emphasis></entry>
35276 <entry>Type: <emphasis>boolean</emphasis></entry>
35277 <entry>Default: <emphasis>false</emphasis></entry>
35278 </row>
35279 </tbody>
35280 </tgroup>
35281 </informaltable>
35282 <para>
35283 If this option is true, items of the form
35284 </para>
35285 <literallayout class="monospaced">
35286 :include:&lt;path name&gt;
35287 </literallayout>
35288 <para>
35289 are not permitted in non-filter redirection lists.
35290 </para>
35291 <para>
35292 <indexterm role="option">
35293 <primary><option>forbid_pipe</option></primary>
35294 </indexterm>
35295 </para>
35296 <informaltable frame="all">
35297 <tgroup cols="4" colsep="0" rowsep="0">
35298 <colspec colwidth="8*" align="left"/>
35299 <colspec colwidth="6*" align="center"/>
35300 <colspec colwidth="6*" align="center"/>
35301 <colspec colwidth="6*" align="right"/>
35302 <tbody>
35303 <row>
35304 <entry><option>forbid_pipe</option></entry>
35305 <entry>Use: <emphasis>redirect</emphasis></entry>
35306 <entry>Type: <emphasis>boolean</emphasis></entry>
35307 <entry>Default: <emphasis>false</emphasis></entry>
35308 </row>
35309 </tbody>
35310 </tgroup>
35311 </informaltable>
35312 <para>
35313 <indexterm role="concept">
35314 <primary>delivery</primary>
35315 <secondary>to pipe; forbidding</secondary>
35316 </indexterm>
35317 If this option is true, this router may not generate a new address which
35318 specifies delivery to a pipe, either from an Exim filter or from a conventional
35319 forward file. This option is forced to be true if <option>one_time</option> is set.
35320 </para>
35321 <para>
35322 <indexterm role="option">
35323 <primary><option>forbid_sieve_filter</option></primary>
35324 </indexterm>
35325 </para>
35326 <informaltable frame="all">
35327 <tgroup cols="4" colsep="0" rowsep="0">
35328 <colspec colwidth="8*" align="left"/>
35329 <colspec colwidth="6*" align="center"/>
35330 <colspec colwidth="6*" align="center"/>
35331 <colspec colwidth="6*" align="right"/>
35332 <tbody>
35333 <row>
35334 <entry><option>forbid_sieve_filter</option></entry>
35335 <entry>Use: <emphasis>redirect</emphasis></entry>
35336 <entry>Type: <emphasis>boolean</emphasis></entry>
35337 <entry>Default: <emphasis>false</emphasis></entry>
35338 </row>
35339 </tbody>
35340 </tgroup>
35341 </informaltable>
35342 <para>
35343 If this option is set true, only Exim filters are permitted when
35344 <option>allow_filter</option> is true.
35345 </para>
35346 <para>
35347 <indexterm role="concept">
35348 <primary>SMTP</primary>
35349 <secondary>error codes</secondary>
35350 </indexterm>
35351 <indexterm role="option">
35352 <primary><option>forbid_smtp_code</option></primary>
35353 </indexterm>
35354 </para>
35355 <informaltable frame="all">
35356 <tgroup cols="4" colsep="0" rowsep="0">
35357 <colspec colwidth="8*" align="left"/>
35358 <colspec colwidth="6*" align="center"/>
35359 <colspec colwidth="6*" align="center"/>
35360 <colspec colwidth="6*" align="right"/>
35361 <tbody>
35362 <row>
35363 <entry><option>forbid_smtp_code</option></entry>
35364 <entry>Use: <emphasis>redirect</emphasis></entry>
35365 <entry>Type: <emphasis>boolean</emphasis></entry>
35366 <entry>Default: <emphasis>false</emphasis></entry>
35367 </row>
35368 </tbody>
35369 </tgroup>
35370 </informaltable>
35371 <para>
35372 If this option is set true, any SMTP error codes that are present at the start
35373 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
35374 the default codes (451 and 550, respectively) are always used.
35375 </para>
35376 <para>
35377 <indexterm role="option">
35378 <primary><option>hide_child_in_errmsg</option></primary>
35379 </indexterm>
35380 </para>
35381 <informaltable frame="all">
35382 <tgroup cols="4" colsep="0" rowsep="0">
35383 <colspec colwidth="8*" align="left"/>
35384 <colspec colwidth="6*" align="center"/>
35385 <colspec colwidth="6*" align="center"/>
35386 <colspec colwidth="6*" align="right"/>
35387 <tbody>
35388 <row>
35389 <entry><option>hide_child_in_errmsg</option></entry>
35390 <entry>Use: <emphasis>redirect</emphasis></entry>
35391 <entry>Type: <emphasis>boolean</emphasis></entry>
35392 <entry>Default: <emphasis>false</emphasis></entry>
35393 </row>
35394 </tbody>
35395 </tgroup>
35396 </informaltable>
35397 <para>
35398 <indexterm role="concept">
35399 <primary>bounce message</primary>
35400 <secondary>redirection details; suppressing</secondary>
35401 </indexterm>
35402 If this option is true, it prevents Exim from quoting a child address if it
35403 generates a bounce or delay message for it. Instead it says <quote>an address
35404 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
35405 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
35406 bounce may well quote the generated address.
35407 </para>
35408 <para>
35409 <indexterm role="option">
35410 <primary><option>ignore_eacces</option></primary>
35411 </indexterm>
35412 </para>
35413 <informaltable frame="all">
35414 <tgroup cols="4" colsep="0" rowsep="0">
35415 <colspec colwidth="8*" align="left"/>
35416 <colspec colwidth="6*" align="center"/>
35417 <colspec colwidth="6*" align="center"/>
35418 <colspec colwidth="6*" align="right"/>
35419 <tbody>
35420 <row>
35421 <entry><option>ignore_eacces</option></entry>
35422 <entry>Use: <emphasis>redirect</emphasis></entry>
35423 <entry>Type: <emphasis>boolean</emphasis></entry>
35424 <entry>Default: <emphasis>false</emphasis></entry>
35425 </row>
35426 </tbody>
35427 </tgroup>
35428 </informaltable>
35429 <para>
35430 <indexterm role="concept">
35431 <primary>EACCES</primary>
35432 </indexterm>
35433 If this option is set and an attempt to open a redirection file yields the
35434 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
35435 file did not exist.
35436 </para>
35437 <para>
35438 <indexterm role="option">
35439 <primary><option>ignore_enotdir</option></primary>
35440 </indexterm>
35441 </para>
35442 <informaltable frame="all">
35443 <tgroup cols="4" colsep="0" rowsep="0">
35444 <colspec colwidth="8*" align="left"/>
35445 <colspec colwidth="6*" align="center"/>
35446 <colspec colwidth="6*" align="center"/>
35447 <colspec colwidth="6*" align="right"/>
35448 <tbody>
35449 <row>
35450 <entry><option>ignore_enotdir</option></entry>
35451 <entry>Use: <emphasis>redirect</emphasis></entry>
35452 <entry>Type: <emphasis>boolean</emphasis></entry>
35453 <entry>Default: <emphasis>false</emphasis></entry>
35454 </row>
35455 </tbody>
35456 </tgroup>
35457 </informaltable>
35458 <para>
35459 <indexterm role="concept">
35460 <primary>ENOTDIR</primary>
35461 </indexterm>
35462 If this option is set and an attempt to open a redirection file yields the
35463 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
35464 router behaves as if the file did not exist.
35465 </para>
35466 <para>
35467 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
35468 router that has the <option>file</option> option set discovers that the file does not exist
35469 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
35470 against unmounted NFS directories. If the parent can not be statted, delivery
35471 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
35472 is set, because that option tells Exim to ignore <quote>something on the path is not
35473 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
35474 that some operating systems give ENOENT where others give ENOTDIR.
35475 </para>
35476 <para>
35477 <indexterm role="option">
35478 <primary><option>include_directory</option></primary>
35479 </indexterm>
35480 </para>
35481 <informaltable frame="all">
35482 <tgroup cols="4" colsep="0" rowsep="0">
35483 <colspec colwidth="8*" align="left"/>
35484 <colspec colwidth="6*" align="center"/>
35485 <colspec colwidth="6*" align="center"/>
35486 <colspec colwidth="6*" align="right"/>
35487 <tbody>
35488 <row>
35489 <entry><option>include_directory</option></entry>
35490 <entry>Use: <emphasis>redirect</emphasis></entry>
35491 <entry>Type: <emphasis>string</emphasis></entry>
35492 <entry>Default: <emphasis>unset</emphasis></entry>
35493 </row>
35494 </tbody>
35495 </tgroup>
35496 </informaltable>
35497 <para>
35498 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
35499 redirection list must start with this directory.
35500 </para>
35501 <para>
35502 <indexterm role="option">
35503 <primary><option>modemask</option></primary>
35504 </indexterm>
35505 </para>
35506 <informaltable frame="all">
35507 <tgroup cols="4" colsep="0" rowsep="0">
35508 <colspec colwidth="8*" align="left"/>
35509 <colspec colwidth="6*" align="center"/>
35510 <colspec colwidth="6*" align="center"/>
35511 <colspec colwidth="6*" align="right"/>
35512 <tbody>
35513 <row>
35514 <entry><option>modemask</option></entry>
35515 <entry>Use: <emphasis>redirect</emphasis></entry>
35516 <entry>Type: <emphasis>octal integer</emphasis></entry>
35517 <entry>Default: <emphasis>022</emphasis></entry>
35518 </row>
35519 </tbody>
35520 </tgroup>
35521 </informaltable>
35522 <para>
35523 This specifies mode bits which must not be set for a file specified by the
35524 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
35525 </para>
35526 <para>
35527 <indexterm role="option">
35528 <primary><option>one_time</option></primary>
35529 </indexterm>
35530 </para>
35531 <informaltable frame="all">
35532 <tgroup cols="4" colsep="0" rowsep="0">
35533 <colspec colwidth="8*" align="left"/>
35534 <colspec colwidth="6*" align="center"/>
35535 <colspec colwidth="6*" align="center"/>
35536 <colspec colwidth="6*" align="right"/>
35537 <tbody>
35538 <row>
35539 <entry><option>one_time</option></entry>
35540 <entry>Use: <emphasis>redirect</emphasis></entry>
35541 <entry>Type: <emphasis>boolean</emphasis></entry>
35542 <entry>Default: <emphasis>false</emphasis></entry>
35543 </row>
35544 </tbody>
35545 </tgroup>
35546 </informaltable>
35547 <para>
35548 <indexterm role="concept">
35549 <primary>one-time aliasing/forwarding expansion</primary>
35550 </indexterm>
35551 <indexterm role="concept">
35552 <primary>alias file</primary>
35553 <secondary>one-time expansion</secondary>
35554 </indexterm>
35555 <indexterm role="concept">
35556 <primary>forward file</primary>
35557 <secondary>one-time expansion</secondary>
35558 </indexterm>
35559 <indexterm role="concept">
35560 <primary>mailing lists</primary>
35561 <secondary>one-time expansion</secondary>
35562 </indexterm>
35563 <indexterm role="concept">
35564 <primary>address redirection</primary>
35565 <secondary>one-time expansion</secondary>
35566 </indexterm>
35567 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
35568 files each time it tries to deliver a message causes a problem when one or more
35569 of the generated addresses fails be delivered at the first attempt. The problem
35570 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
35571 but of what happens when the redirection list changes during the time that the
35572 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
35573 lists, where new subscribers might receive copies of messages that were posted
35574 before they subscribed.
35575 </para>
35576 <para>
35577 If <option>one_time</option> is set and any addresses generated by the router fail to
35578 deliver at the first attempt, the failing addresses are added to the message as
35579 <quote>top level</quote> addresses, and the parent address that generated them is marked
35580 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
35581 attempt.
35582 </para>
35583 <para>
35584 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
35585 router would be lost if delivery did not succeed at the first attempt. For this
35586 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
35587 permitted when <option>one_time</option> is set.
35588 </para>
35589 <para>
35590 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
35591 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
35592 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
35593 </para>
35594 <para>
35595 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
35596 <option>one_time</option>.
35597 </para>
35598 <para>
35599 The original top-level address is remembered with each of the generated
35600 addresses, and is output in any log messages. However, any intermediate parent
35601 addresses are not recorded. This makes a difference to the log only if
35602 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
35603 typically be used for mailing lists, where there is normally just one level of
35604 expansion.
35605 </para>
35606 <para>
35607 <indexterm role="option">
35608 <primary><option>owners</option></primary>
35609 </indexterm>
35610 </para>
35611 <informaltable frame="all">
35612 <tgroup cols="4" colsep="0" rowsep="0">
35613 <colspec colwidth="8*" align="left"/>
35614 <colspec colwidth="6*" align="center"/>
35615 <colspec colwidth="6*" align="center"/>
35616 <colspec colwidth="6*" align="right"/>
35617 <tbody>
35618 <row>
35619 <entry><option>owners</option></entry>
35620 <entry>Use: <emphasis>redirect</emphasis></entry>
35621 <entry>Type: <emphasis>string list</emphasis></entry>
35622 <entry>Default: <emphasis>unset</emphasis></entry>
35623 </row>
35624 </tbody>
35625 </tgroup>
35626 </informaltable>
35627 <para>
35628 <indexterm role="concept">
35629 <primary>ownership</primary>
35630 <secondary>alias file</secondary>
35631 </indexterm>
35632 <indexterm role="concept">
35633 <primary>ownership</primary>
35634 <secondary>forward file</secondary>
35635 </indexterm>
35636 <indexterm role="concept">
35637 <primary>alias file</primary>
35638 <secondary>ownership</secondary>
35639 </indexterm>
35640 <indexterm role="concept">
35641 <primary>forward file</primary>
35642 <secondary>ownership</secondary>
35643 </indexterm>
35644 This specifies a list of permitted owners for the file specified by <option>file</option>.
35645 This list is in addition to the local user when <option>check_local_user</option> is set.
35646 See <option>check_owner</option> above.
35647 </para>
35648 <para>
35649 <indexterm role="option">
35650 <primary><option>owngroups</option></primary>
35651 </indexterm>
35652 </para>
35653 <informaltable frame="all">
35654 <tgroup cols="4" colsep="0" rowsep="0">
35655 <colspec colwidth="8*" align="left"/>
35656 <colspec colwidth="6*" align="center"/>
35657 <colspec colwidth="6*" align="center"/>
35658 <colspec colwidth="6*" align="right"/>
35659 <tbody>
35660 <row>
35661 <entry><option>owngroups</option></entry>
35662 <entry>Use: <emphasis>redirect</emphasis></entry>
35663 <entry>Type: <emphasis>string list</emphasis></entry>
35664 <entry>Default: <emphasis>unset</emphasis></entry>
35665 </row>
35666 </tbody>
35667 </tgroup>
35668 </informaltable>
35669 <para>
35670 This specifies a list of permitted groups for the file specified by <option>file</option>.
35671 The list is in addition to the local user&#x2019;s primary group when
35672 <option>check_local_user</option> is set. See <option>check_group</option> above.
35673 </para>
35674 <para>
35675 <indexterm role="option">
35676 <primary><option>pipe_transport</option></primary>
35677 </indexterm>
35678 </para>
35679 <informaltable frame="all">
35680 <tgroup cols="4" colsep="0" rowsep="0">
35681 <colspec colwidth="8*" align="left"/>
35682 <colspec colwidth="6*" align="center"/>
35683 <colspec colwidth="6*" align="center"/>
35684 <colspec colwidth="6*" align="right"/>
35685 <tbody>
35686 <row>
35687 <entry><option>pipe_transport</option></entry>
35688 <entry>Use: <emphasis>redirect</emphasis></entry>
35689 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35690 <entry>Default: <emphasis>unset</emphasis></entry>
35691 </row>
35692 </tbody>
35693 </tgroup>
35694 </informaltable>
35695 <para>
35696 <indexterm role="variable">
35697 <primary><varname>$address_pipe</varname></primary>
35698 </indexterm>
35699 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
35700 starting with a vertical bar character is specified as a new <quote>address</quote>. The
35701 transport used is specified by this option, which, after expansion, must be the
35702 name of a configured transport. This should normally be a <command>pipe</command> transport.
35703 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
35704 </para>
35705 <para>
35706 <indexterm role="option">
35707 <primary><option>qualify_domain</option></primary>
35708 </indexterm>
35709 </para>
35710 <informaltable frame="all">
35711 <tgroup cols="4" colsep="0" rowsep="0">
35712 <colspec colwidth="8*" align="left"/>
35713 <colspec colwidth="6*" align="center"/>
35714 <colspec colwidth="6*" align="center"/>
35715 <colspec colwidth="6*" align="right"/>
35716 <tbody>
35717 <row>
35718 <entry><option>qualify_domain</option></entry>
35719 <entry>Use: <emphasis>redirect</emphasis></entry>
35720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35721 <entry>Default: <emphasis>unset</emphasis></entry>
35722 </row>
35723 </tbody>
35724 </tgroup>
35725 </informaltable>
35726 <para>
35727 <indexterm role="variable">
35728 <primary><varname>$qualify_recipient</varname></primary>
35729 </indexterm>
35730 If this option is set, and an unqualified address (one without a domain) is
35731 generated, and that address would normally be qualified by the global setting
35732 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
35733 expanding this string. If the expansion fails, the router declines. If you want
35734 to revert to the default, you can have the expansion generate
35735 <varname>$qualify_recipient</varname>.
35736 </para>
35737 <para>
35738 This option applies to all unqualified addresses generated by Exim filters,
35739 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
35740 not preceded by a backslash. Sieve filters cannot generate unqualified
35741 addresses.
35742 </para>
35743 <para>
35744 <indexterm role="option">
35745 <primary><option>qualify_preserve_domain</option></primary>
35746 </indexterm>
35747 </para>
35748 <informaltable frame="all">
35749 <tgroup cols="4" colsep="0" rowsep="0">
35750 <colspec colwidth="8*" align="left"/>
35751 <colspec colwidth="6*" align="center"/>
35752 <colspec colwidth="6*" align="center"/>
35753 <colspec colwidth="6*" align="right"/>
35754 <tbody>
35755 <row>
35756 <entry><option>qualify_preserve_domain</option></entry>
35757 <entry>Use: <emphasis>redirect</emphasis></entry>
35758 <entry>Type: <emphasis>boolean</emphasis></entry>
35759 <entry>Default: <emphasis>false</emphasis></entry>
35760 </row>
35761 </tbody>
35762 </tgroup>
35763 </informaltable>
35764 <para>
35765 <indexterm role="concept">
35766 <primary>domain</primary>
35767 <secondary>in redirection; preserving</secondary>
35768 </indexterm>
35769 <indexterm role="concept">
35770 <primary>preserving domain in redirection</primary>
35771 </indexterm>
35772 <indexterm role="concept">
35773 <primary>address redirection</primary>
35774 <secondary>domain; preserving</secondary>
35775 </indexterm>
35776 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
35777 set (a configuration error occurs if it is). If an unqualified address (one
35778 without a domain) is generated, it is qualified with the domain of the parent
35779 address (the immediately preceding ancestor) instead of the global
35780 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
35781 this applies whether or not the address is preceded by a backslash.
35782 </para>
35783 <para>
35784 <indexterm role="option">
35785 <primary><option>repeat_use</option></primary>
35786 </indexterm>
35787 </para>
35788 <informaltable frame="all">
35789 <tgroup cols="4" colsep="0" rowsep="0">
35790 <colspec colwidth="8*" align="left"/>
35791 <colspec colwidth="6*" align="center"/>
35792 <colspec colwidth="6*" align="center"/>
35793 <colspec colwidth="6*" align="right"/>
35794 <tbody>
35795 <row>
35796 <entry><option>repeat_use</option></entry>
35797 <entry>Use: <emphasis>redirect</emphasis></entry>
35798 <entry>Type: <emphasis>boolean</emphasis></entry>
35799 <entry>Default: <emphasis>true</emphasis></entry>
35800 </row>
35801 </tbody>
35802 </tgroup>
35803 </informaltable>
35804 <para>
35805 If this option is set false, the router is skipped for a child address that has
35806 any ancestor that was routed by this router. This test happens before any of
35807 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
35808 only when the ancestor is the same as the current address. See also
35809 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
35810 </para>
35811 <para>
35812 <indexterm role="option">
35813 <primary><option>reply_transport</option></primary>
35814 </indexterm>
35815 </para>
35816 <informaltable frame="all">
35817 <tgroup cols="4" colsep="0" rowsep="0">
35818 <colspec colwidth="8*" align="left"/>
35819 <colspec colwidth="6*" align="center"/>
35820 <colspec colwidth="6*" align="center"/>
35821 <colspec colwidth="6*" align="right"/>
35822 <tbody>
35823 <row>
35824 <entry><option>reply_transport</option></entry>
35825 <entry>Use: <emphasis>redirect</emphasis></entry>
35826 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35827 <entry>Default: <emphasis>unset</emphasis></entry>
35828 </row>
35829 </tbody>
35830 </tgroup>
35831 </informaltable>
35832 <para>
35833 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
35834 <option>vacation</option> command is used in a filter file. The transport used is specified
35835 by this option, which, after expansion, must be the name of a configured
35836 transport. This should normally be an <command>autoreply</command> transport. Other transports
35837 are unlikely to do anything sensible or useful.
35838 </para>
35839 <para>
35840 <indexterm role="option">
35841 <primary><option>rewrite</option></primary>
35842 </indexterm>
35843 </para>
35844 <informaltable frame="all">
35845 <tgroup cols="4" colsep="0" rowsep="0">
35846 <colspec colwidth="8*" align="left"/>
35847 <colspec colwidth="6*" align="center"/>
35848 <colspec colwidth="6*" align="center"/>
35849 <colspec colwidth="6*" align="right"/>
35850 <tbody>
35851 <row>
35852 <entry><option>rewrite</option></entry>
35853 <entry>Use: <emphasis>redirect</emphasis></entry>
35854 <entry>Type: <emphasis>boolean</emphasis></entry>
35855 <entry>Default: <emphasis>true</emphasis></entry>
35856 </row>
35857 </tbody>
35858 </tgroup>
35859 </informaltable>
35860 <para>
35861 <indexterm role="concept">
35862 <primary>address redirection</primary>
35863 <secondary>disabling rewriting</secondary>
35864 </indexterm>
35865 If this option is set false, addresses generated by the router are not
35866 subject to address rewriting. Otherwise, they are treated like new addresses
35867 and are rewritten according to the global rewriting rules.
35868 </para>
35869 <para>
35870 <indexterm role="option">
35871 <primary><option>sieve_subaddress</option></primary>
35872 </indexterm>
35873 </para>
35874 <informaltable frame="all">
35875 <tgroup cols="4" colsep="0" rowsep="0">
35876 <colspec colwidth="8*" align="left"/>
35877 <colspec colwidth="6*" align="center"/>
35878 <colspec colwidth="6*" align="center"/>
35879 <colspec colwidth="6*" align="right"/>
35880 <tbody>
35881 <row>
35882 <entry><option>sieve_subaddress</option></entry>
35883 <entry>Use: <emphasis>redirect</emphasis></entry>
35884 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35885 <entry>Default: <emphasis>unset</emphasis></entry>
35886 </row>
35887 </tbody>
35888 </tgroup>
35889 </informaltable>
35890 <para>
35891 The value of this option is passed to a Sieve filter to specify the
35892 :subaddress part of an address.
35893 </para>
35894 <para>
35895 <indexterm role="option">
35896 <primary><option>sieve_useraddress</option></primary>
35897 </indexterm>
35898 </para>
35899 <informaltable frame="all">
35900 <tgroup cols="4" colsep="0" rowsep="0">
35901 <colspec colwidth="8*" align="left"/>
35902 <colspec colwidth="6*" align="center"/>
35903 <colspec colwidth="6*" align="center"/>
35904 <colspec colwidth="6*" align="right"/>
35905 <tbody>
35906 <row>
35907 <entry><option>sieve_useraddress</option></entry>
35908 <entry>Use: <emphasis>redirect</emphasis></entry>
35909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35910 <entry>Default: <emphasis>unset</emphasis></entry>
35911 </row>
35912 </tbody>
35913 </tgroup>
35914 </informaltable>
35915 <para>
35916 The value of this option is passed to a Sieve filter to specify the :user part
35917 of an address. However, if it is unset, the entire original local part
35918 (including any prefix or suffix) is used for :user.
35919 </para>
35920 <para>
35921 <indexterm role="option">
35922 <primary><option>sieve_vacation_directory</option></primary>
35923 </indexterm>
35924 </para>
35925 <informaltable frame="all">
35926 <tgroup cols="4" colsep="0" rowsep="0">
35927 <colspec colwidth="8*" align="left"/>
35928 <colspec colwidth="6*" align="center"/>
35929 <colspec colwidth="6*" align="center"/>
35930 <colspec colwidth="6*" align="right"/>
35931 <tbody>
35932 <row>
35933 <entry><option>sieve_vacation_directory</option></entry>
35934 <entry>Use: <emphasis>redirect</emphasis></entry>
35935 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35936 <entry>Default: <emphasis>unset</emphasis></entry>
35937 </row>
35938 </tbody>
35939 </tgroup>
35940 </informaltable>
35941 <para>
35942 <indexterm role="concept">
35943 <primary>Sieve filter</primary>
35944 <secondary>vacation directory</secondary>
35945 </indexterm>
35946 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
35947 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
35948 (do not put anything else in that directory), and ensure that the
35949 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
35950 needs their own directory; Exim will create it if necessary.
35951 </para>
35952 <para>
35953 <indexterm role="option">
35954 <primary><option>skip_syntax_errors</option></primary>
35955 </indexterm>
35956 </para>
35957 <informaltable frame="all">
35958 <tgroup cols="4" colsep="0" rowsep="0">
35959 <colspec colwidth="8*" align="left"/>
35960 <colspec colwidth="6*" align="center"/>
35961 <colspec colwidth="6*" align="center"/>
35962 <colspec colwidth="6*" align="right"/>
35963 <tbody>
35964 <row>
35965 <entry><option>skip_syntax_errors</option></entry>
35966 <entry>Use: <emphasis>redirect</emphasis></entry>
35967 <entry>Type: <emphasis>boolean</emphasis></entry>
35968 <entry>Default: <emphasis>false</emphasis></entry>
35969 </row>
35970 </tbody>
35971 </tgroup>
35972 </informaltable>
35973 <para>
35974 <indexterm role="concept">
35975 <primary>forward file</primary>
35976 <secondary>broken</secondary>
35977 </indexterm>
35978 <indexterm role="concept">
35979 <primary>address redirection</primary>
35980 <secondary>broken files</secondary>
35981 </indexterm>
35982 <indexterm role="concept">
35983 <primary>alias file</primary>
35984 <secondary>broken</secondary>
35985 </indexterm>
35986 <indexterm role="concept">
35987 <primary>broken alias or forward files</primary>
35988 </indexterm>
35989 <indexterm role="concept">
35990 <primary>ignoring faulty addresses</primary>
35991 </indexterm>
35992 <indexterm role="concept">
35993 <primary>skipping faulty addresses</primary>
35994 </indexterm>
35995 <indexterm role="concept">
35996 <primary>error</primary>
35997 <secondary>skipping bad syntax</secondary>
35998 </indexterm>
35999 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
36000 non-filter redirection data are skipped, and each failing address is logged. If
36001 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
36002 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
36003 are expanded and placed at the head of the error message generated by
36004 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
36005 be the same address as the generic <option>errors_to</option> option. The
36006 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
36007 </para>
36008 <para>
36009 If all the addresses in a redirection list are skipped because of syntax
36010 errors, the router declines to handle the original address, and it is passed to
36011 the following routers.
36012 </para>
36013 <para>
36014 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
36015 error in the filter causes filtering to be abandoned without any action being
36016 taken. The incident is logged, and the router declines to handle the address,
36017 so it is passed to the following routers.
36018 </para>
36019 <para>
36020 <indexterm role="concept">
36021 <primary>Sieve filter</primary>
36022 <secondary>syntax errors in</secondary>
36023 </indexterm>
36024 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
36025 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
36026 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
36027 </para>
36028 <para>
36029 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
36030 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
36031 option, used with an address that does not get redirected, can be used to
36032 notify users of these errors, by means of a router like this:
36033 </para>
36034 <literallayout class="monospaced">
36035 userforward:
36036   driver = redirect
36037   allow_filter
36038   check_local_user
36039   file = $home/.forward
36040   file_transport = address_file
36041   pipe_transport = address_pipe
36042   reply_transport = address_reply
36043   no_verify
36044   skip_syntax_errors
36045   syntax_errors_to = real-$local_part@$domain
36046   syntax_errors_text = \
36047    This is an automatically generated message. An error has\n\
36048    been found in your .forward file. Details of the error are\n\
36049    reported below. While this error persists, you will receive\n\
36050    a copy of this message for every message that is addressed\n\
36051    to you. If your .forward file is a filter file, or if it is\n\
36052    a non-filter file containing no valid forwarding addresses,\n\
36053    a copy of each incoming message will be put in your normal\n\
36054    mailbox. If a non-filter file contains at least one valid\n\
36055    forwarding address, forwarding to the valid addresses will\n\
36056    happen, and those will be the only deliveries that occur.
36057 </literallayout>
36058 <para>
36059 You also need a router to ensure that local addresses that are prefixed by
36060 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
36061 put this immediately before the <command>userforward</command> router:
36062 </para>
36063 <literallayout class="monospaced">
36064 real_localuser:
36065   driver = accept
36066   check_local_user
36067   local_part_prefix = real-
36068   transport = local_delivery
36069 </literallayout>
36070 <para>
36071 For security, it would probably be a good idea to restrict the use of this
36072 router to locally-generated messages, using a condition such as this:
36073 </para>
36074 <literallayout class="monospaced">
36075   condition = ${if match {$sender_host_address}\
36076                          {\N^(|127\.0\.0\.1)$\N}}
36077 </literallayout>
36078 <para>
36079 <indexterm role="option">
36080 <primary><option>syntax_errors_text</option></primary>
36081 </indexterm>
36082 </para>
36083 <informaltable frame="all">
36084 <tgroup cols="4" colsep="0" rowsep="0">
36085 <colspec colwidth="8*" align="left"/>
36086 <colspec colwidth="6*" align="center"/>
36087 <colspec colwidth="6*" align="center"/>
36088 <colspec colwidth="6*" align="right"/>
36089 <tbody>
36090 <row>
36091 <entry><option>syntax_errors_text</option></entry>
36092 <entry>Use: <emphasis>redirect</emphasis></entry>
36093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36094 <entry>Default: <emphasis>unset</emphasis></entry>
36095 </row>
36096 </tbody>
36097 </tgroup>
36098 </informaltable>
36099 <para>
36100 See <option>skip_syntax_errors</option> above.
36101 </para>
36102 <para>
36103 <indexterm role="option">
36104 <primary><option>syntax_errors_to</option></primary>
36105 </indexterm>
36106 </para>
36107 <informaltable frame="all">
36108 <tgroup cols="4" colsep="0" rowsep="0">
36109 <colspec colwidth="8*" align="left"/>
36110 <colspec colwidth="6*" align="center"/>
36111 <colspec colwidth="6*" align="center"/>
36112 <colspec colwidth="6*" align="right"/>
36113 <tbody>
36114 <row>
36115 <entry><option>syntax_errors_to</option></entry>
36116 <entry>Use: <emphasis>redirect</emphasis></entry>
36117 <entry>Type: <emphasis>string</emphasis></entry>
36118 <entry>Default: <emphasis>unset</emphasis></entry>
36119 </row>
36120 </tbody>
36121 </tgroup>
36122 </informaltable>
36123 <para>
36124 See <option>skip_syntax_errors</option> above.
36125 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
36126 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
36127 </para>
36128 </section>
36129 </chapter>
36130
36131 <chapter id="CHAPenvironment">
36132 <title>Environment for running local transports</title>
36133 <titleabbrev>Environment for local transports</titleabbrev>
36134 <para>
36135 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
36136 <primary>local transports</primary>
36137 <secondary>environment for</secondary>
36138 </indexterm>
36139 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
36140 <primary>environment for local transports</primary>
36141 </indexterm>
36142 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
36143 <primary>transport</primary>
36144 <secondary>local; environment for</secondary>
36145 </indexterm>
36146 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
36147 transport can be thought of as similar to a pipe.) Exim always runs transports
36148 in subprocesses, under specified uids and gids. Typical deliveries to local
36149 mailboxes run under the uid and gid of the local user.
36150 </para>
36151 <para>
36152 Exim also sets a specific current directory while running the transport; for
36153 some transports a home directory setting is also relevant. The <command>pipe</command>
36154 transport is the only one that sets up environment variables; see section
36155 <xref linkend="SECTpipeenv"/> for details.
36156 </para>
36157 <para>
36158 The values used for the uid, gid, and the directories may come from several
36159 different places. In many cases, the router that handles the address associates
36160 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
36161 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
36162 configuration, and these override anything that comes from the router.
36163 </para>
36164 <section id="SECID131">
36165 <title>Concurrent deliveries</title>
36166 <para>
36167 <indexterm role="concept">
36168 <primary>concurrent deliveries</primary>
36169 </indexterm>
36170 <indexterm role="concept">
36171 <primary>simultaneous deliveries</primary>
36172 </indexterm>
36173 If two different messages for the same local recipient arrive more or less
36174 simultaneously, the two delivery processes are likely to run concurrently. When
36175 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
36176 rules to stop concurrent processes from writing to the same file at the same
36177 time.
36178 </para>
36179 <para>
36180 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
36181 locking that is needed. Here is a silly example:
36182 </para>
36183 <literallayout class="monospaced">
36184 my_transport:
36185   driver = pipe
36186   command = /bin/sh -c 'cat &gt;&gt;/some/file'
36187 </literallayout>
36188 <para>
36189 This is supposed to write the message at the end of the file. However, if two
36190 messages arrive at the same time, the file will be scrambled. You can use the
36191 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
36192 file using the same algorithm that Exim itself uses.
36193 </para>
36194 </section>
36195 <section id="SECTenvuidgid">
36196 <title>Uids and gids</title>
36197 <para>
36198 <indexterm role="concept">
36199 <primary>local transports</primary>
36200 <secondary>uid and gid</secondary>
36201 </indexterm>
36202 <indexterm role="concept">
36203 <primary>transport</primary>
36204 <secondary>local; uid and gid</secondary>
36205 </indexterm>
36206 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
36207 overrides any group that the router set in the address, even if <option>user</option> is not
36208 set for the transport. This makes it possible, for example, to run local mail
36209 delivery under the uid of the recipient (set by the router), but in a special
36210 group (set by the transport). For example:
36211 </para>
36212 <literallayout class="monospaced">
36213 # Routers ...
36214 # User/group are set by check_local_user in this router
36215 local_users:
36216   driver = accept
36217   check_local_user
36218   transport = group_delivery
36219
36220 # Transports ...
36221 # This transport overrides the group
36222 group_delivery:
36223   driver = appendfile
36224   file = /var/spool/mail/$local_part
36225   group = mail
36226 </literallayout>
36227 <para>
36228 If <option>user</option> is set for a transport, its value overrides what is set in the
36229 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
36230 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
36231 set.
36232 </para>
36233 <para>
36234 <indexterm role="option">
36235 <primary><option>initgroups</option></primary>
36236 </indexterm>
36237 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
36238 function is called for the groups associated with that uid if the
36239 <option>initgroups</option> option is set for the transport. When the uid is not specified
36240 by the transport, but is associated with the address by a router, the option
36241 for calling <function>initgroups()</function> is taken from the router configuration.
36242 </para>
36243 <para>
36244 <indexterm role="concept">
36245 <primary><command>pipe</command> transport</primary>
36246 <secondary>uid for</secondary>
36247 </indexterm>
36248 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
36249 is set and <option>user</option> is not set, the uid of the process that called Exim to
36250 receive the message is used, and if <option>group</option> is not set, the corresponding
36251 original gid is also used.
36252 </para>
36253 <para>
36254 This is the detailed preference order for obtaining a gid; the first of the
36255 following that is set is used:
36256 </para>
36257 <itemizedlist>
36258 <listitem>
36259 <para>
36260 A <option>group</option> setting of the transport;
36261 </para>
36262 </listitem>
36263 <listitem>
36264 <para>
36265 A <option>group</option> setting of the router;
36266 </para>
36267 </listitem>
36268 <listitem>
36269 <para>
36270 A gid associated with a user setting of the router, either as a result of
36271 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
36272 </para>
36273 </listitem>
36274 <listitem>
36275 <para>
36276 The group associated with a non-numeric <option>user</option> setting of the transport;
36277 </para>
36278 </listitem>
36279 <listitem>
36280 <para>
36281 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
36282 the uid is the creator&#x2019;s uid;
36283 </para>
36284 </listitem>
36285 <listitem>
36286 <para>
36287 The Exim gid if the Exim uid is being used as a default.
36288 </para>
36289 </listitem>
36290 </itemizedlist>
36291 <para>
36292 If, for example, the user is specified numerically on the router and there are
36293 no group settings, no gid is available. In this situation, an error occurs.
36294 This is different for the uid, for which there always is an ultimate default.
36295 The first of the following that is set is used:
36296 </para>
36297 <itemizedlist>
36298 <listitem>
36299 <para>
36300 A <option>user</option> setting of the transport;
36301 </para>
36302 </listitem>
36303 <listitem>
36304 <para>
36305 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
36306 </para>
36307 </listitem>
36308 <listitem>
36309 <para>
36310 A <option>user</option> setting of the router;
36311 </para>
36312 </listitem>
36313 <listitem>
36314 <para>
36315 A <option>check_local_user</option> setting of the router;
36316 </para>
36317 </listitem>
36318 <listitem>
36319 <para>
36320 The Exim uid.
36321 </para>
36322 </listitem>
36323 </itemizedlist>
36324 <para>
36325 Of course, an error will still occur if the uid that is chosen is on the
36326 <option>never_users</option> list.
36327 </para>
36328 </section>
36329 <section id="SECID132">
36330 <title>Current and home directories</title>
36331 <para>
36332 <indexterm role="concept">
36333 <primary>current directory for local transport</primary>
36334 </indexterm>
36335 <indexterm role="concept">
36336 <primary>home directory</primary>
36337 <secondary>for local transport</secondary>
36338 </indexterm>
36339 <indexterm role="concept">
36340 <primary>transport</primary>
36341 <secondary>local; home directory for</secondary>
36342 </indexterm>
36343 <indexterm role="concept">
36344 <primary>transport</primary>
36345 <secondary>local; current directory for</secondary>
36346 </indexterm>
36347 Routers may set current and home directories for local transports by means of
36348 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
36349 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
36350 are set, they override the router&#x2019;s values. In detail, the home directory
36351 for a local transport is taken from the first of these values that is set:
36352 </para>
36353 <itemizedlist>
36354 <listitem>
36355 <para>
36356 The <option>home_directory</option> option on the transport;
36357 </para>
36358 </listitem>
36359 <listitem>
36360 <para>
36361 The <option>transport_home_directory</option> option on the router;
36362 </para>
36363 </listitem>
36364 <listitem>
36365 <para>
36366 The password data if <option>check_local_user</option> is set on the router;
36367 </para>
36368 </listitem>
36369 <listitem>
36370 <para>
36371 The <option>router_home_directory</option> option on the router.
36372 </para>
36373 </listitem>
36374 </itemizedlist>
36375 <para>
36376 The current directory is taken from the first of these values that is set:
36377 </para>
36378 <itemizedlist>
36379 <listitem>
36380 <para>
36381 The <option>current_directory</option> option on the transport;
36382 </para>
36383 </listitem>
36384 <listitem>
36385 <para>
36386 The <option>transport_current_directory</option> option on the router.
36387 </para>
36388 </listitem>
36389 </itemizedlist>
36390 <para>
36391 If neither the router nor the transport sets a current directory, Exim uses the
36392 value of the home directory, if it is set. Otherwise it sets the current
36393 directory to <filename>/</filename> before running a local transport.
36394 </para>
36395 </section>
36396 <section id="SECID133">
36397 <title>Expansion variables derived from the address</title>
36398 <para>
36399 <indexterm role="variable">
36400 <primary><varname>$domain</varname></primary>
36401 </indexterm>
36402 <indexterm role="variable">
36403 <primary><varname>$local_part</varname></primary>
36404 </indexterm>
36405 <indexterm role="variable">
36406 <primary><varname>$original_domain</varname></primary>
36407 </indexterm>
36408 Normally a local delivery is handling a single address, and in that case the
36409 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
36410 deliveries. However, in some circumstances more than one address may be handled
36411 at once (for example, while writing batch SMTP for onward transmission by some
36412 other means). In this case, the variables associated with the local part are
36413 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
36414 and <varname>$original_domain</varname> is never set.
36415 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
36416 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
36417 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
36418 </para>
36419 </section>
36420 </chapter>
36421
36422 <chapter id="CHAPtransportgeneric">
36423 <title>Generic options for transports</title>
36424 <para>
36425 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
36426 <primary>generic options</primary>
36427 <secondary>transport</secondary>
36428 </indexterm>
36429 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
36430 <primary>options</primary>
36431 <secondary>generic; for transports</secondary>
36432 </indexterm>
36433 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
36434 <primary>transport</primary>
36435 <secondary>generic options for</secondary>
36436 </indexterm>
36437 The following generic options apply to all transports:
36438 </para>
36439 <para>
36440 <indexterm role="option">
36441 <primary><option>body_only</option></primary>
36442 </indexterm>
36443 </para>
36444 <informaltable frame="all">
36445 <tgroup cols="4" colsep="0" rowsep="0">
36446 <colspec colwidth="8*" align="left"/>
36447 <colspec colwidth="6*" align="center"/>
36448 <colspec colwidth="6*" align="center"/>
36449 <colspec colwidth="6*" align="right"/>
36450 <tbody>
36451 <row>
36452 <entry><option>body_only</option></entry>
36453 <entry>Use: <emphasis>transports</emphasis></entry>
36454 <entry>Type: <emphasis>boolean</emphasis></entry>
36455 <entry>Default: <emphasis>false</emphasis></entry>
36456 </row>
36457 </tbody>
36458 </tgroup>
36459 </informaltable>
36460 <para>
36461 <indexterm role="concept">
36462 <primary>transport</primary>
36463 <secondary>body only</secondary>
36464 </indexterm>
36465 <indexterm role="concept">
36466 <primary>message</primary>
36467 <secondary>transporting body only</secondary>
36468 </indexterm>
36469 <indexterm role="concept">
36470 <primary>body of message</primary>
36471 <secondary>transporting</secondary>
36472 </indexterm>
36473 If this option is set, the message&#x2019;s headers are not transported. It is
36474 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
36475 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
36476 <option>message_suffix</option> should be checked, because this option does not
36477 automatically suppress them.
36478 </para>
36479 <para>
36480 <indexterm role="option">
36481 <primary><option>current_directory</option></primary>
36482 </indexterm>
36483 </para>
36484 <informaltable frame="all">
36485 <tgroup cols="4" colsep="0" rowsep="0">
36486 <colspec colwidth="8*" align="left"/>
36487 <colspec colwidth="6*" align="center"/>
36488 <colspec colwidth="6*" align="center"/>
36489 <colspec colwidth="6*" align="right"/>
36490 <tbody>
36491 <row>
36492 <entry><option>current_directory</option></entry>
36493 <entry>Use: <emphasis>transports</emphasis></entry>
36494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36495 <entry>Default: <emphasis>unset</emphasis></entry>
36496 </row>
36497 </tbody>
36498 </tgroup>
36499 </informaltable>
36500 <para>
36501 <indexterm role="concept">
36502 <primary>transport</primary>
36503 <secondary>current directory for</secondary>
36504 </indexterm>
36505 This specifies the current directory that is to be set while running the
36506 transport, overriding any value that may have been set by the router.
36507 If the expansion fails for any reason, including forced failure, an error is
36508 logged, and delivery is deferred.
36509 </para>
36510 <para>
36511 <indexterm role="option">
36512 <primary><option>disable_logging</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>disable_logging</option></entry>
36524 <entry>Use: <emphasis>transports</emphasis></entry>
36525 <entry>Type: <emphasis>boolean</emphasis></entry>
36526 <entry>Default: <emphasis>false</emphasis></entry>
36527 </row>
36528 </tbody>
36529 </tgroup>
36530 </informaltable>
36531 <para>
36532 If this option is set true, nothing is logged for any
36533 deliveries by the transport or for any
36534 transport errors. You should not set this option unless you really, really know
36535 what you are doing.
36536 </para>
36537 <para>
36538 <indexterm role="option">
36539 <primary><option>debug_print</option></primary>
36540 </indexterm>
36541 </para>
36542 <informaltable frame="all">
36543 <tgroup cols="4" colsep="0" rowsep="0">
36544 <colspec colwidth="8*" align="left"/>
36545 <colspec colwidth="6*" align="center"/>
36546 <colspec colwidth="6*" align="center"/>
36547 <colspec colwidth="6*" align="right"/>
36548 <tbody>
36549 <row>
36550 <entry><option>debug_print</option></entry>
36551 <entry>Use: <emphasis>transports</emphasis></entry>
36552 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36553 <entry>Default: <emphasis>unset</emphasis></entry>
36554 </row>
36555 </tbody>
36556 </tgroup>
36557 </informaltable>
36558 <para>
36559 <indexterm role="concept">
36560 <primary>testing</primary>
36561 <secondary>variables in drivers</secondary>
36562 </indexterm>
36563 If this option is set and debugging is enabled (see the <option>-d</option> command line
36564 option), the string is expanded and included in the debugging output when the
36565 transport is run.
36566 If expansion of the string fails, the error message is written to the debugging
36567 output, and Exim carries on processing.
36568 This facility is provided to help with checking out the values of variables and
36569 so on when debugging driver configurations. For example, if a <option>headers_add</option>
36570 option is not working properly, <option>debug_print</option> could be used to output the
36571 variables it references. A newline is added to the text if it does not end with
36572 one.
36573 </para>
36574 <para>
36575 <indexterm role="option">
36576 <primary><option>delivery_date_add</option></primary>
36577 </indexterm>
36578 </para>
36579 <informaltable frame="all">
36580 <tgroup cols="4" colsep="0" rowsep="0">
36581 <colspec colwidth="8*" align="left"/>
36582 <colspec colwidth="6*" align="center"/>
36583 <colspec colwidth="6*" align="center"/>
36584 <colspec colwidth="6*" align="right"/>
36585 <tbody>
36586 <row>
36587 <entry><option>delivery_date_add</option></entry>
36588 <entry>Use: <emphasis>transports</emphasis></entry>
36589 <entry>Type: <emphasis>boolean</emphasis></entry>
36590 <entry>Default: <emphasis>false</emphasis></entry>
36591 </row>
36592 </tbody>
36593 </tgroup>
36594 </informaltable>
36595 <para>
36596 <indexterm role="concept">
36597 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
36598 </indexterm>
36599 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
36600 This gives the actual time the delivery was made. As this is not a standard
36601 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
36602 requests its removal from incoming messages, so that delivered messages can
36603 safely be resent to other recipients.
36604 </para>
36605 <para>
36606 <indexterm role="option">
36607 <primary><option>driver</option></primary>
36608 </indexterm>
36609 </para>
36610 <informaltable frame="all">
36611 <tgroup cols="4" colsep="0" rowsep="0">
36612 <colspec colwidth="8*" align="left"/>
36613 <colspec colwidth="6*" align="center"/>
36614 <colspec colwidth="6*" align="center"/>
36615 <colspec colwidth="6*" align="right"/>
36616 <tbody>
36617 <row>
36618 <entry><option>driver</option></entry>
36619 <entry>Use: <emphasis>transports</emphasis></entry>
36620 <entry>Type: <emphasis>string</emphasis></entry>
36621 <entry>Default: <emphasis>unset</emphasis></entry>
36622 </row>
36623 </tbody>
36624 </tgroup>
36625 </informaltable>
36626 <para>
36627 This specifies which of the available transport drivers is to be used.
36628 There is no default, and this option must be set for every transport.
36629 </para>
36630 <para>
36631 <indexterm role="option">
36632 <primary><option>envelope_to_add</option></primary>
36633 </indexterm>
36634 </para>
36635 <informaltable frame="all">
36636 <tgroup cols="4" colsep="0" rowsep="0">
36637 <colspec colwidth="8*" align="left"/>
36638 <colspec colwidth="6*" align="center"/>
36639 <colspec colwidth="6*" align="center"/>
36640 <colspec colwidth="6*" align="right"/>
36641 <tbody>
36642 <row>
36643 <entry><option>envelope_to_add</option></entry>
36644 <entry>Use: <emphasis>transports</emphasis></entry>
36645 <entry>Type: <emphasis>boolean</emphasis></entry>
36646 <entry>Default: <emphasis>false</emphasis></entry>
36647 </row>
36648 </tbody>
36649 </tgroup>
36650 </informaltable>
36651 <para>
36652 <indexterm role="concept">
36653 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36654 </indexterm>
36655 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
36656 This gives the original address(es) in the incoming envelope that caused this
36657 delivery to happen. More than one address may be present if the transport is
36658 configured to handle several addresses at once, or if more than one original
36659 address was redirected to the same final address. As this is not a standard
36660 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
36661 its removal from incoming messages, so that delivered messages can safely be
36662 resent to other recipients.
36663 </para>
36664 <para>
36665 <indexterm role="option">
36666 <primary><option>group</option></primary>
36667 </indexterm>
36668 </para>
36669 <informaltable frame="all">
36670 <tgroup cols="4" colsep="0" rowsep="0">
36671 <colspec colwidth="8*" align="left"/>
36672 <colspec colwidth="6*" align="center"/>
36673 <colspec colwidth="6*" align="center"/>
36674 <colspec colwidth="6*" align="right"/>
36675 <tbody>
36676 <row>
36677 <entry><option>group</option></entry>
36678 <entry>Use: <emphasis>transports</emphasis></entry>
36679 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36680 <entry>Default: <emphasis>Exim group</emphasis></entry>
36681 </row>
36682 </tbody>
36683 </tgroup>
36684 </informaltable>
36685 <para>
36686 <indexterm role="concept">
36687 <primary>transport</primary>
36688 <secondary>group; specifying</secondary>
36689 </indexterm>
36690 This option specifies a gid for running the transport process, overriding any
36691 value that the router supplies, and also overriding any value associated with
36692 <option>user</option> (see below).
36693 </para>
36694 <para>
36695 <indexterm role="option">
36696 <primary><option>headers_add</option></primary>
36697 </indexterm>
36698 </para>
36699 <informaltable frame="all">
36700 <tgroup cols="4" colsep="0" rowsep="0">
36701 <colspec colwidth="8*" align="left"/>
36702 <colspec colwidth="6*" align="center"/>
36703 <colspec colwidth="6*" align="center"/>
36704 <colspec colwidth="6*" align="right"/>
36705 <tbody>
36706 <row>
36707 <entry><option>headers_add</option></entry>
36708 <entry>Use: <emphasis>transports</emphasis></entry>
36709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36710 <entry>Default: <emphasis>unset</emphasis></entry>
36711 </row>
36712 </tbody>
36713 </tgroup>
36714 </informaltable>
36715 <para>
36716 <indexterm role="concept">
36717 <primary>header lines</primary>
36718 <secondary>adding in transport</secondary>
36719 </indexterm>
36720 <indexterm role="concept">
36721 <primary>transport</primary>
36722 <secondary>header lines; adding</secondary>
36723 </indexterm>
36724 This option specifies a string of text that is expanded and added to the header
36725 portion of a message as it is transported, as described in section
36726 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
36727 routers. If the result of the expansion is an empty string, or if the expansion
36728 is forced to fail, no action is taken. Other expansion failures are treated as
36729 errors and cause the delivery to be deferred.
36730 </para>
36731 <para>
36732 <indexterm role="option">
36733 <primary><option>headers_only</option></primary>
36734 </indexterm>
36735 </para>
36736 <informaltable frame="all">
36737 <tgroup cols="4" colsep="0" rowsep="0">
36738 <colspec colwidth="8*" align="left"/>
36739 <colspec colwidth="6*" align="center"/>
36740 <colspec colwidth="6*" align="center"/>
36741 <colspec colwidth="6*" align="right"/>
36742 <tbody>
36743 <row>
36744 <entry><option>headers_only</option></entry>
36745 <entry>Use: <emphasis>transports</emphasis></entry>
36746 <entry>Type: <emphasis>boolean</emphasis></entry>
36747 <entry>Default: <emphasis>false</emphasis></entry>
36748 </row>
36749 </tbody>
36750 </tgroup>
36751 </informaltable>
36752 <para>
36753 <indexterm role="concept">
36754 <primary>transport</primary>
36755 <secondary>header lines only</secondary>
36756 </indexterm>
36757 <indexterm role="concept">
36758 <primary>message</primary>
36759 <secondary>transporting headers only</secondary>
36760 </indexterm>
36761 <indexterm role="concept">
36762 <primary>header lines</primary>
36763 <secondary>transporting</secondary>
36764 </indexterm>
36765 If this option is set, the message&#x2019;s body is not transported. It is mutually
36766 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
36767 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
36768 checked, since this option does not automatically suppress them.
36769 </para>
36770 <para>
36771 <indexterm role="option">
36772 <primary><option>headers_remove</option></primary>
36773 </indexterm>
36774 </para>
36775 <informaltable frame="all">
36776 <tgroup cols="4" colsep="0" rowsep="0">
36777 <colspec colwidth="8*" align="left"/>
36778 <colspec colwidth="6*" align="center"/>
36779 <colspec colwidth="6*" align="center"/>
36780 <colspec colwidth="6*" align="right"/>
36781 <tbody>
36782 <row>
36783 <entry><option>headers_remove</option></entry>
36784 <entry>Use: <emphasis>transports</emphasis></entry>
36785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36786 <entry>Default: <emphasis>unset</emphasis></entry>
36787 </row>
36788 </tbody>
36789 </tgroup>
36790 </informaltable>
36791 <para>
36792 <indexterm role="concept">
36793 <primary>header lines</primary>
36794 <secondary>removing</secondary>
36795 </indexterm>
36796 <indexterm role="concept">
36797 <primary>transport</primary>
36798 <secondary>header lines; removing</secondary>
36799 </indexterm>
36800 This option specifies a string that is expanded into a list of header names;
36801 these headers are omitted from the message as it is transported, as described
36802 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
36803 routers. If the result of the expansion is an empty string, or if the expansion
36804 is forced to fail, no action is taken. Other expansion failures are treated as
36805 errors and cause the delivery to be deferred.
36806 </para>
36807 <para>
36808 <indexterm role="option">
36809 <primary><option>headers_rewrite</option></primary>
36810 </indexterm>
36811 </para>
36812 <informaltable frame="all">
36813 <tgroup cols="4" colsep="0" rowsep="0">
36814 <colspec colwidth="8*" align="left"/>
36815 <colspec colwidth="6*" align="center"/>
36816 <colspec colwidth="6*" align="center"/>
36817 <colspec colwidth="6*" align="right"/>
36818 <tbody>
36819 <row>
36820 <entry><option>headers_rewrite</option></entry>
36821 <entry>Use: <emphasis>transports</emphasis></entry>
36822 <entry>Type: <emphasis>string</emphasis></entry>
36823 <entry>Default: <emphasis>unset</emphasis></entry>
36824 </row>
36825 </tbody>
36826 </tgroup>
36827 </informaltable>
36828 <para>
36829 <indexterm role="concept">
36830 <primary>transport</primary>
36831 <secondary>header lines; rewriting</secondary>
36832 </indexterm>
36833 <indexterm role="concept">
36834 <primary>rewriting</primary>
36835 <secondary>at transport time</secondary>
36836 </indexterm>
36837 This option allows addresses in header lines to be rewritten at transport time,
36838 that is, as the message is being copied to its destination. The contents of the
36839 option are a colon-separated list of rewriting rules. Each rule is in exactly
36840 the same form as one of the general rewriting rules that are applied when a
36841 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
36842 example,
36843 </para>
36844 <literallayout class="monospaced">
36845 headers_rewrite = a@b c@d f : \
36846                   x@y w@z
36847 </literallayout>
36848 <para>
36849 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
36850 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
36851 header lines just before they are written out at transport time, so they affect
36852 only those copies of the message that pass through the transport. However, only
36853 the message&#x2019;s original header lines, and any that were added by a system
36854 filter, are rewritten. If a router or transport adds header lines, they are not
36855 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
36856 envelope. You can change the return path using <option>return_path</option>, but you cannot
36857 change envelope recipients at this time.
36858 </para>
36859 <para>
36860 <indexterm role="option">
36861 <primary><option>home_directory</option></primary>
36862 </indexterm>
36863 </para>
36864 <informaltable frame="all">
36865 <tgroup cols="4" colsep="0" rowsep="0">
36866 <colspec colwidth="8*" align="left"/>
36867 <colspec colwidth="6*" align="center"/>
36868 <colspec colwidth="6*" align="center"/>
36869 <colspec colwidth="6*" align="right"/>
36870 <tbody>
36871 <row>
36872 <entry><option>home_directory</option></entry>
36873 <entry>Use: <emphasis>transports</emphasis></entry>
36874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36875 <entry>Default: <emphasis>unset</emphasis></entry>
36876 </row>
36877 </tbody>
36878 </tgroup>
36879 </informaltable>
36880 <para>
36881 <indexterm role="concept">
36882 <primary>transport</primary>
36883 <secondary>home directory for</secondary>
36884 </indexterm>
36885 <indexterm role="variable">
36886 <primary><varname>$home</varname></primary>
36887 </indexterm>
36888 This option specifies a home directory setting for a local transport,
36889 overriding any value that may be set by the router. The home directory is
36890 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
36891 used as the current directory if no current directory is set by the
36892 <option>current_directory</option> option on the transport or the
36893 <option>transport_current_directory</option> option on the router. If the expansion fails
36894 for any reason, including forced failure, an error is logged, and delivery is
36895 deferred.
36896 </para>
36897 <para>
36898 <indexterm role="option">
36899 <primary><option>initgroups</option></primary>
36900 </indexterm>
36901 </para>
36902 <informaltable frame="all">
36903 <tgroup cols="4" colsep="0" rowsep="0">
36904 <colspec colwidth="8*" align="left"/>
36905 <colspec colwidth="6*" align="center"/>
36906 <colspec colwidth="6*" align="center"/>
36907 <colspec colwidth="6*" align="right"/>
36908 <tbody>
36909 <row>
36910 <entry><option>initgroups</option></entry>
36911 <entry>Use: <emphasis>transports</emphasis></entry>
36912 <entry>Type: <emphasis>boolean</emphasis></entry>
36913 <entry>Default: <emphasis>false</emphasis></entry>
36914 </row>
36915 </tbody>
36916 </tgroup>
36917 </informaltable>
36918 <para>
36919 <indexterm role="concept">
36920 <primary>additional groups</primary>
36921 </indexterm>
36922 <indexterm role="concept">
36923 <primary>groups</primary>
36924 <secondary>additional</secondary>
36925 </indexterm>
36926 <indexterm role="concept">
36927 <primary>transport</primary>
36928 <secondary>group; additional</secondary>
36929 </indexterm>
36930 If this option is true and the uid for the delivery process is provided by the
36931 transport, the <function>initgroups()</function> function is called when running the transport
36932 to ensure that any additional groups associated with the uid are set up.
36933 </para>
36934 <para>
36935 <indexterm role="option">
36936 <primary><option>message_size_limit</option></primary>
36937 </indexterm>
36938 </para>
36939 <informaltable frame="all">
36940 <tgroup cols="4" colsep="0" rowsep="0">
36941 <colspec colwidth="8*" align="left"/>
36942 <colspec colwidth="6*" align="center"/>
36943 <colspec colwidth="6*" align="center"/>
36944 <colspec colwidth="6*" align="right"/>
36945 <tbody>
36946 <row>
36947 <entry><option>message_size_limit</option></entry>
36948 <entry>Use: <emphasis>transports</emphasis></entry>
36949 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36950 <entry>Default: <emphasis>0</emphasis></entry>
36951 </row>
36952 </tbody>
36953 </tgroup>
36954 </informaltable>
36955 <para>
36956 <indexterm role="concept">
36957 <primary>limit</primary>
36958 <secondary>message size per transport</secondary>
36959 </indexterm>
36960 <indexterm role="concept">
36961 <primary>size</primary>
36962 <secondary>of message, limit</secondary>
36963 </indexterm>
36964 <indexterm role="concept">
36965 <primary>transport</primary>
36966 <secondary>message size; limiting</secondary>
36967 </indexterm>
36968 This option controls the size of messages passed through the transport. It is
36969 expanded before use; the result of the expansion must be a sequence of decimal
36970 digits, optionally followed by K or M. If the expansion fails for any reason,
36971 including forced failure, or if the result is not of the required form,
36972 delivery is deferred. If the value is greater than zero and the size of a
36973 message exceeds this limit, the address is failed. If there is any chance that
36974 the resulting bounce message could be routed to the same transport, you should
36975 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
36976 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
36977 delivered.
36978 </para>
36979 <para>
36980 <indexterm role="option">
36981 <primary><option>rcpt_include_affixes</option></primary>
36982 </indexterm>
36983 </para>
36984 <informaltable frame="all">
36985 <tgroup cols="4" colsep="0" rowsep="0">
36986 <colspec colwidth="8*" align="left"/>
36987 <colspec colwidth="6*" align="center"/>
36988 <colspec colwidth="6*" align="center"/>
36989 <colspec colwidth="6*" align="right"/>
36990 <tbody>
36991 <row>
36992 <entry><option>rcpt_include_affixes</option></entry>
36993 <entry>Use: <emphasis>transports</emphasis></entry>
36994 <entry>Type: <emphasis>boolean</emphasis></entry>
36995 <entry>Default: <emphasis>false</emphasis></entry>
36996 </row>
36997 </tbody>
36998 </tgroup>
36999 </informaltable>
37000 <para>
37001 <indexterm role="concept">
37002 <primary>prefix</primary>
37003 <secondary>for local part, including in envelope</secondary>
37004 </indexterm>
37005 <indexterm role="concept">
37006 <primary>suffix for local part</primary>
37007 <secondary>including in envelope</secondary>
37008 </indexterm>
37009 <indexterm role="concept">
37010 <primary>local part</primary>
37011 <secondary>prefix</secondary>
37012 </indexterm>
37013 <indexterm role="concept">
37014 <primary>local part</primary>
37015 <secondary>suffix</secondary>
37016 </indexterm>
37017 When this option is false (the default), and an address that has had any
37018 affixes (prefixes or suffixes) removed from the local part is delivered by any
37019 form of SMTP or LMTP, the affixes are not included. For example, if a router
37020 that contains
37021 </para>
37022 <literallayout class="monospaced">
37023 local_part_prefix = *-
37024 </literallayout>
37025 <para>
37026 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
37027 is delivered with
37028 </para>
37029 <literallayout class="monospaced">
37030 RCPT TO:&lt;xyz@some.domain&gt;
37031 </literallayout>
37032 <para>
37033 This is also the case when an ACL-time callout is being used to verify a
37034 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
37035 whole local part is included in the RCPT command. This option applies to BSMTP
37036 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
37037 <command>lmtp</command> and <command>smtp</command> transports.
37038 </para>
37039 <para>
37040 <indexterm role="option">
37041 <primary><option>retry_use_local_part</option></primary>
37042 </indexterm>
37043 </para>
37044 <informaltable frame="all">
37045 <tgroup cols="4" colsep="0" rowsep="0">
37046 <colspec colwidth="8*" align="left"/>
37047 <colspec colwidth="6*" align="center"/>
37048 <colspec colwidth="6*" align="center"/>
37049 <colspec colwidth="6*" align="right"/>
37050 <tbody>
37051 <row>
37052 <entry><option>retry_use_local_part</option></entry>
37053 <entry>Use: <emphasis>transports</emphasis></entry>
37054 <entry>Type: <emphasis>boolean</emphasis></entry>
37055 <entry>Default: <emphasis>see below</emphasis></entry>
37056 </row>
37057 </tbody>
37058 </tgroup>
37059 </informaltable>
37060 <para>
37061 <indexterm role="concept">
37062 <primary>hints database</primary>
37063 <secondary>retry keys</secondary>
37064 </indexterm>
37065 When a delivery suffers a temporary failure, a retry record is created
37066 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
37067 is based on the name and/or IP address of the failing remote host. For local
37068 deliveries, the key is normally the entire address, including both the local
37069 part and the domain. This is suitable for most common cases of local delivery
37070 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
37071 deliveries to that mailbox, not to the whole domain.
37072 </para>
37073 <para>
37074 However, in some special cases you may want to treat a temporary local delivery
37075 as a failure associated with the domain, and not with a particular local part.
37076 (For example, if you are storing all mail for some domain in files.) You can do
37077 this by setting <option>retry_use_local_part</option> false.
37078 </para>
37079 <para>
37080 For all the local transports, its default value is true. For remote transports,
37081 the default value is false for tidiness, but changing the value has no effect
37082 on a remote transport in the current implementation.
37083 </para>
37084 <para>
37085 <indexterm role="option">
37086 <primary><option>return_path</option></primary>
37087 </indexterm>
37088 </para>
37089 <informaltable frame="all">
37090 <tgroup cols="4" colsep="0" rowsep="0">
37091 <colspec colwidth="8*" align="left"/>
37092 <colspec colwidth="6*" align="center"/>
37093 <colspec colwidth="6*" align="center"/>
37094 <colspec colwidth="6*" align="right"/>
37095 <tbody>
37096 <row>
37097 <entry><option>return_path</option></entry>
37098 <entry>Use: <emphasis>transports</emphasis></entry>
37099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37100 <entry>Default: <emphasis>unset</emphasis></entry>
37101 </row>
37102 </tbody>
37103 </tgroup>
37104 </informaltable>
37105 <para>
37106 <indexterm role="concept">
37107 <primary>envelope sender</primary>
37108 </indexterm>
37109 <indexterm role="concept">
37110 <primary>transport</primary>
37111 <secondary>return path; changing</secondary>
37112 </indexterm>
37113 <indexterm role="concept">
37114 <primary>return path</primary>
37115 <secondary>changing in transport</secondary>
37116 </indexterm>
37117 If this option is set, the string is expanded at transport time and replaces
37118 the existing return path (envelope sender) value in the copy of the message
37119 that is being delivered. An empty return path is permitted. This feature is
37120 designed for remote deliveries, where the value of this option is used in the
37121 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
37122 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
37123 header line, if one is added to the message (see the next option).
37124 </para>
37125 <para>
37126 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
37127 <option>return_path_on_delivery</option> to the log selector.
37128 </para>
37129 <para>
37130 <indexterm role="variable">
37131 <primary><varname>$return_path</varname></primary>
37132 </indexterm>
37133 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
37134 either the message&#x2019;s envelope sender, or an address set by the
37135 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
37136 replacement occurs; if it fails for another reason, delivery is deferred. This
37137 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
37138 section <xref linkend="SECTverp"/>.
37139 </para>
37140 <para>
37141 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
37142 remote server rejects a message at SMTP time, the bounce message is not sent to
37143 the value of this option. It is sent to the previously set errors address.
37144 This defaults to the incoming sender address, but can be changed by setting
37145 <option>errors_to</option> in a router.
37146 </para>
37147 <para>
37148 <indexterm role="option">
37149 <primary><option>return_path_add</option></primary>
37150 </indexterm>
37151 </para>
37152 <informaltable frame="all">
37153 <tgroup cols="4" colsep="0" rowsep="0">
37154 <colspec colwidth="8*" align="left"/>
37155 <colspec colwidth="6*" align="center"/>
37156 <colspec colwidth="6*" align="center"/>
37157 <colspec colwidth="6*" align="right"/>
37158 <tbody>
37159 <row>
37160 <entry><option>return_path_add</option></entry>
37161 <entry>Use: <emphasis>transports</emphasis></entry>
37162 <entry>Type: <emphasis>boolean</emphasis></entry>
37163 <entry>Default: <emphasis>false</emphasis></entry>
37164 </row>
37165 </tbody>
37166 </tgroup>
37167 </informaltable>
37168 <para>
37169 <indexterm role="concept">
37170 <primary><emphasis>Return-path:</emphasis> header line</primary>
37171 </indexterm>
37172 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
37173 Although the return path is normally available in the prefix line of BSD
37174 mailboxes, this is commonly not displayed by MUAs, and so the user does not
37175 have easy access to it.
37176 </para>
37177 <para>
37178 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
37179 the delivery SMTP server makes the final delivery</quote>. This implies that this
37180 header should not be present in incoming messages. Exim has a configuration
37181 option, <option>return_path_remove</option>, which requests removal of this header from
37182 incoming messages, so that delivered messages can safely be resent to other
37183 recipients.
37184 </para>
37185 <para>
37186 <indexterm role="option">
37187 <primary><option>shadow_condition</option></primary>
37188 </indexterm>
37189 </para>
37190 <informaltable frame="all">
37191 <tgroup cols="4" colsep="0" rowsep="0">
37192 <colspec colwidth="8*" align="left"/>
37193 <colspec colwidth="6*" align="center"/>
37194 <colspec colwidth="6*" align="center"/>
37195 <colspec colwidth="6*" align="right"/>
37196 <tbody>
37197 <row>
37198 <entry><option>shadow_condition</option></entry>
37199 <entry>Use: <emphasis>transports</emphasis></entry>
37200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37201 <entry>Default: <emphasis>unset</emphasis></entry>
37202 </row>
37203 </tbody>
37204 </tgroup>
37205 </informaltable>
37206 <para>
37207 See <option>shadow_transport</option> below.
37208 </para>
37209 <para>
37210 <indexterm role="option">
37211 <primary><option>shadow_transport</option></primary>
37212 </indexterm>
37213 </para>
37214 <informaltable frame="all">
37215 <tgroup cols="4" colsep="0" rowsep="0">
37216 <colspec colwidth="8*" align="left"/>
37217 <colspec colwidth="6*" align="center"/>
37218 <colspec colwidth="6*" align="center"/>
37219 <colspec colwidth="6*" align="right"/>
37220 <tbody>
37221 <row>
37222 <entry><option>shadow_transport</option></entry>
37223 <entry>Use: <emphasis>transports</emphasis></entry>
37224 <entry>Type: <emphasis>string</emphasis></entry>
37225 <entry>Default: <emphasis>unset</emphasis></entry>
37226 </row>
37227 </tbody>
37228 </tgroup>
37229 </informaltable>
37230 <para>
37231 <indexterm role="concept">
37232 <primary>shadow transport</primary>
37233 </indexterm>
37234 <indexterm role="concept">
37235 <primary>transport</primary>
37236 <secondary>shadow</secondary>
37237 </indexterm>
37238 A local transport may set the <option>shadow_transport</option> option to the name of
37239 another local transport. Shadow remote transports are not supported.
37240 </para>
37241 <para>
37242 Whenever a delivery to the main transport succeeds, and either
37243 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
37244 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
37245 passed to the shadow transport, with the same delivery address or addresses. If
37246 expansion fails, no action is taken except that non-forced expansion failures
37247 cause a log line to be written.
37248 </para>
37249 <para>
37250 The result of the shadow transport is discarded and does not affect the
37251 subsequent processing of the message. Only a single level of shadowing is
37252 provided; the <option>shadow_transport</option> option is ignored on any transport when it
37253 is running as a shadow. Options concerned with output from pipes are also
37254 ignored. The log line for the successful delivery has an item added on the end,
37255 of the form
37256 </para>
37257 <literallayout class="monospaced">
37258 ST=&lt;shadow transport name&gt;
37259 </literallayout>
37260 <para>
37261 If the shadow transport did not succeed, the error message is put in
37262 parentheses afterwards. Shadow transports can be used for a number of different
37263 purposes, including keeping more detailed log information than Exim normally
37264 provides, and implementing automatic acknowledgment policies based on message
37265 headers that some sites insist on.
37266 </para>
37267 <para>
37268 <indexterm role="option">
37269 <primary><option>transport_filter</option></primary>
37270 </indexterm>
37271 </para>
37272 <informaltable frame="all">
37273 <tgroup cols="4" colsep="0" rowsep="0">
37274 <colspec colwidth="8*" align="left"/>
37275 <colspec colwidth="6*" align="center"/>
37276 <colspec colwidth="6*" align="center"/>
37277 <colspec colwidth="6*" align="right"/>
37278 <tbody>
37279 <row>
37280 <entry><option>transport_filter</option></entry>
37281 <entry>Use: <emphasis>transports</emphasis></entry>
37282 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37283 <entry>Default: <emphasis>unset</emphasis></entry>
37284 </row>
37285 </tbody>
37286 </tgroup>
37287 </informaltable>
37288 <para>
37289 <indexterm role="concept">
37290 <primary>transport</primary>
37291 <secondary>filter</secondary>
37292 </indexterm>
37293 <indexterm role="concept">
37294 <primary>filter</primary>
37295 <secondary>transport filter</secondary>
37296 </indexterm>
37297 This option sets up a filtering (in the Unix shell sense) process for messages
37298 at transport time. It should not be confused with mail filtering as set up by
37299 individual users or via a system filter.
37300 </para>
37301 <para>
37302 When the message is about to be written out, the command specified by
37303 <option>transport_filter</option> is started up in a separate, parallel process, and
37304 the entire message, including the header lines, is passed to it on its standard
37305 input (this in fact is done from a third process, to avoid deadlock). The
37306 command must be specified as an absolute path.
37307 </para>
37308 <para>
37309 The lines of the message that are written to the transport filter are
37310 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
37311 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
37312 lines beginning with a dot, and also before any processing implied by the
37313 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
37314 <command>pipe</command> transports.
37315 </para>
37316 <para>
37317 The standard error for the filter process is set to the same destination as its
37318 standard output; this is read and written to the message&#x2019;s ultimate
37319 destination. The process that writes the message to the filter, the
37320 filter itself, and the original process that reads the result and delivers it
37321 are all run in parallel, like a shell pipeline.
37322 </para>
37323 <para>
37324 The filter can perform any transformations it likes, but of course should take
37325 care not to break RFC 2822 syntax. Exim does not check the result, except to
37326 test for a final newline when SMTP is in use. All messages transmitted over
37327 SMTP must end with a newline, so Exim supplies one if it is missing.
37328 </para>
37329 <para>
37330 <indexterm role="concept">
37331 <primary>content scanning</primary>
37332 <secondary>per user</secondary>
37333 </indexterm>
37334 A transport filter can be used to provide content-scanning on a per-user basis
37335 at delivery time if the only required effect of the scan is to modify the
37336 message. For example, a content scan could insert a new header line containing
37337 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
37338 not possible to discard a message at this stage.
37339 </para>
37340 <para>
37341 <indexterm role="concept">
37342 <primary>SMTP</primary>
37343 <secondary>SIZE</secondary>
37344 </indexterm>
37345 A problem might arise if the filter increases the size of a message that is
37346 being sent down an SMTP connection. If the receiving SMTP server has indicated
37347 support for the SIZE parameter, Exim will have sent the size of the message
37348 at the start of the SMTP session. If what is actually sent is substantially
37349 more, the server might reject the message. This can be worked round by setting
37350 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
37351 additions to the message, or to disable the use of SIZE altogether.
37352 </para>
37353 <para>
37354 <indexterm role="variable">
37355 <primary><varname>$pipe_addresses</varname></primary>
37356 </indexterm>
37357 The value of the <option>transport_filter</option> option is the command string for starting
37358 the filter, which is run directly from Exim, not under a shell. The string is
37359 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
37360 Exim breaks it up into arguments and then expands each argument separately (see
37361 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
37362 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
37363 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
37364 an ideal name for this feature here, but as it was already implemented for the
37365 <command>pipe</command> transport, it seemed sensible not to change it.)
37366 </para>
37367 <para>
37368 <indexterm role="variable">
37369 <primary><varname>$host</varname></primary>
37370 </indexterm>
37371 <indexterm role="variable">
37372 <primary><varname>$host_address</varname></primary>
37373 </indexterm>
37374 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
37375 transport is a remote one. They contain the name and IP address of the host to
37376 which the message is being sent. For example:
37377 </para>
37378 <literallayout class="monospaced">
37379 transport_filter = /some/directory/transport-filter.pl \
37380   $host $host_address $sender_address $pipe_addresses
37381 </literallayout>
37382 <para>
37383 Two problems arise if you want to use more complicated expansion items to
37384 generate transport filter commands, both of which due to the fact that the
37385 command is split up <emphasis>before</emphasis> expansion.
37386 </para>
37387 <itemizedlist>
37388 <listitem>
37389 <para>
37390 If an expansion item contains white space, you must quote it, so that it is all
37391 part of the same command item. If the entire option setting is one such
37392 expansion item, you have to take care what kind of quoting you use. For
37393 example:
37394 </para>
37395 <literallayout class="monospaced">
37396 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
37397 </literallayout>
37398 <para>
37399 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
37400 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
37401 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
37402 the single quotes were missing, the line would be split into two items,
37403 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
37404 Exim tried to expand the first one.
37405 </para>
37406 </listitem>
37407 <listitem>
37408 <para>
37409 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
37410 expansion cannot generate multiple arguments, or a command name followed by
37411 arguments. Consider this example:
37412 </para>
37413 <literallayout class="monospaced">
37414 transport_filter = ${lookup{$host}lsearch{/a/file}\
37415                     {$value}{/bin/cat}}
37416 </literallayout>
37417 <para>
37418 The result of the lookup is interpreted as the name of the command, even
37419 if it contains white space. The simplest way round this is to use a shell:
37420 </para>
37421 <literallayout class="monospaced">
37422 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
37423                                {$value}{/bin/cat}}
37424 </literallayout>
37425 </listitem>
37426 </itemizedlist>
37427 <para>
37428 The filter process is run under the same uid and gid as the normal delivery.
37429 For remote deliveries this is the Exim uid/gid by default. The command should
37430 normally yield a zero return code. Transport filters are not supposed to fail.
37431 A non-zero code is taken to mean that the transport filter encountered some
37432 serious problem. Delivery of the message is deferred; the message remains on
37433 the queue and is tried again later. It is not possible to cause a message to be
37434 bounced from a transport filter.
37435 </para>
37436 <para>
37437 If a transport filter is set on an autoreply transport, the original message is
37438 passed through the filter as it is being copied into the newly generated
37439 message, which happens if the <option>return_message</option> option is set.
37440 </para>
37441 <para>
37442 <indexterm role="option">
37443 <primary><option>transport_filter_timeout</option></primary>
37444 </indexterm>
37445 </para>
37446 <informaltable frame="all">
37447 <tgroup cols="4" colsep="0" rowsep="0">
37448 <colspec colwidth="8*" align="left"/>
37449 <colspec colwidth="6*" align="center"/>
37450 <colspec colwidth="6*" align="center"/>
37451 <colspec colwidth="6*" align="right"/>
37452 <tbody>
37453 <row>
37454 <entry><option>transport_filter_timeout</option></entry>
37455 <entry>Use: <emphasis>transports</emphasis></entry>
37456 <entry>Type: <emphasis>time</emphasis></entry>
37457 <entry>Default: <emphasis>5m</emphasis></entry>
37458 </row>
37459 </tbody>
37460 </tgroup>
37461 </informaltable>
37462 <para>
37463 <indexterm role="concept">
37464 <primary>transport</primary>
37465 <secondary>filter, timeout</secondary>
37466 </indexterm>
37467 When Exim is reading the output of a transport filter, it a applies a timeout
37468 that can be set by this option. Exceeding the timeout is normally treated as a
37469 temporary delivery failure. However, if a transport filter is used with a
37470 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
37471 way as a timeout in the pipe command itself. By default, a timeout is a hard
37472 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
37473 becomes a temporary error.
37474 </para>
37475 <para>
37476 <indexterm role="option">
37477 <primary><option>user</option></primary>
37478 </indexterm>
37479 </para>
37480 <informaltable frame="all">
37481 <tgroup cols="4" colsep="0" rowsep="0">
37482 <colspec colwidth="8*" align="left"/>
37483 <colspec colwidth="6*" align="center"/>
37484 <colspec colwidth="6*" align="center"/>
37485 <colspec colwidth="6*" align="right"/>
37486 <tbody>
37487 <row>
37488 <entry><option>user</option></entry>
37489 <entry>Use: <emphasis>transports</emphasis></entry>
37490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37491 <entry>Default: <emphasis>Exim user</emphasis></entry>
37492 </row>
37493 </tbody>
37494 </tgroup>
37495 </informaltable>
37496 <para>
37497 <indexterm role="concept">
37498 <primary>uid (user id)</primary>
37499 <secondary>local delivery</secondary>
37500 </indexterm>
37501 <indexterm role="concept">
37502 <primary>transport</primary>
37503 <secondary>user, specifying</secondary>
37504 </indexterm>
37505 This option specifies the user under whose uid the delivery process is to be
37506 run, overriding any uid that may have been set by the router. If the user is
37507 given as a name, the uid is looked up from the password data, and the
37508 associated group is taken as the value of the gid to be used if the <option>group</option>
37509 option is not set.
37510 </para>
37511 <para>
37512 For deliveries that use local transports, a user and group are normally
37513 specified explicitly or implicitly (for example, as a result of
37514 <option>check_local_user</option>) by the router or transport.
37515 </para>
37516 <para>
37517 <indexterm role="concept">
37518 <primary>hints database</primary>
37519 <secondary>access by remote transport</secondary>
37520 </indexterm>
37521 For remote transports, you should leave this option unset unless you really are
37522 sure you know what you are doing. When a remote transport is running, it needs
37523 to be able to access Exim&#x2019;s hints databases, because each host may have its own
37524 retry data.
37525 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
37526 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
37527 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
37528 </para>
37529 </chapter>
37530
37531 <chapter id="CHAPbatching">
37532 <title>Address batching in local transports</title>
37533 <titleabbrev>Address batching</titleabbrev>
37534 <para>
37535 <indexterm role="concept">
37536 <primary>transport</primary>
37537 <secondary>local; address batching in</secondary>
37538 </indexterm>
37539 The only remote transport (<command>smtp</command>) is normally configured to handle more than
37540 one address at a time, so that when several addresses are routed to the same
37541 remote host, just one copy of the message is sent. Local transports, however,
37542 normally handle one address at a time. That is, a separate instance of the
37543 transport is run for each address that is routed to the transport. A separate
37544 copy of the message is delivered each time.
37545 </para>
37546 <para>
37547 <indexterm role="concept">
37548 <primary>batched local delivery</primary>
37549 </indexterm>
37550 <indexterm role="option">
37551 <primary><option>batch_max</option></primary>
37552 </indexterm>
37553 <indexterm role="option">
37554 <primary><option>batch_id</option></primary>
37555 </indexterm>
37556 In special cases, it may be desirable to handle several addresses at once in a
37557 local transport, for example:
37558 </para>
37559 <itemizedlist>
37560 <listitem>
37561 <para>
37562 In an <command>appendfile</command> transport, when storing messages in files for later
37563 delivery by some other means, a single copy of the message with multiple
37564 recipients saves space.
37565 </para>
37566 </listitem>
37567 <listitem>
37568 <para>
37569 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
37570 a single copy saves time, and is the normal way LMTP is expected to work.
37571 </para>
37572 </listitem>
37573 <listitem>
37574 <para>
37575 In a <command>pipe</command> transport, when passing the message
37576 to a scanner program or
37577 to some other delivery mechanism such as UUCP, multiple recipients may be
37578 acceptable.
37579 </para>
37580 </listitem>
37581 </itemizedlist>
37582 <para>
37583 These three local transports all have the same options for controlling multiple
37584 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
37585 repeating the information for each transport, these options are described here.
37586 </para>
37587 <para>
37588 The <option>batch_max</option> option specifies the maximum number of addresses that can be
37589 delivered together in a single run of the transport. Its default value is one
37590 (no batching). When more than one address is routed to a transport that has a
37591 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
37592 (that is, in a single run of the transport with multiple recipients), subject
37593 to certain conditions:
37594 </para>
37595 <itemizedlist>
37596 <listitem>
37597 <para>
37598 <indexterm role="variable">
37599 <primary><varname>$local_part</varname></primary>
37600 </indexterm>
37601 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
37602 batching is possible.
37603 </para>
37604 </listitem>
37605 <listitem>
37606 <para>
37607 <indexterm role="variable">
37608 <primary><varname>$domain</varname></primary>
37609 </indexterm>
37610 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
37611 addresses with the same domain are batched.
37612 </para>
37613 </listitem>
37614 <listitem>
37615 <para>
37616 <indexterm role="concept">
37617 <primary>customizing</primary>
37618 <secondary>batching condition</secondary>
37619 </indexterm>
37620 If <option>batch_id</option> is set, it is expanded for each address, and only those
37621 addresses with the same expanded value are batched. This allows you to specify
37622 customized batching conditions. Failure of the expansion for any reason,
37623 including forced failure, disables batching, but it does not stop the delivery
37624 from taking place.
37625 </para>
37626 </listitem>
37627 <listitem>
37628 <para>
37629 Batched addresses must also have the same errors address (where to send
37630 delivery errors), the same header additions and removals, the same user and
37631 group for the transport, and if a host list is present, the first host must
37632 be the same.
37633 </para>
37634 </listitem>
37635 </itemizedlist>
37636 <para>
37637 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
37638 both when the file or pipe command is specified in the transport, and when it
37639 is specified by a <command>redirect</command> router, but all the batched addresses must of
37640 course be routed to the same file or pipe command. These two transports have an
37641 option called <option>use_bsmtp</option>, which causes them to deliver the message in
37642 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
37643 <option>check_string</option> and <option>escape_string</option> options are forced to the values
37644 </para>
37645 <literallayout class="monospaced">
37646 check_string = "."
37647 escape_string = ".."
37648 </literallayout>
37649 <para>
37650 when batched SMTP is in use. A full description of the batch SMTP mechanism is
37651 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
37652 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
37653 </para>
37654 <para>
37655 <indexterm role="concept">
37656 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
37657 </indexterm>
37658 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
37659 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
37660 that are being processed together. If you are using a batching <command>appendfile</command>
37661 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
37662 addresses is to set the <option>envelope_to_add</option> option.
37663 </para>
37664 <para>
37665 <indexterm role="concept">
37666 <primary><command>pipe</command> transport</primary>
37667 <secondary>with multiple addresses</secondary>
37668 </indexterm>
37669 <indexterm role="variable">
37670 <primary><varname>$pipe_addresses</varname></primary>
37671 </indexterm>
37672 If you are using a <command>pipe</command> transport without BSMTP, and setting the
37673 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
37674 the command. This is not a true variable; it is a bit of magic that causes each
37675 of the recipient addresses to be inserted into the command as a separate
37676 argument. This provides a way of accessing all the addresses that are being
37677 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
37678 are specified by a <command>redirect</command> router.
37679 </para>
37680 </chapter>
37681
37682 <chapter id="CHAPappendfile">
37683 <title>The appendfile transport</title>
37684 <para>
37685 <indexterm role="concept" id="IIDapptra1" class="startofrange">
37686 <primary><command>appendfile</command> transport</primary>
37687 </indexterm>
37688 <indexterm role="concept" id="IIDapptra2" class="startofrange">
37689 <primary>transports</primary>
37690 <secondary><command>appendfile</command></secondary>
37691 </indexterm>
37692 <indexterm role="concept">
37693 <primary>directory creation</primary>
37694 </indexterm>
37695 <indexterm role="concept">
37696 <primary>creating directories</primary>
37697 </indexterm>
37698 The <command>appendfile</command> transport delivers a message by appending it to an existing
37699 file, or by creating an entirely new file in a specified directory. Single
37700 files to which messages are appended can be in the traditional Unix mailbox
37701 format, or optionally in the MBX format supported by the Pine MUA and
37702 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
37703 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
37704 to give added protection against failures that happen part-way through the
37705 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
37706 supported. For all file formats, Exim attempts to create as many levels of
37707 directory as necessary, provided that <option>create_directory</option> is set.
37708 </para>
37709 <para>
37710 The code for the optional formats is not included in the Exim binary by
37711 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
37712 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
37713 included.
37714 </para>
37715 <para>
37716 <indexterm role="concept">
37717 <primary>quota</primary>
37718 <secondary>system</secondary>
37719 </indexterm>
37720 Exim recognizes system quota errors, and generates an appropriate message. Exim
37721 also supports its own quota control within the transport, for use when the
37722 system facility is unavailable or cannot be used for some reason.
37723 </para>
37724 <para>
37725 If there is an error while appending to a file (for example, quota exceeded or
37726 partition filled), Exim attempts to reset the file&#x2019;s length and last
37727 modification time back to what they were before. If there is an error while
37728 creating an entirely new file, the new file is removed.
37729 </para>
37730 <para>
37731 Before appending to a file, a number of security checks are made, and the
37732 file is locked. A detailed description is given below, after the list of
37733 private options.
37734 </para>
37735 <para>
37736 The <command>appendfile</command> transport is most commonly used for local deliveries to
37737 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
37738 putting messages into files for remote delivery by some means other than Exim.
37739 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
37740 option).
37741 </para>
37742 <section id="SECTfildiropt">
37743 <title>The file and directory options</title>
37744 <para>
37745 The <option>file</option> option specifies a single file, to which the message is appended;
37746 the <option>directory</option> option specifies a directory, in which a new file containing
37747 the message is created. Only one of these two options can be set, and for
37748 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
37749 </para>
37750 <para>
37751 <indexterm role="variable">
37752 <primary><varname>$address_file</varname></primary>
37753 </indexterm>
37754 <indexterm role="variable">
37755 <primary><varname>$local_part</varname></primary>
37756 </indexterm>
37757 However, <command>appendfile</command> is also used for delivering messages to files or
37758 directories whose names (or parts of names) are obtained from alias,
37759 forwarding, or filtering operations (for example, a <option>save</option> command in a
37760 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
37761 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
37762 name (or partial name) of the file or directory generated by the redirection
37763 operation. There are two cases:
37764 </para>
37765 <itemizedlist>
37766 <listitem>
37767 <para>
37768 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
37769 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
37770 common case when users with local accounts use filtering to sort mail into
37771 different folders. See for example, the <command>address_file</command> transport in the
37772 default configuration. If the path ends with a slash, it is assumed to be the
37773 name of a directory. A delivery to a directory can also be forced by setting
37774 <option>maildir_format</option> or <option>mailstore_format</option>.
37775 </para>
37776 </listitem>
37777 <listitem>
37778 <para>
37779 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
37780 used to determine the file or directory name for the delivery. Normally, the
37781 contents of <varname>$address_file</varname> are used in some way in the string expansion.
37782 </para>
37783 </listitem>
37784 </itemizedlist>
37785 <para>
37786 <indexterm role="concept">
37787 <primary>Sieve filter</primary>
37788 <secondary>configuring <command>appendfile</command></secondary>
37789 </indexterm>
37790 <indexterm role="concept">
37791 <primary>Sieve filter</primary>
37792 <secondary>relative mailbox path handling</secondary>
37793 </indexterm>
37794 As an example of the second case, consider an environment where users do not
37795 have home directories. They may be permitted to use Exim filter commands of the
37796 form:
37797 </para>
37798 <literallayout class="monospaced">
37799 save folder23
37800 </literallayout>
37801 <para>
37802 or Sieve filter commands of the form:
37803 </para>
37804 <literallayout class="monospaced">
37805 require "fileinto";
37806 fileinto "folder23";
37807 </literallayout>
37808 <para>
37809 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
37810 must transform the relative path into an appropriate absolute file name. In the
37811 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
37812 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
37813 way of handling this requirement:
37814 </para>
37815 <literallayout class="monospaced">
37816 file = ${if eq{$address_file}{inbox} \
37817             {/var/mail/$local_part} \
37818             {${if eq{${substr_0_1:$address_file}}{/} \
37819                   {$address_file} \
37820                   {$home/mail/$address_file} \
37821             }} \
37822        }
37823 </literallayout>
37824 <para>
37825 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
37826 location, absolute paths are used without change, and other folders are in the
37827 <filename>mail</filename> directory within the home directory.
37828 </para>
37829 <para>
37830 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
37831 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
37832 the router. In particular, this is the case if <option>check_local_user</option> is set. If
37833 you want to prevent this happening at routing time, you can set
37834 <option>router_home_directory</option> empty. This forces the router to pass the relative
37835 path to the transport.
37836 </para>
37837 <para>
37838 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
37839 the <option>file</option> or <option>directory</option> option is still used if it is set.
37840 </para>
37841 </section>
37842 <section id="SECID134">
37843 <title>Private options for appendfile</title>
37844 <para>
37845 <indexterm role="concept">
37846 <primary>options</primary>
37847 <secondary><command>appendfile</command> transport</secondary>
37848 </indexterm>
37849 </para>
37850 <para>
37851 <indexterm role="option">
37852 <primary><option>allow_fifo</option></primary>
37853 </indexterm>
37854 </para>
37855 <informaltable frame="all">
37856 <tgroup cols="4" colsep="0" rowsep="0">
37857 <colspec colwidth="8*" align="left"/>
37858 <colspec colwidth="6*" align="center"/>
37859 <colspec colwidth="6*" align="center"/>
37860 <colspec colwidth="6*" align="right"/>
37861 <tbody>
37862 <row>
37863 <entry><option>allow_fifo</option></entry>
37864 <entry>Use: <emphasis>appendfile</emphasis></entry>
37865 <entry>Type: <emphasis>boolean</emphasis></entry>
37866 <entry>Default: <emphasis>false</emphasis></entry>
37867 </row>
37868 </tbody>
37869 </tgroup>
37870 </informaltable>
37871 <para>
37872 <indexterm role="concept">
37873 <primary>fifo (named pipe)</primary>
37874 </indexterm>
37875 <indexterm role="concept">
37876 <primary>named pipe (fifo)</primary>
37877 </indexterm>
37878 <indexterm role="concept">
37879 <primary>pipe</primary>
37880 <secondary>named (fifo)</secondary>
37881 </indexterm>
37882 Setting this option permits delivery to named pipes (FIFOs) as well as to
37883 regular files. If no process is reading the named pipe at delivery time, the
37884 delivery is deferred.
37885 </para>
37886 <para>
37887 <indexterm role="option">
37888 <primary><option>allow_symlink</option></primary>
37889 </indexterm>
37890 </para>
37891 <informaltable frame="all">
37892 <tgroup cols="4" colsep="0" rowsep="0">
37893 <colspec colwidth="8*" align="left"/>
37894 <colspec colwidth="6*" align="center"/>
37895 <colspec colwidth="6*" align="center"/>
37896 <colspec colwidth="6*" align="right"/>
37897 <tbody>
37898 <row>
37899 <entry><option>allow_symlink</option></entry>
37900 <entry>Use: <emphasis>appendfile</emphasis></entry>
37901 <entry>Type: <emphasis>boolean</emphasis></entry>
37902 <entry>Default: <emphasis>false</emphasis></entry>
37903 </row>
37904 </tbody>
37905 </tgroup>
37906 </informaltable>
37907 <para>
37908 <indexterm role="concept">
37909 <primary>symbolic link</primary>
37910 <secondary>to mailbox</secondary>
37911 </indexterm>
37912 <indexterm role="concept">
37913 <primary>mailbox</primary>
37914 <secondary>symbolic link</secondary>
37915 </indexterm>
37916 By default, <command>appendfile</command> will not deliver if the path name for the file is
37917 that of a symbolic link. Setting this option relaxes that constraint, but there
37918 are security issues involved in the use of symbolic links. Be sure you know
37919 what you are doing if you set this. Details of exactly what this option affects
37920 are included in the discussion which follows this list of options.
37921 </para>
37922 <para>
37923 <indexterm role="option">
37924 <primary><option>batch_id</option></primary>
37925 </indexterm>
37926 </para>
37927 <informaltable frame="all">
37928 <tgroup cols="4" colsep="0" rowsep="0">
37929 <colspec colwidth="8*" align="left"/>
37930 <colspec colwidth="6*" align="center"/>
37931 <colspec colwidth="6*" align="center"/>
37932 <colspec colwidth="6*" align="right"/>
37933 <tbody>
37934 <row>
37935 <entry><option>batch_id</option></entry>
37936 <entry>Use: <emphasis>appendfile</emphasis></entry>
37937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37938 <entry>Default: <emphasis>unset</emphasis></entry>
37939 </row>
37940 </tbody>
37941 </tgroup>
37942 </informaltable>
37943 <para>
37944 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37945 However, batching is automatically disabled for <command>appendfile</command> deliveries that
37946 happen as a result of forwarding or aliasing or other redirection directly to a
37947 file.
37948 </para>
37949 <para>
37950 <indexterm role="option">
37951 <primary><option>batch_max</option></primary>
37952 </indexterm>
37953 </para>
37954 <informaltable frame="all">
37955 <tgroup cols="4" colsep="0" rowsep="0">
37956 <colspec colwidth="8*" align="left"/>
37957 <colspec colwidth="6*" align="center"/>
37958 <colspec colwidth="6*" align="center"/>
37959 <colspec colwidth="6*" align="right"/>
37960 <tbody>
37961 <row>
37962 <entry><option>batch_max</option></entry>
37963 <entry>Use: <emphasis>appendfile</emphasis></entry>
37964 <entry>Type: <emphasis>integer</emphasis></entry>
37965 <entry>Default: <emphasis>1</emphasis></entry>
37966 </row>
37967 </tbody>
37968 </tgroup>
37969 </informaltable>
37970 <para>
37971 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37972 </para>
37973 <para>
37974 <indexterm role="option">
37975 <primary><option>check_group</option></primary>
37976 </indexterm>
37977 </para>
37978 <informaltable frame="all">
37979 <tgroup cols="4" colsep="0" rowsep="0">
37980 <colspec colwidth="8*" align="left"/>
37981 <colspec colwidth="6*" align="center"/>
37982 <colspec colwidth="6*" align="center"/>
37983 <colspec colwidth="6*" align="right"/>
37984 <tbody>
37985 <row>
37986 <entry><option>check_group</option></entry>
37987 <entry>Use: <emphasis>appendfile</emphasis></entry>
37988 <entry>Type: <emphasis>boolean</emphasis></entry>
37989 <entry>Default: <emphasis>false</emphasis></entry>
37990 </row>
37991 </tbody>
37992 </tgroup>
37993 </informaltable>
37994 <para>
37995 When this option is set, the group owner of the file defined by the <option>file</option>
37996 option is checked to see that it is the same as the group under which the
37997 delivery process is running. The default setting is false because the default
37998 file mode is 0600, which means that the group is irrelevant.
37999 </para>
38000 <para>
38001 <indexterm role="option">
38002 <primary><option>check_owner</option></primary>
38003 </indexterm>
38004 </para>
38005 <informaltable frame="all">
38006 <tgroup cols="4" colsep="0" rowsep="0">
38007 <colspec colwidth="8*" align="left"/>
38008 <colspec colwidth="6*" align="center"/>
38009 <colspec colwidth="6*" align="center"/>
38010 <colspec colwidth="6*" align="right"/>
38011 <tbody>
38012 <row>
38013 <entry><option>check_owner</option></entry>
38014 <entry>Use: <emphasis>appendfile</emphasis></entry>
38015 <entry>Type: <emphasis>boolean</emphasis></entry>
38016 <entry>Default: <emphasis>true</emphasis></entry>
38017 </row>
38018 </tbody>
38019 </tgroup>
38020 </informaltable>
38021 <para>
38022 When this option is set, the owner of the file defined by the <option>file</option> option
38023 is checked to ensure that it is the same as the user under which the delivery
38024 process is running.
38025 </para>
38026 <para>
38027 <indexterm role="option">
38028 <primary><option>check_string</option></primary>
38029 </indexterm>
38030 </para>
38031 <informaltable frame="all">
38032 <tgroup cols="4" colsep="0" rowsep="0">
38033 <colspec colwidth="8*" align="left"/>
38034 <colspec colwidth="6*" align="center"/>
38035 <colspec colwidth="6*" align="center"/>
38036 <colspec colwidth="6*" align="right"/>
38037 <tbody>
38038 <row>
38039 <entry><option>check_string</option></entry>
38040 <entry>Use: <emphasis>appendfile</emphasis></entry>
38041 <entry>Type: <emphasis>string</emphasis></entry>
38042 <entry>Default: <emphasis>see below</emphasis></entry>
38043 </row>
38044 </tbody>
38045 </tgroup>
38046 </informaltable>
38047 <para>
38048 <indexterm role="concept">
38049 <primary><quote>From</quote> line</primary>
38050 </indexterm>
38051 As <command>appendfile</command> writes the message, the start of each line is tested for
38052 matching <option>check_string</option>, and if it does, the initial matching characters are
38053 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
38054 a literal string, not a regular expression, and the case of any letters it
38055 contains is significant.
38056 </para>
38057 <para>
38058 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
38059 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
38060 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
38061 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
38062 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
38063 </para>
38064 <para>
38065 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
38066 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
38067 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
38068 if another format is used. For example, to deliver to mailboxes in MMDF format:
38069 <indexterm role="concept">
38070 <primary>MMDF format mailbox</primary>
38071 </indexterm>
38072 <indexterm role="concept">
38073 <primary>mailbox</primary>
38074 <secondary>MMDF format</secondary>
38075 </indexterm>
38076 </para>
38077 <literallayout class="monospaced">
38078 check_string = "\1\1\1\1\n"
38079 escape_string = "\1\1\1\1 \n"
38080 message_prefix = "\1\1\1\1\n"
38081 message_suffix = "\1\1\1\1\n"
38082 </literallayout>
38083 <para>
38084 <indexterm role="option">
38085 <primary><option>create_directory</option></primary>
38086 </indexterm>
38087 </para>
38088 <informaltable frame="all">
38089 <tgroup cols="4" colsep="0" rowsep="0">
38090 <colspec colwidth="8*" align="left"/>
38091 <colspec colwidth="6*" align="center"/>
38092 <colspec colwidth="6*" align="center"/>
38093 <colspec colwidth="6*" align="right"/>
38094 <tbody>
38095 <row>
38096 <entry><option>create_directory</option></entry>
38097 <entry>Use: <emphasis>appendfile</emphasis></entry>
38098 <entry>Type: <emphasis>boolean</emphasis></entry>
38099 <entry>Default: <emphasis>true</emphasis></entry>
38100 </row>
38101 </tbody>
38102 </tgroup>
38103 </informaltable>
38104 <para>
38105 <indexterm role="concept">
38106 <primary>directory creation</primary>
38107 </indexterm>
38108 When this option is true, Exim attempts to create any missing superior
38109 directories for the file that it is about to write. A created directory&#x2019;s mode
38110 is given by the <option>directory_mode</option> option.
38111 </para>
38112 <para>
38113 The group ownership of a newly created directory is highly dependent on the
38114 operating system (and possibly the file system) that is being used. For
38115 example, in Solaris, if the parent directory has the setgid bit set, its group
38116 is propagated to the child; if not, the currently set group is used. However,
38117 in FreeBSD, the parent&#x2019;s group is always used.
38118 </para>
38119 <para>
38120 <indexterm role="option">
38121 <primary><option>create_file</option></primary>
38122 </indexterm>
38123 </para>
38124 <informaltable frame="all">
38125 <tgroup cols="4" colsep="0" rowsep="0">
38126 <colspec colwidth="8*" align="left"/>
38127 <colspec colwidth="6*" align="center"/>
38128 <colspec colwidth="6*" align="center"/>
38129 <colspec colwidth="6*" align="right"/>
38130 <tbody>
38131 <row>
38132 <entry><option>create_file</option></entry>
38133 <entry>Use: <emphasis>appendfile</emphasis></entry>
38134 <entry>Type: <emphasis>string</emphasis></entry>
38135 <entry>Default: <emphasis>anywhere</emphasis></entry>
38136 </row>
38137 </tbody>
38138 </tgroup>
38139 </informaltable>
38140 <para>
38141 This option constrains the location of files and directories that are created
38142 by this transport. It applies to files defined by the <option>file</option> option and
38143 directories defined by the <option>directory</option> option. In the case of maildir
38144 delivery, it applies to the top level directory, not the maildir directories
38145 beneath.
38146 </para>
38147 <para>
38148 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
38149 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
38150 set for the transport. This option is not useful when an explicit file name is
38151 given for normal mailbox deliveries. It is intended for the case when file
38152 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
38153 by an <command>appendfile</command> transport called <option>address_file</option>. See also
38154 <option>file_must_exist</option>.
38155 </para>
38156 <para>
38157 <indexterm role="option">
38158 <primary><option>directory</option></primary>
38159 </indexterm>
38160 </para>
38161 <informaltable frame="all">
38162 <tgroup cols="4" colsep="0" rowsep="0">
38163 <colspec colwidth="8*" align="left"/>
38164 <colspec colwidth="6*" align="center"/>
38165 <colspec colwidth="6*" align="center"/>
38166 <colspec colwidth="6*" align="right"/>
38167 <tbody>
38168 <row>
38169 <entry><option>directory</option></entry>
38170 <entry>Use: <emphasis>appendfile</emphasis></entry>
38171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38172 <entry>Default: <emphasis>unset</emphasis></entry>
38173 </row>
38174 </tbody>
38175 </tgroup>
38176 </informaltable>
38177 <para>
38178 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
38179 or <option>directory</option> must be set, unless the delivery is the direct result of a
38180 redirection (see section <xref linkend="SECTfildiropt"/>).
38181 </para>
38182 <para>
38183 When <option>directory</option> is set, the string is expanded, and the message is delivered
38184 into a new file or files in or below the given directory, instead of being
38185 appended to a single mailbox file. A number of different formats are provided
38186 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
38187 <xref linkend="SECTopdir"/> for further details of this form of delivery.
38188 </para>
38189 <para>
38190 <indexterm role="option">
38191 <primary><option>directory_file</option></primary>
38192 </indexterm>
38193 </para>
38194 <informaltable frame="all">
38195 <tgroup cols="4" colsep="0" rowsep="0">
38196 <colspec colwidth="8*" align="left"/>
38197 <colspec colwidth="6*" align="center"/>
38198 <colspec colwidth="6*" align="center"/>
38199 <colspec colwidth="6*" align="right"/>
38200 <tbody>
38201 <row>
38202 <entry><option>directory_file</option></entry>
38203 <entry>Use: <emphasis>appendfile</emphasis></entry>
38204 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38205 <entry>Default: <emphasis>see below</emphasis></entry>
38206 </row>
38207 </tbody>
38208 </tgroup>
38209 </informaltable>
38210 <para>
38211 <indexterm role="concept">
38212 <primary>base62</primary>
38213 </indexterm>
38214 <indexterm role="variable">
38215 <primary><varname>$inode</varname></primary>
38216 </indexterm>
38217 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
38218 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
38219 whose name is obtained by expanding this string. The default value is:
38220 </para>
38221 <literallayout class="monospaced">
38222 q${base62:$tod_epoch}-$inode
38223 </literallayout>
38224 <para>
38225 This generates a unique name from the current time, in base 62 form, and the
38226 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
38227 option.
38228 </para>
38229 <para>
38230 <indexterm role="option">
38231 <primary><option>directory_mode</option></primary>
38232 </indexterm>
38233 </para>
38234 <informaltable frame="all">
38235 <tgroup cols="4" colsep="0" rowsep="0">
38236 <colspec colwidth="8*" align="left"/>
38237 <colspec colwidth="6*" align="center"/>
38238 <colspec colwidth="6*" align="center"/>
38239 <colspec colwidth="6*" align="right"/>
38240 <tbody>
38241 <row>
38242 <entry><option>directory_mode</option></entry>
38243 <entry>Use: <emphasis>appendfile</emphasis></entry>
38244 <entry>Type: <emphasis>octal integer</emphasis></entry>
38245 <entry>Default: <emphasis>0700</emphasis></entry>
38246 </row>
38247 </tbody>
38248 </tgroup>
38249 </informaltable>
38250 <para>
38251 If <command>appendfile</command> creates any directories as a result of the
38252 <option>create_directory</option> option, their mode is specified by this option.
38253 </para>
38254 <para>
38255 <indexterm role="option">
38256 <primary><option>escape_string</option></primary>
38257 </indexterm>
38258 </para>
38259 <informaltable frame="all">
38260 <tgroup cols="4" colsep="0" rowsep="0">
38261 <colspec colwidth="8*" align="left"/>
38262 <colspec colwidth="6*" align="center"/>
38263 <colspec colwidth="6*" align="center"/>
38264 <colspec colwidth="6*" align="right"/>
38265 <tbody>
38266 <row>
38267 <entry><option>escape_string</option></entry>
38268 <entry>Use: <emphasis>appendfile</emphasis></entry>
38269 <entry>Type: <emphasis>string</emphasis></entry>
38270 <entry>Default: <emphasis>see description</emphasis></entry>
38271 </row>
38272 </tbody>
38273 </tgroup>
38274 </informaltable>
38275 <para>
38276 See <option>check_string</option> above.
38277 </para>
38278 <para>
38279 <indexterm role="option">
38280 <primary><option>file</option></primary>
38281 </indexterm>
38282 </para>
38283 <informaltable frame="all">
38284 <tgroup cols="4" colsep="0" rowsep="0">
38285 <colspec colwidth="8*" align="left"/>
38286 <colspec colwidth="6*" align="center"/>
38287 <colspec colwidth="6*" align="center"/>
38288 <colspec colwidth="6*" align="right"/>
38289 <tbody>
38290 <row>
38291 <entry><option>file</option></entry>
38292 <entry>Use: <emphasis>appendfile</emphasis></entry>
38293 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38294 <entry>Default: <emphasis>unset</emphasis></entry>
38295 </row>
38296 </tbody>
38297 </tgroup>
38298 </informaltable>
38299 <para>
38300 This option is mutually exclusive with the <option>directory</option> option, but one of
38301 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
38302 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
38303 specifies a single file, to which the message is appended. One or more of
38304 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
38305 <option>file</option>.
38306 </para>
38307 <para>
38308 <indexterm role="concept">
38309 <primary>NFS</primary>
38310 <secondary>lock file</secondary>
38311 </indexterm>
38312 <indexterm role="concept">
38313 <primary>locking files</primary>
38314 </indexterm>
38315 <indexterm role="concept">
38316 <primary>lock files</primary>
38317 </indexterm>
38318 If you are using more than one host to deliver over NFS into the same
38319 mailboxes, you should always use lock files.
38320 </para>
38321 <para>
38322 The string value is expanded for each delivery, and must yield an absolute
38323 path. The most common settings of this option are variations on one of these
38324 examples:
38325 </para>
38326 <literallayout class="monospaced">
38327 file = /var/spool/mail/$local_part
38328 file = /home/$local_part/inbox
38329 file = $home/inbox
38330 </literallayout>
38331 <para>
38332 <indexterm role="concept">
38333 <primary><quote>sticky</quote> bit</primary>
38334 </indexterm>
38335 In the first example, all deliveries are done into the same directory. If Exim
38336 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
38337 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
38338 deliveries to be possible, or alternatively the <option>group</option> option can be used to
38339 run the delivery under a group id which has write access to the directory.
38340 </para>
38341 <para>
38342 <indexterm role="option">
38343 <primary><option>file_format</option></primary>
38344 </indexterm>
38345 </para>
38346 <informaltable frame="all">
38347 <tgroup cols="4" colsep="0" rowsep="0">
38348 <colspec colwidth="8*" align="left"/>
38349 <colspec colwidth="6*" align="center"/>
38350 <colspec colwidth="6*" align="center"/>
38351 <colspec colwidth="6*" align="right"/>
38352 <tbody>
38353 <row>
38354 <entry><option>file_format</option></entry>
38355 <entry>Use: <emphasis>appendfile</emphasis></entry>
38356 <entry>Type: <emphasis>string</emphasis></entry>
38357 <entry>Default: <emphasis>unset</emphasis></entry>
38358 </row>
38359 </tbody>
38360 </tgroup>
38361 </informaltable>
38362 <para>
38363 <indexterm role="concept">
38364 <primary>file</primary>
38365 <secondary>mailbox; checking existing format</secondary>
38366 </indexterm>
38367 This option requests the transport to check the format of an existing file
38368 before adding to it. The check consists of matching a specific string at the
38369 start of the file. The value of the option consists of an even number of
38370 colon-separated strings. The first of each pair is the test string, and the
38371 second is the name of a transport. If the transport associated with a matched
38372 string is not the current transport, control is passed over to the other
38373 transport. For example, suppose the standard <command>local_delivery</command> transport has
38374 this added to it:
38375 </para>
38376 <literallayout class="monospaced">
38377 file_format = "From       : local_delivery :\
38378                \1\1\1\1\n : local_mmdf_delivery"
38379 </literallayout>
38380 <para>
38381 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
38382 a mailbox begins with four binary ones followed by a newline, control is passed
38383 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
38384 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
38385 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
38386 match any string, or if the transport named for a given string is not defined,
38387 delivery is deferred.
38388 </para>
38389 <para>
38390 <indexterm role="option">
38391 <primary><option>file_must_exist</option></primary>
38392 </indexterm>
38393 </para>
38394 <informaltable frame="all">
38395 <tgroup cols="4" colsep="0" rowsep="0">
38396 <colspec colwidth="8*" align="left"/>
38397 <colspec colwidth="6*" align="center"/>
38398 <colspec colwidth="6*" align="center"/>
38399 <colspec colwidth="6*" align="right"/>
38400 <tbody>
38401 <row>
38402 <entry><option>file_must_exist</option></entry>
38403 <entry>Use: <emphasis>appendfile</emphasis></entry>
38404 <entry>Type: <emphasis>boolean</emphasis></entry>
38405 <entry>Default: <emphasis>false</emphasis></entry>
38406 </row>
38407 </tbody>
38408 </tgroup>
38409 </informaltable>
38410 <para>
38411 If this option is true, the file specified by the <option>file</option> option must exist.
38412 A temporary error occurs if it does not, causing delivery to be deferred.
38413 If this option is false, the file is created if it does not exist.
38414 </para>
38415 <para>
38416 <indexterm role="option">
38417 <primary><option>lock_fcntl_timeout</option></primary>
38418 </indexterm>
38419 </para>
38420 <informaltable frame="all">
38421 <tgroup cols="4" colsep="0" rowsep="0">
38422 <colspec colwidth="8*" align="left"/>
38423 <colspec colwidth="6*" align="center"/>
38424 <colspec colwidth="6*" align="center"/>
38425 <colspec colwidth="6*" align="right"/>
38426 <tbody>
38427 <row>
38428 <entry><option>lock_fcntl_timeout</option></entry>
38429 <entry>Use: <emphasis>appendfile</emphasis></entry>
38430 <entry>Type: <emphasis>time</emphasis></entry>
38431 <entry>Default: <emphasis>0s</emphasis></entry>
38432 </row>
38433 </tbody>
38434 </tgroup>
38435 </informaltable>
38436 <para>
38437 <indexterm role="concept">
38438 <primary>timeout</primary>
38439 <secondary>mailbox locking</secondary>
38440 </indexterm>
38441 <indexterm role="concept">
38442 <primary>mailbox</primary>
38443 <secondary>locking, blocking and non-blocking</secondary>
38444 </indexterm>
38445 <indexterm role="concept">
38446 <primary>locking files</primary>
38447 </indexterm>
38448 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
38449 when locking an open mailbox file. If the call fails, the delivery process
38450 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
38451 Non-blocking calls are used so that the file is not kept open during the wait
38452 for the lock; the reason for this is to make it as safe as possible for
38453 deliveries over NFS in the case when processes might be accessing an NFS
38454 mailbox without using a lock file. This should not be done, but
38455 misunderstandings and hence misconfigurations are not unknown.
38456 </para>
38457 <para>
38458 On a busy system, however, the performance of a non-blocking lock approach is
38459 not as good as using a blocking lock with a timeout. In this case, the waiting
38460 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
38461 and can proceed as soon as the previous lock holder releases it.
38462 </para>
38463 <para>
38464 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
38465 timeout, are used. There may still be some retrying: the maximum number of
38466 retries is
38467 </para>
38468 <literallayout class="monospaced">
38469 (lock_retries * lock_interval) / lock_fcntl_timeout
38470 </literallayout>
38471 <para>
38472 rounded up to the next whole number. In other words, the total time during
38473 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
38474 <option>lock_fcntl_timeout</option> is set very large.
38475 </para>
38476 <para>
38477 You should consider setting this option if you are getting a lot of delayed
38478 local deliveries because of errors of the form
38479 </para>
38480 <literallayout class="monospaced">
38481 failed to lock mailbox /some/file (fcntl)
38482 </literallayout>
38483 <para>
38484 <indexterm role="option">
38485 <primary><option>lock_flock_timeout</option></primary>
38486 </indexterm>
38487 </para>
38488 <informaltable frame="all">
38489 <tgroup cols="4" colsep="0" rowsep="0">
38490 <colspec colwidth="8*" align="left"/>
38491 <colspec colwidth="6*" align="center"/>
38492 <colspec colwidth="6*" align="center"/>
38493 <colspec colwidth="6*" align="right"/>
38494 <tbody>
38495 <row>
38496 <entry><option>lock_flock_timeout</option></entry>
38497 <entry>Use: <emphasis>appendfile</emphasis></entry>
38498 <entry>Type: <emphasis>time</emphasis></entry>
38499 <entry>Default: <emphasis>0s</emphasis></entry>
38500 </row>
38501 </tbody>
38502 </tgroup>
38503 </informaltable>
38504 <para>
38505 This timeout applies to file locking when using <function>flock()</function> (see
38506 <option>use_flock</option>); the timeout operates in a similar manner to
38507 <option>lock_fcntl_timeout</option>.
38508 </para>
38509 <para>
38510 <indexterm role="option">
38511 <primary><option>lock_interval</option></primary>
38512 </indexterm>
38513 </para>
38514 <informaltable frame="all">
38515 <tgroup cols="4" colsep="0" rowsep="0">
38516 <colspec colwidth="8*" align="left"/>
38517 <colspec colwidth="6*" align="center"/>
38518 <colspec colwidth="6*" align="center"/>
38519 <colspec colwidth="6*" align="right"/>
38520 <tbody>
38521 <row>
38522 <entry><option>lock_interval</option></entry>
38523 <entry>Use: <emphasis>appendfile</emphasis></entry>
38524 <entry>Type: <emphasis>time</emphasis></entry>
38525 <entry>Default: <emphasis>3s</emphasis></entry>
38526 </row>
38527 </tbody>
38528 </tgroup>
38529 </informaltable>
38530 <para>
38531 This specifies the time to wait between attempts to lock the file. See below
38532 for details of locking.
38533 </para>
38534 <para>
38535 <indexterm role="option">
38536 <primary><option>lock_retries</option></primary>
38537 </indexterm>
38538 </para>
38539 <informaltable frame="all">
38540 <tgroup cols="4" colsep="0" rowsep="0">
38541 <colspec colwidth="8*" align="left"/>
38542 <colspec colwidth="6*" align="center"/>
38543 <colspec colwidth="6*" align="center"/>
38544 <colspec colwidth="6*" align="right"/>
38545 <tbody>
38546 <row>
38547 <entry><option>lock_retries</option></entry>
38548 <entry>Use: <emphasis>appendfile</emphasis></entry>
38549 <entry>Type: <emphasis>integer</emphasis></entry>
38550 <entry>Default: <emphasis>10</emphasis></entry>
38551 </row>
38552 </tbody>
38553 </tgroup>
38554 </informaltable>
38555 <para>
38556 This specifies the maximum number of attempts to lock the file. A value of zero
38557 is treated as 1. See below for details of locking.
38558 </para>
38559 <para>
38560 <indexterm role="option">
38561 <primary><option>lockfile_mode</option></primary>
38562 </indexterm>
38563 </para>
38564 <informaltable frame="all">
38565 <tgroup cols="4" colsep="0" rowsep="0">
38566 <colspec colwidth="8*" align="left"/>
38567 <colspec colwidth="6*" align="center"/>
38568 <colspec colwidth="6*" align="center"/>
38569 <colspec colwidth="6*" align="right"/>
38570 <tbody>
38571 <row>
38572 <entry><option>lockfile_mode</option></entry>
38573 <entry>Use: <emphasis>appendfile</emphasis></entry>
38574 <entry>Type: <emphasis>octal integer</emphasis></entry>
38575 <entry>Default: <emphasis>0600</emphasis></entry>
38576 </row>
38577 </tbody>
38578 </tgroup>
38579 </informaltable>
38580 <para>
38581 This specifies the mode of the created lock file, when a lock file is being
38582 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
38583 </para>
38584 <para>
38585 <indexterm role="option">
38586 <primary><option>lockfile_timeout</option></primary>
38587 </indexterm>
38588 </para>
38589 <informaltable frame="all">
38590 <tgroup cols="4" colsep="0" rowsep="0">
38591 <colspec colwidth="8*" align="left"/>
38592 <colspec colwidth="6*" align="center"/>
38593 <colspec colwidth="6*" align="center"/>
38594 <colspec colwidth="6*" align="right"/>
38595 <tbody>
38596 <row>
38597 <entry><option>lockfile_timeout</option></entry>
38598 <entry>Use: <emphasis>appendfile</emphasis></entry>
38599 <entry>Type: <emphasis>time</emphasis></entry>
38600 <entry>Default: <emphasis>30m</emphasis></entry>
38601 </row>
38602 </tbody>
38603 </tgroup>
38604 </informaltable>
38605 <para>
38606 <indexterm role="concept">
38607 <primary>timeout</primary>
38608 <secondary>mailbox locking</secondary>
38609 </indexterm>
38610 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
38611 exists and is older than this value, it is assumed to have been left behind by
38612 accident, and Exim attempts to remove it.
38613 </para>
38614 <para>
38615 <indexterm role="option">
38616 <primary><option>mailbox_filecount</option></primary>
38617 </indexterm>
38618 </para>
38619 <informaltable frame="all">
38620 <tgroup cols="4" colsep="0" rowsep="0">
38621 <colspec colwidth="8*" align="left"/>
38622 <colspec colwidth="6*" align="center"/>
38623 <colspec colwidth="6*" align="center"/>
38624 <colspec colwidth="6*" align="right"/>
38625 <tbody>
38626 <row>
38627 <entry><option>mailbox_filecount</option></entry>
38628 <entry>Use: <emphasis>appendfile</emphasis></entry>
38629 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38630 <entry>Default: <emphasis>unset</emphasis></entry>
38631 </row>
38632 </tbody>
38633 </tgroup>
38634 </informaltable>
38635 <para>
38636 <indexterm role="concept">
38637 <primary>mailbox</primary>
38638 <secondary>specifying size of</secondary>
38639 </indexterm>
38640 <indexterm role="concept">
38641 <primary>size</primary>
38642 <secondary>of mailbox</secondary>
38643 </indexterm>
38644 If this option is set, it is expanded, and the result is taken as the current
38645 number of files in the mailbox. It must be a decimal number, optionally
38646 followed by K or M. This provides a way of obtaining this information from an
38647 external source that maintains the data.
38648 </para>
38649 <para>
38650 <indexterm role="option">
38651 <primary><option>mailbox_size</option></primary>
38652 </indexterm>
38653 </para>
38654 <informaltable frame="all">
38655 <tgroup cols="4" colsep="0" rowsep="0">
38656 <colspec colwidth="8*" align="left"/>
38657 <colspec colwidth="6*" align="center"/>
38658 <colspec colwidth="6*" align="center"/>
38659 <colspec colwidth="6*" align="right"/>
38660 <tbody>
38661 <row>
38662 <entry><option>mailbox_size</option></entry>
38663 <entry>Use: <emphasis>appendfile</emphasis></entry>
38664 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38665 <entry>Default: <emphasis>unset</emphasis></entry>
38666 </row>
38667 </tbody>
38668 </tgroup>
38669 </informaltable>
38670 <para>
38671 <indexterm role="concept">
38672 <primary>mailbox</primary>
38673 <secondary>specifying size of</secondary>
38674 </indexterm>
38675 <indexterm role="concept">
38676 <primary>size</primary>
38677 <secondary>of mailbox</secondary>
38678 </indexterm>
38679 If this option is set, it is expanded, and the result is taken as the current
38680 size the mailbox. It must be a decimal number, optionally followed by K or M.
38681 This provides a way of obtaining this information from an external source that
38682 maintains the data. This is likely to be helpful for maildir deliveries where
38683 it is computationally expensive to compute the size of a mailbox.
38684 </para>
38685 <para>
38686 <indexterm role="option">
38687 <primary><option>maildir_format</option></primary>
38688 </indexterm>
38689 </para>
38690 <informaltable frame="all">
38691 <tgroup cols="4" colsep="0" rowsep="0">
38692 <colspec colwidth="8*" align="left"/>
38693 <colspec colwidth="6*" align="center"/>
38694 <colspec colwidth="6*" align="center"/>
38695 <colspec colwidth="6*" align="right"/>
38696 <tbody>
38697 <row>
38698 <entry><option>maildir_format</option></entry>
38699 <entry>Use: <emphasis>appendfile</emphasis></entry>
38700 <entry>Type: <emphasis>boolean</emphasis></entry>
38701 <entry>Default: <emphasis>false</emphasis></entry>
38702 </row>
38703 </tbody>
38704 </tgroup>
38705 </informaltable>
38706 <para>
38707 <indexterm role="concept">
38708 <primary>maildir format</primary>
38709 <secondary>specifying</secondary>
38710 </indexterm>
38711 If this option is set with the <option>directory</option> option, the delivery is into a new
38712 file, in the <quote>maildir</quote> format that is used by other mail software. When the
38713 transport is activated directly from a <command>redirect</command> router (for example, the
38714 <command>address_file</command> transport in the default configuration), setting
38715 <option>maildir_format</option> causes the path received from the router to be treated as a
38716 directory, whether or not it ends with <literal>/</literal>. This option is available only if
38717 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
38718 <xref linkend="SECTmaildirdelivery"/> below for further details.
38719 </para>
38720 <para>
38721 <indexterm role="option">
38722 <primary><option>maildir_quota_directory_regex</option></primary>
38723 </indexterm>
38724 </para>
38725 <informaltable frame="all">
38726 <tgroup cols="4" colsep="0" rowsep="0">
38727 <colspec colwidth="8*" align="left"/>
38728 <colspec colwidth="6*" align="center"/>
38729 <colspec colwidth="6*" align="center"/>
38730 <colspec colwidth="6*" align="right"/>
38731 <tbody>
38732 <row>
38733 <entry><option>maildir_quota_directory_regex</option></entry>
38734 <entry>Use: <emphasis>appendfile</emphasis></entry>
38735 <entry>Type: <emphasis>string</emphasis></entry>
38736 <entry>Default: <emphasis>See below</emphasis></entry>
38737 </row>
38738 </tbody>
38739 </tgroup>
38740 </informaltable>
38741 <para>
38742 <indexterm role="concept">
38743 <primary>maildir format</primary>
38744 <secondary>quota; directories included in</secondary>
38745 </indexterm>
38746 <indexterm role="concept">
38747 <primary>quota</primary>
38748 <secondary>maildir; directories included in</secondary>
38749 </indexterm>
38750 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
38751 a regular expression for specifying directories, relative to the quota
38752 directory (see <option>quota_directory</option>), that should be included in the quota
38753 calculation. The default value is:
38754 </para>
38755 <literallayout class="monospaced">
38756 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
38757 </literallayout>
38758 <para>
38759 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
38760 (directories whose names begin with a dot). If you want to exclude the
38761 <filename>Trash</filename>
38762 folder from the count (as some sites do), you need to change this setting to
38763 </para>
38764 <literallayout class="monospaced">
38765 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
38766 </literallayout>
38767 <para>
38768 This uses a negative lookahead in the regular expression to exclude the
38769 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
38770 calculations, quota processing is bypassed for any messages that are delivered
38771 directly into that directory.
38772 </para>
38773 <para>
38774 <indexterm role="option">
38775 <primary><option>maildir_retries</option></primary>
38776 </indexterm>
38777 </para>
38778 <informaltable frame="all">
38779 <tgroup cols="4" colsep="0" rowsep="0">
38780 <colspec colwidth="8*" align="left"/>
38781 <colspec colwidth="6*" align="center"/>
38782 <colspec colwidth="6*" align="center"/>
38783 <colspec colwidth="6*" align="right"/>
38784 <tbody>
38785 <row>
38786 <entry><option>maildir_retries</option></entry>
38787 <entry>Use: <emphasis>appendfile</emphasis></entry>
38788 <entry>Type: <emphasis>integer</emphasis></entry>
38789 <entry>Default: <emphasis>10</emphasis></entry>
38790 </row>
38791 </tbody>
38792 </tgroup>
38793 </informaltable>
38794 <para>
38795 This option specifies the number of times to retry when writing a file in
38796 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
38797 </para>
38798 <para>
38799 <indexterm role="option">
38800 <primary><option>maildir_tag</option></primary>
38801 </indexterm>
38802 </para>
38803 <informaltable frame="all">
38804 <tgroup cols="4" colsep="0" rowsep="0">
38805 <colspec colwidth="8*" align="left"/>
38806 <colspec colwidth="6*" align="center"/>
38807 <colspec colwidth="6*" align="center"/>
38808 <colspec colwidth="6*" align="right"/>
38809 <tbody>
38810 <row>
38811 <entry><option>maildir_tag</option></entry>
38812 <entry>Use: <emphasis>appendfile</emphasis></entry>
38813 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38814 <entry>Default: <emphasis>unset</emphasis></entry>
38815 </row>
38816 </tbody>
38817 </tgroup>
38818 </informaltable>
38819 <para>
38820 This option applies only to deliveries in maildir format, and is described in
38821 section <xref linkend="SECTmaildirdelivery"/> below.
38822 </para>
38823 <para revisionflag="changed">
38824 <indexterm role="option">
38825 <primary><option>maildir_use_size_file</option></primary>
38826 </indexterm>
38827 </para>
38828 <informaltable frame="all" revisionflag="changed">
38829 <tgroup cols="4" colsep="0" rowsep="0">
38830 <colspec colwidth="8*" align="left"/>
38831 <colspec colwidth="6*" align="center"/>
38832 <colspec colwidth="6*" align="center"/>
38833 <colspec colwidth="6*" align="right"/>
38834 <tbody>
38835 <row>
38836 <entry><option>maildir_use_size_file</option></entry>
38837 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
38838 <entry>Type: <emphasis>boolean</emphasis></entry>
38839 <entry>Default: <emphasis>false</emphasis></entry>
38840 </row>
38841 </tbody>
38842 </tgroup>
38843 </informaltable>
38844 <para revisionflag="changed">
38845 <indexterm role="concept">
38846 <primary>maildir format</primary>
38847 <secondary><filename>maildirsize</filename> file</secondary>
38848 </indexterm>
38849 The result of string expansion for this option must be a valid boolean value.
38850 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
38851 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
38852 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
38853 value is zero. See <option>maildir_quota_directory_regex</option> above and section
38854 <xref linkend="SECTmaildirdelivery"/> below for further details.
38855 </para>
38856 <para>
38857 <indexterm role="option">
38858 <primary><option>maildirfolder_create_regex</option></primary>
38859 </indexterm>
38860 </para>
38861 <informaltable frame="all">
38862 <tgroup cols="4" colsep="0" rowsep="0">
38863 <colspec colwidth="8*" align="left"/>
38864 <colspec colwidth="6*" align="center"/>
38865 <colspec colwidth="6*" align="center"/>
38866 <colspec colwidth="6*" align="right"/>
38867 <tbody>
38868 <row>
38869 <entry><option>maildirfolder_create_regex</option></entry>
38870 <entry>Use: <emphasis>appendfile</emphasis></entry>
38871 <entry>Type: <emphasis>string</emphasis></entry>
38872 <entry>Default: <emphasis>unset</emphasis></entry>
38873 </row>
38874 </tbody>
38875 </tgroup>
38876 </informaltable>
38877 <para>
38878 <indexterm role="concept">
38879 <primary>maildir format</primary>
38880 <secondary><filename>maildirfolder</filename> file</secondary>
38881 </indexterm>
38882 <indexterm role="concept">
38883 <primary><filename>maildirfolder</filename>, creating</primary>
38884 </indexterm>
38885 The value of this option is a regular expression. If it is unset, it has no
38886 effect. Otherwise, before a maildir delivery takes place, the pattern is
38887 matched against the name of the maildir directory, that is, the directory
38888 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
38889 delivery. If there is a match, Exim checks for the existence of a file called
38890 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
38891 See section <xref linkend="SECTmaildirdelivery"/> for more details.
38892 </para>
38893 <para>
38894 <indexterm role="option">
38895 <primary><option>mailstore_format</option></primary>
38896 </indexterm>
38897 </para>
38898 <informaltable frame="all">
38899 <tgroup cols="4" colsep="0" rowsep="0">
38900 <colspec colwidth="8*" align="left"/>
38901 <colspec colwidth="6*" align="center"/>
38902 <colspec colwidth="6*" align="center"/>
38903 <colspec colwidth="6*" align="right"/>
38904 <tbody>
38905 <row>
38906 <entry><option>mailstore_format</option></entry>
38907 <entry>Use: <emphasis>appendfile</emphasis></entry>
38908 <entry>Type: <emphasis>boolean</emphasis></entry>
38909 <entry>Default: <emphasis>false</emphasis></entry>
38910 </row>
38911 </tbody>
38912 </tgroup>
38913 </informaltable>
38914 <para>
38915 <indexterm role="concept">
38916 <primary>mailstore format</primary>
38917 <secondary>specifying</secondary>
38918 </indexterm>
38919 If this option is set with the <option>directory</option> option, the delivery is into two
38920 new files in  <quote>mailstore</quote> format. The option is available only if
38921 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
38922 below for further details.
38923 </para>
38924 <para>
38925 <indexterm role="option">
38926 <primary><option>mailstore_prefix</option></primary>
38927 </indexterm>
38928 </para>
38929 <informaltable frame="all">
38930 <tgroup cols="4" colsep="0" rowsep="0">
38931 <colspec colwidth="8*" align="left"/>
38932 <colspec colwidth="6*" align="center"/>
38933 <colspec colwidth="6*" align="center"/>
38934 <colspec colwidth="6*" align="right"/>
38935 <tbody>
38936 <row>
38937 <entry><option>mailstore_prefix</option></entry>
38938 <entry>Use: <emphasis>appendfile</emphasis></entry>
38939 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38940 <entry>Default: <emphasis>unset</emphasis></entry>
38941 </row>
38942 </tbody>
38943 </tgroup>
38944 </informaltable>
38945 <para>
38946 This option applies only to deliveries in mailstore format, and is described in
38947 section <xref linkend="SECTopdir"/> below.
38948 </para>
38949 <para>
38950 <indexterm role="option">
38951 <primary><option>mailstore_suffix</option></primary>
38952 </indexterm>
38953 </para>
38954 <informaltable frame="all">
38955 <tgroup cols="4" colsep="0" rowsep="0">
38956 <colspec colwidth="8*" align="left"/>
38957 <colspec colwidth="6*" align="center"/>
38958 <colspec colwidth="6*" align="center"/>
38959 <colspec colwidth="6*" align="right"/>
38960 <tbody>
38961 <row>
38962 <entry><option>mailstore_suffix</option></entry>
38963 <entry>Use: <emphasis>appendfile</emphasis></entry>
38964 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38965 <entry>Default: <emphasis>unset</emphasis></entry>
38966 </row>
38967 </tbody>
38968 </tgroup>
38969 </informaltable>
38970 <para>
38971 This option applies only to deliveries in mailstore format, and is described in
38972 section <xref linkend="SECTopdir"/> below.
38973 </para>
38974 <para>
38975 <indexterm role="option">
38976 <primary><option>mbx_format</option></primary>
38977 </indexterm>
38978 </para>
38979 <informaltable frame="all">
38980 <tgroup cols="4" colsep="0" rowsep="0">
38981 <colspec colwidth="8*" align="left"/>
38982 <colspec colwidth="6*" align="center"/>
38983 <colspec colwidth="6*" align="center"/>
38984 <colspec colwidth="6*" align="right"/>
38985 <tbody>
38986 <row>
38987 <entry><option>mbx_format</option></entry>
38988 <entry>Use: <emphasis>appendfile</emphasis></entry>
38989 <entry>Type: <emphasis>boolean</emphasis></entry>
38990 <entry>Default: <emphasis>false</emphasis></entry>
38991 </row>
38992 </tbody>
38993 </tgroup>
38994 </informaltable>
38995 <para>
38996 <indexterm role="concept">
38997 <primary>locking files</primary>
38998 </indexterm>
38999 <indexterm role="concept">
39000 <primary>file</primary>
39001 <secondary>locking</secondary>
39002 </indexterm>
39003 <indexterm role="concept">
39004 <primary>file</primary>
39005 <secondary>MBX format</secondary>
39006 </indexterm>
39007 <indexterm role="concept">
39008 <primary>MBX format, specifying</primary>
39009 </indexterm>
39010 This option is available only if Exim has been compiled with SUPPORT_MBX
39011 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
39012 the message is appended to the mailbox file in MBX format instead of
39013 traditional Unix format. This format is supported by Pine4 and its associated
39014 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
39015 </para>
39016 <para>
39017 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
39018 automatically changed by the use of <option>mbx_format</option>. They should normally be set
39019 empty when using MBX format, so this option almost always appears in this
39020 combination:
39021 </para>
39022 <literallayout class="monospaced">
39023 mbx_format = true
39024 message_prefix =
39025 message_suffix =
39026 </literallayout>
39027 <para>
39028 If none of the locking options are mentioned in the configuration,
39029 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
39030 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
39031 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
39032 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
39033 should not be used if any program that does not use this form of locking is
39034 going to access the mailbox, nor should it be used if the mailbox file is NFS
39035 mounted, because it works only when the mailbox is accessed from a single host.
39036 </para>
39037 <para>
39038 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
39039 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
39040 (this means for the whole of a Pine or IMAP session), Exim will not be able to
39041 append messages to it.
39042 </para>
39043 <para>
39044 <indexterm role="option">
39045 <primary><option>message_prefix</option></primary>
39046 </indexterm>
39047 </para>
39048 <informaltable frame="all">
39049 <tgroup cols="4" colsep="0" rowsep="0">
39050 <colspec colwidth="8*" align="left"/>
39051 <colspec colwidth="6*" align="center"/>
39052 <colspec colwidth="6*" align="center"/>
39053 <colspec colwidth="6*" align="right"/>
39054 <tbody>
39055 <row>
39056 <entry><option>message_prefix</option></entry>
39057 <entry>Use: <emphasis>appendfile</emphasis></entry>
39058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39059 <entry>Default: <emphasis>see below</emphasis></entry>
39060 </row>
39061 </tbody>
39062 </tgroup>
39063 </informaltable>
39064 <para>
39065 <indexterm role="concept">
39066 <primary><quote>From</quote> line</primary>
39067 </indexterm>
39068 The string specified here is expanded and output at the start of every message.
39069 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
39070 in which case it is:
39071 </para>
39072 <literallayout class="monospaced">
39073 message_prefix = "From ${if def:return_path{$return_path}\
39074   {MAILER-DAEMON}} $tod_bsdinbox\n"
39075 </literallayout>
39076 <para>
39077 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
39078 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
39079 </para>
39080 <para>
39081 <indexterm role="option">
39082 <primary><option>message_suffix</option></primary>
39083 </indexterm>
39084 </para>
39085 <informaltable frame="all">
39086 <tgroup cols="4" colsep="0" rowsep="0">
39087 <colspec colwidth="8*" align="left"/>
39088 <colspec colwidth="6*" align="center"/>
39089 <colspec colwidth="6*" align="center"/>
39090 <colspec colwidth="6*" align="right"/>
39091 <tbody>
39092 <row>
39093 <entry><option>message_suffix</option></entry>
39094 <entry>Use: <emphasis>appendfile</emphasis></entry>
39095 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39096 <entry>Default: <emphasis>see below</emphasis></entry>
39097 </row>
39098 </tbody>
39099 </tgroup>
39100 </informaltable>
39101 <para>
39102 The string specified here is expanded and output at the end of every message.
39103 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
39104 in which case it is a single newline character. The suffix can be suppressed by
39105 setting
39106 </para>
39107 <literallayout class="monospaced">
39108 message_suffix =
39109 </literallayout>
39110 <para>
39111 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
39112 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
39113 </para>
39114 <para>
39115 <indexterm role="option">
39116 <primary><option>mode</option></primary>
39117 </indexterm>
39118 </para>
39119 <informaltable frame="all">
39120 <tgroup cols="4" colsep="0" rowsep="0">
39121 <colspec colwidth="8*" align="left"/>
39122 <colspec colwidth="6*" align="center"/>
39123 <colspec colwidth="6*" align="center"/>
39124 <colspec colwidth="6*" align="right"/>
39125 <tbody>
39126 <row>
39127 <entry><option>mode</option></entry>
39128 <entry>Use: <emphasis>appendfile</emphasis></entry>
39129 <entry>Type: <emphasis>octal integer</emphasis></entry>
39130 <entry>Default: <emphasis>0600</emphasis></entry>
39131 </row>
39132 </tbody>
39133 </tgroup>
39134 </informaltable>
39135 <para>
39136 If the output file is created, it is given this mode. If it already exists and
39137 has wider permissions, they are reduced to this mode. If it has narrower
39138 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
39139 if the delivery is the result of a <option>save</option> command in a filter file specifying
39140 a particular mode, the mode of the output file is always forced to take that
39141 value, and this option is ignored.
39142 </para>
39143 <para>
39144 <indexterm role="option">
39145 <primary><option>mode_fail_narrower</option></primary>
39146 </indexterm>
39147 </para>
39148 <informaltable frame="all">
39149 <tgroup cols="4" colsep="0" rowsep="0">
39150 <colspec colwidth="8*" align="left"/>
39151 <colspec colwidth="6*" align="center"/>
39152 <colspec colwidth="6*" align="center"/>
39153 <colspec colwidth="6*" align="right"/>
39154 <tbody>
39155 <row>
39156 <entry><option>mode_fail_narrower</option></entry>
39157 <entry>Use: <emphasis>appendfile</emphasis></entry>
39158 <entry>Type: <emphasis>boolean</emphasis></entry>
39159 <entry>Default: <emphasis>true</emphasis></entry>
39160 </row>
39161 </tbody>
39162 </tgroup>
39163 </informaltable>
39164 <para>
39165 This option applies in the case when an existing mailbox file has a narrower
39166 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
39167 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
39168 continues with the delivery attempt, using the existing mode of the file.
39169 </para>
39170 <para>
39171 <indexterm role="option">
39172 <primary><option>notify_comsat</option></primary>
39173 </indexterm>
39174 </para>
39175 <informaltable frame="all">
39176 <tgroup cols="4" colsep="0" rowsep="0">
39177 <colspec colwidth="8*" align="left"/>
39178 <colspec colwidth="6*" align="center"/>
39179 <colspec colwidth="6*" align="center"/>
39180 <colspec colwidth="6*" align="right"/>
39181 <tbody>
39182 <row>
39183 <entry><option>notify_comsat</option></entry>
39184 <entry>Use: <emphasis>appendfile</emphasis></entry>
39185 <entry>Type: <emphasis>boolean</emphasis></entry>
39186 <entry>Default: <emphasis>false</emphasis></entry>
39187 </row>
39188 </tbody>
39189 </tgroup>
39190 </informaltable>
39191 <para>
39192 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
39193 successful delivery to a user mailbox. This is the daemon that notifies logged
39194 on users about incoming mail.
39195 </para>
39196 <para>
39197 <indexterm role="option">
39198 <primary><option>quota</option></primary>
39199 </indexterm>
39200 </para>
39201 <informaltable frame="all">
39202 <tgroup cols="4" colsep="0" rowsep="0">
39203 <colspec colwidth="8*" align="left"/>
39204 <colspec colwidth="6*" align="center"/>
39205 <colspec colwidth="6*" align="center"/>
39206 <colspec colwidth="6*" align="right"/>
39207 <tbody>
39208 <row>
39209 <entry><option>quota</option></entry>
39210 <entry>Use: <emphasis>appendfile</emphasis></entry>
39211 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39212 <entry>Default: <emphasis>unset</emphasis></entry>
39213 </row>
39214 </tbody>
39215 </tgroup>
39216 </informaltable>
39217 <para>
39218 <indexterm role="concept">
39219 <primary>quota</primary>
39220 <secondary>imposed by Exim</secondary>
39221 </indexterm>
39222 This option imposes a limit on the size of the file to which Exim is appending,
39223 or to the total space used in the directory tree when the <option>directory</option> option
39224 is set. In the latter case, computation of the space used is expensive, because
39225 all the files in the directory (and any sub-directories) have to be
39226 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
39227 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
39228 have no shell access to their mailboxes).
39229 </para>
39230 <para>
39231 As there is no interlock against two simultaneous deliveries into a
39232 multi-file mailbox, it is possible for the quota to be overrun in this case.
39233 For single-file mailboxes, of course, an interlock is a necessity.
39234 </para>
39235 <para>
39236 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
39237 may be a lot less than the actual amount of disk space allocated to the file.
39238 If the sizes of a number of files are being added up, the rounding effect can
39239 become quite noticeable, especially on systems that have large block sizes.
39240 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
39241 the obvious value which users understand most easily.
39242 </para>
39243 <para>
39244 The value of the option is expanded, and must then be a numerical value
39245 (decimal point allowed), optionally followed by one of the letters K, M, or G,
39246 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
39247 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
39248 be handled.
39249 </para>
39250 <para>
39251 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
39252 </para>
39253 <para>
39254 The expansion happens while Exim is running as root, before it changes uid for
39255 the delivery. This means that files that are inaccessible to the end user can
39256 be used to hold quota values that are looked up in the expansion. When delivery
39257 fails because this quota is exceeded, the handling of the error is as for
39258 system quota failures.
39259 </para>
39260 <para>
39261 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
39262 mailbox to the specified maximum size, though the value is not accurate to the
39263 last byte, owing to separator lines and additional headers that may get added
39264 during message delivery. When a mailbox is nearly full, large messages may get
39265 refused even though small ones are accepted, because the size of the current
39266 message is added to the quota when the check is made. This behaviour can be
39267 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
39268 for exceeding the quota does not include the current message. Thus, deliveries
39269 continue until the quota has been exceeded; thereafter, no further messages are
39270 delivered. See also <option>quota_warn_threshold</option>.
39271 </para>
39272 <para>
39273 <indexterm role="option">
39274 <primary><option>quota_directory</option></primary>
39275 </indexterm>
39276 </para>
39277 <informaltable frame="all">
39278 <tgroup cols="4" colsep="0" rowsep="0">
39279 <colspec colwidth="8*" align="left"/>
39280 <colspec colwidth="6*" align="center"/>
39281 <colspec colwidth="6*" align="center"/>
39282 <colspec colwidth="6*" align="right"/>
39283 <tbody>
39284 <row>
39285 <entry><option>quota_directory</option></entry>
39286 <entry>Use: <emphasis>appendfile</emphasis></entry>
39287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39288 <entry>Default: <emphasis>unset</emphasis></entry>
39289 </row>
39290 </tbody>
39291 </tgroup>
39292 </informaltable>
39293 <para>
39294 This option defines the directory to check for quota purposes when delivering
39295 into individual files. The default is the delivery directory, or, if a file
39296 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
39297 delivery directory.
39298 </para>
39299 <para>
39300 <indexterm role="option">
39301 <primary><option>quota_filecount</option></primary>
39302 </indexterm>
39303 </para>
39304 <informaltable frame="all">
39305 <tgroup cols="4" colsep="0" rowsep="0">
39306 <colspec colwidth="8*" align="left"/>
39307 <colspec colwidth="6*" align="center"/>
39308 <colspec colwidth="6*" align="center"/>
39309 <colspec colwidth="6*" align="right"/>
39310 <tbody>
39311 <row>
39312 <entry><option>quota_filecount</option></entry>
39313 <entry>Use: <emphasis>appendfile</emphasis></entry>
39314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39315 <entry>Default: <emphasis>0</emphasis></entry>
39316 </row>
39317 </tbody>
39318 </tgroup>
39319 </informaltable>
39320 <para>
39321 This option applies when the <option>directory</option> option is set. It limits the total
39322 number of files in the directory (compare the inode limit in system quotas). It
39323 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
39324 failure causes delivery to be deferred. A value of zero is interpreted as
39325 <quote>no quota</quote>.
39326 </para>
39327 <para>
39328 <indexterm role="option">
39329 <primary><option>quota_is_inclusive</option></primary>
39330 </indexterm>
39331 </para>
39332 <informaltable frame="all">
39333 <tgroup cols="4" colsep="0" rowsep="0">
39334 <colspec colwidth="8*" align="left"/>
39335 <colspec colwidth="6*" align="center"/>
39336 <colspec colwidth="6*" align="center"/>
39337 <colspec colwidth="6*" align="right"/>
39338 <tbody>
39339 <row>
39340 <entry><option>quota_is_inclusive</option></entry>
39341 <entry>Use: <emphasis>appendfile</emphasis></entry>
39342 <entry>Type: <emphasis>boolean</emphasis></entry>
39343 <entry>Default: <emphasis>true</emphasis></entry>
39344 </row>
39345 </tbody>
39346 </tgroup>
39347 </informaltable>
39348 <para>
39349 See <option>quota</option> above.
39350 </para>
39351 <para>
39352 <indexterm role="option">
39353 <primary><option>quota_size_regex</option></primary>
39354 </indexterm>
39355 </para>
39356 <informaltable frame="all">
39357 <tgroup cols="4" colsep="0" rowsep="0">
39358 <colspec colwidth="8*" align="left"/>
39359 <colspec colwidth="6*" align="center"/>
39360 <colspec colwidth="6*" align="center"/>
39361 <colspec colwidth="6*" align="right"/>
39362 <tbody>
39363 <row>
39364 <entry><option>quota_size_regex</option></entry>
39365 <entry>Use: <emphasis>appendfile</emphasis></entry>
39366 <entry>Type: <emphasis>string</emphasis></entry>
39367 <entry>Default: <emphasis>unset</emphasis></entry>
39368 </row>
39369 </tbody>
39370 </tgroup>
39371 </informaltable>
39372 <para>
39373 This option applies when one of the delivery modes that writes a separate file
39374 for each message is being used. When Exim wants to find the size of one of
39375 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
39376 If this is set to a regular expression that matches the file name, and it
39377 captures one string, that string is interpreted as a representation of the
39378 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
39379 </para>
39380 <para>
39381 This feature is useful only when users have no shell access to their mailboxes
39382 &ndash; otherwise they could defeat the quota simply by renaming the files. This
39383 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
39384 the file length to the file name. For example:
39385 </para>
39386 <literallayout class="monospaced">
39387 maildir_tag = ,S=$message_size
39388 quota_size_regex = ,S=(\d+)
39389 </literallayout>
39390 <para>
39391 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
39392 number of lines in the message.
39393 </para>
39394 <para>
39395 The regular expression should not assume that the length is at the end of the
39396 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
39397 sometimes add other information onto the ends of message file names.
39398 </para>
39399 <para>
39400 Section <xref linkend="SECID136"/> contains further information.
39401 </para>
39402 <para>
39403 <indexterm role="option">
39404 <primary><option>quota_warn_message</option></primary>
39405 </indexterm>
39406 </para>
39407 <informaltable frame="all">
39408 <tgroup cols="4" colsep="0" rowsep="0">
39409 <colspec colwidth="8*" align="left"/>
39410 <colspec colwidth="6*" align="center"/>
39411 <colspec colwidth="6*" align="center"/>
39412 <colspec colwidth="6*" align="right"/>
39413 <tbody>
39414 <row>
39415 <entry><option>quota_warn_message</option></entry>
39416 <entry>Use: <emphasis>appendfile</emphasis></entry>
39417 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39418 <entry>Default: <emphasis>see below</emphasis></entry>
39419 </row>
39420 </tbody>
39421 </tgroup>
39422 </informaltable>
39423 <para>
39424 See below for the use of this option. If it is not set when
39425 <option>quota_warn_threshold</option> is set, it defaults to
39426 </para>
39427 <literallayout class="monospaced">
39428 quota_warn_message = "\
39429   To: $local_part@$domain\n\
39430   Subject: Your mailbox\n\n\
39431   This message is automatically created \
39432   by mail delivery software.\n\n\
39433   The size of your mailbox has exceeded \
39434   a warning threshold that is\n\
39435   set by the system administrator.\n"
39436 </literallayout>
39437 <para>
39438 <indexterm role="option">
39439 <primary><option>quota_warn_threshold</option></primary>
39440 </indexterm>
39441 </para>
39442 <informaltable frame="all">
39443 <tgroup cols="4" colsep="0" rowsep="0">
39444 <colspec colwidth="8*" align="left"/>
39445 <colspec colwidth="6*" align="center"/>
39446 <colspec colwidth="6*" align="center"/>
39447 <colspec colwidth="6*" align="right"/>
39448 <tbody>
39449 <row>
39450 <entry><option>quota_warn_threshold</option></entry>
39451 <entry>Use: <emphasis>appendfile</emphasis></entry>
39452 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39453 <entry>Default: <emphasis>0</emphasis></entry>
39454 </row>
39455 </tbody>
39456 </tgroup>
39457 </informaltable>
39458 <para>
39459 <indexterm role="concept">
39460 <primary>quota</primary>
39461 <secondary>warning threshold</secondary>
39462 </indexterm>
39463 <indexterm role="concept">
39464 <primary>mailbox</primary>
39465 <secondary>size warning</secondary>
39466 </indexterm>
39467 <indexterm role="concept">
39468 <primary>size</primary>
39469 <secondary>of mailbox</secondary>
39470 </indexterm>
39471 This option is expanded in the same way as <option>quota</option> (see above). If the
39472 resulting value is greater than zero, and delivery of the message causes the
39473 size of the file or total space in the directory tree to cross the given
39474 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
39475 may be specified as a percentage of it by following the value with a percent
39476 sign. For example:
39477 </para>
39478 <literallayout class="monospaced">
39479 quota = 10M
39480 quota_warn_threshold = 75%
39481 </literallayout>
39482 <para>
39483 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
39484 percent sign is ignored.
39485 </para>
39486 <para>
39487 The warning message itself is specified by the <option>quota_warn_message</option> option,
39488 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
39489 warning message. These do not necessarily have to include the recipient(s) of
39490 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
39491 can include any other header lines that you want. If you do not include a
39492 <emphasis>From:</emphasis> line, the default is:
39493 </para>
39494 <literallayout class="monospaced">
39495 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
39496 </literallayout>
39497 <para>
39498 <indexterm role="option">
39499 <primary><option>errors_reply_to</option></primary>
39500 </indexterm>
39501 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
39502 option.
39503 </para>
39504 <para>
39505 The <option>quota</option> option does not have to be set in order to use this option; they
39506 are independent of one another except when the threshold is specified as a
39507 percentage.
39508 </para>
39509 <para>
39510 <indexterm role="option">
39511 <primary><option>use_bsmtp</option></primary>
39512 </indexterm>
39513 </para>
39514 <informaltable frame="all">
39515 <tgroup cols="4" colsep="0" rowsep="0">
39516 <colspec colwidth="8*" align="left"/>
39517 <colspec colwidth="6*" align="center"/>
39518 <colspec colwidth="6*" align="center"/>
39519 <colspec colwidth="6*" align="right"/>
39520 <tbody>
39521 <row>
39522 <entry><option>use_bsmtp</option></entry>
39523 <entry>Use: <emphasis>appendfile</emphasis></entry>
39524 <entry>Type: <emphasis>boolean</emphasis></entry>
39525 <entry>Default: <emphasis>false</emphasis></entry>
39526 </row>
39527 </tbody>
39528 </tgroup>
39529 </informaltable>
39530 <para>
39531 <indexterm role="concept">
39532 <primary>envelope sender</primary>
39533 </indexterm>
39534 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
39535 format, with the envelope sender and recipient(s) included as SMTP commands. If
39536 you want to include a leading HELO command with such messages, you can do
39537 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
39538 for details of batch SMTP.
39539 </para>
39540 <para>
39541 <indexterm role="option">
39542 <primary><option>use_crlf</option></primary>
39543 </indexterm>
39544 </para>
39545 <informaltable frame="all">
39546 <tgroup cols="4" colsep="0" rowsep="0">
39547 <colspec colwidth="8*" align="left"/>
39548 <colspec colwidth="6*" align="center"/>
39549 <colspec colwidth="6*" align="center"/>
39550 <colspec colwidth="6*" align="right"/>
39551 <tbody>
39552 <row>
39553 <entry><option>use_crlf</option></entry>
39554 <entry>Use: <emphasis>appendfile</emphasis></entry>
39555 <entry>Type: <emphasis>boolean</emphasis></entry>
39556 <entry>Default: <emphasis>false</emphasis></entry>
39557 </row>
39558 </tbody>
39559 </tgroup>
39560 </informaltable>
39561 <para>
39562 <indexterm role="concept">
39563 <primary>carriage return</primary>
39564 </indexterm>
39565 <indexterm role="concept">
39566 <primary>linefeed</primary>
39567 </indexterm>
39568 This option causes lines to be terminated with the two-character CRLF sequence
39569 (carriage return, linefeed) instead of just a linefeed character. In the case
39570 of batched SMTP, the byte sequence written to the file is then an exact image
39571 of what would be sent down a real SMTP connection.
39572 </para>
39573 <para>
39574 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
39575 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
39576 in Berkeley-style mailboxes) are written verbatim, so must contain their own
39577 carriage return characters if these are needed. In cases where these options
39578 have non-empty defaults, the values end with a single linefeed, so they must be
39579 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39580 </para>
39581 <para>
39582 <indexterm role="option">
39583 <primary><option>use_fcntl_lock</option></primary>
39584 </indexterm>
39585 </para>
39586 <informaltable frame="all">
39587 <tgroup cols="4" colsep="0" rowsep="0">
39588 <colspec colwidth="8*" align="left"/>
39589 <colspec colwidth="6*" align="center"/>
39590 <colspec colwidth="6*" align="center"/>
39591 <colspec colwidth="6*" align="right"/>
39592 <tbody>
39593 <row>
39594 <entry><option>use_fcntl_lock</option></entry>
39595 <entry>Use: <emphasis>appendfile</emphasis></entry>
39596 <entry>Type: <emphasis>boolean</emphasis></entry>
39597 <entry>Default: <emphasis>see below</emphasis></entry>
39598 </row>
39599 </tbody>
39600 </tgroup>
39601 </informaltable>
39602 <para>
39603 This option controls the use of the <function>fcntl()</function> function to lock a file for
39604 exclusive use when a message is being appended. It is set by default unless
39605 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
39606 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
39607 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
39608 </para>
39609 <para>
39610 <indexterm role="option">
39611 <primary><option>use_flock_lock</option></primary>
39612 </indexterm>
39613 </para>
39614 <informaltable frame="all">
39615 <tgroup cols="4" colsep="0" rowsep="0">
39616 <colspec colwidth="8*" align="left"/>
39617 <colspec colwidth="6*" align="center"/>
39618 <colspec colwidth="6*" align="center"/>
39619 <colspec colwidth="6*" align="right"/>
39620 <tbody>
39621 <row>
39622 <entry><option>use_flock_lock</option></entry>
39623 <entry>Use: <emphasis>appendfile</emphasis></entry>
39624 <entry>Type: <emphasis>boolean</emphasis></entry>
39625 <entry>Default: <emphasis>false</emphasis></entry>
39626 </row>
39627 </tbody>
39628 </tgroup>
39629 </informaltable>
39630 <para>
39631 This option is provided to support the use of <function>flock()</function> for file locking, for
39632 the few situations where it is needed. Most modern operating systems support
39633 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
39634 each other. Exim uses <function>fcntl()</function> locking by default.
39635 </para>
39636 <para>
39637 This option is required only if you are using an operating system where
39638 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
39639 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
39640 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
39641 </para>
39642 <para>
39643 <indexterm role="concept">
39644 <primary>Solaris</primary>
39645 <secondary><function>flock()</function> support</secondary>
39646 </indexterm>
39647 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
39648 have it (and some, I think, provide a not quite right version built on top of
39649 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
39650 the ability to use it, and any attempt to do so will cause a configuration
39651 error.
39652 </para>
39653 <para>
39654 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
39655 is just being mapped onto <function>fcntl()</function> by the OS).
39656 </para>
39657 <para>
39658 <indexterm role="option">
39659 <primary><option>use_lockfile</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>use_lockfile</option></entry>
39671 <entry>Use: <emphasis>appendfile</emphasis></entry>
39672 <entry>Type: <emphasis>boolean</emphasis></entry>
39673 <entry>Default: <emphasis>see below</emphasis></entry>
39674 </row>
39675 </tbody>
39676 </tgroup>
39677 </informaltable>
39678 <para>
39679 If this option is turned off, Exim does not attempt to create a lock file when
39680 appending to a mailbox file. In this situation, the only locking is by
39681 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
39682 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
39683 <function>fcntl()</function> rather than a lock file, and even then only when you are not
39684 delivering over NFS from more than one host.
39685 </para>
39686 <para>
39687 <indexterm role="concept">
39688 <primary>NFS</primary>
39689 <secondary>lock file</secondary>
39690 </indexterm>
39691 In order to append to an NFS file safely from more than one host, it is
39692 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
39693 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
39694 file corruption.
39695 </para>
39696 <para>
39697 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
39698 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
39699 except when <option>mbx_format</option> is set.
39700 </para>
39701 <para>
39702 <indexterm role="option">
39703 <primary><option>use_mbx_lock</option></primary>
39704 </indexterm>
39705 </para>
39706 <informaltable frame="all">
39707 <tgroup cols="4" colsep="0" rowsep="0">
39708 <colspec colwidth="8*" align="left"/>
39709 <colspec colwidth="6*" align="center"/>
39710 <colspec colwidth="6*" align="center"/>
39711 <colspec colwidth="6*" align="right"/>
39712 <tbody>
39713 <row>
39714 <entry><option>use_mbx_lock</option></entry>
39715 <entry>Use: <emphasis>appendfile</emphasis></entry>
39716 <entry>Type: <emphasis>boolean</emphasis></entry>
39717 <entry>Default: <emphasis>see below</emphasis></entry>
39718 </row>
39719 </tbody>
39720 </tgroup>
39721 </informaltable>
39722 <para>
39723 This option is available only if Exim has been compiled with SUPPORT_MBX
39724 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
39725 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
39726 of the locking options are mentioned in the configuration. The locking rules
39727 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
39728 the IMAP4 and POP daemons that come with it (see the discussion below). The
39729 rules allow for shared access to the mailbox. However, this kind of locking
39730 does not work when the mailbox is NFS mounted.
39731 </para>
39732 <para>
39733 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
39734 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
39735 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
39736 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
39737 </para>
39738 </section>
39739 <section id="SECTopappend">
39740 <title>Operational details for appending</title>
39741 <para>
39742 <indexterm role="concept">
39743 <primary>appending to a file</primary>
39744 </indexterm>
39745 <indexterm role="concept">
39746 <primary>file</primary>
39747 <secondary>appending</secondary>
39748 </indexterm>
39749 Before appending to a file, the following preparations are made:
39750 </para>
39751 <itemizedlist>
39752 <listitem>
39753 <para>
39754 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
39755 return is given.
39756 </para>
39757 </listitem>
39758 <listitem>
39759 <para>
39760 <indexterm role="concept">
39761 <primary>directory creation</primary>
39762 </indexterm>
39763 If any directories on the file&#x2019;s path are missing, Exim creates them if the
39764 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
39765 <option>directory_mode</option> option.
39766 </para>
39767 </listitem>
39768 <listitem>
39769 <para>
39770 If <option>file_format</option> is set, the format of an existing file is checked. If this
39771 indicates that a different transport should be used, control is passed to that
39772 transport.
39773 </para>
39774 </listitem>
39775 <listitem>
39776 <para>
39777 <indexterm role="concept">
39778 <primary>file</primary>
39779 <secondary>locking</secondary>
39780 </indexterm>
39781 <indexterm role="concept">
39782 <primary>locking files</primary>
39783 </indexterm>
39784 <indexterm role="concept">
39785 <primary>NFS</primary>
39786 <secondary>lock file</secondary>
39787 </indexterm>
39788 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
39789 reliably over NFS, as follows:
39790 </para>
39791 <orderedlist numeration="arabic">
39792 <listitem>
39793 <para>
39794 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
39795 current time, primary host name, and process id added, by opening for writing
39796 as a new file. If this fails with an access error, delivery is deferred.
39797 </para>
39798 </listitem>
39799 <listitem>
39800 <para>
39801 Close the hitching post file, and hard link it to the lock file name.
39802 </para>
39803 </listitem>
39804 <listitem>
39805 <para>
39806 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
39807 Unlink the hitching post name.
39808 </para>
39809 </listitem>
39810 <listitem>
39811 <para>
39812 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
39813 then unlink hitching post name. If the number of links is exactly two, creation
39814 of the lock file succeeded but something (for example, an NFS server crash and
39815 restart) caused this fact not to be communicated to the <function>link()</function> call.
39816 </para>
39817 </listitem>
39818 <listitem>
39819 <para>
39820 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
39821 up to <option>lock_retries</option> times. However, since any program that writes to a
39822 mailbox should complete its task very quickly, it is reasonable to time out old
39823 lock files that are normally the result of user agent and system crashes. If an
39824 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
39825 it before trying again.
39826 </para>
39827 </listitem>
39828 </orderedlist>
39829 </listitem>
39830 <listitem>
39831 <para>
39832 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
39833 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
39834 than non-existence, delivery is deferred.
39835 </para>
39836 </listitem>
39837 <listitem>
39838 <para>
39839 <indexterm role="concept">
39840 <primary>symbolic link</primary>
39841 <secondary>to mailbox</secondary>
39842 </indexterm>
39843 <indexterm role="concept">
39844 <primary>mailbox</primary>
39845 <secondary>symbolic link</secondary>
39846 </indexterm>
39847 If the file does exist and is a symbolic link, delivery is deferred, unless the
39848 <option>allow_symlink</option> option is set, in which case the ownership of the link is
39849 checked, and then <function>stat()</function> is called to find out about the real file, which
39850 is then subjected to the checks below. The check on the top-level link
39851 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
39852 directory, though allowing symbolic links in this case is definitely not a good
39853 idea. If there is a chain of symbolic links, the intermediate ones are not
39854 checked.
39855 </para>
39856 </listitem>
39857 <listitem>
39858 <para>
39859 If the file already exists but is not a regular file, or if the file&#x2019;s owner
39860 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
39861 different from the user and group under which the delivery is running,
39862 delivery is deferred.
39863 </para>
39864 </listitem>
39865 <listitem>
39866 <para>
39867 If the file&#x2019;s permissions are more generous than specified, they are reduced.
39868 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
39869 is set false, in which case the delivery is tried using the existing
39870 permissions.
39871 </para>
39872 </listitem>
39873 <listitem>
39874 <para>
39875 The file&#x2019;s inode number is saved, and the file is then opened for appending.
39876 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
39877 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
39878 </para>
39879 </listitem>
39880 <listitem>
39881 <para>
39882 If the file is opened successfully, check that the inode number hasn&#x2019;t
39883 changed, that it is still a regular file, and that the owner and permissions
39884 have not changed. If anything is wrong, defer delivery and freeze the message.
39885 </para>
39886 </listitem>
39887 <listitem>
39888 <para>
39889 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
39890 option is set. Otherwise, check that the file is being created in a permitted
39891 directory if the <option>create_file</option> option is set (deferring on failure), and then
39892 open for writing as a new file, with the O_EXCL and O_CREAT options,
39893 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
39894 set). In this case, which can happen if the link points to a non-existent file,
39895 the file is opened for writing using O_CREAT but not O_EXCL, because
39896 that prevents link following.
39897 </para>
39898 </listitem>
39899 <listitem>
39900 <para>
39901 <indexterm role="concept">
39902 <primary>loop</primary>
39903 <secondary>while file testing</secondary>
39904 </indexterm>
39905 If opening fails because the file exists, obey the tests given above for
39906 existing files. However, to avoid looping in a situation where the file is
39907 being continuously created and destroyed, the exists/not-exists loop is broken
39908 after 10 repetitions, and the message is then frozen.
39909 </para>
39910 </listitem>
39911 <listitem>
39912 <para>
39913 If opening fails with any other error, defer delivery.
39914 </para>
39915 </listitem>
39916 <listitem>
39917 <para>
39918 <indexterm role="concept">
39919 <primary>file</primary>
39920 <secondary>locking</secondary>
39921 </indexterm>
39922 <indexterm role="concept">
39923 <primary>locking files</primary>
39924 </indexterm>
39925 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
39926 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
39927 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
39928 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
39929 file, and an exclusive lock on the file whose name is
39930 </para>
39931 <literallayout class="monospaced">
39932 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
39933 </literallayout>
39934 <para>
39935 using the device and inode numbers of the open mailbox file, in accordance with
39936 the MBX locking rules. This file is created with a mode that is specified by
39937 the <option>lockfile_mode</option> option.
39938 </para>
39939 <para>
39940 If Exim fails to lock the file, there are two possible courses of action,
39941 depending on the value of the locking timeout. This is obtained from
39942 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
39943 </para>
39944 <para>
39945 If the timeout value is zero, the file is closed, Exim waits for
39946 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
39947 to lock it again. This happens up to <option>lock_retries</option> times, after which the
39948 delivery is deferred.
39949 </para>
39950 <para>
39951 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
39952 <function>flock()</function> are used (with the given timeout), so there has already been some
39953 waiting involved by the time locking fails. Nevertheless, Exim does not give up
39954 immediately. It retries up to
39955 </para>
39956 <literallayout class="monospaced">
39957 (lock_retries * lock_interval) / &lt;timeout&gt;
39958 </literallayout>
39959 <para>
39960 times (rounded up).
39961 </para>
39962 </listitem>
39963 </itemizedlist>
39964 <para>
39965 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
39966 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
39967 </para>
39968 </section>
39969 <section id="SECTopdir">
39970 <title>Operational details for delivery to a new file</title>
39971 <para>
39972 <indexterm role="concept">
39973 <primary>delivery</primary>
39974 <secondary>to single file</secondary>
39975 </indexterm>
39976 <indexterm role="concept">
39977 <primary><quote>From</quote> line</primary>
39978 </indexterm>
39979 When the <option>directory</option> option is set instead of <option>file</option>, each message is
39980 delivered into a newly-created file or set of files. When <command>appendfile</command> is
39981 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
39982 <option>directory</option> is normally set, because the path for delivery is supplied by the
39983 router. (See for example, the <command>address_file</command> transport in the default
39984 configuration.) In this case, delivery is to a new file if either the path name
39985 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
39986 </para>
39987 <para>
39988 No locking is required while writing the message to a new file, so the various
39989 locking options of the transport are ignored. The <quote>From</quote> line that by default
39990 separates messages in a single file is not normally needed, nor is the escaping
39991 of message lines that start with <quote>From</quote>, and there is no need to ensure a
39992 newline at the end of each message. Consequently, the default values for
39993 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
39994 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
39995 </para>
39996 <para>
39997 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
39998 the files in the delivery directory by default. However, you can specify a
39999 different directory by setting <option>quota_directory</option>. Also, for maildir
40000 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
40001 </para>
40002 <para>
40003 <indexterm role="concept">
40004 <primary>maildir format</primary>
40005 </indexterm>
40006 <indexterm role="concept">
40007 <primary>mailstore format</primary>
40008 </indexterm>
40009 There are three different ways in which delivery to individual files can be
40010 done, controlled by the settings of the <option>maildir_format</option> and
40011 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
40012 formats is not included in the binary unless SUPPORT_MAILDIR or
40013 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
40014 </para>
40015 <para>
40016 <indexterm role="concept">
40017 <primary>directory creation</primary>
40018 </indexterm>
40019 In all three cases an attempt is made to create the directory and any necessary
40020 sub-directories if they do not exist, provided that the <option>create_directory</option>
40021 option is set (the default). The location of a created directory can be
40022 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
40023 the <option>directory_mode</option> option. If creation fails, or if the
40024 <option>create_directory</option> option is not set when creation is required, delivery is
40025 deferred.
40026 </para>
40027 </section>
40028 <section id="SECTmaildirdelivery">
40029 <title>Maildir delivery</title>
40030 <para>
40031 <indexterm role="concept">
40032 <primary>maildir format</primary>
40033 <secondary>description of</secondary>
40034 </indexterm>
40035 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
40036 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
40037 directory that is defined by the <option>directory</option> option (the <quote>delivery
40038 directory</quote>). If the delivery is successful, the file is renamed into the
40039 <filename>new</filename> subdirectory.
40040 </para>
40041 <para>
40042 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
40043 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
40044 Exim checks that the time-of-day clock has moved on by at least one microsecond
40045 before terminating the delivery process. This guarantees uniqueness for the
40046 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
40047 opening it. If any response other than ENOENT (does not exist) is given,
40048 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
40049 </para>
40050 <para>
40051 Before Exim carries out a maildir delivery, it ensures that subdirectories
40052 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
40053 do not exist, Exim tries to create them and any superior directories in their
40054 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
40055 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
40056 contains matches the delivery directory, Exim also ensures that a file called
40057 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
40058 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
40059 </para>
40060 <para>
40061 These features make it possible to use Exim to create all the necessary files
40062 and directories in a maildir mailbox, including subdirectories for maildir++
40063 folders. Consider this example:
40064 </para>
40065 <literallayout class="monospaced">
40066 maildir_format = true
40067 directory = /var/mail/$local_part\
40068            ${if eq{$local_part_suffix}{}{}\
40069            {/.${substr_1:$local_part_suffix}}}
40070 maildirfolder_create_regex = /\.[^/]+$
40071 </literallayout>
40072 <para>
40073 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
40074 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
40075 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
40076 not match this name, so Exim will not look for or create the file
40077 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
40078 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
40079 </para>
40080 <para>
40081 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
40082 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
40083 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
40084 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
40085 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
40086 </para>
40087 <para>
40088 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
40089 not inadvertently match the toplevel maildir directory, because a
40090 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
40091 </para>
40092 <para>
40093 <indexterm role="concept">
40094 <primary>quota</primary>
40095 <secondary>in maildir delivery</secondary>
40096 </indexterm>
40097 <indexterm role="concept">
40098 <primary>maildir++</primary>
40099 </indexterm>
40100 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
40101 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
40102 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
40103 Exim assumes the directory is a maildir++ folder directory, which is one level
40104 down from the user&#x2019;s top level mailbox directory. This causes it to start at
40105 the parent directory instead of the current directory when calculating the
40106 amount of space used.
40107 </para>
40108 <para>
40109 One problem with delivering into a multi-file mailbox is that it is
40110 computationally expensive to compute the size of the mailbox for quota
40111 checking. Various approaches have been taken to reduce the amount of work
40112 needed. The next two sections describe two of them. A third alternative is to
40113 use some external process for maintaining the size data, and use the expansion
40114 of the <option>mailbox_size</option> option as a way of importing it into Exim.
40115 </para>
40116 </section>
40117 <section id="SECID135">
40118 <title>Using tags to record message sizes</title>
40119 <para>
40120 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
40121 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
40122 tag is added to its name. However, if adding the tag takes the length of the
40123 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
40124 the tag is dropped and the maildir file is created with no tag.
40125 </para>
40126 <para>
40127 <indexterm role="variable">
40128 <primary><varname>$message_size</varname></primary>
40129 </indexterm>
40130 Tags can be used to encode the size of files in their names; see
40131 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
40132 happens after the message has been written. The value of the <varname>$message_size</varname>
40133 variable is set to the number of bytes actually written. If the expansion is
40134 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
40135 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
40136 Non-printing characters in the string are ignored; if the resulting string is
40137 empty, it is ignored. If it starts with an alphanumeric character, a leading
40138 colon is inserted; this default has not proven to be the path that popular
40139 maildir implementations have chosen (but changing it in Exim would break
40140 backwards compatibility).
40141 </para>
40142 <para>
40143 For one common implementation, you might set:
40144 </para>
40145 <literallayout class="monospaced">
40146 maildir_tag = ,S=${message_size}
40147 </literallayout>
40148 <para>
40149 but you should check the documentation of the other software to be sure.
40150 </para>
40151 <para>
40152 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
40153 as this allows Exim to extract the size from your tag, instead of having to
40154 <function>stat()</function> each message file.
40155 </para>
40156 </section>
40157 <section id="SECID136">
40158 <title>Using a maildirsize file</title>
40159 <para>
40160 <indexterm role="concept">
40161 <primary>quota</primary>
40162 <secondary>in maildir delivery</secondary>
40163 </indexterm>
40164 <indexterm role="concept">
40165 <primary>maildir format</primary>
40166 <secondary><filename>maildirsize</filename> file</secondary>
40167 </indexterm>
40168 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
40169 storing quota and message size information in a file called <filename>maildirsize</filename>
40170 within the toplevel maildir directory. If this file does not exist, Exim
40171 creates it, setting the quota from the <option>quota</option> option of the transport. If
40172 the maildir directory itself does not exist, it is created before any attempt
40173 to write a <filename>maildirsize</filename> file.
40174 </para>
40175 <para>
40176 The <filename>maildirsize</filename> file is used to hold information about the sizes of
40177 messages in the maildir, thus speeding up quota calculations. The quota value
40178 in the file is just a cache; if the quota is changed in the transport, the new
40179 value overrides the cached value when the next message is delivered. The cache
40180 is maintained for the benefit of other programs that access the maildir and
40181 need to know the quota.
40182 </para>
40183 <para>
40184 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
40185 file is maintained (with a zero quota setting), but no quota is imposed.
40186 </para>
40187 <para>
40188 A regular expression is available for controlling which directories in the
40189 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
40190 See the description of the <option>maildir_quota_directory_regex</option> option above for
40191 details.
40192 </para>
40193 </section>
40194 <section id="SECID137">
40195 <title>Mailstore delivery</title>
40196 <para>
40197 <indexterm role="concept">
40198 <primary>mailstore format</primary>
40199 <secondary>description of</secondary>
40200 </indexterm>
40201 If the <option>mailstore_format</option> option is true, each message is written as two
40202 files in the given directory. A unique base name is constructed from the
40203 message id and the current delivery process, and the files that are written use
40204 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
40205 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
40206 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
40207 </para>
40208 <para>
40209 During delivery, the envelope is first written to a file with the suffix
40210 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
40211 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
40212 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
40213 file before accessing either of them. An alternative approach is to wait for
40214 the absence of a <filename>.tmp</filename> file.
40215 </para>
40216 <para>
40217 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
40218 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
40219 the sender address on one line, then all the recipient addresses, one per line.
40220 There can be more than one recipient only if the <option>batch_max</option> option is set
40221 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
40222 appended to the file, followed by a newline if it does not end with one.
40223 </para>
40224 <para>
40225 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
40226 failure, it is ignored. Other expansion errors are treated as serious
40227 configuration errors, and delivery is deferred. The variable
40228 <varname>$mailstore_basename</varname> is available for use during these expansions.
40229 </para>
40230 </section>
40231 <section id="SECID138">
40232 <title>Non-special new file delivery</title>
40233 <para>
40234 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
40235 file is created directly in the named directory. For example, when delivering
40236 messages into files in batched SMTP format for later delivery to some host (see
40237 section <xref linkend="SECTbatchSMTP"/>), a setting such as
40238 </para>
40239 <literallayout class="monospaced">
40240 directory = /var/bsmtp/$host
40241 </literallayout>
40242 <para>
40243 might be used. A message is written to a file with a temporary name, which is
40244 then renamed when the delivery is complete. The final name is obtained by
40245 expanding the contents of the <option>directory_file</option> option.
40246 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
40247 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
40248 </para>
40249 </section>
40250 </chapter>
40251
40252 <chapter id="CHID8">
40253 <title>The autoreply transport</title>
40254 <para>
40255 <indexterm role="concept" id="IIDauttra1" class="startofrange">
40256 <primary>transports</primary>
40257 <secondary><command>autoreply</command></secondary>
40258 </indexterm>
40259 <indexterm role="concept" id="IIDauttra2" class="startofrange">
40260 <primary><command>autoreply</command> transport</primary>
40261 </indexterm>
40262 The <command>autoreply</command> transport is not a true transport in that it does not cause
40263 the message to be transmitted. Instead, it generates a new mail message as an
40264 automatic reply to the incoming message. <emphasis>References:</emphasis> and
40265 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
40266 to the rules in RFCs 2822 and 3834, respectively.
40267 </para>
40268 <para>
40269 If the router that passes the message to this transport does not have the
40270 <option>unseen</option> option set, the original message (for the current recipient) is not
40271 delivered anywhere. However, when the <option>unseen</option> option is set on the router
40272 that passes the message to this transport, routing of the address continues, so
40273 another router can set up a normal message delivery.
40274 </para>
40275 <para>
40276 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
40277 <quote>vacation</quote> message being the standard example. However, it can also be run
40278 directly from a router like any other transport. To reduce the possibility of
40279 message cascades, messages created by the <command>autoreply</command> transport always have
40280 empty envelope sender addresses, like bounce messages.
40281 </para>
40282 <para>
40283 The parameters of the message to be sent can be specified in the configuration
40284 by options described below. However, these are used only when the address
40285 passed to the transport does not contain its own reply information. When the
40286 transport is run as a consequence of a
40287 <option>mail</option>
40288 or <option>vacation</option> command in a filter file, the parameters of the message are
40289 supplied by the filter, and passed with the address. The transport&#x2019;s options
40290 that define the message are then ignored (so they are not usually set in this
40291 case). The message is specified entirely by the filter or by the transport; it
40292 is never built from a mixture of options. However, the <option>file_optional</option>,
40293 <option>mode</option>, and <option>return_message</option> options apply in all cases.
40294 </para>
40295 <para>
40296 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
40297 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
40298 gid of the user, and with appropriate current and home directories (see chapter
40299 <xref linkend="CHAPenvironment"/>).
40300 </para>
40301 <para>
40302 There is a subtle difference between routing a message to a <command>pipe</command> transport
40303 that generates some text to be returned to the sender, and routing it to an
40304 <command>autoreply</command> transport. This difference is noticeable only if more than one
40305 address from the same message is so handled. In the case of a pipe, the
40306 separate outputs from the different addresses are gathered up and returned to
40307 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
40308 message is generated for each address that is passed to it.
40309 </para>
40310 <para>
40311 Non-printing characters are not permitted in the header lines generated for the
40312 message that <command>autoreply</command> creates, with the exception of newlines that are
40313 immediately followed by white space. If any non-printing characters are found,
40314 the transport defers.
40315 Whether characters with the top bit set count as printing characters or not is
40316 controlled by the <option>print_topbitchars</option> global option.
40317 </para>
40318 <para>
40319 If any of the generic options for manipulating headers (for example,
40320 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
40321 of the original message that is included in the generated message when
40322 <option>return_message</option> is set. They do not apply to the generated message itself.
40323 </para>
40324 <para>
40325 <indexterm role="variable">
40326 <primary><varname>$sender_address</varname></primary>
40327 </indexterm>
40328 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
40329 the message, indicating that there were no recipients, it does not treat this
40330 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
40331 is empty (because the incoming message is a bounce message) do not cause
40332 problems. They are just discarded.
40333 </para>
40334 <section id="SECID139">
40335 <title>Private options for autoreply</title>
40336 <para>
40337 <indexterm role="concept">
40338 <primary>options</primary>
40339 <secondary><command>autoreply</command> transport</secondary>
40340 </indexterm>
40341 </para>
40342 <para>
40343 <indexterm role="option">
40344 <primary><option>bcc</option></primary>
40345 </indexterm>
40346 </para>
40347 <informaltable frame="all">
40348 <tgroup cols="4" colsep="0" rowsep="0">
40349 <colspec colwidth="8*" align="left"/>
40350 <colspec colwidth="6*" align="center"/>
40351 <colspec colwidth="6*" align="center"/>
40352 <colspec colwidth="6*" align="right"/>
40353 <tbody>
40354 <row>
40355 <entry><option>bcc</option></entry>
40356 <entry>Use: <emphasis>autoreply</emphasis></entry>
40357 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40358 <entry>Default: <emphasis>unset</emphasis></entry>
40359 </row>
40360 </tbody>
40361 </tgroup>
40362 </informaltable>
40363 <para>
40364 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
40365 message when the message is specified by the transport.
40366 </para>
40367 <para>
40368 <indexterm role="option">
40369 <primary><option>cc</option></primary>
40370 </indexterm>
40371 </para>
40372 <informaltable frame="all">
40373 <tgroup cols="4" colsep="0" rowsep="0">
40374 <colspec colwidth="8*" align="left"/>
40375 <colspec colwidth="6*" align="center"/>
40376 <colspec colwidth="6*" align="center"/>
40377 <colspec colwidth="6*" align="right"/>
40378 <tbody>
40379 <row>
40380 <entry><option>cc</option></entry>
40381 <entry>Use: <emphasis>autoreply</emphasis></entry>
40382 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40383 <entry>Default: <emphasis>unset</emphasis></entry>
40384 </row>
40385 </tbody>
40386 </tgroup>
40387 </informaltable>
40388 <para>
40389 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
40390 when the message is specified by the transport.
40391 </para>
40392 <para>
40393 <indexterm role="option">
40394 <primary><option>file</option></primary>
40395 </indexterm>
40396 </para>
40397 <informaltable frame="all">
40398 <tgroup cols="4" colsep="0" rowsep="0">
40399 <colspec colwidth="8*" align="left"/>
40400 <colspec colwidth="6*" align="center"/>
40401 <colspec colwidth="6*" align="center"/>
40402 <colspec colwidth="6*" align="right"/>
40403 <tbody>
40404 <row>
40405 <entry><option>file</option></entry>
40406 <entry>Use: <emphasis>autoreply</emphasis></entry>
40407 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40408 <entry>Default: <emphasis>unset</emphasis></entry>
40409 </row>
40410 </tbody>
40411 </tgroup>
40412 </informaltable>
40413 <para>
40414 The contents of the file are sent as the body of the message when the message
40415 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
40416 string comes first.
40417 </para>
40418 <para>
40419 <indexterm role="option">
40420 <primary><option>file_expand</option></primary>
40421 </indexterm>
40422 </para>
40423 <informaltable frame="all">
40424 <tgroup cols="4" colsep="0" rowsep="0">
40425 <colspec colwidth="8*" align="left"/>
40426 <colspec colwidth="6*" align="center"/>
40427 <colspec colwidth="6*" align="center"/>
40428 <colspec colwidth="6*" align="right"/>
40429 <tbody>
40430 <row>
40431 <entry><option>file_expand</option></entry>
40432 <entry>Use: <emphasis>autoreply</emphasis></entry>
40433 <entry>Type: <emphasis>boolean</emphasis></entry>
40434 <entry>Default: <emphasis>false</emphasis></entry>
40435 </row>
40436 </tbody>
40437 </tgroup>
40438 </informaltable>
40439 <para>
40440 If this is set, the contents of the file named by the <option>file</option> option are
40441 subjected to string expansion as they are added to the message.
40442 </para>
40443 <para>
40444 <indexterm role="option">
40445 <primary><option>file_optional</option></primary>
40446 </indexterm>
40447 </para>
40448 <informaltable frame="all">
40449 <tgroup cols="4" colsep="0" rowsep="0">
40450 <colspec colwidth="8*" align="left"/>
40451 <colspec colwidth="6*" align="center"/>
40452 <colspec colwidth="6*" align="center"/>
40453 <colspec colwidth="6*" align="right"/>
40454 <tbody>
40455 <row>
40456 <entry><option>file_optional</option></entry>
40457 <entry>Use: <emphasis>autoreply</emphasis></entry>
40458 <entry>Type: <emphasis>boolean</emphasis></entry>
40459 <entry>Default: <emphasis>false</emphasis></entry>
40460 </row>
40461 </tbody>
40462 </tgroup>
40463 </informaltable>
40464 <para>
40465 If this option is true, no error is generated if the file named by the <option>file</option>
40466 option or passed with the address does not exist or cannot be read.
40467 </para>
40468 <para>
40469 <indexterm role="option">
40470 <primary><option>from</option></primary>
40471 </indexterm>
40472 </para>
40473 <informaltable frame="all">
40474 <tgroup cols="4" colsep="0" rowsep="0">
40475 <colspec colwidth="8*" align="left"/>
40476 <colspec colwidth="6*" align="center"/>
40477 <colspec colwidth="6*" align="center"/>
40478 <colspec colwidth="6*" align="right"/>
40479 <tbody>
40480 <row>
40481 <entry><option>from</option></entry>
40482 <entry>Use: <emphasis>autoreply</emphasis></entry>
40483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40484 <entry>Default: <emphasis>unset</emphasis></entry>
40485 </row>
40486 </tbody>
40487 </tgroup>
40488 </informaltable>
40489 <para>
40490 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
40491 specified by the transport.
40492 </para>
40493 <para>
40494 <indexterm role="option">
40495 <primary><option>headers</option></primary>
40496 </indexterm>
40497 </para>
40498 <informaltable frame="all">
40499 <tgroup cols="4" colsep="0" rowsep="0">
40500 <colspec colwidth="8*" align="left"/>
40501 <colspec colwidth="6*" align="center"/>
40502 <colspec colwidth="6*" align="center"/>
40503 <colspec colwidth="6*" align="right"/>
40504 <tbody>
40505 <row>
40506 <entry><option>headers</option></entry>
40507 <entry>Use: <emphasis>autoreply</emphasis></entry>
40508 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40509 <entry>Default: <emphasis>unset</emphasis></entry>
40510 </row>
40511 </tbody>
40512 </tgroup>
40513 </informaltable>
40514 <para>
40515 This specifies additional RFC 2822 headers that are to be added to the message
40516 when the message is specified by the transport. Several can be given by using
40517 <quote>\n</quote> to separate them. There is no check on the format.
40518 </para>
40519 <para>
40520 <indexterm role="option">
40521 <primary><option>log</option></primary>
40522 </indexterm>
40523 </para>
40524 <informaltable frame="all">
40525 <tgroup cols="4" colsep="0" rowsep="0">
40526 <colspec colwidth="8*" align="left"/>
40527 <colspec colwidth="6*" align="center"/>
40528 <colspec colwidth="6*" align="center"/>
40529 <colspec colwidth="6*" align="right"/>
40530 <tbody>
40531 <row>
40532 <entry><option>log</option></entry>
40533 <entry>Use: <emphasis>autoreply</emphasis></entry>
40534 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40535 <entry>Default: <emphasis>unset</emphasis></entry>
40536 </row>
40537 </tbody>
40538 </tgroup>
40539 </informaltable>
40540 <para>
40541 This option names a file in which a record of every message sent is logged when
40542 the message is specified by the transport.
40543 </para>
40544 <para>
40545 <indexterm role="option">
40546 <primary><option>mode</option></primary>
40547 </indexterm>
40548 </para>
40549 <informaltable frame="all">
40550 <tgroup cols="4" colsep="0" rowsep="0">
40551 <colspec colwidth="8*" align="left"/>
40552 <colspec colwidth="6*" align="center"/>
40553 <colspec colwidth="6*" align="center"/>
40554 <colspec colwidth="6*" align="right"/>
40555 <tbody>
40556 <row>
40557 <entry><option>mode</option></entry>
40558 <entry>Use: <emphasis>autoreply</emphasis></entry>
40559 <entry>Type: <emphasis>octal integer</emphasis></entry>
40560 <entry>Default: <emphasis>0600</emphasis></entry>
40561 </row>
40562 </tbody>
40563 </tgroup>
40564 </informaltable>
40565 <para>
40566 If either the log file or the <quote>once</quote> file has to be created, this mode is
40567 used.
40568 </para>
40569 <para>
40570 <indexterm role="option">
40571 <primary><option>never_mail</option></primary>
40572 </indexterm>
40573 </para>
40574 <informaltable frame="all">
40575 <tgroup cols="4" colsep="0" rowsep="0">
40576 <colspec colwidth="8*" align="left"/>
40577 <colspec colwidth="6*" align="center"/>
40578 <colspec colwidth="6*" align="center"/>
40579 <colspec colwidth="6*" align="right"/>
40580 <tbody>
40581 <row>
40582 <entry><option>never_mail</option></entry>
40583 <entry>Use: <emphasis>autoreply</emphasis></entry>
40584 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
40585 <entry>Default: <emphasis>unset</emphasis></entry>
40586 </row>
40587 </tbody>
40588 </tgroup>
40589 </informaltable>
40590 <para>
40591 If any run of the transport creates a message with a recipient that matches any
40592 item in the list, that recipient is quietly discarded. If all recipients are
40593 discarded, no message is created. This applies both when the recipients are
40594 generated by a filter and when they are specified in the transport.
40595 </para>
40596 <para>
40597 <indexterm role="option">
40598 <primary><option>once</option></primary>
40599 </indexterm>
40600 </para>
40601 <informaltable frame="all">
40602 <tgroup cols="4" colsep="0" rowsep="0">
40603 <colspec colwidth="8*" align="left"/>
40604 <colspec colwidth="6*" align="center"/>
40605 <colspec colwidth="6*" align="center"/>
40606 <colspec colwidth="6*" align="right"/>
40607 <tbody>
40608 <row>
40609 <entry><option>once</option></entry>
40610 <entry>Use: <emphasis>autoreply</emphasis></entry>
40611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40612 <entry>Default: <emphasis>unset</emphasis></entry>
40613 </row>
40614 </tbody>
40615 </tgroup>
40616 </informaltable>
40617 <para>
40618 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
40619 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
40620 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
40621 </para>
40622 <para>
40623 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
40624 By default, if <option>once</option> is set to a non-empty file name, the message
40625 is not sent if a potential recipient is already listed in the database.
40626 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
40627 message is sent if that much time has elapsed since a message was last sent to
40628 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
40629 prevents a message from being sent a second time &ndash; in this case, zero means
40630 infinity.
40631 </para>
40632 <para>
40633 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
40634 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
40635 greater than zero, it changes the way Exim implements the <option>once</option> option.
40636 Instead of using a DBM file to record every recipient it sends to, it uses a
40637 regular file, whose size will never get larger than the given value.
40638 </para>
40639 <para>
40640 In the file, Exim keeps a linear list of recipient addresses and the times at
40641 which they were sent messages. If the file is full when a new address needs to
40642 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
40643 means that a given recipient may receive multiple messages, but at
40644 unpredictable intervals that depend on the rate of turnover of addresses in the
40645 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
40646 </para>
40647 <para>
40648 <indexterm role="option">
40649 <primary><option>once_file_size</option></primary>
40650 </indexterm>
40651 </para>
40652 <informaltable frame="all">
40653 <tgroup cols="4" colsep="0" rowsep="0">
40654 <colspec colwidth="8*" align="left"/>
40655 <colspec colwidth="6*" align="center"/>
40656 <colspec colwidth="6*" align="center"/>
40657 <colspec colwidth="6*" align="right"/>
40658 <tbody>
40659 <row>
40660 <entry><option>once_file_size</option></entry>
40661 <entry>Use: <emphasis>autoreply</emphasis></entry>
40662 <entry>Type: <emphasis>integer</emphasis></entry>
40663 <entry>Default: <emphasis>0</emphasis></entry>
40664 </row>
40665 </tbody>
40666 </tgroup>
40667 </informaltable>
40668 <para>
40669 See <option>once</option> above.
40670 </para>
40671 <para>
40672 <indexterm role="option">
40673 <primary><option>once_repeat</option></primary>
40674 </indexterm>
40675 </para>
40676 <informaltable frame="all">
40677 <tgroup cols="4" colsep="0" rowsep="0">
40678 <colspec colwidth="8*" align="left"/>
40679 <colspec colwidth="6*" align="center"/>
40680 <colspec colwidth="6*" align="center"/>
40681 <colspec colwidth="6*" align="right"/>
40682 <tbody>
40683 <row>
40684 <entry><option>once_repeat</option></entry>
40685 <entry>Use: <emphasis>autoreply</emphasis></entry>
40686 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
40687 <entry>Default: <emphasis>0s</emphasis></entry>
40688 </row>
40689 </tbody>
40690 </tgroup>
40691 </informaltable>
40692 <para>
40693 See <option>once</option> above.
40694 After expansion, the value of this option must be a valid time value.
40695 </para>
40696 <para>
40697 <indexterm role="option">
40698 <primary><option>reply_to</option></primary>
40699 </indexterm>
40700 </para>
40701 <informaltable frame="all">
40702 <tgroup cols="4" colsep="0" rowsep="0">
40703 <colspec colwidth="8*" align="left"/>
40704 <colspec colwidth="6*" align="center"/>
40705 <colspec colwidth="6*" align="center"/>
40706 <colspec colwidth="6*" align="right"/>
40707 <tbody>
40708 <row>
40709 <entry><option>reply_to</option></entry>
40710 <entry>Use: <emphasis>autoreply</emphasis></entry>
40711 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40712 <entry>Default: <emphasis>unset</emphasis></entry>
40713 </row>
40714 </tbody>
40715 </tgroup>
40716 </informaltable>
40717 <para>
40718 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
40719 specified by the transport.
40720 </para>
40721 <para>
40722 <indexterm role="option">
40723 <primary><option>return_message</option></primary>
40724 </indexterm>
40725 </para>
40726 <informaltable frame="all">
40727 <tgroup cols="4" colsep="0" rowsep="0">
40728 <colspec colwidth="8*" align="left"/>
40729 <colspec colwidth="6*" align="center"/>
40730 <colspec colwidth="6*" align="center"/>
40731 <colspec colwidth="6*" align="right"/>
40732 <tbody>
40733 <row>
40734 <entry><option>return_message</option></entry>
40735 <entry>Use: <emphasis>autoreply</emphasis></entry>
40736 <entry>Type: <emphasis>boolean</emphasis></entry>
40737 <entry>Default: <emphasis>false</emphasis></entry>
40738 </row>
40739 </tbody>
40740 </tgroup>
40741 </informaltable>
40742 <para>
40743 If this is set, a copy of the original message is returned with the new
40744 message, subject to the maximum size set in the <option>return_size_limit</option> global
40745 configuration option.
40746 </para>
40747 <para>
40748 <indexterm role="option">
40749 <primary><option>subject</option></primary>
40750 </indexterm>
40751 </para>
40752 <informaltable frame="all">
40753 <tgroup cols="4" colsep="0" rowsep="0">
40754 <colspec colwidth="8*" align="left"/>
40755 <colspec colwidth="6*" align="center"/>
40756 <colspec colwidth="6*" align="center"/>
40757 <colspec colwidth="6*" align="right"/>
40758 <tbody>
40759 <row>
40760 <entry><option>subject</option></entry>
40761 <entry>Use: <emphasis>autoreply</emphasis></entry>
40762 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40763 <entry>Default: <emphasis>unset</emphasis></entry>
40764 </row>
40765 </tbody>
40766 </tgroup>
40767 </informaltable>
40768 <para>
40769 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
40770 specified by the transport. It is tempting to quote the original subject in
40771 automatic responses. For example:
40772 </para>
40773 <literallayout class="monospaced">
40774 subject = Re: $h_subject:
40775 </literallayout>
40776 <para>
40777 There is a danger in doing this, however. It may allow a third party to
40778 subscribe your users to an opt-in mailing list, provided that the list accepts
40779 bounce messages as subscription confirmations. Well-managed lists require a
40780 non-bounce message to confirm a subscription, so the danger is relatively
40781 small.
40782 </para>
40783 <para>
40784 <indexterm role="option">
40785 <primary><option>text</option></primary>
40786 </indexterm>
40787 </para>
40788 <informaltable frame="all">
40789 <tgroup cols="4" colsep="0" rowsep="0">
40790 <colspec colwidth="8*" align="left"/>
40791 <colspec colwidth="6*" align="center"/>
40792 <colspec colwidth="6*" align="center"/>
40793 <colspec colwidth="6*" align="right"/>
40794 <tbody>
40795 <row>
40796 <entry><option>text</option></entry>
40797 <entry>Use: <emphasis>autoreply</emphasis></entry>
40798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40799 <entry>Default: <emphasis>unset</emphasis></entry>
40800 </row>
40801 </tbody>
40802 </tgroup>
40803 </informaltable>
40804 <para>
40805 This specifies a single string to be used as the body of the message when the
40806 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
40807 the text comes first.
40808 </para>
40809 <para>
40810 <indexterm role="option">
40811 <primary><option>to</option></primary>
40812 </indexterm>
40813 </para>
40814 <informaltable frame="all">
40815 <tgroup cols="4" colsep="0" rowsep="0">
40816 <colspec colwidth="8*" align="left"/>
40817 <colspec colwidth="6*" align="center"/>
40818 <colspec colwidth="6*" align="center"/>
40819 <colspec colwidth="6*" align="right"/>
40820 <tbody>
40821 <row>
40822 <entry><option>to</option></entry>
40823 <entry>Use: <emphasis>autoreply</emphasis></entry>
40824 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40825 <entry>Default: <emphasis>unset</emphasis></entry>
40826 </row>
40827 </tbody>
40828 </tgroup>
40829 </informaltable>
40830 <para>
40831 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
40832 when the message is specified by the transport.
40833 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
40834 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
40835 </para>
40836 </section>
40837 </chapter>
40838
40839 <chapter id="CHAPLMTP">
40840 <title>The lmtp transport</title>
40841 <para>
40842 <indexterm role="concept">
40843 <primary>transports</primary>
40844 <secondary><command>lmtp</command></secondary>
40845 </indexterm>
40846 <indexterm role="concept">
40847 <primary><command>lmtp</command> transport</primary>
40848 </indexterm>
40849 <indexterm role="concept">
40850 <primary>LMTP</primary>
40851 <secondary>over a pipe</secondary>
40852 </indexterm>
40853 <indexterm role="concept">
40854 <primary>LMTP</primary>
40855 <secondary>over a socket</secondary>
40856 </indexterm>
40857 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
40858 specified command
40859 or by interacting with a Unix domain socket.
40860 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
40861 transports. Exim also has support for using LMTP over TCP/IP; this is
40862 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
40863 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
40864 has it commented out. You need to ensure that
40865 </para>
40866 <literallayout class="monospaced">
40867 TRANSPORT_LMTP=yes
40868 </literallayout>
40869 <para>
40870 <indexterm role="concept">
40871 <primary>options</primary>
40872 <secondary><command>lmtp</command> transport</secondary>
40873 </indexterm>
40874 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
40875 included in the Exim binary. The private options of the <command>lmtp</command> transport are
40876 as follows:
40877 </para>
40878 <para>
40879 <indexterm role="option">
40880 <primary><option>batch_id</option></primary>
40881 </indexterm>
40882 </para>
40883 <informaltable frame="all">
40884 <tgroup cols="4" colsep="0" rowsep="0">
40885 <colspec colwidth="8*" align="left"/>
40886 <colspec colwidth="6*" align="center"/>
40887 <colspec colwidth="6*" align="center"/>
40888 <colspec colwidth="6*" align="right"/>
40889 <tbody>
40890 <row>
40891 <entry><option>batch_id</option></entry>
40892 <entry>Use: <emphasis>lmtp</emphasis></entry>
40893 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40894 <entry>Default: <emphasis>unset</emphasis></entry>
40895 </row>
40896 </tbody>
40897 </tgroup>
40898 </informaltable>
40899 <para>
40900 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40901 </para>
40902 <para>
40903 <indexterm role="option">
40904 <primary><option>batch_max</option></primary>
40905 </indexterm>
40906 </para>
40907 <informaltable frame="all">
40908 <tgroup cols="4" colsep="0" rowsep="0">
40909 <colspec colwidth="8*" align="left"/>
40910 <colspec colwidth="6*" align="center"/>
40911 <colspec colwidth="6*" align="center"/>
40912 <colspec colwidth="6*" align="right"/>
40913 <tbody>
40914 <row>
40915 <entry><option>batch_max</option></entry>
40916 <entry>Use: <emphasis>lmtp</emphasis></entry>
40917 <entry>Type: <emphasis>integer</emphasis></entry>
40918 <entry>Default: <emphasis>1</emphasis></entry>
40919 </row>
40920 </tbody>
40921 </tgroup>
40922 </informaltable>
40923 <para>
40924 This limits the number of addresses that can be handled in a single delivery.
40925 Most LMTP servers can handle several addresses at once, so it is normally a
40926 good idea to increase this value. See the description of local delivery
40927 batching in chapter <xref linkend="CHAPbatching"/>.
40928 </para>
40929 <para>
40930 <indexterm role="option">
40931 <primary><option>command</option></primary>
40932 </indexterm>
40933 </para>
40934 <informaltable frame="all">
40935 <tgroup cols="4" colsep="0" rowsep="0">
40936 <colspec colwidth="8*" align="left"/>
40937 <colspec colwidth="6*" align="center"/>
40938 <colspec colwidth="6*" align="center"/>
40939 <colspec colwidth="6*" align="right"/>
40940 <tbody>
40941 <row>
40942 <entry><option>command</option></entry>
40943 <entry>Use: <emphasis>lmtp</emphasis></entry>
40944 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40945 <entry>Default: <emphasis>unset</emphasis></entry>
40946 </row>
40947 </tbody>
40948 </tgroup>
40949 </informaltable>
40950 <para>
40951 This option must be set if <option>socket</option> is not set. The string is a command which
40952 is run in a separate process. It is split up into a command name and list of
40953 arguments, each of which is separately expanded (so expansion cannot change the
40954 number of arguments). The command is run directly, not via a shell. The message
40955 is passed to the new process using the standard input and output to operate the
40956 LMTP protocol.
40957 </para>
40958 <para>
40959 <indexterm role="option">
40960 <primary><option>ignore_quota</option></primary>
40961 </indexterm>
40962 </para>
40963 <informaltable frame="all">
40964 <tgroup cols="4" colsep="0" rowsep="0">
40965 <colspec colwidth="8*" align="left"/>
40966 <colspec colwidth="6*" align="center"/>
40967 <colspec colwidth="6*" align="center"/>
40968 <colspec colwidth="6*" align="right"/>
40969 <tbody>
40970 <row>
40971 <entry><option>ignore_quota</option></entry>
40972 <entry>Use: <emphasis>lmtp</emphasis></entry>
40973 <entry>Type: <emphasis>boolean</emphasis></entry>
40974 <entry>Default: <emphasis>false</emphasis></entry>
40975 </row>
40976 </tbody>
40977 </tgroup>
40978 </informaltable>
40979 <para>
40980 <indexterm role="concept">
40981 <primary>LMTP</primary>
40982 <secondary>ignoring quota errors</secondary>
40983 </indexterm>
40984 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
40985 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
40986 in its response to the LHLO command.
40987 </para>
40988 <para>
40989 <indexterm role="option">
40990 <primary><option>socket</option></primary>
40991 </indexterm>
40992 </para>
40993 <informaltable frame="all">
40994 <tgroup cols="4" colsep="0" rowsep="0">
40995 <colspec colwidth="8*" align="left"/>
40996 <colspec colwidth="6*" align="center"/>
40997 <colspec colwidth="6*" align="center"/>
40998 <colspec colwidth="6*" align="right"/>
40999 <tbody>
41000 <row>
41001 <entry><option>socket</option></entry>
41002 <entry>Use: <emphasis>lmtp</emphasis></entry>
41003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41004 <entry>Default: <emphasis>unset</emphasis></entry>
41005 </row>
41006 </tbody>
41007 </tgroup>
41008 </informaltable>
41009 <para>
41010 This option must be set if <option>command</option> is not set. The result of expansion must
41011 be the name of a Unix domain socket. The transport connects to the socket and
41012 delivers the message to it using the LMTP protocol.
41013 </para>
41014 <para>
41015 <indexterm role="option">
41016 <primary><option>timeout</option></primary>
41017 </indexterm>
41018 </para>
41019 <informaltable frame="all">
41020 <tgroup cols="4" colsep="0" rowsep="0">
41021 <colspec colwidth="8*" align="left"/>
41022 <colspec colwidth="6*" align="center"/>
41023 <colspec colwidth="6*" align="center"/>
41024 <colspec colwidth="6*" align="right"/>
41025 <tbody>
41026 <row>
41027 <entry><option>timeout</option></entry>
41028 <entry>Use: <emphasis>lmtp</emphasis></entry>
41029 <entry>Type: <emphasis>time</emphasis></entry>
41030 <entry>Default: <emphasis>5m</emphasis></entry>
41031 </row>
41032 </tbody>
41033 </tgroup>
41034 </informaltable>
41035 <para>
41036 The transport is aborted if the created process or Unix domain socket does not
41037 respond to LMTP commands or message input within this timeout. Delivery
41038 is deferred, and will be tried again later. Here is an example of a typical
41039 LMTP transport:
41040 </para>
41041 <literallayout class="monospaced">
41042 lmtp:
41043   driver = lmtp
41044   command = /some/local/lmtp/delivery/program
41045   batch_max = 20
41046   user = exim
41047 </literallayout>
41048 <para>
41049 This delivers up to 20 addresses at a time, in a mixture of domains if
41050 necessary, running as the user <emphasis>exim</emphasis>.
41051 </para>
41052 </chapter>
41053
41054 <chapter id="CHAPpipetransport">
41055 <title>The pipe transport</title>
41056 <para>
41057 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
41058 <primary>transports</primary>
41059 <secondary><command>pipe</command></secondary>
41060 </indexterm>
41061 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
41062 <primary><command>pipe</command> transport</primary>
41063 </indexterm>
41064 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
41065 running in another process. One example is the use of <command>pipe</command> as a
41066 pseudo-remote transport for passing messages to some other delivery mechanism
41067 (such as UUCP). Another is the use by individual users to automatically process
41068 their incoming messages. The <command>pipe</command> transport can be used in one of the
41069 following ways:
41070 </para>
41071 <itemizedlist>
41072 <listitem>
41073 <para>
41074 <indexterm role="variable">
41075 <primary><varname>$local_part</varname></primary>
41076 </indexterm>
41077 A router routes one address to a transport in the normal way, and the
41078 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
41079 contains the local part of the address (as usual), and the command that is run
41080 is specified by the <option>command</option> option on the transport.
41081 </para>
41082 </listitem>
41083 <listitem>
41084 <para>
41085 <indexterm role="variable">
41086 <primary><varname>$pipe_addresses</varname></primary>
41087 </indexterm>
41088 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
41089 transport can handle more than one address in a single run. In this case, when
41090 more than one address is routed to the transport, <varname>$local_part</varname> is not set
41091 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
41092 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
41093 that are routed to the transport.
41094 </para>
41095 </listitem>
41096 <listitem>
41097 <para>
41098 <indexterm role="variable">
41099 <primary><varname>$address_pipe</varname></primary>
41100 </indexterm>
41101 A router redirects an address directly to a pipe command (for example, from an
41102 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
41103 pipe command, and the <option>command</option> option on the transport is ignored. If only
41104 one address is being transported (<option>batch_max</option> is not greater than one, or
41105 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
41106 the local part that was redirected.
41107 </para>
41108 </listitem>
41109 </itemizedlist>
41110 <para>
41111 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
41112 deliver messages over pipes using the LMTP interactive protocol. This is
41113 implemented by the <command>lmtp</command> transport.
41114 </para>
41115 <para>
41116 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
41117 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
41118 other cases, the uid and gid have to be specified explicitly, either on the
41119 transport or on the router that handles the address. Current and <quote>home</quote>
41120 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
41121 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
41122 for a discussion of local delivery batching.
41123 </para>
41124 <section id="SECID140">
41125 <title>Concurrent delivery</title>
41126 <para>
41127 If two messages arrive at almost the same time, and both are routed to a pipe
41128 delivery, the two pipe transports may be run concurrently. You must ensure that
41129 any pipe commands you set up are robust against this happening. If the commands
41130 write to a file, the <option>exim_lock</option> utility might be of use.
41131 </para>
41132 </section>
41133 <section id="SECID141">
41134 <title>Returned status and data</title>
41135 <para>
41136 <indexterm role="concept">
41137 <primary><command>pipe</command> transport</primary>
41138 <secondary>returned data</secondary>
41139 </indexterm>
41140 If the command exits with a non-zero return code, the delivery is deemed to
41141 have failed, unless either the <option>ignore_status</option> option is set (in which case
41142 the return code is treated as zero), or the return code is one of those listed
41143 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
41144 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
41145 logged, but are not included in the bounce message, which merely contains
41146 <quote>local delivery failed</quote>.
41147 </para>
41148 <para>
41149 If the command exits on a signal and the <option>freeze_signal</option> option is set then
41150 the message will be frozen in the queue. If that option is not set, a bounce
41151 will be sent as normal.
41152 </para>
41153 <para>
41154 If the return code is greater than 128 and the command being run is a shell
41155 script, it normally means that the script was terminated by a signal whose
41156 value is the return code minus 128. The <option>freeze_signal</option> option does not
41157 apply in this case.
41158 </para>
41159 <para>
41160 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
41161 return code is set to 127. This is the value that a shell returns if it is
41162 asked to run a non-existent command. The wording for the log line suggests that
41163 a non-existent command may be the problem.
41164 </para>
41165 <para>
41166 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
41167 set and the command produces any output on its standard output or standard
41168 error streams, the command is considered to have failed, even if it gave a zero
41169 return code or if <option>ignore_status</option> is set. The output from the command is
41170 included as part of the bounce message. The <option>return_fail_output</option> option is
41171 similar, except that output is returned only when the command exits with a
41172 failure return code, that is, a value other than zero or a code that matches
41173 <option>temp_errors</option>.
41174 </para>
41175 </section>
41176 <section id="SECThowcommandrun">
41177 <title>How the command is run</title>
41178 <para>
41179 <indexterm role="concept">
41180 <primary><command>pipe</command> transport</primary>
41181 <secondary>path for command</secondary>
41182 </indexterm>
41183 The command line is (by default) broken down into a command name and arguments
41184 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
41185 <option>restrict_to_path</option> options can be used to restrict the commands that may be
41186 run.
41187 </para>
41188 <para>
41189 <indexterm role="concept">
41190 <primary>quoting</primary>
41191 <secondary>in pipe command</secondary>
41192 </indexterm>
41193 Unquoted arguments are delimited by white space. If an argument appears in
41194 double quotes, backslash is interpreted as an escape character in the usual
41195 way. If an argument appears in single quotes, no escaping is done.
41196 </para>
41197 <para>
41198 String expansion is applied to the command line except when it comes from a
41199 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
41200 expansion is applied to each argument in turn rather than to the whole line.
41201 For this reason, any string expansion item that contains white space must be
41202 quoted so as to be contained within a single argument. A setting such as
41203 </para>
41204 <literallayout class="monospaced">
41205 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
41206 </literallayout>
41207 <para>
41208 will not work, because the expansion item gets split between several
41209 arguments. You have to write
41210 </para>
41211 <literallayout class="monospaced">
41212 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
41213 </literallayout>
41214 <para>
41215 to ensure that it is all in one argument. The expansion is done in this way,
41216 argument by argument, so that the number of arguments cannot be changed as a
41217 result of expansion, and quotes or backslashes in inserted variables do not
41218 interact with external quoting. However, this leads to problems if you want to
41219 generate multiple arguments (or the command name plus arguments) from a single
41220 expansion. In this situation, the simplest solution is to use a shell. For
41221 example:
41222 </para>
41223 <literallayout class="monospaced">
41224 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
41225 </literallayout>
41226 <para>
41227 <indexterm role="concept">
41228 <primary>transport</primary>
41229 <secondary>filter</secondary>
41230 </indexterm>
41231 <indexterm role="concept">
41232 <primary>filter</primary>
41233 <secondary>transport filter</secondary>
41234 </indexterm>
41235 <indexterm role="variable">
41236 <primary><varname>$pipe_addresses</varname></primary>
41237 </indexterm>
41238 Special handling takes place when an argument consists of precisely the text
41239 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
41240 place this string is recognized is when it appears as an argument for a pipe or
41241 transport filter command. It causes each address that is being handled to be
41242 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
41243 avoids any problems with spaces or shell metacharacters, and is of use when a
41244 <command>pipe</command> transport is handling groups of addresses in a batch.
41245 </para>
41246 <para>
41247 After splitting up into arguments and expansion, the resulting command is run
41248 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
41249 message that is being delivered is supplied on the standard input, and the
41250 standard output and standard error are both connected to a single pipe that is
41251 read by Exim. The <option>max_output</option> option controls how much output the command
41252 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
41253 control what is done with it.
41254 </para>
41255 <para>
41256 Not running the command under a shell (by default) lessens the security risks
41257 in cases when a command from a user&#x2019;s filter file is built out of data that was
41258 taken from an incoming message. If a shell is required, it can of course be
41259 explicitly specified as the command to be run. However, there are circumstances
41260 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
41261 under a shell and cannot easily be modified. To allow for these cases, there is
41262 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
41263 works. Instead of breaking up the command line as just described, it expands it
41264 as a single string and passes the result to <filename>/bin/sh</filename>. The
41265 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
41266 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
41267 </para>
41268 </section>
41269 <section id="SECTpipeenv">
41270 <title>Environment variables</title>
41271 <para>
41272 <indexterm role="concept">
41273 <primary><command>pipe</command> transport</primary>
41274 <secondary>environment for command</secondary>
41275 </indexterm>
41276 <indexterm role="concept">
41277 <primary>environment for pipe transport</primary>
41278 </indexterm>
41279 The environment variables listed below are set up when the command is invoked.
41280 This list is a compromise for maximum compatibility with other MTAs. Note that
41281 the <option>environment</option> option can be used to add additional variables to this
41282 environment.
41283 </para>
41284 <literallayout>
41285 <literal>DOMAIN            </literal>   the domain of the address
41286 <literal>HOME              </literal>   the home directory, if set
41287 <literal>HOST              </literal>   the host name when called from a router (see below)
41288 <literal>LOCAL_PART        </literal>   see below
41289 <literal>LOCAL_PART_PREFIX </literal>   see below
41290 <literal>LOCAL_PART_SUFFIX </literal>   see below
41291 <literal>LOGNAME           </literal>   see below
41292 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
41293 <literal>PATH              </literal>   as specified by the <option>path</option> option below
41294 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
41295 <literal>RECIPIENT         </literal>   the complete recipient address
41296 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
41297 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
41298 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
41299 <literal>USER              </literal>   see below
41300 </literallayout>
41301 <para>
41302 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
41303 router, LOCAL_PART is set to the local part of the address. When it is
41304 called as a result of a forward or alias expansion, LOCAL_PART is set to
41305 the local part of the address that was expanded. In both cases, any affixes are
41306 removed from the local part, and made available in LOCAL_PART_PREFIX and
41307 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
41308 same value as LOCAL_PART for compatibility with other MTAs.
41309 </para>
41310 <para>
41311 <indexterm role="concept">
41312 <primary>HOST</primary>
41313 </indexterm>
41314 HOST is set only when a <command>pipe</command> transport is called from a router that
41315 associates hosts with an address, typically when using <command>pipe</command> as a
41316 pseudo-remote transport. HOST is set to the first host name specified by
41317 the router.
41318 </para>
41319 <para>
41320 <indexterm role="concept">
41321 <primary>HOME</primary>
41322 </indexterm>
41323 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
41324 for the HOME environment variable. Otherwise, a home directory may be set
41325 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
41326 user&#x2019;s home directory if <option>check_local_user</option> is set.
41327 </para>
41328 </section>
41329 <section id="SECID142">
41330 <title>Private options for pipe</title>
41331 <para>
41332 <indexterm role="concept">
41333 <primary>options</primary>
41334 <secondary><command>pipe</command> transport</secondary>
41335 </indexterm>
41336 </para>
41337 <para>
41338 <indexterm role="option">
41339 <primary><option>allow_commands</option></primary>
41340 </indexterm>
41341 </para>
41342 <informaltable frame="all">
41343 <tgroup cols="4" colsep="0" rowsep="0">
41344 <colspec colwidth="8*" align="left"/>
41345 <colspec colwidth="6*" align="center"/>
41346 <colspec colwidth="6*" align="center"/>
41347 <colspec colwidth="6*" align="right"/>
41348 <tbody>
41349 <row>
41350 <entry><option>allow_commands</option></entry>
41351 <entry>Use: <emphasis>pipe</emphasis></entry>
41352 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41353 <entry>Default: <emphasis>unset</emphasis></entry>
41354 </row>
41355 </tbody>
41356 </tgroup>
41357 </informaltable>
41358 <para>
41359 <indexterm role="concept">
41360 <primary><command>pipe</command> transport</primary>
41361 <secondary>permitted commands</secondary>
41362 </indexterm>
41363 The string is expanded, and is then interpreted as a colon-separated list of
41364 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
41365 permitted are those in the <option>allow_commands</option> list. They need not be absolute
41366 paths; the <option>path</option> option is still used for relative paths. If
41367 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
41368 in the <option>allow_commands</option> list, or a name without any slashes that is found on
41369 the path. In other words, if neither <option>allow_commands</option> nor
41370 <option>restrict_to_path</option> is set, there is no restriction on the command, but
41371 otherwise only commands that are permitted by one or the other are allowed. For
41372 example, if
41373 </para>
41374 <literallayout class="monospaced">
41375 allow_commands = /usr/bin/vacation
41376 </literallayout>
41377 <para>
41378 and <option>restrict_to_path</option> is not set, the only permitted command is
41379 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
41380 <option>use_shell</option> is set.
41381 </para>
41382 <para>
41383 <indexterm role="option">
41384 <primary><option>batch_id</option></primary>
41385 </indexterm>
41386 </para>
41387 <informaltable frame="all">
41388 <tgroup cols="4" colsep="0" rowsep="0">
41389 <colspec colwidth="8*" align="left"/>
41390 <colspec colwidth="6*" align="center"/>
41391 <colspec colwidth="6*" align="center"/>
41392 <colspec colwidth="6*" align="right"/>
41393 <tbody>
41394 <row>
41395 <entry><option>batch_id</option></entry>
41396 <entry>Use: <emphasis>pipe</emphasis></entry>
41397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41398 <entry>Default: <emphasis>unset</emphasis></entry>
41399 </row>
41400 </tbody>
41401 </tgroup>
41402 </informaltable>
41403 <para>
41404 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41405 </para>
41406 <para>
41407 <indexterm role="option">
41408 <primary><option>batch_max</option></primary>
41409 </indexterm>
41410 </para>
41411 <informaltable frame="all">
41412 <tgroup cols="4" colsep="0" rowsep="0">
41413 <colspec colwidth="8*" align="left"/>
41414 <colspec colwidth="6*" align="center"/>
41415 <colspec colwidth="6*" align="center"/>
41416 <colspec colwidth="6*" align="right"/>
41417 <tbody>
41418 <row>
41419 <entry><option>batch_max</option></entry>
41420 <entry>Use: <emphasis>pipe</emphasis></entry>
41421 <entry>Type: <emphasis>integer</emphasis></entry>
41422 <entry>Default: <emphasis>1</emphasis></entry>
41423 </row>
41424 </tbody>
41425 </tgroup>
41426 </informaltable>
41427 <para>
41428 This limits the number of addresses that can be handled in a single delivery.
41429 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41430 </para>
41431 <para>
41432 <indexterm role="option">
41433 <primary><option>check_string</option></primary>
41434 </indexterm>
41435 </para>
41436 <informaltable frame="all">
41437 <tgroup cols="4" colsep="0" rowsep="0">
41438 <colspec colwidth="8*" align="left"/>
41439 <colspec colwidth="6*" align="center"/>
41440 <colspec colwidth="6*" align="center"/>
41441 <colspec colwidth="6*" align="right"/>
41442 <tbody>
41443 <row>
41444 <entry><option>check_string</option></entry>
41445 <entry>Use: <emphasis>pipe</emphasis></entry>
41446 <entry>Type: <emphasis>string</emphasis></entry>
41447 <entry>Default: <emphasis>unset</emphasis></entry>
41448 </row>
41449 </tbody>
41450 </tgroup>
41451 </informaltable>
41452 <para>
41453 As <command>pipe</command> writes the message, the start of each line is tested for matching
41454 <option>check_string</option>, and if it does, the initial matching characters are replaced
41455 by the contents of <option>escape_string</option>, provided both are set. The value of
41456 <option>check_string</option> is a literal string, not a regular expression, and the case of
41457 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
41458 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
41459 the SMTP escaping protocol. Any settings made in the configuration file are
41460 ignored.
41461 </para>
41462 <para>
41463 <indexterm role="option">
41464 <primary><option>command</option></primary>
41465 </indexterm>
41466 </para>
41467 <informaltable frame="all">
41468 <tgroup cols="4" colsep="0" rowsep="0">
41469 <colspec colwidth="8*" align="left"/>
41470 <colspec colwidth="6*" align="center"/>
41471 <colspec colwidth="6*" align="center"/>
41472 <colspec colwidth="6*" align="right"/>
41473 <tbody>
41474 <row>
41475 <entry><option>command</option></entry>
41476 <entry>Use: <emphasis>pipe</emphasis></entry>
41477 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41478 <entry>Default: <emphasis>unset</emphasis></entry>
41479 </row>
41480 </tbody>
41481 </tgroup>
41482 </informaltable>
41483 <para>
41484 This option need not be set when <command>pipe</command> is being used to deliver to pipes
41485 obtained directly from address redirections. In other cases, the option must be
41486 set, to provide a command to be run. It need not yield an absolute path (see
41487 the <option>path</option> option below). The command is split up into separate arguments by
41488 Exim, and each argument is separately expanded, as described in section
41489 <xref linkend="SECThowcommandrun"/> above.
41490 </para>
41491 <para>
41492 <indexterm role="option">
41493 <primary><option>environment</option></primary>
41494 </indexterm>
41495 </para>
41496 <informaltable frame="all">
41497 <tgroup cols="4" colsep="0" rowsep="0">
41498 <colspec colwidth="8*" align="left"/>
41499 <colspec colwidth="6*" align="center"/>
41500 <colspec colwidth="6*" align="center"/>
41501 <colspec colwidth="6*" align="right"/>
41502 <tbody>
41503 <row>
41504 <entry><option>environment</option></entry>
41505 <entry>Use: <emphasis>pipe</emphasis></entry>
41506 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41507 <entry>Default: <emphasis>unset</emphasis></entry>
41508 </row>
41509 </tbody>
41510 </tgroup>
41511 </informaltable>
41512 <para>
41513 <indexterm role="concept">
41514 <primary><command>pipe</command> transport</primary>
41515 <secondary>environment for command</secondary>
41516 </indexterm>
41517 <indexterm role="concept">
41518 <primary>environment for <command>pipe</command> transport</primary>
41519 </indexterm>
41520 This option is used to add additional variables to the environment in which the
41521 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
41522 a string which is expanded, and then interpreted as a colon-separated list of
41523 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
41524 </para>
41525 <para>
41526 <indexterm role="option">
41527 <primary><option>escape_string</option></primary>
41528 </indexterm>
41529 </para>
41530 <informaltable frame="all">
41531 <tgroup cols="4" colsep="0" rowsep="0">
41532 <colspec colwidth="8*" align="left"/>
41533 <colspec colwidth="6*" align="center"/>
41534 <colspec colwidth="6*" align="center"/>
41535 <colspec colwidth="6*" align="right"/>
41536 <tbody>
41537 <row>
41538 <entry><option>escape_string</option></entry>
41539 <entry>Use: <emphasis>pipe</emphasis></entry>
41540 <entry>Type: <emphasis>string</emphasis></entry>
41541 <entry>Default: <emphasis>unset</emphasis></entry>
41542 </row>
41543 </tbody>
41544 </tgroup>
41545 </informaltable>
41546 <para>
41547 See <option>check_string</option> above.
41548 </para>
41549 <para>
41550 <indexterm role="option">
41551 <primary><option>freeze_exec_fail</option></primary>
41552 </indexterm>
41553 </para>
41554 <informaltable frame="all">
41555 <tgroup cols="4" colsep="0" rowsep="0">
41556 <colspec colwidth="8*" align="left"/>
41557 <colspec colwidth="6*" align="center"/>
41558 <colspec colwidth="6*" align="center"/>
41559 <colspec colwidth="6*" align="right"/>
41560 <tbody>
41561 <row>
41562 <entry><option>freeze_exec_fail</option></entry>
41563 <entry>Use: <emphasis>pipe</emphasis></entry>
41564 <entry>Type: <emphasis>boolean</emphasis></entry>
41565 <entry>Default: <emphasis>false</emphasis></entry>
41566 </row>
41567 </tbody>
41568 </tgroup>
41569 </informaltable>
41570 <para>
41571 <indexterm role="concept">
41572 <primary>exec failure</primary>
41573 </indexterm>
41574 <indexterm role="concept">
41575 <primary>failure of exec</primary>
41576 </indexterm>
41577 <indexterm role="concept">
41578 <primary><command>pipe</command> transport</primary>
41579 <secondary>failure of exec</secondary>
41580 </indexterm>
41581 Failure to exec the command in a pipe transport is by default treated like
41582 any other failure while running the command. However, if <option>freeze_exec_fail</option>
41583 is set, failure to exec is treated specially, and causes the message to be
41584 frozen, whatever the setting of <option>ignore_status</option>.
41585 </para>
41586 <para>
41587 <indexterm role="option">
41588 <primary><option>freeze_signal</option></primary>
41589 </indexterm>
41590 </para>
41591 <informaltable frame="all">
41592 <tgroup cols="4" colsep="0" rowsep="0">
41593 <colspec colwidth="8*" align="left"/>
41594 <colspec colwidth="6*" align="center"/>
41595 <colspec colwidth="6*" align="center"/>
41596 <colspec colwidth="6*" align="right"/>
41597 <tbody>
41598 <row>
41599 <entry><option>freeze_signal</option></entry>
41600 <entry>Use: <emphasis>pipe</emphasis></entry>
41601 <entry>Type: <emphasis>boolean</emphasis></entry>
41602 <entry>Default: <emphasis>false</emphasis></entry>
41603 </row>
41604 </tbody>
41605 </tgroup>
41606 </informaltable>
41607 <para>
41608 <indexterm role="concept">
41609 <primary>signal exit</primary>
41610 </indexterm>
41611 <indexterm role="concept">
41612 <primary><command>pipe</command> transport</primary>
41613 <secondary>,</secondary>
41614 </indexterm>
41615 Normally if the process run by a command in a pipe transport exits on a signal,
41616 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
41617 frozen in Exim&#x2019;s queue instead.
41618 </para>
41619 <para>
41620 <indexterm role="option">
41621 <primary><option>ignore_status</option></primary>
41622 </indexterm>
41623 </para>
41624 <informaltable frame="all">
41625 <tgroup cols="4" colsep="0" rowsep="0">
41626 <colspec colwidth="8*" align="left"/>
41627 <colspec colwidth="6*" align="center"/>
41628 <colspec colwidth="6*" align="center"/>
41629 <colspec colwidth="6*" align="right"/>
41630 <tbody>
41631 <row>
41632 <entry><option>ignore_status</option></entry>
41633 <entry>Use: <emphasis>pipe</emphasis></entry>
41634 <entry>Type: <emphasis>boolean</emphasis></entry>
41635 <entry>Default: <emphasis>false</emphasis></entry>
41636 </row>
41637 </tbody>
41638 </tgroup>
41639 </informaltable>
41640 <para>
41641 If this option is true, the status returned by the subprocess that is set up to
41642 run the command is ignored, and Exim behaves as if zero had been returned.
41643 Otherwise, a non-zero status or termination by signal causes an error return
41644 from the transport unless the status value is one of those listed in
41645 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
41646 </para>
41647 <para>
41648 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
41649 See the <option>timeout_defer</option> option for how timeouts are handled.
41650 </para>
41651 <para>
41652 <indexterm role="option">
41653 <primary><option>log_defer_output</option></primary>
41654 </indexterm>
41655 </para>
41656 <informaltable frame="all">
41657 <tgroup cols="4" colsep="0" rowsep="0">
41658 <colspec colwidth="8*" align="left"/>
41659 <colspec colwidth="6*" align="center"/>
41660 <colspec colwidth="6*" align="center"/>
41661 <colspec colwidth="6*" align="right"/>
41662 <tbody>
41663 <row>
41664 <entry><option>log_defer_output</option></entry>
41665 <entry>Use: <emphasis>pipe</emphasis></entry>
41666 <entry>Type: <emphasis>boolean</emphasis></entry>
41667 <entry>Default: <emphasis>false</emphasis></entry>
41668 </row>
41669 </tbody>
41670 </tgroup>
41671 </informaltable>
41672 <para>
41673 <indexterm role="concept">
41674 <primary><command>pipe</command> transport</primary>
41675 <secondary>logging output</secondary>
41676 </indexterm>
41677 If this option is set, and the status returned by the command is
41678 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
41679 and any output was produced, the first line of it is written to the main log.
41680 </para>
41681 <para>
41682 <indexterm role="option">
41683 <primary><option>log_fail_output</option></primary>
41684 </indexterm>
41685 </para>
41686 <informaltable frame="all">
41687 <tgroup cols="4" colsep="0" rowsep="0">
41688 <colspec colwidth="8*" align="left"/>
41689 <colspec colwidth="6*" align="center"/>
41690 <colspec colwidth="6*" align="center"/>
41691 <colspec colwidth="6*" align="right"/>
41692 <tbody>
41693 <row>
41694 <entry><option>log_fail_output</option></entry>
41695 <entry>Use: <emphasis>pipe</emphasis></entry>
41696 <entry>Type: <emphasis>boolean</emphasis></entry>
41697 <entry>Default: <emphasis>false</emphasis></entry>
41698 </row>
41699 </tbody>
41700 </tgroup>
41701 </informaltable>
41702 <para>
41703 If this option is set, and the command returns any output, and also ends with a
41704 return code that is neither zero nor one of the return codes listed in
41705 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
41706 written to the main log. This option and <option>log_output</option> are mutually exclusive.
41707 Only one of them may be set.
41708 </para>
41709 <para>
41710 <indexterm role="option">
41711 <primary><option>log_output</option></primary>
41712 </indexterm>
41713 </para>
41714 <informaltable frame="all">
41715 <tgroup cols="4" colsep="0" rowsep="0">
41716 <colspec colwidth="8*" align="left"/>
41717 <colspec colwidth="6*" align="center"/>
41718 <colspec colwidth="6*" align="center"/>
41719 <colspec colwidth="6*" align="right"/>
41720 <tbody>
41721 <row>
41722 <entry><option>log_output</option></entry>
41723 <entry>Use: <emphasis>pipe</emphasis></entry>
41724 <entry>Type: <emphasis>boolean</emphasis></entry>
41725 <entry>Default: <emphasis>false</emphasis></entry>
41726 </row>
41727 </tbody>
41728 </tgroup>
41729 </informaltable>
41730 <para>
41731 If this option is set and the command returns any output, the first line of
41732 output is written to the main log, whatever the return code. This option and
41733 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
41734 </para>
41735 <para>
41736 <indexterm role="option">
41737 <primary><option>max_output</option></primary>
41738 </indexterm>
41739 </para>
41740 <informaltable frame="all">
41741 <tgroup cols="4" colsep="0" rowsep="0">
41742 <colspec colwidth="8*" align="left"/>
41743 <colspec colwidth="6*" align="center"/>
41744 <colspec colwidth="6*" align="center"/>
41745 <colspec colwidth="6*" align="right"/>
41746 <tbody>
41747 <row>
41748 <entry><option>max_output</option></entry>
41749 <entry>Use: <emphasis>pipe</emphasis></entry>
41750 <entry>Type: <emphasis>integer</emphasis></entry>
41751 <entry>Default: <emphasis>20K</emphasis></entry>
41752 </row>
41753 </tbody>
41754 </tgroup>
41755 </informaltable>
41756 <para>
41757 This specifies the maximum amount of output that the command may produce on its
41758 standard output and standard error file combined. If the limit is exceeded, the
41759 process running the command is killed. This is intended as a safety measure to
41760 catch runaway processes. The limit is applied independently of the settings of
41761 the options that control what is done with such output (for example,
41762 <option>return_output</option>). Because of buffering effects, the amount of output may
41763 exceed the limit by a small amount before Exim notices.
41764 </para>
41765 <para>
41766 <indexterm role="option">
41767 <primary><option>message_prefix</option></primary>
41768 </indexterm>
41769 </para>
41770 <informaltable frame="all">
41771 <tgroup cols="4" colsep="0" rowsep="0">
41772 <colspec colwidth="8*" align="left"/>
41773 <colspec colwidth="6*" align="center"/>
41774 <colspec colwidth="6*" align="center"/>
41775 <colspec colwidth="6*" align="right"/>
41776 <tbody>
41777 <row>
41778 <entry><option>message_prefix</option></entry>
41779 <entry>Use: <emphasis>pipe</emphasis></entry>
41780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41781 <entry>Default: <emphasis>see below</emphasis></entry>
41782 </row>
41783 </tbody>
41784 </tgroup>
41785 </informaltable>
41786 <para>
41787 The string specified here is expanded and output at the start of every message.
41788 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
41789 </para>
41790 <literallayout class="monospaced">
41791 message_prefix = \
41792   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
41793   ${tod_bsdinbox}\n
41794 </literallayout>
41795 <para>
41796 <indexterm role="concept">
41797 <primary>Cyrus</primary>
41798 </indexterm>
41799 <indexterm role="concept">
41800 <primary><option>tmail</option></primary>
41801 </indexterm>
41802 <indexterm role="concept">
41803 <primary><quote>From</quote> line</primary>
41804 </indexterm>
41805 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
41806 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
41807 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
41808 setting
41809 </para>
41810 <literallayout class="monospaced">
41811 message_prefix =
41812 </literallayout>
41813 <para>
41814 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41815 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41816 </para>
41817 <para>
41818 <indexterm role="option">
41819 <primary><option>message_suffix</option></primary>
41820 </indexterm>
41821 </para>
41822 <informaltable frame="all">
41823 <tgroup cols="4" colsep="0" rowsep="0">
41824 <colspec colwidth="8*" align="left"/>
41825 <colspec colwidth="6*" align="center"/>
41826 <colspec colwidth="6*" align="center"/>
41827 <colspec colwidth="6*" align="right"/>
41828 <tbody>
41829 <row>
41830 <entry><option>message_suffix</option></entry>
41831 <entry>Use: <emphasis>pipe</emphasis></entry>
41832 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41833 <entry>Default: <emphasis>see below</emphasis></entry>
41834 </row>
41835 </tbody>
41836 </tgroup>
41837 </informaltable>
41838 <para>
41839 The string specified here is expanded and output at the end of every message.
41840 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
41841 The suffix can be suppressed by setting
41842 </para>
41843 <literallayout class="monospaced">
41844 message_suffix =
41845 </literallayout>
41846 <para>
41847 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41848 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41849 </para>
41850 <para>
41851 <indexterm role="option">
41852 <primary><option>path</option></primary>
41853 </indexterm>
41854 </para>
41855 <informaltable frame="all">
41856 <tgroup cols="4" colsep="0" rowsep="0">
41857 <colspec colwidth="8*" align="left"/>
41858 <colspec colwidth="6*" align="center"/>
41859 <colspec colwidth="6*" align="center"/>
41860 <colspec colwidth="6*" align="right"/>
41861 <tbody>
41862 <row>
41863 <entry><option>path</option></entry>
41864 <entry>Use: <emphasis>pipe</emphasis></entry>
41865 <entry>Type: <emphasis>string</emphasis></entry>
41866 <entry>Default: <emphasis>see below</emphasis></entry>
41867 </row>
41868 </tbody>
41869 </tgroup>
41870 </informaltable>
41871 <para>
41872 This option specifies the string that is set up in the PATH environment
41873 variable of the subprocess. The default is:
41874 </para>
41875 <literallayout class="monospaced">
41876 /bin:/usr/bin
41877 </literallayout>
41878 <para>
41879 If the <option>command</option> option does not yield an absolute path name, the command is
41880 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
41881 apply to a command specified as a transport filter.
41882 </para>
41883 <para>
41884 <indexterm role="option">
41885 <primary><option>permit_coredump</option></primary>
41886 </indexterm>
41887 </para>
41888 <informaltable frame="all">
41889 <tgroup cols="4" colsep="0" rowsep="0">
41890 <colspec colwidth="8*" align="left"/>
41891 <colspec colwidth="6*" align="center"/>
41892 <colspec colwidth="6*" align="center"/>
41893 <colspec colwidth="6*" align="right"/>
41894 <tbody>
41895 <row>
41896 <entry><option>permit_coredump</option></entry>
41897 <entry>Use: <emphasis>pipe</emphasis></entry>
41898 <entry>Type: <emphasis>boolean</emphasis></entry>
41899 <entry>Default: <emphasis>false</emphasis></entry>
41900 </row>
41901 </tbody>
41902 </tgroup>
41903 </informaltable>
41904 <para>
41905 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
41906 a core-dump of a pipe command, enable this command.  This enables core-dumps
41907 during delivery and affects both the Exim binary and the pipe command run.
41908 It is recommended that this option remain off unless and until you have a need
41909 for it and that this only be enabled when needed, as the risk of excessive
41910 resource consumption can be quite high.  Note also that Exim is typically
41911 installed as a setuid binary and most operating systems will inhibit coredumps
41912 of these by default, so further OS-specific action may be required.
41913 </para>
41914 <para>
41915 <indexterm role="option">
41916 <primary><option>pipe_as_creator</option></primary>
41917 </indexterm>
41918 </para>
41919 <informaltable frame="all">
41920 <tgroup cols="4" colsep="0" rowsep="0">
41921 <colspec colwidth="8*" align="left"/>
41922 <colspec colwidth="6*" align="center"/>
41923 <colspec colwidth="6*" align="center"/>
41924 <colspec colwidth="6*" align="right"/>
41925 <tbody>
41926 <row>
41927 <entry><option>pipe_as_creator</option></entry>
41928 <entry>Use: <emphasis>pipe</emphasis></entry>
41929 <entry>Type: <emphasis>boolean</emphasis></entry>
41930 <entry>Default: <emphasis>false</emphasis></entry>
41931 </row>
41932 </tbody>
41933 </tgroup>
41934 </informaltable>
41935 <para>
41936 <indexterm role="concept">
41937 <primary>uid (user id)</primary>
41938 <secondary>local delivery</secondary>
41939 </indexterm>
41940 If the generic <option>user</option> option is not set and this option is true, the delivery
41941 process is run under the uid that was in force when Exim was originally called
41942 to accept the message. If the group id is not otherwise set (via the generic
41943 <option>group</option> option), the gid that was in force when Exim was originally called to
41944 accept the message is used.
41945 </para>
41946 <para>
41947 <indexterm role="option">
41948 <primary><option>restrict_to_path</option></primary>
41949 </indexterm>
41950 </para>
41951 <informaltable frame="all">
41952 <tgroup cols="4" colsep="0" rowsep="0">
41953 <colspec colwidth="8*" align="left"/>
41954 <colspec colwidth="6*" align="center"/>
41955 <colspec colwidth="6*" align="center"/>
41956 <colspec colwidth="6*" align="right"/>
41957 <tbody>
41958 <row>
41959 <entry><option>restrict_to_path</option></entry>
41960 <entry>Use: <emphasis>pipe</emphasis></entry>
41961 <entry>Type: <emphasis>boolean</emphasis></entry>
41962 <entry>Default: <emphasis>false</emphasis></entry>
41963 </row>
41964 </tbody>
41965 </tgroup>
41966 </informaltable>
41967 <para>
41968 When this option is set, any command name not listed in <option>allow_commands</option> must
41969 contain no slashes. The command is searched for only in the directories listed
41970 in the <option>path</option> option. This option is intended for use in the case when a pipe
41971 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
41972 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
41973 </para>
41974 <para>
41975 <indexterm role="option">
41976 <primary><option>return_fail_output</option></primary>
41977 </indexterm>
41978 </para>
41979 <informaltable frame="all">
41980 <tgroup cols="4" colsep="0" rowsep="0">
41981 <colspec colwidth="8*" align="left"/>
41982 <colspec colwidth="6*" align="center"/>
41983 <colspec colwidth="6*" align="center"/>
41984 <colspec colwidth="6*" align="right"/>
41985 <tbody>
41986 <row>
41987 <entry><option>return_fail_output</option></entry>
41988 <entry>Use: <emphasis>pipe</emphasis></entry>
41989 <entry>Type: <emphasis>boolean</emphasis></entry>
41990 <entry>Default: <emphasis>false</emphasis></entry>
41991 </row>
41992 </tbody>
41993 </tgroup>
41994 </informaltable>
41995 <para>
41996 If this option is true, and the command produced any output and ended with a
41997 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
41998 is, the delivery failed), the output is returned in the bounce message.
41999 However, if the message has a null sender (that is, it is itself a bounce
42000 message), output from the command is discarded. This option and
42001 <option>return_output</option> are mutually exclusive. Only one of them may be set.
42002 </para>
42003 <para>
42004 <indexterm role="option">
42005 <primary><option>return_output</option></primary>
42006 </indexterm>
42007 </para>
42008 <informaltable frame="all">
42009 <tgroup cols="4" colsep="0" rowsep="0">
42010 <colspec colwidth="8*" align="left"/>
42011 <colspec colwidth="6*" align="center"/>
42012 <colspec colwidth="6*" align="center"/>
42013 <colspec colwidth="6*" align="right"/>
42014 <tbody>
42015 <row>
42016 <entry><option>return_output</option></entry>
42017 <entry>Use: <emphasis>pipe</emphasis></entry>
42018 <entry>Type: <emphasis>boolean</emphasis></entry>
42019 <entry>Default: <emphasis>false</emphasis></entry>
42020 </row>
42021 </tbody>
42022 </tgroup>
42023 </informaltable>
42024 <para>
42025 If this option is true, and the command produced any output, the delivery is
42026 deemed to have failed whatever the return code from the command, and the output
42027 is returned in the bounce message. Otherwise, the output is just discarded.
42028 However, if the message has a null sender (that is, it is a bounce message),
42029 output from the command is always discarded, whatever the setting of this
42030 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
42031 of them may be set.
42032 </para>
42033 <para>
42034 <indexterm role="option">
42035 <primary><option>temp_errors</option></primary>
42036 </indexterm>
42037 </para>
42038 <informaltable frame="all">
42039 <tgroup cols="4" colsep="0" rowsep="0">
42040 <colspec colwidth="8*" align="left"/>
42041 <colspec colwidth="6*" align="center"/>
42042 <colspec colwidth="6*" align="center"/>
42043 <colspec colwidth="6*" align="right"/>
42044 <tbody>
42045 <row>
42046 <entry><option>temp_errors</option></entry>
42047 <entry>Use: <emphasis>pipe</emphasis></entry>
42048 <entry>Type: <emphasis>string list</emphasis></entry>
42049 <entry>Default: <emphasis>see below</emphasis></entry>
42050 </row>
42051 </tbody>
42052 </tgroup>
42053 </informaltable>
42054 <para>
42055 <indexterm role="concept">
42056 <primary><command>pipe</command> transport</primary>
42057 <secondary>temporary failure</secondary>
42058 </indexterm>
42059 This option contains either a colon-separated list of numbers, or a single
42060 asterisk. If <option>ignore_status</option> is false
42061 and <option>return_output</option> is not set,
42062 and the command exits with a non-zero return code, the failure is treated as
42063 temporary and the delivery is deferred if the return code matches one of the
42064 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
42065 codes are treated as permanent errors. The default setting contains the codes
42066 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
42067 compiled on a system that does not define these macros, it assumes values of 75
42068 and 73, respectively.
42069 </para>
42070 <para>
42071 <indexterm role="option">
42072 <primary><option>timeout</option></primary>
42073 </indexterm>
42074 </para>
42075 <informaltable frame="all">
42076 <tgroup cols="4" colsep="0" rowsep="0">
42077 <colspec colwidth="8*" align="left"/>
42078 <colspec colwidth="6*" align="center"/>
42079 <colspec colwidth="6*" align="center"/>
42080 <colspec colwidth="6*" align="right"/>
42081 <tbody>
42082 <row>
42083 <entry><option>timeout</option></entry>
42084 <entry>Use: <emphasis>pipe</emphasis></entry>
42085 <entry>Type: <emphasis>time</emphasis></entry>
42086 <entry>Default: <emphasis>1h</emphasis></entry>
42087 </row>
42088 </tbody>
42089 </tgroup>
42090 </informaltable>
42091 <para>
42092 If the command fails to complete within this time, it is killed. This normally
42093 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
42094 specifies no timeout. In order to ensure that any subprocesses created by the
42095 command are also killed, Exim makes the initial process a process group leader,
42096 and kills the whole process group on a timeout. However, this can be defeated
42097 if one of the processes starts a new process group.
42098 </para>
42099 <para>
42100 <indexterm role="option">
42101 <primary><option>timeout_defer</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>timeout_defer</option></entry>
42113 <entry>Use: <emphasis>pipe</emphasis></entry>
42114 <entry>Type: <emphasis>boolean</emphasis></entry>
42115 <entry>Default: <emphasis>false</emphasis></entry>
42116 </row>
42117 </tbody>
42118 </tgroup>
42119 </informaltable>
42120 <para>
42121 A timeout in a <command>pipe</command> transport, either in the command that the transport
42122 runs, or in a transport filter that is associated with it, is by default
42123 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
42124 is set true, both kinds of timeout become temporary errors, causing the
42125 delivery to be deferred.
42126 </para>
42127 <para>
42128 <indexterm role="option">
42129 <primary><option>umask</option></primary>
42130 </indexterm>
42131 </para>
42132 <informaltable frame="all">
42133 <tgroup cols="4" colsep="0" rowsep="0">
42134 <colspec colwidth="8*" align="left"/>
42135 <colspec colwidth="6*" align="center"/>
42136 <colspec colwidth="6*" align="center"/>
42137 <colspec colwidth="6*" align="right"/>
42138 <tbody>
42139 <row>
42140 <entry><option>umask</option></entry>
42141 <entry>Use: <emphasis>pipe</emphasis></entry>
42142 <entry>Type: <emphasis>octal integer</emphasis></entry>
42143 <entry>Default: <emphasis>022</emphasis></entry>
42144 </row>
42145 </tbody>
42146 </tgroup>
42147 </informaltable>
42148 <para>
42149 This specifies the umask setting for the subprocess that runs the command.
42150 </para>
42151 <para>
42152 <indexterm role="option">
42153 <primary><option>use_bsmtp</option></primary>
42154 </indexterm>
42155 </para>
42156 <informaltable frame="all">
42157 <tgroup cols="4" colsep="0" rowsep="0">
42158 <colspec colwidth="8*" align="left"/>
42159 <colspec colwidth="6*" align="center"/>
42160 <colspec colwidth="6*" align="center"/>
42161 <colspec colwidth="6*" align="right"/>
42162 <tbody>
42163 <row>
42164 <entry><option>use_bsmtp</option></entry>
42165 <entry>Use: <emphasis>pipe</emphasis></entry>
42166 <entry>Type: <emphasis>boolean</emphasis></entry>
42167 <entry>Default: <emphasis>false</emphasis></entry>
42168 </row>
42169 </tbody>
42170 </tgroup>
42171 </informaltable>
42172 <para>
42173 <indexterm role="concept">
42174 <primary>envelope sender</primary>
42175 </indexterm>
42176 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
42177 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
42178 commands. If you want to include a leading HELO command with such messages,
42179 you can do so by setting the <option>message_prefix</option> option. See section
42180 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
42181 </para>
42182 <para>
42183 <indexterm role="option">
42184 <primary><option>use_classresources</option></primary>
42185 </indexterm>
42186 </para>
42187 <informaltable frame="all">
42188 <tgroup cols="4" colsep="0" rowsep="0">
42189 <colspec colwidth="8*" align="left"/>
42190 <colspec colwidth="6*" align="center"/>
42191 <colspec colwidth="6*" align="center"/>
42192 <colspec colwidth="6*" align="right"/>
42193 <tbody>
42194 <row>
42195 <entry><option>use_classresources</option></entry>
42196 <entry>Use: <emphasis>pipe</emphasis></entry>
42197 <entry>Type: <emphasis>boolean</emphasis></entry>
42198 <entry>Default: <emphasis>false</emphasis></entry>
42199 </row>
42200 </tbody>
42201 </tgroup>
42202 </informaltable>
42203 <para>
42204 <indexterm role="concept">
42205 <primary>class resources (BSD)</primary>
42206 </indexterm>
42207 This option is available only when Exim is running on FreeBSD, NetBSD, or
42208 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
42209 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
42210 limits for the uid under which the pipe is to run are obtained from the login
42211 class database.
42212 </para>
42213 <para>
42214 <indexterm role="option">
42215 <primary><option>use_crlf</option></primary>
42216 </indexterm>
42217 </para>
42218 <informaltable frame="all">
42219 <tgroup cols="4" colsep="0" rowsep="0">
42220 <colspec colwidth="8*" align="left"/>
42221 <colspec colwidth="6*" align="center"/>
42222 <colspec colwidth="6*" align="center"/>
42223 <colspec colwidth="6*" align="right"/>
42224 <tbody>
42225 <row>
42226 <entry><option>use_crlf</option></entry>
42227 <entry>Use: <emphasis>pipe</emphasis></entry>
42228 <entry>Type: <emphasis>boolean</emphasis></entry>
42229 <entry>Default: <emphasis>false</emphasis></entry>
42230 </row>
42231 </tbody>
42232 </tgroup>
42233 </informaltable>
42234 <para>
42235 <indexterm role="concept">
42236 <primary>carriage return</primary>
42237 </indexterm>
42238 <indexterm role="concept">
42239 <primary>linefeed</primary>
42240 </indexterm>
42241 This option causes lines to be terminated with the two-character CRLF sequence
42242 (carriage return, linefeed) instead of just a linefeed character. In the case
42243 of batched SMTP, the byte sequence written to the pipe is then an exact image
42244 of what would be sent down a real SMTP connection.
42245 </para>
42246 <para>
42247 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
42248 written verbatim, so must contain their own carriage return characters if these
42249 are needed. When <option>use_bsmtp</option> is not set, the default values for both
42250 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
42251 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
42252 </para>
42253 <para>
42254 <indexterm role="option">
42255 <primary><option>use_shell</option></primary>
42256 </indexterm>
42257 </para>
42258 <informaltable frame="all">
42259 <tgroup cols="4" colsep="0" rowsep="0">
42260 <colspec colwidth="8*" align="left"/>
42261 <colspec colwidth="6*" align="center"/>
42262 <colspec colwidth="6*" align="center"/>
42263 <colspec colwidth="6*" align="right"/>
42264 <tbody>
42265 <row>
42266 <entry><option>use_shell</option></entry>
42267 <entry>Use: <emphasis>pipe</emphasis></entry>
42268 <entry>Type: <emphasis>boolean</emphasis></entry>
42269 <entry>Default: <emphasis>false</emphasis></entry>
42270 </row>
42271 </tbody>
42272 </tgroup>
42273 </informaltable>
42274 <para>
42275 <indexterm role="variable">
42276 <primary><varname>$pipe_addresses</varname></primary>
42277 </indexterm>
42278 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
42279 instead of being run directly from the transport, as described in section
42280 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
42281 where the command is expected to be run under a shell and cannot easily be
42282 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
42283 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
42284 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
42285 its <option>-c</option> option.
42286 </para>
42287 </section>
42288 <section id="SECID143">
42289 <title>Using an external local delivery agent</title>
42290 <para>
42291 <indexterm role="concept">
42292 <primary>local delivery</primary>
42293 <secondary>using an external agent</secondary>
42294 </indexterm>
42295 <indexterm role="concept">
42296 <primary><emphasis>procmail</emphasis></primary>
42297 </indexterm>
42298 <indexterm role="concept">
42299 <primary>external local delivery</primary>
42300 </indexterm>
42301 <indexterm role="concept">
42302 <primary>delivery</primary>
42303 <secondary><emphasis>procmail</emphasis></secondary>
42304 </indexterm>
42305 <indexterm role="concept">
42306 <primary>delivery</primary>
42307 <secondary>by external agent</secondary>
42308 </indexterm>
42309 The <command>pipe</command> transport can be used to pass all messages that require local
42310 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
42311 this, care must be taken to ensure that the pipe is run under an appropriate
42312 uid and gid. In some configurations one wants this to be a uid that is trusted
42313 by the delivery agent to supply the correct sender of the message. It may be
42314 necessary to recompile or reconfigure the delivery agent so that it trusts an
42315 appropriate user. The following is an example transport and router
42316 configuration for <option>procmail</option>:
42317 </para>
42318 <literallayout class="monospaced">
42319 # transport
42320 procmail_pipe:
42321   driver = pipe
42322   command = /usr/local/bin/procmail -d $local_part
42323   return_path_add
42324   delivery_date_add
42325   envelope_to_add
42326   check_string = "From "
42327   escape_string = "&gt;From "
42328   umask = 077
42329   user = $local_part
42330   group = mail
42331
42332 # router
42333 procmail:
42334   driver = accept
42335   check_local_user
42336   transport = procmail_pipe
42337 </literallayout>
42338 <para>
42339 In this example, the pipe is run as the local user, but with the group set to
42340 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
42341 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
42342 user to supply a correct sender address. If you do not specify either a
42343 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
42344 home directory is the user&#x2019;s home directory by default.
42345 </para>
42346 <para>
42347 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
42348 </para>
42349 <literallayout class="monospaced">
42350 IFS=" "
42351 </literallayout>
42352 <para>
42353 as shown in some <option>procmail</option> documentation, because Exim does not by default
42354 use a shell to run pipe commands.
42355 </para>
42356 <para>
42357 <indexterm role="concept">
42358 <primary>Cyrus</primary>
42359 </indexterm>
42360 The next example shows a transport and a router for a system where local
42361 deliveries are handled by the Cyrus IMAP server.
42362 </para>
42363 <literallayout class="monospaced">
42364 # transport
42365 local_delivery_cyrus:
42366   driver = pipe
42367   command = /usr/cyrus/bin/deliver \
42368             -m ${substr_1:$local_part_suffix} -- $local_part
42369   user = cyrus
42370   group = mail
42371   return_output
42372   log_output
42373   message_prefix =
42374   message_suffix =
42375
42376 # router
42377 local_user_cyrus:
42378   driver = accept
42379   check_local_user
42380   local_part_suffix = .*
42381   transport = local_delivery_cyrus
42382 </literallayout>
42383 <para>
42384 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
42385 <option>return_output</option> to cause any text written by Cyrus to be returned to the
42386 sender.
42387 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
42388 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
42389 </para>
42390 </section>
42391 </chapter>
42392
42393 <chapter id="CHAPsmtptrans">
42394 <title>The smtp transport</title>
42395 <para>
42396 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
42397 <primary>transports</primary>
42398 <secondary><command>smtp</command></secondary>
42399 </indexterm>
42400 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
42401 <primary><command>smtp</command> transport</primary>
42402 </indexterm>
42403 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
42404 or LMTP protocol. The list of hosts to try can either be taken from the address
42405 that is being processed (having been set up by the router), or specified
42406 explicitly for the transport. Timeout and retry processing (see chapter
42407 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
42408 </para>
42409 <section id="SECID144">
42410 <title>Multiple messages on a single connection</title>
42411 <para>
42412 The sending of multiple messages over a single TCP/IP connection can arise in
42413 two ways:
42414 </para>
42415 <itemizedlist>
42416 <listitem>
42417 <para>
42418 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
42419 routed to the same host, more than one copy of the message has to be sent to
42420 that host. In this situation, multiple copies may be sent in a single run of
42421 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
42422 does when it has too many addresses to send in one message also depends on the
42423 value of the global <option>remote_max_parallel</option> option. Details are given in
42424 section <xref linkend="SECToutSMTPTCP"/>.)
42425 </para>
42426 </listitem>
42427 <listitem>
42428 <para>
42429 <indexterm role="concept">
42430 <primary>hints database</primary>
42431 <secondary>remembering routing</secondary>
42432 </indexterm>
42433 When a message has been successfully delivered over a TCP/IP connection, Exim
42434 looks in its hints database to see if there are any other messages awaiting a
42435 connection to the same host. If there are, a new delivery process is started
42436 for one of them, and the current TCP/IP connection is passed on to it. The new
42437 process may in turn send multiple copies and possibly create yet another
42438 process.
42439 </para>
42440 </listitem>
42441 </itemizedlist>
42442 <para>
42443 For each copy sent over the same TCP/IP connection, a sequence counter is
42444 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
42445 no further messages are sent over that connection.
42446 </para>
42447 </section>
42448 <section id="SECID145">
42449 <title>Use of the $host and $host_address variables</title>
42450 <para>
42451 <indexterm role="variable">
42452 <primary><varname>$host</varname></primary>
42453 </indexterm>
42454 <indexterm role="variable">
42455 <primary><varname>$host_address</varname></primary>
42456 </indexterm>
42457 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
42458 <varname>$host_address</varname> are the name and IP address of the first host on the host list
42459 passed by the router. However, when the transport is about to connect to a
42460 specific host, and while it is connected to that host, <varname>$host</varname> and
42461 <varname>$host_address</varname> are set to the values for that host. These are the values
42462 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
42463 <option>serialize_hosts</option>, and the various TLS options are expanded.
42464 </para>
42465 </section>
42466 <section id="usecippeer">
42467 <title>Use of $tls_cipher and $tls_peerdn</title>
42468 <para>
42469 <indexterm role="variable">
42470 <primary><varname>$tls_bits</varname></primary>
42471 </indexterm>
42472 <indexterm role="variable">
42473 <primary><varname>$tls_cipher</varname></primary>
42474 </indexterm>
42475 <indexterm role="variable">
42476 <primary><varname>$tls_peerdn</varname></primary>
42477 </indexterm>
42478 <indexterm role="variable">
42479 <primary><varname>$tls_sni</varname></primary>
42480 </indexterm>
42481 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
42482 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
42483 are the values that were set when the message was received.
42484 These are the values that are used for options that are expanded before any
42485 SMTP connections are made. Just before each connection is made, these four
42486 variables are emptied. If TLS is subsequently started, they are set to the
42487 appropriate values for the outgoing connection, and these are the values that
42488 are in force when any authenticators are run and when the
42489 <option>authenticated_sender</option> option is expanded.
42490 </para>
42491 </section>
42492 <section id="SECID146">
42493 <title>Private options for smtp</title>
42494 <para>
42495 <indexterm role="concept">
42496 <primary>options</primary>
42497 <secondary><command>smtp</command> transport</secondary>
42498 </indexterm>
42499 The private options of the <command>smtp</command> transport are as follows:
42500 </para>
42501 <para>
42502 <indexterm role="option">
42503 <primary><option>address_retry_include_sender</option></primary>
42504 </indexterm>
42505 </para>
42506 <informaltable frame="all">
42507 <tgroup cols="4" colsep="0" rowsep="0">
42508 <colspec colwidth="8*" align="left"/>
42509 <colspec colwidth="6*" align="center"/>
42510 <colspec colwidth="6*" align="center"/>
42511 <colspec colwidth="6*" align="right"/>
42512 <tbody>
42513 <row>
42514 <entry><option>address_retry_include_sender</option></entry>
42515 <entry>Use: <emphasis>smtp</emphasis></entry>
42516 <entry>Type: <emphasis>boolean</emphasis></entry>
42517 <entry>Default: <emphasis>true</emphasis></entry>
42518 </row>
42519 </tbody>
42520 </tgroup>
42521 </informaltable>
42522 <para>
42523 <indexterm role="concept">
42524 <primary>4<emphasis>xx</emphasis> responses</primary>
42525 <secondary>retrying after</secondary>
42526 </indexterm>
42527 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
42528 is the combination of sender and recipient that is delayed in subsequent queue
42529 runs until the retry time is reached. You can delay the recipient without
42530 reference to the sender (which is what earlier versions of Exim did), by
42531 setting <option>address_retry_include_sender</option> false. However, this can lead to
42532 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
42533 </para>
42534 <para>
42535 <indexterm role="option">
42536 <primary><option>allow_localhost</option></primary>
42537 </indexterm>
42538 </para>
42539 <informaltable frame="all">
42540 <tgroup cols="4" colsep="0" rowsep="0">
42541 <colspec colwidth="8*" align="left"/>
42542 <colspec colwidth="6*" align="center"/>
42543 <colspec colwidth="6*" align="center"/>
42544 <colspec colwidth="6*" align="right"/>
42545 <tbody>
42546 <row>
42547 <entry><option>allow_localhost</option></entry>
42548 <entry>Use: <emphasis>smtp</emphasis></entry>
42549 <entry>Type: <emphasis>boolean</emphasis></entry>
42550 <entry>Default: <emphasis>false</emphasis></entry>
42551 </row>
42552 </tbody>
42553 </tgroup>
42554 </informaltable>
42555 <para>
42556 <indexterm role="concept">
42557 <primary>local host</primary>
42558 <secondary>sending to</secondary>
42559 </indexterm>
42560 <indexterm role="concept">
42561 <primary>fallback</primary>
42562 <secondary>hosts specified on transport</secondary>
42563 </indexterm>
42564 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
42565 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
42566 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
42567 the delivery anyway. This should be used only in special cases when the
42568 configuration ensures that no looping will result (for example, a differently
42569 configured Exim is listening on the port to which the message is sent).
42570 </para>
42571 <para>
42572 <indexterm role="option">
42573 <primary><option>authenticated_sender</option></primary>
42574 </indexterm>
42575 </para>
42576 <informaltable frame="all">
42577 <tgroup cols="4" colsep="0" rowsep="0">
42578 <colspec colwidth="8*" align="left"/>
42579 <colspec colwidth="6*" align="center"/>
42580 <colspec colwidth="6*" align="center"/>
42581 <colspec colwidth="6*" align="right"/>
42582 <tbody>
42583 <row>
42584 <entry><option>authenticated_sender</option></entry>
42585 <entry>Use: <emphasis>smtp</emphasis></entry>
42586 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42587 <entry>Default: <emphasis>unset</emphasis></entry>
42588 </row>
42589 </tbody>
42590 </tgroup>
42591 </informaltable>
42592 <para>
42593 <indexterm role="concept">
42594 <primary>Cyrus</primary>
42595 </indexterm>
42596 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
42597 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
42598 overriding any existing authenticated sender value. If the string expansion is
42599 forced to fail, the option is ignored. Other expansion failures cause delivery
42600 to be deferred. If the result of expansion is an empty string, that is also
42601 ignored.
42602 </para>
42603 <para>
42604 The expansion happens after the outgoing connection has been made and TLS
42605 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
42606 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
42607 particular connection.
42608 </para>
42609 <para>
42610 If the SMTP session is not authenticated, the expansion of
42611 <option>authenticated_sender</option> still happens (and can cause the delivery to be
42612 deferred if it fails), but no AUTH= item is added to MAIL commands
42613 unless <option>authenticated_sender_force</option> is true.
42614 </para>
42615 <para>
42616 This option allows you to use the <command>smtp</command> transport in LMTP mode to
42617 deliver mail to Cyrus IMAP and provide the proper local part as the
42618 <quote>authenticated sender</quote>, via a setting such as:
42619 </para>
42620 <literallayout class="monospaced">
42621 authenticated_sender = $local_part
42622 </literallayout>
42623 <para>
42624 This removes the need for IMAP subfolders to be assigned special ACLs to
42625 allow direct delivery to those subfolders.
42626 </para>
42627 <para>
42628 Because of expected uses such as that just described for Cyrus (when no
42629 domain is involved), there is no checking on the syntax of the provided
42630 value.
42631 </para>
42632 <para>
42633 <indexterm role="option">
42634 <primary><option>authenticated_sender_force</option></primary>
42635 </indexterm>
42636 </para>
42637 <informaltable frame="all">
42638 <tgroup cols="4" colsep="0" rowsep="0">
42639 <colspec colwidth="8*" align="left"/>
42640 <colspec colwidth="6*" align="center"/>
42641 <colspec colwidth="6*" align="center"/>
42642 <colspec colwidth="6*" align="right"/>
42643 <tbody>
42644 <row>
42645 <entry><option>authenticated_sender_force</option></entry>
42646 <entry>Use: <emphasis>smtp</emphasis></entry>
42647 <entry>Type: <emphasis>boolean</emphasis></entry>
42648 <entry>Default: <emphasis>false</emphasis></entry>
42649 </row>
42650 </tbody>
42651 </tgroup>
42652 </informaltable>
42653 <para>
42654 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
42655 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
42656 authenticated as a client.
42657 </para>
42658 <para>
42659 <indexterm role="option">
42660 <primary><option>command_timeout</option></primary>
42661 </indexterm>
42662 </para>
42663 <informaltable frame="all">
42664 <tgroup cols="4" colsep="0" rowsep="0">
42665 <colspec colwidth="8*" align="left"/>
42666 <colspec colwidth="6*" align="center"/>
42667 <colspec colwidth="6*" align="center"/>
42668 <colspec colwidth="6*" align="right"/>
42669 <tbody>
42670 <row>
42671 <entry><option>command_timeout</option></entry>
42672 <entry>Use: <emphasis>smtp</emphasis></entry>
42673 <entry>Type: <emphasis>time</emphasis></entry>
42674 <entry>Default: <emphasis>5m</emphasis></entry>
42675 </row>
42676 </tbody>
42677 </tgroup>
42678 </informaltable>
42679 <para>
42680 This sets a timeout for receiving a response to an SMTP command that has been
42681 sent out. It is also used when waiting for the initial banner line from the
42682 remote host. Its value must not be zero.
42683 </para>
42684 <para>
42685 <indexterm role="option">
42686 <primary><option>connect_timeout</option></primary>
42687 </indexterm>
42688 </para>
42689 <informaltable frame="all">
42690 <tgroup cols="4" colsep="0" rowsep="0">
42691 <colspec colwidth="8*" align="left"/>
42692 <colspec colwidth="6*" align="center"/>
42693 <colspec colwidth="6*" align="center"/>
42694 <colspec colwidth="6*" align="right"/>
42695 <tbody>
42696 <row>
42697 <entry><option>connect_timeout</option></entry>
42698 <entry>Use: <emphasis>smtp</emphasis></entry>
42699 <entry>Type: <emphasis>time</emphasis></entry>
42700 <entry>Default: <emphasis>5m</emphasis></entry>
42701 </row>
42702 </tbody>
42703 </tgroup>
42704 </informaltable>
42705 <para>
42706 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
42707 to a remote host. A setting of zero allows the system timeout (typically
42708 several minutes) to act. To have any effect, the value of this option must be
42709 less than the system timeout. However, it has been observed that on some
42710 systems there is no system timeout, which is why the default value for this
42711 option is 5 minutes, a value recommended by RFC 1123.
42712 </para>
42713 <para>
42714 <indexterm role="option">
42715 <primary><option>connection_max_messages</option></primary>
42716 </indexterm>
42717 </para>
42718 <informaltable frame="all">
42719 <tgroup cols="4" colsep="0" rowsep="0">
42720 <colspec colwidth="8*" align="left"/>
42721 <colspec colwidth="6*" align="center"/>
42722 <colspec colwidth="6*" align="center"/>
42723 <colspec colwidth="6*" align="right"/>
42724 <tbody>
42725 <row>
42726 <entry><option>connection_max_messages</option></entry>
42727 <entry>Use: <emphasis>smtp</emphasis></entry>
42728 <entry>Type: <emphasis>integer</emphasis></entry>
42729 <entry>Default: <emphasis>500</emphasis></entry>
42730 </row>
42731 </tbody>
42732 </tgroup>
42733 </informaltable>
42734 <para>
42735 <indexterm role="concept">
42736 <primary>SMTP</primary>
42737 <secondary>passed connection</secondary>
42738 </indexterm>
42739 <indexterm role="concept">
42740 <primary>SMTP</primary>
42741 <secondary>multiple deliveries</secondary>
42742 </indexterm>
42743 <indexterm role="concept">
42744 <primary>multiple SMTP deliveries</primary>
42745 </indexterm>
42746 This controls the maximum number of separate message deliveries that are sent
42747 over a single TCP/IP connection. If the value is zero, there is no limit.
42748 For testing purposes, this value can be overridden by the <option>-oB</option> command line
42749 option.
42750 </para>
42751 <para>
42752 <indexterm role="option">
42753 <primary><option>data_timeout</option></primary>
42754 </indexterm>
42755 </para>
42756 <informaltable frame="all">
42757 <tgroup cols="4" colsep="0" rowsep="0">
42758 <colspec colwidth="8*" align="left"/>
42759 <colspec colwidth="6*" align="center"/>
42760 <colspec colwidth="6*" align="center"/>
42761 <colspec colwidth="6*" align="right"/>
42762 <tbody>
42763 <row>
42764 <entry><option>data_timeout</option></entry>
42765 <entry>Use: <emphasis>smtp</emphasis></entry>
42766 <entry>Type: <emphasis>time</emphasis></entry>
42767 <entry>Default: <emphasis>5m</emphasis></entry>
42768 </row>
42769 </tbody>
42770 </tgroup>
42771 </informaltable>
42772 <para>
42773 This sets a timeout for the transmission of each block in the data portion of
42774 the message. As a result, the overall timeout for a message depends on the size
42775 of the message. Its value must not be zero. See also <option>final_timeout</option>.
42776 </para>
42777 <para>
42778 <indexterm role="option">
42779 <primary><option>delay_after_cutoff</option></primary>
42780 </indexterm>
42781 </para>
42782 <informaltable frame="all">
42783 <tgroup cols="4" colsep="0" rowsep="0">
42784 <colspec colwidth="8*" align="left"/>
42785 <colspec colwidth="6*" align="center"/>
42786 <colspec colwidth="6*" align="center"/>
42787 <colspec colwidth="6*" align="right"/>
42788 <tbody>
42789 <row>
42790 <entry><option>delay_after_cutoff</option></entry>
42791 <entry>Use: <emphasis>smtp</emphasis></entry>
42792 <entry>Type: <emphasis>boolean</emphasis></entry>
42793 <entry>Default: <emphasis>true</emphasis></entry>
42794 </row>
42795 </tbody>
42796 </tgroup>
42797 </informaltable>
42798 <para>
42799 This option controls what happens when all remote IP addresses for a given
42800 domain have been inaccessible for so long that they have passed their retry
42801 cutoff times.
42802 </para>
42803 <para>
42804 In the default state, if the next retry time has not been reached for any of
42805 them, the address is bounced without trying any deliveries. In other words,
42806 Exim delays retrying an IP address after the final cutoff time until a new
42807 retry time is reached, and can therefore bounce an address without ever trying
42808 a delivery, when machines have been down for a long time. Some people are
42809 unhappy at this prospect, so...
42810 </para>
42811 <para>
42812 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
42813 addresses are past their final cutoff time, Exim tries to deliver to those
42814 IP addresses that have not been tried since the message arrived. If there are
42815 none, of if they all fail, the address is bounced. In other words, it does not
42816 delay when a new message arrives, but immediately tries those expired IP
42817 addresses that haven&#x2019;t been tried since the message arrived. If there is a
42818 continuous stream of messages for the dead hosts, unsetting
42819 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
42820 to them.
42821 </para>
42822 <para>
42823 <indexterm role="option">
42824 <primary><option>dns_qualify_single</option></primary>
42825 </indexterm>
42826 </para>
42827 <informaltable frame="all">
42828 <tgroup cols="4" colsep="0" rowsep="0">
42829 <colspec colwidth="8*" align="left"/>
42830 <colspec colwidth="6*" align="center"/>
42831 <colspec colwidth="6*" align="center"/>
42832 <colspec colwidth="6*" align="right"/>
42833 <tbody>
42834 <row>
42835 <entry><option>dns_qualify_single</option></entry>
42836 <entry>Use: <emphasis>smtp</emphasis></entry>
42837 <entry>Type: <emphasis>boolean</emphasis></entry>
42838 <entry>Default: <emphasis>true</emphasis></entry>
42839 </row>
42840 </tbody>
42841 </tgroup>
42842 </informaltable>
42843 <para>
42844 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
42845 and the <option>gethostbyname</option> option is false,
42846 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
42847 in chapter <xref linkend="CHAPdnslookup"/> for more details.
42848 </para>
42849 <para>
42850 <indexterm role="option">
42851 <primary><option>dns_search_parents</option></primary>
42852 </indexterm>
42853 </para>
42854 <informaltable frame="all">
42855 <tgroup cols="4" colsep="0" rowsep="0">
42856 <colspec colwidth="8*" align="left"/>
42857 <colspec colwidth="6*" align="center"/>
42858 <colspec colwidth="6*" align="center"/>
42859 <colspec colwidth="6*" align="right"/>
42860 <tbody>
42861 <row>
42862 <entry><option>dns_search_parents</option></entry>
42863 <entry>Use: <emphasis>smtp</emphasis></entry>
42864 <entry>Type: <emphasis>boolean</emphasis></entry>
42865 <entry>Default: <emphasis>false</emphasis></entry>
42866 </row>
42867 </tbody>
42868 </tgroup>
42869 </informaltable>
42870 <para>
42871 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
42872 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
42873 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
42874 details.
42875 </para>
42876 <para>
42877 <indexterm role="option">
42878 <primary><option>fallback_hosts</option></primary>
42879 </indexterm>
42880 </para>
42881 <informaltable frame="all">
42882 <tgroup cols="4" colsep="0" rowsep="0">
42883 <colspec colwidth="8*" align="left"/>
42884 <colspec colwidth="6*" align="center"/>
42885 <colspec colwidth="6*" align="center"/>
42886 <colspec colwidth="6*" align="right"/>
42887 <tbody>
42888 <row>
42889 <entry><option>fallback_hosts</option></entry>
42890 <entry>Use: <emphasis>smtp</emphasis></entry>
42891 <entry>Type: <emphasis>string list</emphasis></entry>
42892 <entry>Default: <emphasis>unset</emphasis></entry>
42893 </row>
42894 </tbody>
42895 </tgroup>
42896 </informaltable>
42897 <para>
42898 <indexterm role="concept">
42899 <primary>fallback</primary>
42900 <secondary>hosts specified on transport</secondary>
42901 </indexterm>
42902 String expansion is not applied to this option. The argument must be a
42903 colon-separated list of host names or IP addresses, optionally also including
42904 port numbers, though the separator can be changed, as described in section
42905 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42906 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42907 in section <xref linkend="SECTformatonehostitem"/>.
42908 </para>
42909 <para>
42910 Fallback hosts can also be specified on routers, which associate them with the
42911 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
42912 <option>fallback_hosts</option> specified on the transport is used only if the address does
42913 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
42914 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
42915 However, <option>hosts_randomize</option> does apply to fallback host lists.
42916 </para>
42917 <para>
42918 If Exim is unable to deliver to any of the hosts for a particular address, and
42919 the errors are not permanent rejections, the address is put on a separate
42920 transport queue with its host list replaced by the fallback hosts, unless the
42921 address was routed via MX records and the current host was in the original MX
42922 list. In that situation, the fallback host list is not used.
42923 </para>
42924 <para>
42925 Once normal deliveries are complete, the fallback queue is delivered by
42926 re-running the same transports with the new host lists. If several failing
42927 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
42928 copy of the message is sent.
42929 </para>
42930 <para>
42931 The resolution of the host names on the fallback list is controlled by the
42932 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
42933 both to cases when the host list comes with the address and when it is taken
42934 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
42935 fails</quote> facility.
42936 </para>
42937 <para>
42938 <indexterm role="option">
42939 <primary><option>final_timeout</option></primary>
42940 </indexterm>
42941 </para>
42942 <informaltable frame="all">
42943 <tgroup cols="4" colsep="0" rowsep="0">
42944 <colspec colwidth="8*" align="left"/>
42945 <colspec colwidth="6*" align="center"/>
42946 <colspec colwidth="6*" align="center"/>
42947 <colspec colwidth="6*" align="right"/>
42948 <tbody>
42949 <row>
42950 <entry><option>final_timeout</option></entry>
42951 <entry>Use: <emphasis>smtp</emphasis></entry>
42952 <entry>Type: <emphasis>time</emphasis></entry>
42953 <entry>Default: <emphasis>10m</emphasis></entry>
42954 </row>
42955 </tbody>
42956 </tgroup>
42957 </informaltable>
42958 <para>
42959 This is the timeout that applies while waiting for the response to the final
42960 line containing just <quote>.</quote> that terminates a message. Its value must not be
42961 zero.
42962 </para>
42963 <para>
42964 <indexterm role="option">
42965 <primary><option>gethostbyname</option></primary>
42966 </indexterm>
42967 </para>
42968 <informaltable frame="all">
42969 <tgroup cols="4" colsep="0" rowsep="0">
42970 <colspec colwidth="8*" align="left"/>
42971 <colspec colwidth="6*" align="center"/>
42972 <colspec colwidth="6*" align="center"/>
42973 <colspec colwidth="6*" align="right"/>
42974 <tbody>
42975 <row>
42976 <entry><option>gethostbyname</option></entry>
42977 <entry>Use: <emphasis>smtp</emphasis></entry>
42978 <entry>Type: <emphasis>boolean</emphasis></entry>
42979 <entry>Default: <emphasis>false</emphasis></entry>
42980 </row>
42981 </tbody>
42982 </tgroup>
42983 </informaltable>
42984 <para>
42985 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
42986 being used, names are looked up using <function>gethostbyname()</function>
42987 (or <function>getipnodebyname()</function> when available)
42988 instead of using the DNS. Of course, that function may in fact use the DNS, but
42989 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
42990 </para>
42991 <para>
42992 <indexterm role="option">
42993 <primary><option>gnutls_compat_mode</option></primary>
42994 </indexterm>
42995 </para>
42996 <informaltable frame="all">
42997 <tgroup cols="4" colsep="0" rowsep="0">
42998 <colspec colwidth="8*" align="left"/>
42999 <colspec colwidth="6*" align="center"/>
43000 <colspec colwidth="6*" align="center"/>
43001 <colspec colwidth="6*" align="right"/>
43002 <tbody>
43003 <row>
43004 <entry><option>gnutls_compat_mode</option></entry>
43005 <entry>Use: <emphasis>smtp</emphasis></entry>
43006 <entry>Type: <emphasis>boolean</emphasis></entry>
43007 <entry>Default: <emphasis>unset</emphasis></entry>
43008 </row>
43009 </tbody>
43010 </tgroup>
43011 </informaltable>
43012 <para>
43013 This option controls whether GnuTLS is used in compatibility mode in an Exim
43014 server. This reduces security slightly, but improves interworking with older
43015 implementations of TLS.
43016 </para>
43017 <para>
43018 <indexterm role="option">
43019 <primary><option>helo_data</option></primary>
43020 </indexterm>
43021 </para>
43022 <informaltable frame="all">
43023 <tgroup cols="4" colsep="0" rowsep="0">
43024 <colspec colwidth="8*" align="left"/>
43025 <colspec colwidth="6*" align="center"/>
43026 <colspec colwidth="6*" align="center"/>
43027 <colspec colwidth="6*" align="right"/>
43028 <tbody>
43029 <row>
43030 <entry><option>helo_data</option></entry>
43031 <entry>Use: <emphasis>smtp</emphasis></entry>
43032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43033 <entry>Default: <emphasis>see below</emphasis></entry>
43034 </row>
43035 </tbody>
43036 </tgroup>
43037 </informaltable>
43038 <para>
43039 <indexterm role="concept">
43040 <primary>HELO</primary>
43041 <secondary>argument, setting</secondary>
43042 </indexterm>
43043 <indexterm role="concept">
43044 <primary>EHLO</primary>
43045 <secondary>argument, setting</secondary>
43046 </indexterm>
43047 <indexterm role="concept">
43048 <primary>LHLO argument setting</primary>
43049 </indexterm>
43050 The value of this option is expanded after a connection to a another host has
43051 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
43052 command that starts the outgoing SMTP or LMTP session. The default value of the
43053 option is:
43054 </para>
43055 <literallayout class="monospaced">
43056 $primary_hostname
43057 </literallayout>
43058 <para>
43059 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
43060 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
43061 <varname>$sending_port</varname> are set to the local IP address and port number that are being
43062 used. These variables can be used to generate different values for different
43063 servers or different local IP addresses. For example, if you want the string
43064 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
43065 interface address, you could use this:
43066 </para>
43067 <literallayout class="monospaced">
43068 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
43069   {$primary_hostname}}
43070 </literallayout>
43071 <para>
43072 The use of <option>helo_data</option> applies both to sending messages and when doing
43073 callouts.
43074 </para>
43075 <para>
43076 <indexterm role="option">
43077 <primary><option>hosts</option></primary>
43078 </indexterm>
43079 </para>
43080 <informaltable frame="all">
43081 <tgroup cols="4" colsep="0" rowsep="0">
43082 <colspec colwidth="8*" align="left"/>
43083 <colspec colwidth="6*" align="center"/>
43084 <colspec colwidth="6*" align="center"/>
43085 <colspec colwidth="6*" align="right"/>
43086 <tbody>
43087 <row>
43088 <entry><option>hosts</option></entry>
43089 <entry>Use: <emphasis>smtp</emphasis></entry>
43090 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43091 <entry>Default: <emphasis>unset</emphasis></entry>
43092 </row>
43093 </tbody>
43094 </tgroup>
43095 </informaltable>
43096 <para>
43097 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
43098 finds the hosts by looking up the address domain in the DNS, or by
43099 <command>manualroute</command>, which has lists of hosts in its configuration. However,
43100 email addresses can be passed to the <command>smtp</command> transport by any router, and not
43101 all of them can provide an associated list of hosts.
43102 </para>
43103 <para>
43104 The <option>hosts</option> option specifies a list of hosts to be used if the address being
43105 processed does not have any hosts associated with it. The hosts specified by
43106 <option>hosts</option> are also used, whether or not the address has its own hosts, if
43107 <option>hosts_override</option> is set.
43108 </para>
43109 <para>
43110 The string is first expanded, before being interpreted as a colon-separated
43111 list of host names or IP addresses, possibly including port numbers. The
43112 separator may be changed to something other than colon, as described in section
43113 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
43114 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
43115 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
43116 of the <command>manualroute</command> router is not available here.
43117 </para>
43118 <para>
43119 If the expansion fails, delivery is deferred. Unless the failure was caused by
43120 the inability to complete a lookup, the error is logged to the panic log as
43121 well as the main log. Host names are looked up either by searching directly for
43122 address records in the DNS or by calling <function>gethostbyname()</function> (or
43123 <function>getipnodebyname()</function> when available), depending on the setting of the
43124 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
43125 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
43126 address are used.
43127 </para>
43128 <para>
43129 During delivery, the hosts are tried in order, subject to their retry status,
43130 unless <option>hosts_randomize</option> is set.
43131 </para>
43132 <para>
43133 <indexterm role="option">
43134 <primary><option>hosts_avoid_esmtp</option></primary>
43135 </indexterm>
43136 </para>
43137 <informaltable frame="all">
43138 <tgroup cols="4" colsep="0" rowsep="0">
43139 <colspec colwidth="8*" align="left"/>
43140 <colspec colwidth="6*" align="center"/>
43141 <colspec colwidth="6*" align="center"/>
43142 <colspec colwidth="6*" align="right"/>
43143 <tbody>
43144 <row>
43145 <entry><option>hosts_avoid_esmtp</option></entry>
43146 <entry>Use: <emphasis>smtp</emphasis></entry>
43147 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43148 <entry>Default: <emphasis>unset</emphasis></entry>
43149 </row>
43150 </tbody>
43151 </tgroup>
43152 </informaltable>
43153 <para>
43154 <indexterm role="concept">
43155 <primary>ESMTP, avoiding use of</primary>
43156 </indexterm>
43157 <indexterm role="concept">
43158 <primary>HELO</primary>
43159 <secondary>forcing use of</secondary>
43160 </indexterm>
43161 <indexterm role="concept">
43162 <primary>EHLO</primary>
43163 <secondary>avoiding use of</secondary>
43164 </indexterm>
43165 <indexterm role="concept">
43166 <primary>PIPELINING</primary>
43167 <secondary>avoiding the use of</secondary>
43168 </indexterm>
43169 This option is for use with broken hosts that announce ESMTP facilities (for
43170 example, PIPELINING) and then fail to implement them properly. When a host
43171 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
43172 start of the SMTP session. This means that it cannot use any of the ESMTP
43173 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
43174 </para>
43175 <para>
43176 <indexterm role="option">
43177 <primary><option>hosts_avoid_pipelining</option></primary>
43178 </indexterm>
43179 </para>
43180 <informaltable frame="all">
43181 <tgroup cols="4" colsep="0" rowsep="0">
43182 <colspec colwidth="8*" align="left"/>
43183 <colspec colwidth="6*" align="center"/>
43184 <colspec colwidth="6*" align="center"/>
43185 <colspec colwidth="6*" align="right"/>
43186 <tbody>
43187 <row>
43188 <entry><option>hosts_avoid_pipelining</option></entry>
43189 <entry>Use: <emphasis>smtp</emphasis></entry>
43190 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43191 <entry>Default: <emphasis>unset</emphasis></entry>
43192 </row>
43193 </tbody>
43194 </tgroup>
43195 </informaltable>
43196 <para>
43197 <indexterm role="concept">
43198 <primary>PIPELINING</primary>
43199 <secondary>avoiding the use of</secondary>
43200 </indexterm>
43201 Exim will not use the SMTP PIPELINING extension when delivering to any host
43202 that matches this list, even if the server host advertises PIPELINING support.
43203 </para>
43204 <para>
43205 <indexterm role="option">
43206 <primary><option>hosts_avoid_tls</option></primary>
43207 </indexterm>
43208 </para>
43209 <informaltable frame="all">
43210 <tgroup cols="4" colsep="0" rowsep="0">
43211 <colspec colwidth="8*" align="left"/>
43212 <colspec colwidth="6*" align="center"/>
43213 <colspec colwidth="6*" align="center"/>
43214 <colspec colwidth="6*" align="right"/>
43215 <tbody>
43216 <row>
43217 <entry><option>hosts_avoid_tls</option></entry>
43218 <entry>Use: <emphasis>smtp</emphasis></entry>
43219 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43220 <entry>Default: <emphasis>unset</emphasis></entry>
43221 </row>
43222 </tbody>
43223 </tgroup>
43224 </informaltable>
43225 <para>
43226 <indexterm role="concept">
43227 <primary>TLS</primary>
43228 <secondary>avoiding for certain hosts</secondary>
43229 </indexterm>
43230 Exim will not try to start a TLS session when delivering to any host that
43231 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43232 </para>
43233 <para>
43234 <indexterm role="option">
43235 <primary><option>hosts_max_try</option></primary>
43236 </indexterm>
43237 </para>
43238 <informaltable frame="all">
43239 <tgroup cols="4" colsep="0" rowsep="0">
43240 <colspec colwidth="8*" align="left"/>
43241 <colspec colwidth="6*" align="center"/>
43242 <colspec colwidth="6*" align="center"/>
43243 <colspec colwidth="6*" align="right"/>
43244 <tbody>
43245 <row>
43246 <entry><option>hosts_max_try</option></entry>
43247 <entry>Use: <emphasis>smtp</emphasis></entry>
43248 <entry>Type: <emphasis>integer</emphasis></entry>
43249 <entry>Default: <emphasis>5</emphasis></entry>
43250 </row>
43251 </tbody>
43252 </tgroup>
43253 </informaltable>
43254 <para>
43255 <indexterm role="concept">
43256 <primary>host</primary>
43257 <secondary>maximum number to try</secondary>
43258 </indexterm>
43259 <indexterm role="concept">
43260 <primary>limit</primary>
43261 <secondary>number of hosts tried</secondary>
43262 </indexterm>
43263 <indexterm role="concept">
43264 <primary>limit</primary>
43265 <secondary>number of MX tried</secondary>
43266 </indexterm>
43267 <indexterm role="concept">
43268 <primary>MX record</primary>
43269 <secondary>maximum tried</secondary>
43270 </indexterm>
43271 This option limits the number of IP addresses that are tried for any one
43272 delivery in cases where there are temporary delivery errors. Section
43273 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
43274 </para>
43275 <para>
43276 <indexterm role="option">
43277 <primary><option>hosts_max_try_hardlimit</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>hosts_max_try_hardlimit</option></entry>
43289 <entry>Use: <emphasis>smtp</emphasis></entry>
43290 <entry>Type: <emphasis>integer</emphasis></entry>
43291 <entry>Default: <emphasis>50</emphasis></entry>
43292 </row>
43293 </tbody>
43294 </tgroup>
43295 </informaltable>
43296 <para>
43297 This is an additional check on the maximum number of IP addresses that Exim
43298 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
43299 why it exists.
43300 </para>
43301 <para>
43302 <indexterm role="option">
43303 <primary><option>hosts_nopass_tls</option></primary>
43304 </indexterm>
43305 </para>
43306 <informaltable frame="all">
43307 <tgroup cols="4" colsep="0" rowsep="0">
43308 <colspec colwidth="8*" align="left"/>
43309 <colspec colwidth="6*" align="center"/>
43310 <colspec colwidth="6*" align="center"/>
43311 <colspec colwidth="6*" align="right"/>
43312 <tbody>
43313 <row>
43314 <entry><option>hosts_nopass_tls</option></entry>
43315 <entry>Use: <emphasis>smtp</emphasis></entry>
43316 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43317 <entry>Default: <emphasis>unset</emphasis></entry>
43318 </row>
43319 </tbody>
43320 </tgroup>
43321 </informaltable>
43322 <para>
43323 <indexterm role="concept">
43324 <primary>TLS</primary>
43325 <secondary>passing connection</secondary>
43326 </indexterm>
43327 <indexterm role="concept">
43328 <primary>multiple SMTP deliveries</primary>
43329 </indexterm>
43330 <indexterm role="concept">
43331 <primary>TLS</primary>
43332 <secondary>multiple message deliveries</secondary>
43333 </indexterm>
43334 For any host that matches this list, a connection on which a TLS session has
43335 been started will not be passed to a new delivery process for sending another
43336 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
43337 explanation of when this might be needed.
43338 </para>
43339 <para>
43340 <indexterm role="option">
43341 <primary><option>hosts_override</option></primary>
43342 </indexterm>
43343 </para>
43344 <informaltable frame="all">
43345 <tgroup cols="4" colsep="0" rowsep="0">
43346 <colspec colwidth="8*" align="left"/>
43347 <colspec colwidth="6*" align="center"/>
43348 <colspec colwidth="6*" align="center"/>
43349 <colspec colwidth="6*" align="right"/>
43350 <tbody>
43351 <row>
43352 <entry><option>hosts_override</option></entry>
43353 <entry>Use: <emphasis>smtp</emphasis></entry>
43354 <entry>Type: <emphasis>boolean</emphasis></entry>
43355 <entry>Default: <emphasis>false</emphasis></entry>
43356 </row>
43357 </tbody>
43358 </tgroup>
43359 </informaltable>
43360 <para>
43361 If this option is set and the <option>hosts</option> option is also set, any hosts that are
43362 attached to the address are ignored, and instead the hosts specified by the
43363 <option>hosts</option> option are always used. This option does not apply to
43364 <option>fallback_hosts</option>.
43365 </para>
43366 <para>
43367 <indexterm role="option">
43368 <primary><option>hosts_randomize</option></primary>
43369 </indexterm>
43370 </para>
43371 <informaltable frame="all">
43372 <tgroup cols="4" colsep="0" rowsep="0">
43373 <colspec colwidth="8*" align="left"/>
43374 <colspec colwidth="6*" align="center"/>
43375 <colspec colwidth="6*" align="center"/>
43376 <colspec colwidth="6*" align="right"/>
43377 <tbody>
43378 <row>
43379 <entry><option>hosts_randomize</option></entry>
43380 <entry>Use: <emphasis>smtp</emphasis></entry>
43381 <entry>Type: <emphasis>boolean</emphasis></entry>
43382 <entry>Default: <emphasis>false</emphasis></entry>
43383 </row>
43384 </tbody>
43385 </tgroup>
43386 </informaltable>
43387 <para>
43388 <indexterm role="concept">
43389 <primary>randomized host list</primary>
43390 </indexterm>
43391 <indexterm role="concept">
43392 <primary>host</primary>
43393 <secondary>list of; randomized</secondary>
43394 </indexterm>
43395 <indexterm role="concept">
43396 <primary>fallback</primary>
43397 <secondary>randomized hosts</secondary>
43398 </indexterm>
43399 If this option is set, and either the list of hosts is taken from the
43400 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
43401 were not obtained from MX records (this includes fallback hosts from the
43402 router), and were not randomized by the router, the order of trying the hosts
43403 is randomized each time the transport runs. Randomizing the order of a host
43404 list can be used to do crude load sharing.
43405 </para>
43406 <para>
43407 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
43408 order is separately randomized. This makes it possible to set up MX-like
43409 behaviour. The boundaries between groups are indicated by an item that is just
43410 <literal>+</literal> in the host list. For example:
43411 </para>
43412 <literallayout class="monospaced">
43413 hosts = host1:host2:host3:+:host4:host5
43414 </literallayout>
43415 <para>
43416 The order of the first three hosts and the order of the last two hosts is
43417 randomized for each use, but the first three always end up before the last two.
43418 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
43419 </para>
43420 <para>
43421 <indexterm role="option">
43422 <primary><option>hosts_require_auth</option></primary>
43423 </indexterm>
43424 </para>
43425 <informaltable frame="all">
43426 <tgroup cols="4" colsep="0" rowsep="0">
43427 <colspec colwidth="8*" align="left"/>
43428 <colspec colwidth="6*" align="center"/>
43429 <colspec colwidth="6*" align="center"/>
43430 <colspec colwidth="6*" align="right"/>
43431 <tbody>
43432 <row>
43433 <entry><option>hosts_require_auth</option></entry>
43434 <entry>Use: <emphasis>smtp</emphasis></entry>
43435 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43436 <entry>Default: <emphasis>unset</emphasis></entry>
43437 </row>
43438 </tbody>
43439 </tgroup>
43440 </informaltable>
43441 <para>
43442 <indexterm role="concept">
43443 <primary>authentication</primary>
43444 <secondary>required by client</secondary>
43445 </indexterm>
43446 This option provides a list of servers for which authentication must succeed
43447 before Exim will try to transfer a message. If authentication fails for
43448 servers which are not in this list, Exim tries to send unauthenticated. If
43449 authentication fails for one of these servers, delivery is deferred. This
43450 temporary error is detectable in the retry rules, so it can be turned into a
43451 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
43452 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43453 </para>
43454 <para>
43455 <indexterm role="option">
43456 <primary><option>hosts_require_tls</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>hosts_require_tls</option></entry>
43468 <entry>Use: <emphasis>smtp</emphasis></entry>
43469 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43470 <entry>Default: <emphasis>unset</emphasis></entry>
43471 </row>
43472 </tbody>
43473 </tgroup>
43474 </informaltable>
43475 <para>
43476 <indexterm role="concept">
43477 <primary>TLS</primary>
43478 <secondary>requiring for certain servers</secondary>
43479 </indexterm>
43480 Exim will insist on using a TLS session when delivering to any host that
43481 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43482 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
43483 incoming messages, use an appropriate ACL.
43484 </para>
43485 <para>
43486 <indexterm role="option">
43487 <primary><option>hosts_try_auth</option></primary>
43488 </indexterm>
43489 </para>
43490 <informaltable frame="all">
43491 <tgroup cols="4" colsep="0" rowsep="0">
43492 <colspec colwidth="8*" align="left"/>
43493 <colspec colwidth="6*" align="center"/>
43494 <colspec colwidth="6*" align="center"/>
43495 <colspec colwidth="6*" align="right"/>
43496 <tbody>
43497 <row>
43498 <entry><option>hosts_try_auth</option></entry>
43499 <entry>Use: <emphasis>smtp</emphasis></entry>
43500 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43501 <entry>Default: <emphasis>unset</emphasis></entry>
43502 </row>
43503 </tbody>
43504 </tgroup>
43505 </informaltable>
43506 <para>
43507 <indexterm role="concept">
43508 <primary>authentication</primary>
43509 <secondary>optional in client</secondary>
43510 </indexterm>
43511 This option provides a list of servers to which, provided they announce
43512 authentication support, Exim will attempt to authenticate as a client when it
43513 connects. If authentication fails, Exim will try to transfer the message
43514 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
43515 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43516 </para>
43517 <para>
43518 <indexterm role="option">
43519 <primary><option>interface</option></primary>
43520 </indexterm>
43521 </para>
43522 <informaltable frame="all">
43523 <tgroup cols="4" colsep="0" rowsep="0">
43524 <colspec colwidth="8*" align="left"/>
43525 <colspec colwidth="6*" align="center"/>
43526 <colspec colwidth="6*" align="center"/>
43527 <colspec colwidth="6*" align="right"/>
43528 <tbody>
43529 <row>
43530 <entry><option>interface</option></entry>
43531 <entry>Use: <emphasis>smtp</emphasis></entry>
43532 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43533 <entry>Default: <emphasis>unset</emphasis></entry>
43534 </row>
43535 </tbody>
43536 </tgroup>
43537 </informaltable>
43538 <para>
43539 <indexterm role="concept">
43540 <primary>bind IP address</primary>
43541 </indexterm>
43542 <indexterm role="concept">
43543 <primary>IP address</primary>
43544 <secondary>binding</secondary>
43545 </indexterm>
43546 <indexterm role="variable">
43547 <primary><varname>$host</varname></primary>
43548 </indexterm>
43549 <indexterm role="variable">
43550 <primary><varname>$host_address</varname></primary>
43551 </indexterm>
43552 This option specifies which interface to bind to when making an outgoing SMTP
43553 call. The value is an IP address, not an interface name such as
43554 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
43555 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
43556 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
43557 outgoing interface address. There is no variable that contains an outgoing
43558 interface address because, unless it is set by this option, its value is
43559 unknown.
43560 </para>
43561 <para>
43562 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
43563 <varname>$host_address</varname> refer to the host to which a connection is about to be made
43564 during the expansion of the string. Forced expansion failure, or an empty
43565 string result causes the option to be ignored. Otherwise, after expansion, the
43566 string must be a list of IP addresses, colon-separated by default, but the
43567 separator can be changed in the usual way. For example:
43568 </para>
43569 <literallayout class="monospaced">
43570 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
43571 </literallayout>
43572 <para>
43573 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
43574 connection. If none of them are the correct type, the option is ignored. If
43575 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
43576 interface to use if the host has more than one.
43577 </para>
43578 <para>
43579 <indexterm role="option">
43580 <primary><option>keepalive</option></primary>
43581 </indexterm>
43582 </para>
43583 <informaltable frame="all">
43584 <tgroup cols="4" colsep="0" rowsep="0">
43585 <colspec colwidth="8*" align="left"/>
43586 <colspec colwidth="6*" align="center"/>
43587 <colspec colwidth="6*" align="center"/>
43588 <colspec colwidth="6*" align="right"/>
43589 <tbody>
43590 <row>
43591 <entry><option>keepalive</option></entry>
43592 <entry>Use: <emphasis>smtp</emphasis></entry>
43593 <entry>Type: <emphasis>boolean</emphasis></entry>
43594 <entry>Default: <emphasis>true</emphasis></entry>
43595 </row>
43596 </tbody>
43597 </tgroup>
43598 </informaltable>
43599 <para>
43600 <indexterm role="concept">
43601 <primary>keepalive</primary>
43602 <secondary>on outgoing connection</secondary>
43603 </indexterm>
43604 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
43605 connections. When set, it causes the kernel to probe idle connections
43606 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
43607 of the connection should send a acknowledgment if the connection is still okay
43608 or a reset if the connection has been aborted. The reason for doing this is
43609 that it has the beneficial effect of freeing up certain types of connection
43610 that can get stuck when the remote host is disconnected without tidying up the
43611 TCP/IP call properly. The keepalive mechanism takes several hours to detect
43612 unreachable hosts.
43613 </para>
43614 <para>
43615 <indexterm role="option">
43616 <primary><option>lmtp_ignore_quota</option></primary>
43617 </indexterm>
43618 </para>
43619 <informaltable frame="all">
43620 <tgroup cols="4" colsep="0" rowsep="0">
43621 <colspec colwidth="8*" align="left"/>
43622 <colspec colwidth="6*" align="center"/>
43623 <colspec colwidth="6*" align="center"/>
43624 <colspec colwidth="6*" align="right"/>
43625 <tbody>
43626 <row>
43627 <entry><option>lmtp_ignore_quota</option></entry>
43628 <entry>Use: <emphasis>smtp</emphasis></entry>
43629 <entry>Type: <emphasis>boolean</emphasis></entry>
43630 <entry>Default: <emphasis>false</emphasis></entry>
43631 </row>
43632 </tbody>
43633 </tgroup>
43634 </informaltable>
43635 <para>
43636 <indexterm role="concept">
43637 <primary>LMTP</primary>
43638 <secondary>ignoring quota errors</secondary>
43639 </indexterm>
43640 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
43641 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
43642 has advertised support for IGNOREQUOTA in its response to the LHLO command.
43643 </para>
43644 <para>
43645 <indexterm role="option">
43646 <primary><option>max_rcpt</option></primary>
43647 </indexterm>
43648 </para>
43649 <informaltable frame="all">
43650 <tgroup cols="4" colsep="0" rowsep="0">
43651 <colspec colwidth="8*" align="left"/>
43652 <colspec colwidth="6*" align="center"/>
43653 <colspec colwidth="6*" align="center"/>
43654 <colspec colwidth="6*" align="right"/>
43655 <tbody>
43656 <row>
43657 <entry><option>max_rcpt</option></entry>
43658 <entry>Use: <emphasis>smtp</emphasis></entry>
43659 <entry>Type: <emphasis>integer</emphasis></entry>
43660 <entry>Default: <emphasis>100</emphasis></entry>
43661 </row>
43662 </tbody>
43663 </tgroup>
43664 </informaltable>
43665 <para>
43666 <indexterm role="concept">
43667 <primary>RCPT</primary>
43668 <secondary>maximum number of outgoing</secondary>
43669 </indexterm>
43670 This option limits the number of RCPT commands that are sent in a single
43671 SMTP message transaction. Each set of addresses is treated independently, and
43672 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
43673 permits this.
43674 </para>
43675 <para>
43676 <indexterm role="option">
43677 <primary><option>multi_domain</option></primary>
43678 </indexterm>
43679 </para>
43680 <informaltable frame="all">
43681 <tgroup cols="4" colsep="0" rowsep="0">
43682 <colspec colwidth="8*" align="left"/>
43683 <colspec colwidth="6*" align="center"/>
43684 <colspec colwidth="6*" align="center"/>
43685 <colspec colwidth="6*" align="right"/>
43686 <tbody>
43687 <row>
43688 <entry><option>multi_domain</option></entry>
43689 <entry>Use: <emphasis>smtp</emphasis></entry>
43690 <entry>Type: <emphasis>boolean</emphasis></entry>
43691 <entry>Default: <emphasis>true</emphasis></entry>
43692 </row>
43693 </tbody>
43694 </tgroup>
43695 </informaltable>
43696 <para>
43697 <indexterm role="variable">
43698 <primary><varname>$domain</varname></primary>
43699 </indexterm>
43700 When this option is set, the <command>smtp</command> transport can handle a number of
43701 addresses containing a mixture of different domains provided they all resolve
43702 to the same list of hosts. Turning the option off restricts the transport to
43703 handling only one domain at a time. This is useful if you want to use
43704 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
43705 is a single domain involved in a remote delivery.
43706 </para>
43707 <para>
43708 <indexterm role="option">
43709 <primary><option>port</option></primary>
43710 </indexterm>
43711 </para>
43712 <informaltable frame="all">
43713 <tgroup cols="4" colsep="0" rowsep="0">
43714 <colspec colwidth="8*" align="left"/>
43715 <colspec colwidth="6*" align="center"/>
43716 <colspec colwidth="6*" align="center"/>
43717 <colspec colwidth="6*" align="right"/>
43718 <tbody>
43719 <row>
43720 <entry><option>port</option></entry>
43721 <entry>Use: <emphasis>smtp</emphasis></entry>
43722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43723 <entry>Default: <emphasis>see below</emphasis></entry>
43724 </row>
43725 </tbody>
43726 </tgroup>
43727 </informaltable>
43728 <para>
43729 <indexterm role="concept">
43730 <primary>port</primary>
43731 <secondary>sending TCP/IP</secondary>
43732 </indexterm>
43733 <indexterm role="concept">
43734 <primary>TCP/IP</primary>
43735 <secondary>setting outgoing port</secondary>
43736 </indexterm>
43737 This option specifies the TCP/IP port on the server to which Exim connects.
43738 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
43739 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
43740 The name was changed to minimize confusion with the outgoing port. There is no
43741 variable that contains an outgoing port.
43742 </para>
43743 <para>
43744 If the value of this option begins with a digit it is taken as a port number;
43745 otherwise it is looked up using <function>getservbyname()</function>. The default value is
43746 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
43747 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
43748 is deferred.
43749 </para>
43750 <para>
43751 <indexterm role="option">
43752 <primary><option>protocol</option></primary>
43753 </indexterm>
43754 </para>
43755 <informaltable frame="all">
43756 <tgroup cols="4" colsep="0" rowsep="0">
43757 <colspec colwidth="8*" align="left"/>
43758 <colspec colwidth="6*" align="center"/>
43759 <colspec colwidth="6*" align="center"/>
43760 <colspec colwidth="6*" align="right"/>
43761 <tbody>
43762 <row>
43763 <entry><option>protocol</option></entry>
43764 <entry>Use: <emphasis>smtp</emphasis></entry>
43765 <entry>Type: <emphasis>string</emphasis></entry>
43766 <entry>Default: <emphasis>smtp</emphasis></entry>
43767 </row>
43768 </tbody>
43769 </tgroup>
43770 </informaltable>
43771 <para>
43772 <indexterm role="concept">
43773 <primary>LMTP</primary>
43774 <secondary>over TCP/IP</secondary>
43775 </indexterm>
43776 <indexterm role="concept">
43777 <primary>ssmtp protocol</primary>
43778 <secondary>outbound</secondary>
43779 </indexterm>
43780 <indexterm role="concept">
43781 <primary>TLS</primary>
43782 <secondary>SSL-on-connect outbound</secondary>
43783 </indexterm>
43784 <indexterm role="variable">
43785 <primary><varname>$port</varname></primary>
43786 </indexterm>
43787 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
43788 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
43789 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
43790 deliveries into closed message stores. Exim also has support for running LMTP
43791 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
43792 </para>
43793 <para revisionflag="changed">
43794 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
43795 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
43796 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
43797 The Internet standards bodies strongly discourage use of this mode.
43798 </para>
43799 <para>
43800 <indexterm role="option">
43801 <primary><option>retry_include_ip_address</option></primary>
43802 </indexterm>
43803 </para>
43804 <informaltable frame="all">
43805 <tgroup cols="4" colsep="0" rowsep="0">
43806 <colspec colwidth="8*" align="left"/>
43807 <colspec colwidth="6*" align="center"/>
43808 <colspec colwidth="6*" align="center"/>
43809 <colspec colwidth="6*" align="right"/>
43810 <tbody>
43811 <row>
43812 <entry><option>retry_include_ip_address</option></entry>
43813 <entry>Use: <emphasis>smtp</emphasis></entry>
43814 <entry>Type: <emphasis>boolean</emphasis></entry>
43815 <entry>Default: <emphasis>true</emphasis></entry>
43816 </row>
43817 </tbody>
43818 </tgroup>
43819 </informaltable>
43820 <para>
43821 Exim normally includes both the host name and the IP address in the key it
43822 constructs for indexing retry data after a temporary delivery failure. This
43823 means that when one of several IP addresses for a host is failing, it gets
43824 tried periodically (controlled by the retry rules), but use of the other IP
43825 addresses is not affected.
43826 </para>
43827 <para>
43828 However, in some dialup environments hosts are assigned a different IP address
43829 each time they connect. In this situation the use of the IP address as part of
43830 the retry key leads to undesirable behaviour. Setting this option false causes
43831 Exim to use only the host name. This should normally be done on a separate
43832 instance of the <command>smtp</command> transport, set up specially to handle the dialup
43833 hosts.
43834 </para>
43835 <para>
43836 <indexterm role="option">
43837 <primary><option>serialize_hosts</option></primary>
43838 </indexterm>
43839 </para>
43840 <informaltable frame="all">
43841 <tgroup cols="4" colsep="0" rowsep="0">
43842 <colspec colwidth="8*" align="left"/>
43843 <colspec colwidth="6*" align="center"/>
43844 <colspec colwidth="6*" align="center"/>
43845 <colspec colwidth="6*" align="right"/>
43846 <tbody>
43847 <row>
43848 <entry><option>serialize_hosts</option></entry>
43849 <entry>Use: <emphasis>smtp</emphasis></entry>
43850 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43851 <entry>Default: <emphasis>unset</emphasis></entry>
43852 </row>
43853 </tbody>
43854 </tgroup>
43855 </informaltable>
43856 <para>
43857 <indexterm role="concept">
43858 <primary>serializing connections</primary>
43859 </indexterm>
43860 <indexterm role="concept">
43861 <primary>host</primary>
43862 <secondary>serializing connections</secondary>
43863 </indexterm>
43864 Because Exim operates in a distributed manner, if several messages for the same
43865 host arrive at around the same time, more than one simultaneous connection to
43866 the remote host can occur. This is not usually a problem except when there is a
43867 slow link between the hosts. In that situation it may be helpful to restrict
43868 Exim to one connection at a time. This can be done by setting
43869 <option>serialize_hosts</option> to match the relevant hosts.
43870 </para>
43871 <para>
43872 <indexterm role="concept">
43873 <primary>hints database</primary>
43874 <secondary>serializing deliveries to a host</secondary>
43875 </indexterm>
43876 Exim implements serialization by means of a hints database in which a record is
43877 written whenever a process connects to one of the restricted hosts. The record
43878 is deleted when the connection is completed. Obviously there is scope for
43879 records to get left lying around if there is a system or program crash. To
43880 guard against this, Exim ignores any records that are more than six hours old.
43881 </para>
43882 <para>
43883 If you set up this kind of serialization, you should also arrange to delete the
43884 relevant hints database whenever your system reboots. The names of the files
43885 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43886 may be one or two files, depending on the type of DBM in use. The same files
43887 are used for ETRN serialization.
43888 </para>
43889 <para>
43890 <indexterm role="option">
43891 <primary><option>size_addition</option></primary>
43892 </indexterm>
43893 </para>
43894 <informaltable frame="all">
43895 <tgroup cols="4" colsep="0" rowsep="0">
43896 <colspec colwidth="8*" align="left"/>
43897 <colspec colwidth="6*" align="center"/>
43898 <colspec colwidth="6*" align="center"/>
43899 <colspec colwidth="6*" align="right"/>
43900 <tbody>
43901 <row>
43902 <entry><option>size_addition</option></entry>
43903 <entry>Use: <emphasis>smtp</emphasis></entry>
43904 <entry>Type: <emphasis>integer</emphasis></entry>
43905 <entry>Default: <emphasis>1024</emphasis></entry>
43906 </row>
43907 </tbody>
43908 </tgroup>
43909 </informaltable>
43910 <para>
43911 <indexterm role="concept">
43912 <primary>SMTP</primary>
43913 <secondary>SIZE</secondary>
43914 </indexterm>
43915 <indexterm role="concept">
43916 <primary>message</primary>
43917 <secondary>size issue for transport filter</secondary>
43918 </indexterm>
43919 <indexterm role="concept">
43920 <primary>size</primary>
43921 <secondary>of message</secondary>
43922 </indexterm>
43923 <indexterm role="concept">
43924 <primary>transport</primary>
43925 <secondary>filter</secondary>
43926 </indexterm>
43927 <indexterm role="concept">
43928 <primary>filter</primary>
43929 <secondary>transport filter</secondary>
43930 </indexterm>
43931 If a remote SMTP server indicates that it supports the SIZE option of the
43932 MAIL command, Exim uses this to pass over the message size at the start of
43933 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
43934 sends, to allow for headers and other text that may be added during delivery by
43935 configuration options or in a transport filter. It may be necessary to increase
43936 this if a lot of text is added to messages.
43937 </para>
43938 <para>
43939 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
43940 the use of the SIZE option altogether.
43941 </para>
43942 <para>
43943 <indexterm role="option">
43944 <primary><option>tls_certificate</option></primary>
43945 </indexterm>
43946 </para>
43947 <informaltable frame="all">
43948 <tgroup cols="4" colsep="0" rowsep="0">
43949 <colspec colwidth="8*" align="left"/>
43950 <colspec colwidth="6*" align="center"/>
43951 <colspec colwidth="6*" align="center"/>
43952 <colspec colwidth="6*" align="right"/>
43953 <tbody>
43954 <row>
43955 <entry><option>tls_certificate</option></entry>
43956 <entry>Use: <emphasis>smtp</emphasis></entry>
43957 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43958 <entry>Default: <emphasis>unset</emphasis></entry>
43959 </row>
43960 </tbody>
43961 </tgroup>
43962 </informaltable>
43963 <para>
43964 <indexterm role="concept">
43965 <primary>TLS</primary>
43966 <secondary>client certificate, location of</secondary>
43967 </indexterm>
43968 <indexterm role="concept">
43969 <primary>certificate</primary>
43970 <secondary>client, location of</secondary>
43971 </indexterm>
43972 <indexterm role="variable">
43973 <primary><varname>$host</varname></primary>
43974 </indexterm>
43975 <indexterm role="variable">
43976 <primary><varname>$host_address</varname></primary>
43977 </indexterm>
43978 The value of this option must be the absolute path to a file which contains the
43979 client&#x2019;s certificate, for possible use when sending a message over an encrypted
43980 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
43981 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
43982 details of TLS.
43983 </para>
43984 <para>
43985 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
43986 certificate when sending messages as a client. The global option of the same
43987 name specifies the certificate for Exim as a server; it is not automatically
43988 assumed that the same certificate should be used when Exim is operating as a
43989 client.
43990 </para>
43991 <para>
43992 <indexterm role="option">
43993 <primary><option>tls_crl</option></primary>
43994 </indexterm>
43995 </para>
43996 <informaltable frame="all">
43997 <tgroup cols="4" colsep="0" rowsep="0">
43998 <colspec colwidth="8*" align="left"/>
43999 <colspec colwidth="6*" align="center"/>
44000 <colspec colwidth="6*" align="center"/>
44001 <colspec colwidth="6*" align="right"/>
44002 <tbody>
44003 <row>
44004 <entry><option>tls_crl</option></entry>
44005 <entry>Use: <emphasis>smtp</emphasis></entry>
44006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44007 <entry>Default: <emphasis>unset</emphasis></entry>
44008 </row>
44009 </tbody>
44010 </tgroup>
44011 </informaltable>
44012 <para>
44013 <indexterm role="concept">
44014 <primary>TLS</primary>
44015 <secondary>client certificate revocation list</secondary>
44016 </indexterm>
44017 <indexterm role="concept">
44018 <primary>certificate</primary>
44019 <secondary>revocation list for client</secondary>
44020 </indexterm>
44021 This option specifies a certificate revocation list. The expanded value must
44022 be the name of a file that contains a CRL in PEM format.
44023 </para>
44024 <para>
44025 <indexterm role="option">
44026 <primary><option>tls_privatekey</option></primary>
44027 </indexterm>
44028 </para>
44029 <informaltable frame="all">
44030 <tgroup cols="4" colsep="0" rowsep="0">
44031 <colspec colwidth="8*" align="left"/>
44032 <colspec colwidth="6*" align="center"/>
44033 <colspec colwidth="6*" align="center"/>
44034 <colspec colwidth="6*" align="right"/>
44035 <tbody>
44036 <row>
44037 <entry><option>tls_privatekey</option></entry>
44038 <entry>Use: <emphasis>smtp</emphasis></entry>
44039 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44040 <entry>Default: <emphasis>unset</emphasis></entry>
44041 </row>
44042 </tbody>
44043 </tgroup>
44044 </informaltable>
44045 <para>
44046 <indexterm role="concept">
44047 <primary>TLS</primary>
44048 <secondary>client private key, location of</secondary>
44049 </indexterm>
44050 <indexterm role="variable">
44051 <primary><varname>$host</varname></primary>
44052 </indexterm>
44053 <indexterm role="variable">
44054 <primary><varname>$host_address</varname></primary>
44055 </indexterm>
44056 The value of this option must be the absolute path to a file which contains the
44057 client&#x2019;s private key. This is used when sending a message over an encrypted
44058 connection using a client certificate. The values of <varname>$host</varname> and
44059 <varname>$host_address</varname> are set to the name and address of the server during the
44060 expansion. If this option is unset, or the expansion is forced to fail, or the
44061 result is an empty string, the private key is assumed to be in the same file as
44062 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44063 </para>
44064 <para>
44065 <indexterm role="option">
44066 <primary><option>tls_require_ciphers</option></primary>
44067 </indexterm>
44068 </para>
44069 <informaltable frame="all">
44070 <tgroup cols="4" colsep="0" rowsep="0">
44071 <colspec colwidth="8*" align="left"/>
44072 <colspec colwidth="6*" align="center"/>
44073 <colspec colwidth="6*" align="center"/>
44074 <colspec colwidth="6*" align="right"/>
44075 <tbody>
44076 <row>
44077 <entry><option>tls_require_ciphers</option></entry>
44078 <entry>Use: <emphasis>smtp</emphasis></entry>
44079 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44080 <entry>Default: <emphasis>unset</emphasis></entry>
44081 </row>
44082 </tbody>
44083 </tgroup>
44084 </informaltable>
44085 <para>
44086 <indexterm role="concept">
44087 <primary>TLS</primary>
44088 <secondary>requiring specific ciphers</secondary>
44089 </indexterm>
44090 <indexterm role="concept">
44091 <primary>cipher</primary>
44092 <secondary>requiring specific</secondary>
44093 </indexterm>
44094 <indexterm role="variable">
44095 <primary><varname>$host</varname></primary>
44096 </indexterm>
44097 <indexterm role="variable">
44098 <primary><varname>$host_address</varname></primary>
44099 </indexterm>
44100 The value of this option must be a list of permitted cipher suites, for use
44101 when setting up an outgoing encrypted connection. (There is a global option of
44102 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
44103 <varname>$host_address</varname> are set to the name and address of the server during the
44104 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
44105 is used in different ways by OpenSSL and GnuTLS (see sections
44106 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
44107 ciphers is a preference order.
44108 </para>
44109 <para revisionflag="changed">
44110 <indexterm role="option">
44111 <primary><option>tls_sni</option></primary>
44112 </indexterm>
44113 </para>
44114 <informaltable frame="all" revisionflag="changed">
44115 <tgroup cols="4" colsep="0" rowsep="0">
44116 <colspec colwidth="8*" align="left"/>
44117 <colspec colwidth="6*" align="center"/>
44118 <colspec colwidth="6*" align="center"/>
44119 <colspec colwidth="6*" align="right"/>
44120 <tbody>
44121 <row>
44122 <entry><option>tls_sni</option></entry>
44123 <entry>Use: <emphasis>smtp</emphasis></entry>
44124 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44125 <entry>Default: <emphasis>unset</emphasis></entry>
44126 </row>
44127 </tbody>
44128 </tgroup>
44129 </informaltable>
44130 <para revisionflag="changed">
44131 <indexterm role="concept">
44132 <primary>TLS</primary>
44133 <secondary>Server Name Indication</secondary>
44134 </indexterm>
44135 <indexterm role="variable">
44136 <primary><varname>$tls_sni</varname></primary>
44137 </indexterm>
44138 If this option is set then it sets the $tls_sni variable and causes any
44139 TLS session to pass this value as the Server Name Indication extension to
44140 the remote side, which can be used by the remote side to select an appropriate
44141 certificate and private key for the session.
44142 </para>
44143 <para revisionflag="changed">
44144 See <xref linkend="SECTtlssni"/> for more information.
44145 </para>
44146 <para revisionflag="changed">
44147 OpenSSL only, also requiring a build of OpenSSL that supports TLS extensions.
44148 </para>
44149 <para>
44150 <indexterm role="option">
44151 <primary><option>tls_tempfail_tryclear</option></primary>
44152 </indexterm>
44153 </para>
44154 <informaltable frame="all">
44155 <tgroup cols="4" colsep="0" rowsep="0">
44156 <colspec colwidth="8*" align="left"/>
44157 <colspec colwidth="6*" align="center"/>
44158 <colspec colwidth="6*" align="center"/>
44159 <colspec colwidth="6*" align="right"/>
44160 <tbody>
44161 <row>
44162 <entry><option>tls_tempfail_tryclear</option></entry>
44163 <entry>Use: <emphasis>smtp</emphasis></entry>
44164 <entry>Type: <emphasis>boolean</emphasis></entry>
44165 <entry>Default: <emphasis>true</emphasis></entry>
44166 </row>
44167 </tbody>
44168 </tgroup>
44169 </informaltable>
44170 <para>
44171 <indexterm role="concept">
44172 <primary>4<emphasis>xx</emphasis> responses</primary>
44173 <secondary>to STARTTLS</secondary>
44174 </indexterm>
44175 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
44176 setting up a TLS session, this option determines whether or not Exim should try
44177 to deliver the message unencrypted. If it is set false, delivery to the
44178 current host is deferred; if there are other hosts, they are tried. If this
44179 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
44180 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
44181 TLS negotiation fails, Exim closes the current connection (because it is in an
44182 unknown state), opens a new one to the same host, and then tries the delivery
44183 in clear.
44184 </para>
44185 <para>
44186 <indexterm role="option">
44187 <primary><option>tls_verify_certificates</option></primary>
44188 </indexterm>
44189 </para>
44190 <informaltable frame="all">
44191 <tgroup cols="4" colsep="0" rowsep="0">
44192 <colspec colwidth="8*" align="left"/>
44193 <colspec colwidth="6*" align="center"/>
44194 <colspec colwidth="6*" align="center"/>
44195 <colspec colwidth="6*" align="right"/>
44196 <tbody>
44197 <row>
44198 <entry><option>tls_verify_certificates</option></entry>
44199 <entry>Use: <emphasis>smtp</emphasis></entry>
44200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44201 <entry>Default: <emphasis>unset</emphasis></entry>
44202 </row>
44203 </tbody>
44204 </tgroup>
44205 </informaltable>
44206 <para>
44207 <indexterm role="concept">
44208 <primary>TLS</primary>
44209 <secondary>server certificate verification</secondary>
44210 </indexterm>
44211 <indexterm role="concept">
44212 <primary>certificate</primary>
44213 <secondary>verification of server</secondary>
44214 </indexterm>
44215 <indexterm role="variable">
44216 <primary><varname>$host</varname></primary>
44217 </indexterm>
44218 <indexterm role="variable">
44219 <primary><varname>$host_address</varname></primary>
44220 </indexterm>
44221 The value of this option must be the absolute path to a file containing
44222 permitted server certificates, for use when setting up an encrypted connection.
44223 Alternatively, if you are using OpenSSL, you can set
44224 <option>tls_verify_certificates</option> to the name of a directory containing certificate
44225 files. This does not work with GnuTLS; the option must be set to the name of a
44226 single file if you are using GnuTLS. The values of <varname>$host</varname> and
44227 <varname>$host_address</varname> are set to the name and address of the server during the
44228 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44229 </para>
44230 </section>
44231 <section id="SECTvalhosmax">
44232 <title>How the limits for the number of hosts to try are used</title>
44233 <para>
44234 <indexterm role="concept">
44235 <primary>host</primary>
44236 <secondary>maximum number to try</secondary>
44237 </indexterm>
44238 <indexterm role="concept">
44239 <primary>limit</primary>
44240 <secondary>hosts; maximum number tried</secondary>
44241 </indexterm>
44242 There are two options that are concerned with the number of hosts that are
44243 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
44244 <option>hosts_max_try_hardlimit</option>.
44245 </para>
44246 <para>
44247 The <option>hosts_max_try</option> option limits the number of hosts that are tried
44248 for a single delivery. However, despite the term <quote>host</quote> in its name, the
44249 option actually applies to each IP address independently. In other words, a
44250 multihomed host is treated as several independent hosts, just as it is for
44251 retrying.
44252 </para>
44253 <para>
44254 Many of the larger ISPs have multiple MX records which often point to
44255 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
44256 created as a result of routing one of these domains.
44257 </para>
44258 <para>
44259 Trying every single IP address on such a long list does not seem sensible; if
44260 several at the top of the list fail, it is reasonable to assume there is some
44261 problem that is likely to affect all of them. Roughly speaking, the value of
44262 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
44263 delivery. However, the logic cannot be quite that simple.
44264 </para>
44265 <para>
44266 Firstly, IP addresses that are skipped because their retry times have not
44267 arrived do not count, and in addition, addresses that are past their retry
44268 limits are also not counted, even when they are tried. This means that when
44269 some IP addresses are past their retry limits, more than the value of
44270 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
44271 that all IP addresses are considered before timing out an email address (but
44272 see below for an exception).
44273 </para>
44274 <para>
44275 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
44276 list to see if there is a subsequent host with a different (higher valued) MX.
44277 If there is, that host is considered next, and the current IP address is used
44278 but not counted. This behaviour helps in the case of a domain with a retry rule
44279 that hardly ever delays any hosts, as is now explained:
44280 </para>
44281 <para>
44282 Consider the case of a long list of hosts with one MX value, and a few with a
44283 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
44284 hosts at the top of the list are tried at first. With the default retry rule,
44285 which specifies increasing retry times, the higher MX hosts are eventually
44286 tried when those at the top of the list are skipped because they have not
44287 reached their retry times.
44288 </para>
44289 <para>
44290 However, it is common practice to put a fixed short retry time on domains for
44291 large ISPs, on the grounds that their servers are rarely down for very long.
44292 Unfortunately, these are exactly the domains that tend to resolve to long lists
44293 of hosts. The short retry time means that the lowest MX hosts are tried every
44294 time. The attempts may be in a different order because of random sorting, but
44295 without the special MX check, the higher MX hosts would never be tried until
44296 all the lower MX hosts had timed out (which might be several days), because
44297 there are always some lower MX hosts that have reached their retry times. With
44298 the special check, Exim considers at least one IP address from each MX value at
44299 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
44300 reached.
44301 </para>
44302 <para>
44303 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
44304 particular, Exim normally eventually tries all the IP addresses before timing
44305 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
44306 reasonable thing to do. Recently, however, some lunatic DNS configurations have
44307 been set up with hundreds of IP addresses for some domains. It can
44308 take a very long time indeed for an address to time out in these cases.
44309 </para>
44310 <para>
44311 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
44312 Exim never tries more than this number of IP addresses; if it hits this limit
44313 and they are all timed out, the email address is bounced, even though not all
44314 possible IP addresses have been tried.
44315 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
44316 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
44317 </para>
44318 </section>
44319 </chapter>
44320
44321 <chapter id="CHAPrewrite">
44322 <title>Address rewriting</title>
44323 <para>
44324 <indexterm role="concept" id="IIDaddrew" class="startofrange">
44325 <primary>rewriting</primary>
44326 <secondary>addresses</secondary>
44327 </indexterm>
44328 There are some circumstances in which Exim automatically rewrites domains in
44329 addresses. The two most common are when an address is given without a domain
44330 (referred to as an <quote>unqualified address</quote>) or when an address contains an
44331 abbreviated domain that is expanded by DNS lookup.
44332 </para>
44333 <para>
44334 Unqualified envelope addresses are accepted only for locally submitted
44335 messages, or for messages that are received from hosts matching
44336 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
44337 appropriate. Unqualified addresses in header lines are qualified if they are in
44338 locally submitted messages, or messages from hosts that are permitted to send
44339 unqualified envelope addresses. Otherwise, unqualified addresses in header
44340 lines are neither qualified nor rewritten.
44341 </para>
44342 <para>
44343 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
44344 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
44345 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
44346 do this. The new RFCs do not contain this suggestion.
44347 </para>
44348 <section id="SECID147">
44349 <title>Explicitly configured address rewriting</title>
44350 <para>
44351 This chapter describes the rewriting rules that can be used in the
44352 main rewrite section of the configuration file, and also in the generic
44353 <option>headers_rewrite</option> option that can be set on any transport.
44354 </para>
44355 <para>
44356 Some people believe that configured address rewriting is a Mortal Sin.
44357 Others believe that life is not possible without it. Exim provides the
44358 facility; you do not have to use it.
44359 </para>
44360 <para>
44361 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
44362 configuration file are applied to addresses in incoming messages, both envelope
44363 addresses and addresses in header lines. Each rule specifies the types of
44364 address to which it applies.
44365 </para>
44366 <para>
44367 Whether or not addresses in header lines are rewritten depends on the origin of
44368 the headers and the type of rewriting. Global rewriting, that is, rewriting
44369 rules from the rewrite section of the configuration file, is applied only to
44370 those headers that were received with the message. Header lines that are added
44371 by ACLs or by a system filter or by individual routers or transports (which
44372 are specific to individual recipient addresses) are not rewritten by the global
44373 rules.
44374 </para>
44375 <para>
44376 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
44377 applies all headers except those added by routers and transports. That is, as
44378 well as the headers that were received with the message, it also applies to
44379 headers that were added by an ACL or a system filter.
44380 </para>
44381 <para>
44382 In general, rewriting addresses from your own system or domain has some
44383 legitimacy. Rewriting other addresses should be done only with great care and
44384 in special circumstances. The author of Exim believes that rewriting should be
44385 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
44386 Although it can sometimes be used as a routing tool, this is very strongly
44387 discouraged.
44388 </para>
44389 <para>
44390 There are two commonly encountered circumstances where rewriting is used, as
44391 illustrated by these examples:
44392 </para>
44393 <itemizedlist>
44394 <listitem>
44395 <para>
44396 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
44397 exchange mail with each other behind a firewall, but there is only a single
44398 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
44399 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
44400 </para>
44401 </listitem>
44402 <listitem>
44403 <para>
44404 A host rewrites the local parts of its own users so that, for example,
44405 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
44406 </para>
44407 </listitem>
44408 </itemizedlist>
44409 </section>
44410 <section id="SECID148">
44411 <title>When does rewriting happen?</title>
44412 <para>
44413 <indexterm role="concept">
44414 <primary>rewriting</primary>
44415 <secondary>timing of</secondary>
44416 </indexterm>
44417 <indexterm role="concept">
44418 <primary>access control lists (ACLs)</primary>
44419 <secondary>rewriting addresses in</secondary>
44420 </indexterm>
44421 Configured address rewriting can take place at several different stages of a
44422 message&#x2019;s processing.
44423 </para>
44424 <para>
44425 <indexterm role="variable">
44426 <primary><varname>$sender_address</varname></primary>
44427 </indexterm>
44428 At the start of an ACL for MAIL, the sender address may have been rewritten
44429 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
44430 ordinary rewrite rules have yet been applied. If, however, the sender address
44431 is verified in the ACL, it is rewritten before verification, and remains
44432 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
44433 rewritten address. This also applies if sender verification happens in a
44434 RCPT ACL. Otherwise, when the sender address is not verified, it is
44435 rewritten as soon as a message&#x2019;s header lines have been received.
44436 </para>
44437 <para>
44438 <indexterm role="variable">
44439 <primary><varname>$domain</varname></primary>
44440 </indexterm>
44441 <indexterm role="variable">
44442 <primary><varname>$local_part</varname></primary>
44443 </indexterm>
44444 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
44445 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
44446 rewrite rules have yet been applied to it. However, the behaviour is different
44447 from the sender address when a recipient is verified. The address is rewritten
44448 for the verification, but the rewriting is not remembered at this stage. The
44449 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
44450 as they were before (that is, they contain the unrewritten &ndash; except for
44451 SMTP-time rewriting &ndash; address).
44452 </para>
44453 <para>
44454 As soon as a message&#x2019;s header lines have been received, all the envelope
44455 recipient addresses are permanently rewritten, and rewriting is also applied to
44456 the addresses in the header lines (if configured). This happens before adding
44457 any header lines that were specified in MAIL or RCPT ACLs, and
44458 <indexterm role="concept">
44459 <primary><function>local_scan()</function> function</primary>
44460 <secondary>address rewriting; timing of</secondary>
44461 </indexterm>
44462 before the DATA ACL and <function>local_scan()</function> functions are run.
44463 </para>
44464 <para>
44465 When an address is being routed, either for delivery or for verification,
44466 rewriting is applied immediately to child addresses that are generated by
44467 redirection, unless <option>no_rewrite</option> is set on the router.
44468 </para>
44469 <para>
44470 <indexterm role="concept">
44471 <primary>envelope sender</primary>
44472 <secondary>rewriting at transport time</secondary>
44473 </indexterm>
44474 <indexterm role="concept">
44475 <primary>rewriting</primary>
44476 <secondary>at transport time</secondary>
44477 </indexterm>
44478 <indexterm role="concept">
44479 <primary>header lines</primary>
44480 <secondary>rewriting at transport time</secondary>
44481 </indexterm>
44482 At transport time, additional rewriting of addresses in header lines can be
44483 specified by setting the generic <option>headers_rewrite</option> option on a transport.
44484 This option contains rules that are identical in form to those in the rewrite
44485 section of the configuration file. They are applied to the original message
44486 header lines and any that were added by ACLs or a system filter. They are not
44487 applied to header lines that are added by routers or the transport.
44488 </para>
44489 <para>
44490 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
44491 transport option. However, it is not possible to rewrite envelope recipients at
44492 transport time.
44493 </para>
44494 </section>
44495 <section id="SECID149">
44496 <title>Testing the rewriting rules that apply on input</title>
44497 <para>
44498 <indexterm role="concept">
44499 <primary>rewriting</primary>
44500 <secondary>testing</secondary>
44501 </indexterm>
44502 <indexterm role="concept">
44503 <primary>testing</primary>
44504 <secondary>rewriting</secondary>
44505 </indexterm>
44506 Exim&#x2019;s input rewriting configuration appears in a part of the run time
44507 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
44508 <option>-brw</option> command line option. This takes an address (which can be a full RFC
44509 2822 address) as its argument. The output is a list of how the address would be
44510 transformed by the rewriting rules for each of the different places it might
44511 appear in an incoming message, that is, for each different header and for the
44512 envelope sender and recipient fields. For example,
44513 </para>
44514 <literallayout class="monospaced">
44515 exim -brw ph10@exim.workshop.example
44516 </literallayout>
44517 <para>
44518 might produce the output
44519 </para>
44520 <literallayout class="monospaced">
44521 sender: Philip.Hazel@exim.workshop.example
44522 from: Philip.Hazel@exim.workshop.example
44523 to: ph10@exim.workshop.example
44524 cc: ph10@exim.workshop.example
44525 bcc: ph10@exim.workshop.example
44526 reply-to: Philip.Hazel@exim.workshop.example
44527 env-from: Philip.Hazel@exim.workshop.example
44528 env-to: ph10@exim.workshop.example
44529 </literallayout>
44530 <para>
44531 which shows that rewriting has been set up for that address when used in any of
44532 the source fields, but not when it appears as a recipient address. At the
44533 present time, there is no equivalent way of testing rewriting rules that are
44534 set for a particular transport.
44535 </para>
44536 </section>
44537 <section id="SECID150">
44538 <title>Rewriting rules</title>
44539 <para>
44540 <indexterm role="concept">
44541 <primary>rewriting</primary>
44542 <secondary>rules</secondary>
44543 </indexterm>
44544 The rewrite section of the configuration file consists of lines of rewriting
44545 rules in the form
44546 </para>
44547 <literallayout>
44548 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
44549 </literallayout>
44550 <para>
44551 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
44552 transport option are given as a colon-separated list. Each item in the list
44553 takes the same form as a line in the main rewriting configuration (except that
44554 any colons must be doubled, of course).
44555 </para>
44556 <para>
44557 The formats of source patterns and replacement strings are described below.
44558 Each is terminated by white space, unless enclosed in double quotes, in which
44559 case normal quoting conventions apply inside the quotes. The flags are single
44560 characters which may appear in any order. Spaces and tabs between them are
44561 ignored.
44562 </para>
44563 <para>
44564 For each address that could potentially be rewritten, the rules are scanned in
44565 order, and replacements for the address from earlier rules can themselves be
44566 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
44567 </para>
44568 <para>
44569 The order in which addresses are rewritten is undefined, may change between
44570 releases, and must not be relied on, with one exception: when a message is
44571 received, the envelope sender is always rewritten first, before any header
44572 lines are rewritten. For example, the replacement string for a rewrite of an
44573 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
44574 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
44575 that the envelope sender has already been rewritten.
44576 </para>
44577 <para>
44578 <indexterm role="variable">
44579 <primary><varname>$domain</varname></primary>
44580 </indexterm>
44581 <indexterm role="variable">
44582 <primary><varname>$local_part</varname></primary>
44583 </indexterm>
44584 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
44585 string to refer to the address that is being rewritten. Note that lookup-driven
44586 rewriting can be done by a rule of the form
44587 </para>
44588 <literallayout class="monospaced">
44589 *@*   ${lookup ...
44590 </literallayout>
44591 <para>
44592 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
44593 refer to the address that is being rewritten.
44594 </para>
44595 </section>
44596 <section id="SECID151">
44597 <title>Rewriting patterns</title>
44598 <para>
44599 <indexterm role="concept">
44600 <primary>rewriting</primary>
44601 <secondary>patterns</secondary>
44602 </indexterm>
44603 <indexterm role="concept">
44604 <primary>address list</primary>
44605 <secondary>in a rewriting pattern</secondary>
44606 </indexterm>
44607 The source pattern in a rewriting rule is any item which may appear in an
44608 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
44609 single-item address list, which means that it is expanded before being tested
44610 against the address. As always, if you use a regular expression as a pattern,
44611 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
44612 facility to suppress string expansion within the regular expression.
44613 </para>
44614 <para>
44615 Domains in patterns should be given in lower case. Local parts in patterns are
44616 case-sensitive. If you want to do case-insensitive matching of local parts, you
44617 can use a regular expression that starts with <literal>^(?i)</literal>.
44618 </para>
44619 <para>
44620 <indexterm role="concept">
44621 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44622 <secondary>in rewriting rules</secondary>
44623 </indexterm>
44624 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
44625 depending on the type of match which occurred. These can be used in the
44626 replacement string to insert portions of the incoming address. <varname>$0</varname> always
44627 refers to the complete incoming address. When a regular expression is used, the
44628 numerical variables are set from its capturing subexpressions. For other types
44629 of pattern they are set as follows:
44630 </para>
44631 <itemizedlist>
44632 <listitem>
44633 <para>
44634 If a local part or domain starts with an asterisk, the numerical variables
44635 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
44636 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
44637 pattern
44638 </para>
44639 <literallayout class="monospaced">
44640 *queen@*.fict.example
44641 </literallayout>
44642 <para>
44643 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
44644 </para>
44645 <literallayout class="monospaced">
44646 $0 = hearts-queen@wonderland.fict.example
44647 $1 = hearts-
44648 $2 = wonderland
44649 </literallayout>
44650 <para>
44651 Note that if the local part does not start with an asterisk, but the domain
44652 does, it is <varname>$1</varname> that contains the wild part of the domain.
44653 </para>
44654 </listitem>
44655 <listitem>
44656 <para>
44657 If the domain part of the pattern is a partial lookup, the wild and fixed parts
44658 of the domain are placed in the next available numerical variables. Suppose,
44659 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
44660 rewriting rule of the form
44661 </para>
44662 <literallayout>
44663 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
44664 </literallayout>
44665 <para>
44666 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
44667 </para>
44668 <literallayout class="monospaced">
44669 $1 = foo
44670 $2 = bar
44671 $3 = baz.example
44672 </literallayout>
44673 <para>
44674 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
44675 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
44676 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
44677 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
44678 whole domain. For non-partial domain lookups, no numerical variables are set.
44679 </para>
44680 </listitem>
44681 </itemizedlist>
44682 </section>
44683 <section id="SECID152">
44684 <title>Rewriting replacements</title>
44685 <para>
44686 <indexterm role="concept">
44687 <primary>rewriting</primary>
44688 <secondary>replacements</secondary>
44689 </indexterm>
44690 If the replacement string for a rule is a single asterisk, addresses that
44691 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
44692 rewriting rules are scanned. For example,
44693 </para>
44694 <literallayout class="monospaced">
44695 hatta@lookingglass.fict.example  *  f
44696 </literallayout>
44697 <para>
44698 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
44699 <emphasis>From:</emphasis> headers.
44700 </para>
44701 <para>
44702 <indexterm role="variable">
44703 <primary><varname>$domain</varname></primary>
44704 </indexterm>
44705 <indexterm role="variable">
44706 <primary><varname>$local_part</varname></primary>
44707 </indexterm>
44708 If the replacement string is not a single asterisk, it is expanded, and must
44709 yield a fully qualified address. Within the expansion, the variables
44710 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
44711 Any letters they contain retain their original case &ndash; they are not lower
44712 cased. The numerical variables are set up according to the type of pattern that
44713 matched the address, as described above. If the expansion is forced to fail by
44714 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
44715 current rule is abandoned, but subsequent rules may take effect. Any other
44716 expansion failure causes the entire rewriting operation to be abandoned, and an
44717 entry written to the panic log.
44718 </para>
44719 </section>
44720 <section id="SECID153">
44721 <title>Rewriting flags</title>
44722 <para>
44723 There are three different kinds of flag that may appear on rewriting rules:
44724 </para>
44725 <itemizedlist>
44726 <listitem>
44727 <para>
44728 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
44729 c, f, h, r, s, t.
44730 </para>
44731 </listitem>
44732 <listitem>
44733 <para>
44734 A flag that specifies rewriting at SMTP time: S.
44735 </para>
44736 </listitem>
44737 <listitem>
44738 <para>
44739 Flags that control the rewriting process: Q, q, R, w.
44740 </para>
44741 </listitem>
44742 </itemizedlist>
44743 <para>
44744 For rules that are part of the <option>headers_rewrite</option> generic transport option,
44745 E, F, T, and S are not permitted.
44746 </para>
44747 </section>
44748 <section id="SECID154">
44749 <title>Flags specifying which headers and envelope addresses to rewrite</title>
44750 <para>
44751 <indexterm role="concept">
44752 <primary>rewriting</primary>
44753 <secondary>flags</secondary>
44754 </indexterm>
44755 If none of the following flag letters, nor the <quote>S</quote> flag (see section
44756 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
44757 and to both the sender and recipient fields of the envelope, whereas a
44758 transport-time rewriting rule just applies to all headers. Otherwise, the
44759 rewriting rule is skipped unless the relevant addresses are being processed.
44760 </para>
44761 <literallayout>
44762 <literal>E</literal>       rewrite all envelope fields
44763 <literal>F</literal>       rewrite the envelope From field
44764 <literal>T</literal>       rewrite the envelope To field
44765 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
44766 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
44767 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
44768 <literal>h</literal>       rewrite all headers
44769 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
44770 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
44771 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
44772 </literallayout>
44773 <para>
44774 "All headers" means all of the headers listed above that can be selected
44775 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
44776 other headers such as <emphasis>Subject:</emphasis> etc.
44777 </para>
44778 <para>
44779 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
44780 restrict this to special known cases in your own domains.
44781 </para>
44782 </section>
44783 <section id="SECTrewriteS">
44784 <title>The SMTP-time rewriting flag</title>
44785 <para>
44786 <indexterm role="concept">
44787 <primary>SMTP</primary>
44788 <secondary>rewriting malformed addresses</secondary>
44789 </indexterm>
44790 <indexterm role="concept">
44791 <primary>RCPT</primary>
44792 <secondary>rewriting argument of</secondary>
44793 </indexterm>
44794 <indexterm role="concept">
44795 <primary>MAIL</primary>
44796 <secondary>rewriting argument of</secondary>
44797 </indexterm>
44798 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
44799 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
44800 before any other processing; even before syntax checking. The pattern is
44801 required to be a regular expression, and it is matched against the whole of the
44802 data for the command, including any surrounding angle brackets.
44803 </para>
44804 <para>
44805 <indexterm role="variable">
44806 <primary><varname>$domain</varname></primary>
44807 </indexterm>
44808 <indexterm role="variable">
44809 <primary><varname>$local_part</varname></primary>
44810 </indexterm>
44811 This form of rewrite rule allows for the handling of addresses that are not
44812 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
44813 input). Because the input is not required to be a syntactically valid address,
44814 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
44815 expansion of the replacement string. The result of rewriting replaces the
44816 original address in the MAIL or RCPT command.
44817 </para>
44818 </section>
44819 <section id="SECID155">
44820 <title>Flags controlling the rewriting process</title>
44821 <para>
44822 There are four flags which control the way the rewriting process works. These
44823 take effect only when a rule is invoked, that is, when the address is of the
44824 correct type (matches the flags) and matches the pattern:
44825 </para>
44826 <itemizedlist>
44827 <listitem>
44828 <para>
44829 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
44830 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
44831 absence of <quote>Q</quote> the rewritten address must always include a domain.
44832 </para>
44833 </listitem>
44834 <listitem>
44835 <para>
44836 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
44837 even if no rewriting actually takes place because of a <quote>fail</quote> in the
44838 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
44839 (does not match the flags) or does not match the pattern.
44840 </para>
44841 </listitem>
44842 <listitem>
44843 <para>
44844 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
44845 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
44846 rewriting once it fails to match (after at least one successful rewrite).
44847 </para>
44848 </listitem>
44849 <listitem>
44850 <para>
44851 <indexterm role="concept">
44852 <primary>rewriting</primary>
44853 <secondary>whole addresses</secondary>
44854 </indexterm>
44855 When an address in a header is rewritten, the rewriting normally applies only
44856 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
44857 left unchanged. For example, rewriting might change
44858 </para>
44859 <literallayout class="monospaced">
44860 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
44861 </literallayout>
44862 <para>
44863 into
44864 </para>
44865 <literallayout class="monospaced">
44866 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
44867 </literallayout>
44868 <para>
44869 <indexterm role="concept">
44870 <primary>RFC 2047</primary>
44871 </indexterm>
44872 Sometimes there is a need to replace the whole address item, and this can be
44873 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
44874 causes an address in a header line to be rewritten, the entire address is
44875 replaced, not just the working part. The replacement must be a complete RFC
44876 2822 address, including the angle brackets if necessary. If text outside angle
44877 brackets contains a character whose value is greater than 126 or less than 32
44878 (except for tab), the text is encoded according to RFC 2047. The character set
44879 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
44880 </para>
44881 <para>
44882 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
44883 rewritten, all but the working part of the replacement address is discarded.
44884 </para>
44885 </listitem>
44886 </itemizedlist>
44887 </section>
44888 <section id="SECID156">
44889 <title>Rewriting examples</title>
44890 <para>
44891 Here is an example of the two common rewriting paradigms:
44892 </para>
44893 <literallayout class="monospaced">
44894 *@*.hitch.fict.example  $1@hitch.fict.example
44895 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
44896                      {$value}fail}@hitch.fict.example bctfrF
44897 </literallayout>
44898 <para>
44899 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
44900 the string expansion to fail if the lookup does not succeed. In this context it
44901 has the effect of leaving the original address unchanged, but Exim goes on to
44902 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
44903 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
44904 explicitly, which would cause the rewritten address to be the same as before,
44905 at the cost of a small bit of processing. Not supplying either of these is an
44906 error, since the rewritten address would then contain no local part.
44907 </para>
44908 <para>
44909 The first example above replaces the domain with a superior, more general
44910 domain. This may not be desirable for certain local parts. If the rule
44911 </para>
44912 <literallayout class="monospaced">
44913 root@*.hitch.fict.example  *
44914 </literallayout>
44915 <para>
44916 were inserted before the first rule, rewriting would be suppressed for the
44917 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
44918 </para>
44919 <para>
44920 Rewriting can be made conditional on a number of tests, by making use of
44921 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
44922 messages that originate outside the local host:
44923 </para>
44924 <literallayout class="monospaced">
44925 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
44926                          {$1@hitch.fict.example}fail}"
44927 </literallayout>
44928 <para>
44929 The replacement string is quoted in this example because it contains white
44930 space.
44931 </para>
44932 <para>
44933 <indexterm role="concept">
44934 <primary>rewriting</primary>
44935 <secondary>bang paths</secondary>
44936 </indexterm>
44937 <indexterm role="concept">
44938 <primary>bang paths</primary>
44939 <secondary>rewriting</secondary>
44940 </indexterm>
44941 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
44942 an address it treats it as an unqualified local part which it qualifies with
44943 the local qualification domain (if the source of the message is local or if the
44944 remote host is permitted to send unqualified addresses). Rewriting can
44945 sometimes be used to handle simple bang paths with a fixed number of
44946 components. For example, the rule
44947 </para>
44948 <literallayout class="monospaced">
44949 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
44950 </literallayout>
44951 <para>
44952 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
44953 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
44954 a global rewriting rule for envelope addresses. It can provide a backdoor
44955 method for using your system as a relay, because the incoming addresses appear
44956 to be local. If the bang path addresses are received via SMTP, it is safer to
44957 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
44958 can be done on the rewritten addresses.
44959 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
44960 </para>
44961 </section>
44962 </chapter>
44963
44964 <chapter id="CHAPretry">
44965 <title>Retry configuration</title>
44966 <para>
44967 <indexterm role="concept" id="IIDretconf1" class="startofrange">
44968 <primary>retry</primary>
44969 <secondary>configuration, description of</secondary>
44970 </indexterm>
44971 <indexterm role="concept" id="IIDregconf2" class="startofrange">
44972 <primary>configuration file</primary>
44973 <secondary>retry section</secondary>
44974 </indexterm>
44975 The <quote>retry</quote> section of the runtime configuration file contains a list of
44976 retry rules that control how often Exim tries to deliver messages that cannot
44977 be delivered at the first attempt. If there are no retry rules (the section is
44978 empty or not present), there are no retries. In this situation, temporary
44979 errors are treated as permanent. The default configuration contains a single,
44980 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
44981 line option can be used to test which retry rule will be used for a given
44982 address, domain and error.
44983 </para>
44984 <para>
44985 The most common cause of retries is temporary failure to deliver to a remote
44986 host because the host is down, or inaccessible because of a network problem.
44987 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
44988 address) basis, not on a per-message basis. Thus, if one message has recently
44989 been delayed, delivery of a new message to the same host is not immediately
44990 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
44991 log selector is set, the message
44992 <indexterm role="concept">
44993 <primary>retry</primary>
44994 <secondary>time not reached</secondary>
44995 </indexterm>
44996 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
44997 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
44998 the handling of errors during remote deliveries.
44999 </para>
45000 <para>
45001 Retry processing applies to routing as well as to delivering, except as covered
45002 in the next paragraph. The retry rules do not distinguish between these
45003 actions. It is not possible, for example, to specify different behaviour for
45004 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
45005 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
45006 added complication, so did not implement it. However, although they share the
45007 same retry rule, the actual retry times for routing and transporting a given
45008 domain are maintained independently.
45009 </para>
45010 <para>
45011 When a delivery is not part of a queue run (typically an immediate delivery on
45012 receipt of a message), the routers are always run, and local deliveries are
45013 always attempted, even if retry times are set for them. This makes for better
45014 behaviour if one particular message is causing problems (for example, causing
45015 quota overflow, or provoking an error in a filter file). If such a delivery
45016 suffers a temporary failure, the retry data is updated as normal, and
45017 subsequent delivery attempts from queue runs occur only when the retry time for
45018 the local address is reached.
45019 </para>
45020 <section id="SECID157">
45021 <title>Changing retry rules</title>
45022 <para>
45023 If you change the retry rules in your configuration, you should consider
45024 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
45025 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
45026 always safe; that is why they are called <quote>hints</quote>.
45027 </para>
45028 <para>
45029 The hints retry data contains suggested retry times based on the previous
45030 rules. In the case of a long-running problem with a remote host, it might
45031 record the fact that the host has timed out. If your new rules increase the
45032 timeout time for such a host, you should definitely remove the old retry data
45033 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
45034 messages that it should now be retaining.
45035 </para>
45036 </section>
45037 <section id="SECID158">
45038 <title>Format of retry rules</title>
45039 <para>
45040 <indexterm role="concept">
45041 <primary>retry</primary>
45042 <secondary>rules</secondary>
45043 </indexterm>
45044 Each retry rule occupies one line and consists of three or four parts,
45045 separated by white space: a pattern, an error name, an optional list of sender
45046 addresses, and a list of retry parameters. The pattern and sender lists must be
45047 enclosed in double quotes if they contain white space. The rules are searched
45048 in order until one is found where the pattern, error name, and sender list (if
45049 present) match the failing host or address, the error that occurred, and the
45050 message&#x2019;s sender, respectively.
45051 </para>
45052 <para>
45053 The pattern is any single item that may appear in an address list (see section
45054 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
45055 which means that it is expanded before being tested against the address that
45056 has been delayed. A negated address list item is permitted. Address
45057 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
45058 which makes it possible for many retry rules to start with just a domain. For
45059 example,
45060 </para>
45061 <literallayout class="monospaced">
45062 lookingglass.fict.example        *  F,24h,30m;
45063 </literallayout>
45064 <para>
45065 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
45066 whereas
45067 </para>
45068 <literallayout class="monospaced">
45069 alice@lookingglass.fict.example  *  F,24h,30m;
45070 </literallayout>
45071 <para>
45072 applies only to temporary failures involving the local part <option>alice</option>.
45073 In practice, almost all rules start with a domain name pattern without a local
45074 part.
45075 </para>
45076 <para>
45077 <indexterm role="concept">
45078 <primary>regular expressions</primary>
45079 <secondary>in retry rules</secondary>
45080 </indexterm>
45081 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
45082 must match a complete address, not just a domain, because that is how regular
45083 expressions work in address lists.
45084 </para>
45085 <literallayout>
45086 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
45087 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
45088 </literallayout>
45089 </section>
45090 <section id="SECID159">
45091 <title>Choosing which retry rule to use for address errors</title>
45092 <para>
45093 When Exim is looking for a retry rule after a routing attempt has failed (for
45094 example, after a DNS timeout), each line in the retry configuration is tested
45095 against the complete address only if <option>retry_use_local_part</option> is set for the
45096 router. Otherwise, only the domain is used, except when matching against a
45097 regular expression, when the local part of the address is replaced with <quote>*</quote>.
45098 A domain on its own can match a domain pattern, or a pattern that starts with
45099 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
45100 <option>check_local_user</option> is true, and false for other routers.
45101 </para>
45102 <para>
45103 Similarly, when Exim is looking for a retry rule after a local delivery has
45104 failed (for example, after a mailbox full error), each line in the retry
45105 configuration is tested against the complete address only if
45106 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
45107 local transports).
45108 </para>
45109 <para>
45110 <indexterm role="concept">
45111 <primary>4<emphasis>xx</emphasis> responses</primary>
45112 <secondary>retry rules for</secondary>
45113 </indexterm>
45114 However, when Exim is looking for a retry rule after a remote delivery attempt
45115 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
45116 whole address is always used as the key when searching the retry rules. The
45117 rule that is found is used to create a retry time for the combination of the
45118 failing address and the message&#x2019;s sender. It is the combination of sender and
45119 recipient that is delayed in subsequent queue runs until its retry time is
45120 reached. You can delay the recipient without regard to the sender by setting
45121 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
45122 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
45123 commands.
45124 </para>
45125 </section>
45126 <section id="SECID160">
45127 <title>Choosing which retry rule to use for host and message errors</title>
45128 <para>
45129 For a temporary error that is not related to an individual address (for
45130 example, a connection timeout), each line in the retry configuration is checked
45131 twice. First, the name of the remote host is used as a domain name (preceded by
45132 <quote>*@</quote> when matching a regular expression). If this does not match the line,
45133 the domain from the email address is tried in a similar fashion. For example,
45134 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
45135 </para>
45136 <literallayout class="monospaced">
45137 a.b.c.example  MX  5  x.y.z.example
45138                MX  6  p.q.r.example
45139                MX  7  m.n.o.example
45140 </literallayout>
45141 <para>
45142 and the retry rules are
45143 </para>
45144 <literallayout class="monospaced">
45145 p.q.r.example    *      F,24h,30m;
45146 a.b.c.example    *      F,4d,45m;
45147 </literallayout>
45148 <para>
45149 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
45150 first rule matches neither the host nor the domain, so Exim looks at the second
45151 rule. This does not match the host, but it does match the domain, so it is used
45152 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
45153 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
45154 first retry rule is used, because it matches the host.
45155 </para>
45156 <para>
45157 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
45158 first rule to determine retry times, but for all the other hosts for the domain
45159 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
45160 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
45161 </para>
45162 <para>
45163 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
45164 However, if a message is routed directly to an IP address without the use of a
45165 host name, for example, if a <command>manualroute</command> router contains a setting such as:
45166 </para>
45167 <literallayout class="monospaced">
45168 route_list = *.a.example  192.168.34.23
45169 </literallayout>
45170 <para>
45171 then the <quote>host name</quote> that is used when searching for a retry rule is the
45172 textual form of the IP address.
45173 </para>
45174 </section>
45175 <section id="SECID161">
45176 <title>Retry rules for specific errors</title>
45177 <para>
45178 <indexterm role="concept">
45179 <primary>retry</primary>
45180 <secondary>specific errors; specifying</secondary>
45181 </indexterm>
45182 The second field in a retry rule is the name of a particular error, or an
45183 asterisk, which matches any error. The errors that can be tested for are:
45184 </para>
45185 <variablelist>
45186 <varlistentry>
45187 <term><option>auth_failed</option></term>
45188 <listitem>
45189 <para>
45190 Authentication failed when trying to send to a host in the
45191 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
45192 </para>
45193 </listitem></varlistentry>
45194 <varlistentry>
45195 <term><option>data_4xx</option></term>
45196 <listitem>
45197 <para>
45198 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
45199 after the command, or after sending the message&#x2019;s data.
45200 </para>
45201 </listitem></varlistentry>
45202 <varlistentry>
45203 <term><option>mail_4xx</option></term>
45204 <listitem>
45205 <para>
45206 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
45207 </para>
45208 </listitem></varlistentry>
45209 <varlistentry>
45210 <term><option>rcpt_4xx</option></term>
45211 <listitem>
45212 <para>
45213 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
45214 </para>
45215 </listitem></varlistentry>
45216 </variablelist>
45217 <para>
45218 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
45219 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
45220 recognize 452 errors given to RCPT commands for addresses in a certain domain,
45221 and have retries every ten minutes with a one-hour timeout, you could set up a
45222 retry rule of this form:
45223 </para>
45224 <literallayout class="monospaced">
45225 the.domain.name  rcpt_452   F,1h,10m
45226 </literallayout>
45227 <para>
45228 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
45229 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
45230 </para>
45231 <variablelist>
45232 <varlistentry>
45233 <term><option>lost_connection</option></term>
45234 <listitem>
45235 <para>
45236 A server unexpectedly closed the SMTP connection. There may, of course,
45237 legitimate reasons for this (host died, network died), but if it repeats a lot
45238 for the same host, it indicates something odd.
45239 </para>
45240 </listitem></varlistentry>
45241 <varlistentry>
45242 <term><option>refused_MX</option></term>
45243 <listitem>
45244 <para>
45245 A connection to a host obtained from an MX record was refused.
45246 </para>
45247 </listitem></varlistentry>
45248 <varlistentry>
45249 <term><option>refused_A</option></term>
45250 <listitem>
45251 <para>
45252 A connection to a host not obtained from an MX record was refused.
45253 </para>
45254 </listitem></varlistentry>
45255 <varlistentry>
45256 <term><option>refused</option></term>
45257 <listitem>
45258 <para>
45259 A connection was refused.
45260 </para>
45261 </listitem></varlistentry>
45262 <varlistentry>
45263 <term><option>timeout_connect_MX</option></term>
45264 <listitem>
45265 <para>
45266 A connection attempt to a host obtained from an MX record timed out.
45267 </para>
45268 </listitem></varlistentry>
45269 <varlistentry>
45270 <term><option>timeout_connect_A</option></term>
45271 <listitem>
45272 <para>
45273 A connection attempt to a host not obtained from an MX record timed out.
45274 </para>
45275 </listitem></varlistentry>
45276 <varlistentry>
45277 <term><option>timeout_connect</option></term>
45278 <listitem>
45279 <para>
45280 A connection attempt timed out.
45281 </para>
45282 </listitem></varlistentry>
45283 <varlistentry>
45284 <term><option>timeout_MX</option></term>
45285 <listitem>
45286 <para>
45287 There was a timeout while connecting or during an SMTP session with a host
45288 obtained from an MX record.
45289 </para>
45290 </listitem></varlistentry>
45291 <varlistentry>
45292 <term><option>timeout_A</option></term>
45293 <listitem>
45294 <para>
45295 There was a timeout while connecting or during an SMTP session with a host not
45296 obtained from an MX record.
45297 </para>
45298 </listitem></varlistentry>
45299 <varlistentry>
45300 <term><option>timeout</option></term>
45301 <listitem>
45302 <para>
45303 There was a timeout while connecting or during an SMTP session.
45304 </para>
45305 </listitem></varlistentry>
45306 <varlistentry>
45307 <term><option>tls_required</option></term>
45308 <listitem>
45309 <para>
45310 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
45311 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
45312 to STARTTLS, or there was a problem setting up the TLS connection.
45313 </para>
45314 </listitem></varlistentry>
45315 <varlistentry>
45316 <term><option>quota</option></term>
45317 <listitem>
45318 <para>
45319 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
45320 transport.
45321 </para>
45322 </listitem></varlistentry>
45323 <varlistentry>
45324 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
45325 <listitem>
45326 <para>
45327 <indexterm role="concept">
45328 <primary>quota</primary>
45329 <secondary>error testing in retry rule</secondary>
45330 </indexterm>
45331 <indexterm role="concept">
45332 <primary>retry</primary>
45333 <secondary>quota error testing</secondary>
45334 </indexterm>
45335 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
45336 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
45337 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
45338 for four days.
45339 </para>
45340 </listitem></varlistentry>
45341 </variablelist>
45342 <para>
45343 <indexterm role="concept">
45344 <primary>mailbox</primary>
45345 <secondary>time of last read</secondary>
45346 </indexterm>
45347 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
45348 timeouts when the mailbox is full and is not being read by its owner. Ideally,
45349 it should be based on the last time that the user accessed the mailbox.
45350 However, it is not always possible to determine this. Exim uses the following
45351 heuristic rules:
45352 </para>
45353 <itemizedlist>
45354 <listitem>
45355 <para>
45356 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
45357 used. As no new messages are being delivered (because the mailbox is over
45358 quota), Exim does not access the file, so this is the time of last user access.
45359 </para>
45360 </listitem>
45361 <listitem>
45362 <para>
45363 <indexterm role="concept">
45364 <primary>maildir format</primary>
45365 <secondary>time of last read</secondary>
45366 </indexterm>
45367 For a maildir delivery, the time of last modification of the <filename>new</filename>
45368 subdirectory is used. As the mailbox is over quota, no new files are created in
45369 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
45370 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
45371 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
45372 time that is used is therefore the last time that the user read a new message.
45373 </para>
45374 </listitem>
45375 <listitem>
45376 <para>
45377 For other kinds of multi-file mailbox, the time of last access cannot be
45378 obtained, so a retry rule that uses this type of error field is never matched.
45379 </para>
45380 </listitem>
45381 </itemizedlist>
45382 <para>
45383 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
45384 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
45385 when a local delivery is deferred because a partition is full (the ENOSPC
45386 error).
45387 </para>
45388 </section>
45389 <section id="SECID162">
45390 <title>Retry rules for specified senders</title>
45391 <para>
45392 <indexterm role="concept">
45393 <primary>retry</primary>
45394 <secondary>rules; sender-specific</secondary>
45395 </indexterm>
45396 You can specify retry rules that apply only when the failing message has a
45397 specific sender. In particular, this can be used to define retry rules that
45398 apply only to bounce messages. The third item in a retry rule can be of this
45399 form:
45400 </para>
45401 <literallayout>
45402 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
45403 </literallayout>
45404 <para>
45405 The retry timings themselves are then the fourth item. For example:
45406 </para>
45407 <literallayout class="monospaced">
45408 *   rcpt_4xx   senders=:   F,1h,30m
45409 </literallayout>
45410 <para>
45411 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
45412 host. If the address list contains white space, it must be enclosed in quotes.
45413 For example:
45414 </para>
45415 <literallayout class="monospaced">
45416 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
45417 </literallayout>
45418 <para>
45419 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
45420 (which do not depend on the recipient). The reason is that the sender is used
45421 only to match the retry rule. Once the rule has been found for a host error,
45422 its contents are used to set a retry time for the host, and this will apply to
45423 all messages, not just those with specific senders.
45424 </para>
45425 <para>
45426 When testing retry rules using <option>-brt</option>, you can supply a sender using the
45427 <option>-f</option> command line option, like this:
45428 </para>
45429 <literallayout class="monospaced">
45430 exim -f "" -brt user@dom.ain
45431 </literallayout>
45432 <para>
45433 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
45434 list is never matched.
45435 </para>
45436 </section>
45437 <section id="SECID163">
45438 <title>Retry parameters</title>
45439 <para>
45440 <indexterm role="concept">
45441 <primary>retry</primary>
45442 <secondary>parameters in rules</secondary>
45443 </indexterm>
45444 The third (or fourth, if a senders list is present) field in a retry rule is a
45445 sequence of retry parameter sets, separated by semicolons. Each set consists of
45446 </para>
45447 <literallayout>
45448 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
45449 </literallayout>
45450 <para>
45451 The letter identifies the algorithm for computing a new retry time; the cutoff
45452 time is the time beyond which this algorithm no longer applies, and the
45453 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
45454 time that the first failure for the domain (combined with the local part if
45455 relevant) was detected, not from the time the message was received.
45456 </para>
45457 <para>
45458 <indexterm role="concept">
45459 <primary>retry</primary>
45460 <secondary>algorithms</secondary>
45461 </indexterm>
45462 <indexterm role="concept">
45463 <primary>retry</primary>
45464 <secondary>fixed intervals</secondary>
45465 </indexterm>
45466 <indexterm role="concept">
45467 <primary>retry</primary>
45468 <secondary>increasing intervals</secondary>
45469 </indexterm>
45470 <indexterm role="concept">
45471 <primary>retry</primary>
45472 <secondary>random intervals</secondary>
45473 </indexterm>
45474 The available algorithms are:
45475 </para>
45476 <itemizedlist>
45477 <listitem>
45478 <para>
45479 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
45480 the interval.
45481 </para>
45482 </listitem>
45483 <listitem>
45484 <para>
45485 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
45486 specifies a starting value for the interval, and the second a multiplier, which
45487 is used to increase the size of the interval at each retry.
45488 </para>
45489 </listitem>
45490 <listitem>
45491 <para>
45492 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
45493 retry, the previous interval is multiplied by the factor in order to get a
45494 maximum for the next interval. The minimum interval is the first argument of
45495 the parameter, and an actual interval is chosen randomly between them. Such a
45496 rule has been found to be helpful in cluster configurations when all the
45497 members of the cluster restart at once, and may therefore synchronize their
45498 queue processing times.
45499 </para>
45500 </listitem>
45501 </itemizedlist>
45502 <para>
45503 When computing the next retry time, the algorithm definitions are scanned in
45504 order until one whose cutoff time has not yet passed is reached. This is then
45505 used to compute a new retry time that is later than the current time. In the
45506 case of fixed interval retries, this simply means adding the interval to the
45507 current time. For geometrically increasing intervals, retry intervals are
45508 computed from the rule&#x2019;s parameters until one that is greater than the previous
45509 interval is found. The main configuration variable
45510 <indexterm role="concept">
45511 <primary>limit</primary>
45512 <secondary>retry interval</secondary>
45513 </indexterm>
45514 <indexterm role="concept">
45515 <primary>retry</primary>
45516 <secondary>interval, maximum</secondary>
45517 </indexterm>
45518 <indexterm role="option">
45519 <primary><option>retry_interval_max</option></primary>
45520 </indexterm>
45521 <option>retry_interval_max</option> limits the maximum interval between retries. It
45522 cannot be set greater than <literal>24h</literal>, which is its default value.
45523 </para>
45524 <para>
45525 A single remote domain may have a number of hosts associated with it, and each
45526 host may have more than one IP address. Retry algorithms are selected on the
45527 basis of the domain name, but are applied to each IP address independently. If,
45528 for example, a host has two IP addresses and one is unusable, Exim will
45529 generate retry times for it and will not try to use it until its next retry
45530 time comes. Thus the good IP address is likely to be tried first most of the
45531 time.
45532 </para>
45533 <para>
45534 <indexterm role="concept">
45535 <primary>hints database</primary>
45536 <secondary>use for retrying</secondary>
45537 </indexterm>
45538 Retry times are hints rather than promises. Exim does not make any attempt to
45539 run deliveries exactly at the computed times. Instead, a queue runner process
45540 starts delivery processes for delayed messages periodically, and these attempt
45541 new deliveries only for those addresses that have passed their next retry time.
45542 If a new message arrives for a deferred address, an immediate delivery attempt
45543 occurs only if the address has passed its retry time. In the absence of new
45544 messages, the minimum time between retries is the interval between queue runner
45545 processes. There is not much point in setting retry times of five minutes if
45546 your queue runners happen only once an hour, unless there are a significant
45547 number of incoming messages (which might be the case on a system that is
45548 sending everything to a smart host, for example).
45549 </para>
45550 <para>
45551 The data in the retry hints database can be inspected by using the
45552 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
45553 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
45554 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
45555 are for the hosts associated with a particular mail domain, and also for local
45556 deliveries that have been deferred.
45557 </para>
45558 </section>
45559 <section id="SECID164">
45560 <title>Retry rule examples</title>
45561 <para>
45562 Here are some example retry rules:
45563 </para>
45564 <literallayout class="monospaced">
45565 alice@wonderland.fict.example quota_5d  F,7d,3h
45566 wonderland.fict.example       quota_5d
45567 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
45568 lookingglass.fict.example     *         F,24h,30m;
45569 *                 refused_A   F,2h,20m;
45570 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
45571 </literallayout>
45572 <para>
45573 The first rule sets up special handling for mail to
45574 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
45575 mailbox has not been read for at least 5 days. Retries continue every three
45576 hours for 7 days. The second rule handles over-quota errors for all other local
45577 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
45578 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
45579 fail are bounced immediately if the mailbox has not been read for at least 5
45580 days.
45581 </para>
45582 <para>
45583 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
45584 happen every 15 minutes for an hour, then with geometrically increasing
45585 intervals until two days have passed since a delivery first failed. After the
45586 first hour there is a delay of one hour, then two hours, then four hours, and
45587 so on (this is a rather extreme example).
45588 </para>
45589 <para>
45590 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
45591 They happen every 30 minutes for 24 hours only. The remaining two rules handle
45592 all other domains, with special action for connection refusal from hosts that
45593 were not obtained from an MX record.
45594 </para>
45595 <para>
45596 The final rule in a retry configuration should always have asterisks in the
45597 first two fields so as to provide a general catch-all for any addresses that do
45598 not have their own special handling. This example tries every 15 minutes for 2
45599 hours, then with intervals starting at one hour and increasing by a factor of
45600 1.5 up to 16 hours, then every 8 hours up to 5 days.
45601 </para>
45602 </section>
45603 <section id="SECID165">
45604 <title>Timeout of retry data</title>
45605 <para>
45606 <indexterm role="concept">
45607 <primary>timeout</primary>
45608 <secondary>of retry data</secondary>
45609 </indexterm>
45610 <indexterm role="option">
45611 <primary><option>retry_data_expire</option></primary>
45612 </indexterm>
45613 <indexterm role="concept">
45614 <primary>hints database</primary>
45615 <secondary>data expiry</secondary>
45616 </indexterm>
45617 <indexterm role="concept">
45618 <primary>retry</primary>
45619 <secondary>timeout of data</secondary>
45620 </indexterm>
45621 Exim timestamps the data that it writes to its retry hints database. When it
45622 consults the data during a delivery it ignores any that is older than the value
45623 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
45624 been tried for 7 days, Exim will try to deliver to it immediately a message
45625 arrives, and if that fails, it will calculate a retry time as if it were
45626 failing for the first time.
45627 </para>
45628 <para>
45629 This improves the behaviour for messages routed to rarely-used hosts such as MX
45630 backups. If such a host was down at one time, and happens to be down again when
45631 Exim tries a month later, using the old retry data would imply that it had been
45632 down all the time, which is not a justified assumption.
45633 </para>
45634 <para>
45635 If a host really is permanently dead, this behaviour causes a burst of retries
45636 every now and again, but only if messages routed to it are rare. If there is a
45637 message at least once every 7 days the retry data never expires.
45638 </para>
45639 </section>
45640 <section id="SECID166">
45641 <title>Long-term failures</title>
45642 <para>
45643 <indexterm role="concept">
45644 <primary>delivery failure, long-term</primary>
45645 </indexterm>
45646 <indexterm role="concept">
45647 <primary>retry</primary>
45648 <secondary>after long-term failure</secondary>
45649 </indexterm>
45650 Special processing happens when an email address has been failing for so long
45651 that the cutoff time for the last algorithm is reached. For example, using the
45652 default retry rule:
45653 </para>
45654 <literallayout class="monospaced">
45655 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
45656 </literallayout>
45657 <para>
45658 the cutoff time is four days. Reaching the retry cutoff is independent of how
45659 long any specific message has been failing; it is the length of continuous
45660 failure for the recipient address that counts.
45661 </para>
45662 <para>
45663 When the cutoff time is reached for a local delivery, or for all the IP
45664 addresses associated with a remote delivery, a subsequent delivery failure
45665 causes Exim to give up on the address, and a bounce message is generated.
45666 In order to cater for new messages that use the failing address, a next retry
45667 time is still computed from the final algorithm, and is used as follows:
45668 </para>
45669 <para>
45670 For local deliveries, one delivery attempt is always made for any subsequent
45671 messages. If this delivery fails, the address fails immediately. The
45672 post-cutoff retry time is not used.
45673 </para>
45674 <para>
45675 If the delivery is remote, there are two possibilities, controlled by the
45676 <indexterm role="option">
45677 <primary><option>delay_after_cutoff</option></primary>
45678 </indexterm>
45679 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
45680 default. Until the post-cutoff retry time for one of the IP addresses is
45681 reached, the failing email address is bounced immediately, without a delivery
45682 attempt taking place. After that time, one new delivery attempt is made to
45683 those IP addresses that are past their retry times, and if that still fails,
45684 the address is bounced and new retry times are computed.
45685 </para>
45686 <para>
45687 In other words, when all the hosts for a given email address have been failing
45688 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
45689 times is reached. Then it tries once, and bounces if that attempt fails. This
45690 behaviour ensures that few resources are wasted in repeatedly trying to deliver
45691 to a broken destination, but if the host does recover, Exim will eventually
45692 notice.
45693 </para>
45694 <para>
45695 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
45696 addresses are past their final cutoff time, Exim tries to deliver to those IP
45697 addresses that have not been tried since the message arrived. If there are
45698 no suitable IP addresses, or if they all fail, the address is bounced. In other
45699 words, it does not delay when a new message arrives, but tries the expired
45700 addresses immediately, unless they have been tried since the message arrived.
45701 If there is a continuous stream of messages for the failing domains, setting
45702 <option>delay_after_cutoff</option> false means that there will be many more attempts to
45703 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
45704 true.
45705 </para>
45706 </section>
45707 <section id="SECID167">
45708 <title>Deliveries that work intermittently</title>
45709 <para>
45710 <indexterm role="concept">
45711 <primary>retry</primary>
45712 <secondary>intermittently working deliveries</secondary>
45713 </indexterm>
45714 Some additional logic is needed to cope with cases where a host is
45715 intermittently available, or when a message has some attribute that prevents
45716 its delivery when others to the same address get through. In this situation,
45717 because some messages are successfully delivered, the <quote>retry clock</quote> for the
45718 host or address keeps getting reset by the successful deliveries, and so
45719 failing messages remain on the queue for ever because the cutoff time is never
45720 reached.
45721 </para>
45722 <para>
45723 Two exceptional actions are applied to prevent this happening. The first
45724 applies to errors that are related to a message rather than a remote host.
45725 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
45726 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
45727 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
45728 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
45729 is used when scanning the retry rules to decide when to try next and when to
45730 time out the address.
45731 </para>
45732 <para>
45733 The exceptional second action applies in all cases. If a message has been on
45734 the queue for longer than the cutoff time of any applicable retry rule for a
45735 given address, a delivery is attempted for that address, even if it is not yet
45736 time, and if this delivery fails, the address is timed out. A new retry time is
45737 not computed in this case, so that other messages for the same address are
45738 considered immediately.
45739 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
45740 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
45741 </para>
45742 </section>
45743 </chapter>
45744
45745 <chapter id="CHAPSMTPAUTH">
45746 <title>SMTP authentication</title>
45747 <para>
45748 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
45749 <primary>SMTP</primary>
45750 <secondary>authentication configuration</secondary>
45751 </indexterm>
45752 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
45753 <primary>authentication</primary>
45754 </indexterm>
45755 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
45756 with SMTP authentication. This facility is an extension to the SMTP protocol,
45757 described in RFC 2554, which allows a client SMTP host to authenticate itself
45758 to a server. This is a common way for a server to recognize clients that are
45759 permitted to use it as a relay. SMTP authentication is not of relevance to the
45760 transfer of mail between servers that have no managerial connection with each
45761 other.
45762 </para>
45763 <para>
45764 <indexterm role="concept">
45765 <primary>AUTH</primary>
45766 <secondary>description of</secondary>
45767 </indexterm>
45768 Very briefly, the way SMTP authentication works is as follows:
45769 </para>
45770 <itemizedlist>
45771 <listitem>
45772 <para>
45773 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
45774 the client&#x2019;s EHLO command.
45775 </para>
45776 </listitem>
45777 <listitem>
45778 <para>
45779 The client issues an AUTH command, naming a specific mechanism. The command
45780 may, optionally, contain some authentication data.
45781 </para>
45782 </listitem>
45783 <listitem>
45784 <para>
45785 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
45786 appropriate responses. In simple authentication mechanisms, the challenges are
45787 just prompts for user names and passwords. The server does not have to issue
45788 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
45789 with the AUTH command.
45790 </para>
45791 </listitem>
45792 <listitem>
45793 <para>
45794 The server either accepts or denies authentication.
45795 </para>
45796 </listitem>
45797 <listitem>
45798 <para>
45799 If authentication succeeds, the client may optionally make use of the AUTH
45800 option on the MAIL command to pass an authenticated sender in subsequent
45801 mail transactions. Authentication lasts for the remainder of the SMTP
45802 connection.
45803 </para>
45804 </listitem>
45805 <listitem>
45806 <para>
45807 If authentication fails, the client may give up, or it may try a different
45808 authentication mechanism, or it may try transferring mail over the
45809 unauthenticated connection.
45810 </para>
45811 </listitem>
45812 </itemizedlist>
45813 <para>
45814 If you are setting up a client, and want to know which authentication
45815 mechanisms the server supports, you can use Telnet to connect to port 25 (the
45816 SMTP port) on the server, and issue an EHLO command. The response to this
45817 includes the list of supported mechanisms. For example:
45818 </para>
45819 <literallayout>
45820 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
45821 <literal>Trying 192.168.34.25...</literal>
45822 <literal>Connected to server.example.</literal>
45823 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
45824 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
45825 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
45826 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
45827 <literal>250-SIZE 52428800</literal>
45828 <literal>250-PIPELINING</literal>
45829 <literal>250-AUTH PLAIN</literal>
45830 <literal>250 HELP</literal>
45831 </literallayout>
45832 <para>
45833 The second-last line of this example output shows that the server supports
45834 authentication using the PLAIN mechanism. In Exim, the different authentication
45835 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
45836 routers and transports, which authenticators are included in the binary is
45837 controlled by build-time definitions. The following are currently available,
45838 included by setting
45839 </para>
45840 <literallayout class="monospaced">
45841 AUTH_CRAM_MD5=yes
45842 AUTH_CYRUS_SASL=yes
45843 <phrase revisionflag="changed">AUTH_DOVECOT=yes
45844 AUTH_GSASL=yes
45845 AUTH_HEIMDAL_GSSAPI=yes
45846 </phrase>AUTH_PLAINTEXT=yes
45847 AUTH_SPA=yes
45848 </literallayout>
45849 <para>
45850 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
45851 authentication mechanism (RFC 2195), and the second provides an interface to
45852 the Cyrus SASL authentication library.
45853 </para>
45854 <para revisionflag="changed">
45855 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
45856 work via a socket interface.
45857 The fourth provides an interface to the GNU SASL authentication library, which
45858 provides mechanisms but typically not data sources.
45859 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
45860 supporting setting a server keytab.
45861 The sixth can be configured to support
45862 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
45863 not formally documented, but used by several MUAs. The seventh authenticator
45864 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
45865 </para>
45866 <para>
45867 The authenticators are configured using the same syntax as other drivers (see
45868 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
45869 authentication section need be present in the configuration file. Each
45870 authenticator can in principle have both server and client functions. When Exim
45871 is receiving SMTP mail, it is acting as a server; when it is sending out
45872 messages over SMTP, it is acting as a client. Authenticator configuration
45873 options are provided for use in both these circumstances.
45874 </para>
45875 <para>
45876 To make it clear which options apply to which situation, the prefixes
45877 <option>server_</option> and <option>client_</option> are used on option names that are specific to
45878 either the server or the client function, respectively. Server and client
45879 functions are disabled if none of their options are set. If an authenticator is
45880 to be used for both server and client functions, a single definition, using
45881 both sets of options, is required. For example:
45882 </para>
45883 <literallayout class="monospaced">
45884 cram:
45885   driver = cram_md5
45886   public_name = CRAM-MD5
45887   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
45888   client_name = ph10
45889   client_secret = secret2
45890 </literallayout>
45891 <para>
45892 The <option>server_</option> option is used when Exim is acting as a server, and the
45893 <option>client_</option> options when it is acting as a client.
45894 </para>
45895 <para>
45896 Descriptions of the individual authenticators are given in subsequent chapters.
45897 The remainder of this chapter covers the generic options for the
45898 authenticators, followed by general discussion of the way authentication works
45899 in Exim.
45900 </para>
45901 <para revisionflag="changed">
45902 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
45903 per-mechanism basis.  Please read carefully to determine which variables hold
45904 account labels such as usercodes and which hold passwords or other
45905 authenticating data.
45906 </para>
45907 <para revisionflag="changed">
45908 Note that some mechanisms support two different identifiers for accounts: the
45909 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
45910 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
45911 Conceptually, authentication data such as passwords are tied to the identifier
45912 used to authenticate; servers may have rules to permit one user to act as a
45913 second user, so that after login the session is treated as though that second
45914 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
45915 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
45916 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
45917 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
45918 choose to honour.
45919 </para>
45920 <para revisionflag="changed">
45921 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
45922 to a client to help it select an account and credentials to use.  In some
45923 mechanisms, the client and server provably agree on the realm, but clients
45924 typically can not treat the realm as secure data to be blindly trusted.
45925 </para>
45926 <section id="SECID168">
45927 <title>Generic options for authenticators</title>
45928 <para>
45929 <indexterm role="concept">
45930 <primary>authentication</primary>
45931 <secondary>generic options</secondary>
45932 </indexterm>
45933 <indexterm role="concept">
45934 <primary>options</primary>
45935 <secondary>generic; for authenticators</secondary>
45936 </indexterm>
45937 </para>
45938 <para>
45939 <indexterm role="option">
45940 <primary><option>client_condition</option></primary>
45941 </indexterm>
45942 </para>
45943 <informaltable frame="all">
45944 <tgroup cols="4" colsep="0" rowsep="0">
45945 <colspec colwidth="8*" align="left"/>
45946 <colspec colwidth="6*" align="center"/>
45947 <colspec colwidth="6*" align="center"/>
45948 <colspec colwidth="6*" align="right"/>
45949 <tbody>
45950 <row>
45951 <entry><option>client_condition</option></entry>
45952 <entry>Use: <emphasis>authenticators</emphasis></entry>
45953 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45954 <entry>Default: <emphasis>unset</emphasis></entry>
45955 </row>
45956 </tbody>
45957 </tgroup>
45958 </informaltable>
45959 <para>
45960 When Exim is authenticating as a client, it skips any authenticator whose
45961 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
45962 used, for example, to skip plain text authenticators when the connection is not
45963 encrypted by a setting such as:
45964 </para>
45965 <literallayout class="monospaced">
45966 client_condition = ${if !eq{$tls_cipher}{}}
45967 </literallayout>
45968 <para>
45969 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
45970 used for incoming messages. In fact, during SMTP delivery, it contains the
45971 cipher used for the delivery.)
45972 </para>
45973 <para>
45974 <indexterm role="option">
45975 <primary><option>driver</option></primary>
45976 </indexterm>
45977 </para>
45978 <informaltable frame="all">
45979 <tgroup cols="4" colsep="0" rowsep="0">
45980 <colspec colwidth="8*" align="left"/>
45981 <colspec colwidth="6*" align="center"/>
45982 <colspec colwidth="6*" align="center"/>
45983 <colspec colwidth="6*" align="right"/>
45984 <tbody>
45985 <row>
45986 <entry><option>driver</option></entry>
45987 <entry>Use: <emphasis>authenticators</emphasis></entry>
45988 <entry>Type: <emphasis>string</emphasis></entry>
45989 <entry>Default: <emphasis>unset</emphasis></entry>
45990 </row>
45991 </tbody>
45992 </tgroup>
45993 </informaltable>
45994 <para>
45995 This option must always be set. It specifies which of the available
45996 authenticators is to be used.
45997 </para>
45998 <para>
45999 <indexterm role="option">
46000 <primary><option>public_name</option></primary>
46001 </indexterm>
46002 </para>
46003 <informaltable frame="all">
46004 <tgroup cols="4" colsep="0" rowsep="0">
46005 <colspec colwidth="8*" align="left"/>
46006 <colspec colwidth="6*" align="center"/>
46007 <colspec colwidth="6*" align="center"/>
46008 <colspec colwidth="6*" align="right"/>
46009 <tbody>
46010 <row>
46011 <entry><option>public_name</option></entry>
46012 <entry>Use: <emphasis>authenticators</emphasis></entry>
46013 <entry>Type: <emphasis>string</emphasis></entry>
46014 <entry>Default: <emphasis>unset</emphasis></entry>
46015 </row>
46016 </tbody>
46017 </tgroup>
46018 </informaltable>
46019 <para>
46020 This option specifies the name of the authentication mechanism that the driver
46021 implements, and by which it is known to the outside world. These names should
46022 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
46023 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
46024 defaults to the driver&#x2019;s instance name.
46025 </para>
46026 <para>
46027 <indexterm role="option">
46028 <primary><option>server_advertise_condition</option></primary>
46029 </indexterm>
46030 </para>
46031 <informaltable frame="all">
46032 <tgroup cols="4" colsep="0" rowsep="0">
46033 <colspec colwidth="8*" align="left"/>
46034 <colspec colwidth="6*" align="center"/>
46035 <colspec colwidth="6*" align="center"/>
46036 <colspec colwidth="6*" align="right"/>
46037 <tbody>
46038 <row>
46039 <entry><option>server_advertise_condition</option></entry>
46040 <entry>Use: <emphasis>authenticators</emphasis></entry>
46041 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46042 <entry>Default: <emphasis>unset</emphasis></entry>
46043 </row>
46044 </tbody>
46045 </tgroup>
46046 </informaltable>
46047 <para>
46048 When a server is about to advertise an authentication mechanism, the condition
46049 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
46050 mechanism is not advertised.
46051 If the expansion fails, the mechanism is not advertised. If the failure was not
46052 forced, and was not caused by a lookup defer, the incident is logged.
46053 See section <xref linkend="SECTauthexiser"/> below for further discussion.
46054 </para>
46055 <para>
46056 <indexterm role="option">
46057 <primary><option>server_condition</option></primary>
46058 </indexterm>
46059 </para>
46060 <informaltable frame="all">
46061 <tgroup cols="4" colsep="0" rowsep="0">
46062 <colspec colwidth="8*" align="left"/>
46063 <colspec colwidth="6*" align="center"/>
46064 <colspec colwidth="6*" align="center"/>
46065 <colspec colwidth="6*" align="right"/>
46066 <tbody>
46067 <row>
46068 <entry><option>server_condition</option></entry>
46069 <entry>Use: <emphasis>authenticators</emphasis></entry>
46070 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46071 <entry>Default: <emphasis>unset</emphasis></entry>
46072 </row>
46073 </tbody>
46074 </tgroup>
46075 </informaltable>
46076 <para>
46077 This option must be set for a <option>plaintext</option> server authenticator, where it
46078 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
46079 for details.
46080 </para>
46081 <para revisionflag="changed">
46082 For the <command>gsasl</command> authenticator, this option is required for various
46083 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
46084 </para>
46085 <para>
46086 For the other authenticators, <option>server_condition</option> can be used as an additional
46087 authentication or authorization mechanism that is applied after the other
46088 authenticator conditions succeed. If it is set, it is expanded when the
46089 authenticator would otherwise return a success code. If the expansion is forced
46090 to fail, authentication fails. Any other expansion failure causes a temporary
46091 error code to be returned. If the result of a successful expansion is an empty
46092 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
46093 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
46094 other result, a temporary error code is returned, with the expanded string as
46095 the error text.
46096 </para>
46097 <para>
46098 <indexterm role="option">
46099 <primary><option>server_debug_print</option></primary>
46100 </indexterm>
46101 </para>
46102 <informaltable frame="all">
46103 <tgroup cols="4" colsep="0" rowsep="0">
46104 <colspec colwidth="8*" align="left"/>
46105 <colspec colwidth="6*" align="center"/>
46106 <colspec colwidth="6*" align="center"/>
46107 <colspec colwidth="6*" align="right"/>
46108 <tbody>
46109 <row>
46110 <entry><option>server_debug_print</option></entry>
46111 <entry>Use: <emphasis>authenticators</emphasis></entry>
46112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46113 <entry>Default: <emphasis>unset</emphasis></entry>
46114 </row>
46115 </tbody>
46116 </tgroup>
46117 </informaltable>
46118 <para>
46119 If this option is set and authentication debugging is enabled (see the <option>-d</option>
46120 command line option), the string is expanded and included in the debugging
46121 output when the authenticator is run as a server. This can help with checking
46122 out the values of variables.
46123 If expansion of the string fails, the error message is written to the debugging
46124 output, and Exim carries on processing.
46125 </para>
46126 <para>
46127 <indexterm role="option">
46128 <primary><option>server_set_id</option></primary>
46129 </indexterm>
46130 </para>
46131 <informaltable frame="all">
46132 <tgroup cols="4" colsep="0" rowsep="0">
46133 <colspec colwidth="8*" align="left"/>
46134 <colspec colwidth="6*" align="center"/>
46135 <colspec colwidth="6*" align="center"/>
46136 <colspec colwidth="6*" align="right"/>
46137 <tbody>
46138 <row>
46139 <entry><option>server_set_id</option></entry>
46140 <entry>Use: <emphasis>authenticators</emphasis></entry>
46141 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46142 <entry>Default: <emphasis>unset</emphasis></entry>
46143 </row>
46144 </tbody>
46145 </tgroup>
46146 </informaltable>
46147 <para>
46148 <indexterm role="variable">
46149 <primary><varname>$authenticated_id</varname></primary>
46150 </indexterm>
46151 When an Exim server successfully authenticates a client, this string is
46152 expanded using data from the authentication, and preserved for any incoming
46153 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
46154 lines for incoming messages. For example, a user/password authenticator
46155 configuration might preserve the user name that was used to authenticate, and
46156 refer to it subsequently during delivery of the message.
46157 If expansion fails, the option is ignored.
46158 </para>
46159 <para>
46160 <indexterm role="option">
46161 <primary><option>server_mail_auth_condition</option></primary>
46162 </indexterm>
46163 </para>
46164 <informaltable frame="all">
46165 <tgroup cols="4" colsep="0" rowsep="0">
46166 <colspec colwidth="8*" align="left"/>
46167 <colspec colwidth="6*" align="center"/>
46168 <colspec colwidth="6*" align="center"/>
46169 <colspec colwidth="6*" align="right"/>
46170 <tbody>
46171 <row>
46172 <entry><option>server_mail_auth_condition</option></entry>
46173 <entry>Use: <emphasis>authenticators</emphasis></entry>
46174 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46175 <entry>Default: <emphasis>unset</emphasis></entry>
46176 </row>
46177 </tbody>
46178 </tgroup>
46179 </informaltable>
46180 <para>
46181 This option allows a server to discard authenticated sender addresses supplied
46182 as part of MAIL commands in SMTP connections that are authenticated by the
46183 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
46184 as part of the authentication process; instead its (unexpanded) value is
46185 remembered for later use.
46186 How it is used is described in the following section.
46187 </para>
46188 </section>
46189 <section id="SECTauthparamail">
46190 <title>The AUTH parameter on MAIL commands</title>
46191 <para>
46192 <indexterm role="concept">
46193 <primary>authentication</primary>
46194 <secondary>sender; authenticated</secondary>
46195 </indexterm>
46196 <indexterm role="concept">
46197 <primary>AUTH</primary>
46198 <secondary>on MAIL command</secondary>
46199 </indexterm>
46200 When a client supplied an AUTH= item on a MAIL command, Exim applies
46201 the following checks before accepting it as the authenticated sender of the
46202 message:
46203 </para>
46204 <itemizedlist>
46205 <listitem>
46206 <para>
46207 If the connection is not using extended SMTP (that is, HELO was used rather
46208 than EHLO), the use of AUTH= is a syntax error.
46209 </para>
46210 </listitem>
46211 <listitem>
46212 <para>
46213 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
46214 </para>
46215 </listitem>
46216 <listitem>
46217 <para>
46218 <indexterm role="variable">
46219 <primary><varname>$authenticated_sender</varname></primary>
46220 </indexterm>
46221 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
46222 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
46223 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
46224 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
46225 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
46226 given for the MAIL command.
46227 </para>
46228 </listitem>
46229 <listitem>
46230 <para>
46231 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
46232 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
46233 authenticated.
46234 </para>
46235 </listitem>
46236 <listitem>
46237 <para>
46238 If the AUTH= value was accepted by either of the two previous rules, and
46239 the client has authenticated, and the authenticator has a setting for the
46240 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
46241 valued that was saved from the authenticator is expanded. If the expansion
46242 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
46243 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
46244 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
46245 message.
46246 </para>
46247 </listitem>
46248 </itemizedlist>
46249 <para>
46250 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
46251 hosts to which Exim authenticates as a client. Do not confuse this value with
46252 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
46253 process, and which is not usually a complete email address.
46254 </para>
46255 <para>
46256 <indexterm role="variable">
46257 <primary><varname>$sender_address</varname></primary>
46258 </indexterm>
46259 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
46260 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
46261 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
46262 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
46263 ACL is run.
46264 </para>
46265 </section>
46266 <section id="SECTauthexiser">
46267 <title>Authentication on an Exim server</title>
46268 <para>
46269 <indexterm role="concept">
46270 <primary>authentication</primary>
46271 <secondary>on an Exim server</secondary>
46272 </indexterm>
46273 When Exim receives an EHLO command, it advertises the public names of those
46274 authenticators that are configured as servers, subject to the following
46275 conditions:
46276 </para>
46277 <itemizedlist>
46278 <listitem>
46279 <para>
46280 The client host must match <option>auth_advertise_hosts</option> (default *).
46281 </para>
46282 </listitem>
46283 <listitem>
46284 <para>
46285 It the <option>server_advertise_condition</option> option is set, its expansion must not
46286 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
46287 </para>
46288 </listitem>
46289 </itemizedlist>
46290 <para>
46291 The order in which the authenticators are defined controls the order in which
46292 the mechanisms are advertised.
46293 </para>
46294 <para>
46295 Some mail clients (for example, some versions of Netscape) require the user to
46296 provide a name and password for authentication whenever AUTH is advertised,
46297 even though authentication may not in fact be needed (for example, Exim may be
46298 set up to allow unconditional relaying from the client by an IP address check).
46299 You can make such clients more friendly by not advertising AUTH to them.
46300 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
46301 that runs for RCPT) to relay without authentication, you should set
46302 </para>
46303 <literallayout class="monospaced">
46304 auth_advertise_hosts = ! 10.9.8.0/24
46305 </literallayout>
46306 <para>
46307 so that no authentication mechanisms are advertised to them.
46308 </para>
46309 <para>
46310 The <option>server_advertise_condition</option> controls the advertisement of individual
46311 authentication mechanisms. For example, it can be used to restrict the
46312 advertisement of a particular mechanism to encrypted connections, by a setting
46313 such as:
46314 </para>
46315 <literallayout class="monospaced">
46316 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
46317 </literallayout>
46318 <para>
46319 <indexterm role="variable">
46320 <primary><varname>$tls_cipher</varname></primary>
46321 </indexterm>
46322 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
46323 yields <quote>yes</quote>, which allows the advertisement to happen.
46324 </para>
46325 <para>
46326 When an Exim server receives an AUTH command from a client, it rejects it
46327 immediately if AUTH was not advertised in response to an earlier EHLO
46328 command. This is the case if
46329 </para>
46330 <itemizedlist>
46331 <listitem>
46332 <para>
46333 The client host does not match <option>auth_advertise_hosts</option>; or
46334 </para>
46335 </listitem>
46336 <listitem>
46337 <para>
46338 No authenticators are configured with server options; or
46339 </para>
46340 </listitem>
46341 <listitem>
46342 <para>
46343 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
46344 server authenticators.
46345 </para>
46346 </listitem>
46347 </itemizedlist>
46348 <para>
46349 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
46350 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
46351 AUTH is accepted from any client host.
46352 </para>
46353 <para>
46354 If AUTH is not rejected by the ACL, Exim searches its configuration for a
46355 server authentication mechanism that was advertised in response to EHLO and
46356 that matches the one named in the AUTH command. If it finds one, it runs
46357 the appropriate authentication protocol, and authentication either succeeds or
46358 fails. If there is no matching advertised mechanism, the AUTH command is
46359 rejected with a 504 error.
46360 </para>
46361 <para>
46362 <indexterm role="variable">
46363 <primary><varname>$received_protocol</varname></primary>
46364 </indexterm>
46365 <indexterm role="variable">
46366 <primary><varname>$sender_host_authenticated</varname></primary>
46367 </indexterm>
46368 When a message is received from an authenticated host, the value of
46369 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
46370 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
46371 public name) of the authenticator driver that successfully authenticated the
46372 client from which the message was received. This variable is empty if there was
46373 no successful authentication.
46374 </para>
46375 </section>
46376 <section id="SECID169">
46377 <title>Testing server authentication</title>
46378 <para>
46379 <indexterm role="concept">
46380 <primary>authentication</primary>
46381 <secondary>testing a server</secondary>
46382 </indexterm>
46383 <indexterm role="concept">
46384 <primary>AUTH</primary>
46385 <secondary>testing a server</secondary>
46386 </indexterm>
46387 <indexterm role="concept">
46388 <primary>base64 encoding</primary>
46389 <secondary>creating authentication test data</secondary>
46390 </indexterm>
46391 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
46392 configurations. The data for the AUTH command has to be sent using base64
46393 encoding. A quick way to produce such data for testing is the following Perl
46394 script:
46395 </para>
46396 <literallayout class="monospaced">
46397 use MIME::Base64;
46398 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
46399 </literallayout>
46400 <para>
46401 <indexterm role="concept">
46402 <primary>binary zero</primary>
46403 <secondary>in authentication data</secondary>
46404 </indexterm>
46405 This interprets its argument as a Perl string, and then encodes it. The
46406 interpretation as a Perl string allows binary zeros, which are required for
46407 some kinds of authentication, to be included in the data. For example, a
46408 command line to run this script on such data might be
46409 </para>
46410 <literallayout class="monospaced">
46411 encode '\0user\0password'
46412 </literallayout>
46413 <para>
46414 Note the use of single quotes to prevent the shell interpreting the
46415 backslashes, so that they can be interpreted by Perl to specify characters
46416 whose code value is zero.
46417 </para>
46418 <para>
46419 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
46420 digit, you must use three zeros instead of one after the leading backslash. If
46421 you do not, the octal digit that starts your string will be incorrectly
46422 interpreted as part of the code for the first character.
46423 </para>
46424 <para>
46425 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
46426 specially, you must use a Perl escape to prevent them being misinterpreted. For
46427 example, a command such as
46428 </para>
46429 <literallayout class="monospaced">
46430 encode '\0user@domain.com\0pas$$word'
46431 </literallayout>
46432 <para>
46433 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
46434 </para>
46435 <para>
46436 If you have the <option>mimencode</option> command installed, another way to do produce
46437 base64-encoded strings is to run the command
46438 </para>
46439 <literallayout class="monospaced">
46440 echo -e -n `\0user\0password' | mimencode
46441 </literallayout>
46442 <para>
46443 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
46444 in the argument, and the <option>-n</option> option specifies no newline at the end of its
46445 output. However, not all versions of <option>echo</option> recognize these options, so you
46446 should check your version before relying on this suggestion.
46447 </para>
46448 </section>
46449 <section id="SECID170">
46450 <title>Authentication by an Exim client</title>
46451 <para>
46452 <indexterm role="concept">
46453 <primary>authentication</primary>
46454 <secondary>on an Exim client</secondary>
46455 </indexterm>
46456 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
46457 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
46458 announces support for authentication, and the host matches an entry in either
46459 of these options, Exim (as a client) tries to authenticate as follows:
46460 </para>
46461 <itemizedlist>
46462 <listitem>
46463 <para>
46464 For each authenticator that is configured as a client, in the order in which
46465 they are defined in the configuration, it searches the authentication
46466 mechanisms announced by the server for one whose name matches the public name
46467 of the authenticator.
46468 </para>
46469 </listitem>
46470 <listitem>
46471 <para>
46472 <indexterm role="variable">
46473 <primary><varname>$host</varname></primary>
46474 </indexterm>
46475 <indexterm role="variable">
46476 <primary><varname>$host_address</varname></primary>
46477 </indexterm>
46478 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
46479 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
46480 that the client might do. They are set to the server&#x2019;s name and IP address. If
46481 any expansion is forced to fail, the authentication attempt is abandoned, and
46482 Exim moves on to the next authenticator. Otherwise an expansion failure causes
46483 delivery to be deferred.
46484 </para>
46485 </listitem>
46486 <listitem>
46487 <para>
46488 If the result of the authentication attempt is a temporary error or a timeout,
46489 Exim abandons trying to send the message to the host for the moment. It will
46490 try again later. If there are any backup hosts available, they are tried in the
46491 usual way.
46492 </para>
46493 </listitem>
46494 <listitem>
46495 <para>
46496 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
46497 carries on searching the list of authenticators and tries another one if
46498 possible. If all authentication attempts give permanent errors, or if there are
46499 no attempts because no mechanisms match (or option expansions force failure),
46500 what happens depends on whether the host matches <option>hosts_require_auth</option> or
46501 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
46502 delivery is deferred. The error can be detected in the retry rules, and thereby
46503 turned into a permanent error if you wish. In the second case, Exim tries to
46504 deliver the message unauthenticated.
46505 </para>
46506 </listitem>
46507 </itemizedlist>
46508 <para>
46509 <indexterm role="concept">
46510 <primary>AUTH</primary>
46511 <secondary>on MAIL command</secondary>
46512 </indexterm>
46513 When Exim has authenticated itself to a remote server, it adds the AUTH
46514 parameter to the MAIL commands it sends, if it has an authenticated sender for
46515 the message. If the message came from a remote host, the authenticated sender
46516 is the one that was receiving on an incoming MAIL command, provided that the
46517 incoming connection was authenticated and the <option>server_mail_auth</option> condition
46518 allowed the authenticated sender to be retained. If a local process calls Exim
46519 to send a message, the sender address that is built from the login name and
46520 <option>qualify_domain</option> is treated as authenticated. However, if the
46521 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
46522 the authenticated sender that was received with the message.
46523 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
46524 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
46525 </para>
46526 </section>
46527 </chapter>
46528
46529 <chapter id="CHAPplaintext">
46530 <title>The plaintext authenticator</title>
46531 <para>
46532 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
46533 <primary><command>plaintext</command> authenticator</primary>
46534 </indexterm>
46535 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
46536 <primary>authenticators</primary>
46537 <secondary><command>plaintext</command></secondary>
46538 </indexterm>
46539 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
46540 LOGIN authentication mechanisms, both of which transfer authentication data as
46541 plain (unencrypted) text (though base64 encoded). The use of plain text is a
46542 security risk; you are strongly advised to insist on the use of SMTP encryption
46543 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
46544 use unencrypted plain text, you should not use the same passwords for SMTP
46545 connections as you do for login accounts.
46546 </para>
46547 <section id="SECID171">
46548 <title>Plaintext options</title>
46549 <para>
46550 <indexterm role="concept">
46551 <primary>options</primary>
46552 <secondary><command>plaintext</command> authenticator (server)</secondary>
46553 </indexterm>
46554 When configured as a server, <command>plaintext</command> uses the following options:
46555 </para>
46556 <para>
46557 <indexterm role="option">
46558 <primary><option>server_condition</option></primary>
46559 </indexterm>
46560 </para>
46561 <informaltable frame="all">
46562 <tgroup cols="4" colsep="0" rowsep="0">
46563 <colspec colwidth="8*" align="left"/>
46564 <colspec colwidth="6*" align="center"/>
46565 <colspec colwidth="6*" align="center"/>
46566 <colspec colwidth="6*" align="right"/>
46567 <tbody>
46568 <row>
46569 <entry><option>server_condition</option></entry>
46570 <entry>Use: <emphasis>authenticators</emphasis></entry>
46571 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46572 <entry>Default: <emphasis>unset</emphasis></entry>
46573 </row>
46574 </tbody>
46575 </tgroup>
46576 </informaltable>
46577 <para>
46578 This is actually a global authentication option, but it must be set in order to
46579 configure the <command>plaintext</command> driver as a server. Its use is described below.
46580 </para>
46581 <para>
46582 <indexterm role="option">
46583 <primary><option>server_prompts</option></primary>
46584 </indexterm>
46585 </para>
46586 <informaltable frame="all">
46587 <tgroup cols="4" colsep="0" rowsep="0">
46588 <colspec colwidth="8*" align="left"/>
46589 <colspec colwidth="6*" align="center"/>
46590 <colspec colwidth="6*" align="center"/>
46591 <colspec colwidth="6*" align="right"/>
46592 <tbody>
46593 <row>
46594 <entry><option>server_prompts</option></entry>
46595 <entry>Use: <emphasis>plaintext</emphasis></entry>
46596 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46597 <entry>Default: <emphasis>unset</emphasis></entry>
46598 </row>
46599 </tbody>
46600 </tgroup>
46601 </informaltable>
46602 <para>
46603 The contents of this option, after expansion, must be a colon-separated list of
46604 prompt strings. If expansion fails, a temporary authentication rejection is
46605 given.
46606 </para>
46607 </section>
46608 <section id="SECTplainserver">
46609 <title>Using plaintext in a server</title>
46610 <para>
46611 <indexterm role="concept">
46612 <primary>AUTH</primary>
46613 <secondary>in <command>plaintext</command> authenticator</secondary>
46614 </indexterm>
46615 <indexterm role="concept">
46616 <primary>binary zero</primary>
46617 <secondary>in <command>plaintext</command> authenticator</secondary>
46618 </indexterm>
46619 <indexterm role="concept">
46620 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46621 <secondary>in <command>plaintext</command> authenticator</secondary>
46622 </indexterm>
46623 <indexterm role="variable">
46624 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
46625 </indexterm>
46626 <indexterm role="concept">
46627 <primary>base64 encoding</primary>
46628 <secondary>in <command>plaintext</command> authenticator</secondary>
46629 </indexterm>
46630 </para>
46631 <para>
46632 When running as a server, <command>plaintext</command> performs the authentication test by
46633 expanding a string. The data sent by the client with the AUTH command, or in
46634 response to subsequent prompts, is base64 encoded, and so may contain any byte
46635 values when decoded. If any data is supplied with the command, it is treated as
46636 a list of strings, separated by NULs (binary zeros), the first three of which
46637 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
46638 (neither LOGIN nor PLAIN uses more than three strings).
46639 </para>
46640 <para>
46641 For compatibility with previous releases of Exim, the values are also placed in
46642 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
46643 variables for this purpose is now deprecated, as it can lead to confusion in
46644 string expansions that also use them for other things.
46645 </para>
46646 <para>
46647 If there are more strings in <option>server_prompts</option> than the number of strings
46648 supplied with the AUTH command, the remaining prompts are used to obtain more
46649 data. Each response from the client may be a list of NUL-separated strings.
46650 </para>
46651 <para>
46652 <indexterm role="variable">
46653 <primary><varname>$authenticated_id</varname></primary>
46654 </indexterm>
46655 Once a sufficient number of data strings have been received,
46656 <option>server_condition</option> is expanded. If the expansion is forced to fail,
46657 authentication fails. Any other expansion failure causes a temporary error code
46658 to be returned. If the result of a successful expansion is an empty string,
46659 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
46660 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
46661 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
46662 For any other result, a temporary error code is returned, with the expanded
46663 string as the error text.
46664 </para>
46665 <para>
46666 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
46667 password, be sure to make the authentication fail if the user is unknown.
46668 There are good and bad examples at the end of the next section.
46669 </para>
46670 </section>
46671 <section id="SECID172">
46672 <title>The PLAIN authentication mechanism</title>
46673 <para>
46674 <indexterm role="concept">
46675 <primary>PLAIN authentication mechanism</primary>
46676 </indexterm>
46677 <indexterm role="concept">
46678 <primary>authentication</primary>
46679 <secondary>PLAIN mechanism</secondary>
46680 </indexterm>
46681 <indexterm role="concept">
46682 <primary>binary zero</primary>
46683 <secondary>in <command>plaintext</command> authenticator</secondary>
46684 </indexterm>
46685 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
46686 sent as one item of data (that is, one combined string containing two NUL
46687 separators). The data is sent either as part of the AUTH command, or
46688 subsequently in response to an empty prompt from the server.
46689 </para>
46690 <para>
46691 The second and third strings are a user name and a corresponding password.
46692 Using a single fixed user name and password as an example, this could be
46693 configured as follows:
46694 </para>
46695 <literallayout class="monospaced">
46696 fixed_plain:
46697   driver = plaintext
46698   public_name = PLAIN
46699   server_prompts = :
46700   server_condition = \
46701     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
46702   server_set_id = $auth2
46703 </literallayout>
46704 <para>
46705 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
46706 are exactly what we want here, so they need not be specified. Obviously, if the
46707 password contains expansion-significant characters such as dollar, backslash,
46708 or closing brace, they have to be escaped.
46709 </para>
46710 <para>
46711 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
46712 the end of a string list are ignored). If all the data comes as part of the
46713 AUTH command, as is commonly the case, the prompt is not used. This
46714 authenticator is advertised in the response to EHLO as
46715 </para>
46716 <literallayout class="monospaced">
46717 250-AUTH PLAIN
46718 </literallayout>
46719 <para>
46720 and a client host can authenticate itself by sending the command
46721 </para>
46722 <literallayout class="monospaced">
46723 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
46724 </literallayout>
46725 <para>
46726 As this contains three strings (more than the number of prompts), no further
46727 data is required from the client. Alternatively, the client may just send
46728 </para>
46729 <literallayout class="monospaced">
46730 AUTH PLAIN
46731 </literallayout>
46732 <para>
46733 to initiate authentication, in which case the server replies with an empty
46734 prompt. The client must respond with the combined data string.
46735 </para>
46736 <para>
46737 The data string is base64 encoded, as required by the RFC. This example,
46738 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;
46739 represents a zero byte. This is split up into three strings, the first of which
46740 is empty. The <option>server_condition</option> option in the authenticator checks that the
46741 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
46742 </para>
46743 <para>
46744 Having just one fixed user name and password, as in this example, is not very
46745 realistic, though for a small organization with only a handful of
46746 authenticating clients it could make sense.
46747 </para>
46748 <para>
46749 A more sophisticated instance of this authenticator could use the user name in
46750 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
46751 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
46752 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
46753 This is an incorrect example:
46754 </para>
46755 <literallayout class="monospaced">
46756 server_condition = \
46757   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
46758 </literallayout>
46759 <para>
46760 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
46761 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
46762 incorrect? It works fine for existing users, but consider what happens if a
46763 non-existent user name is given. The lookup fails, but as no success/failure
46764 strings are given for the lookup, it yields an empty string. Thus, to defeat
46765 the authentication, all a client has to do is to supply a non-existent user
46766 name and an empty password. The correct way of writing this test is:
46767 </para>
46768 <literallayout class="monospaced">
46769 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
46770   {${if eq{$value}{$auth3}}} {false}}
46771 </literallayout>
46772 <para>
46773 In this case, if the lookup succeeds, the result is checked; if the lookup
46774 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
46775 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
46776 always fails if its second argument is empty. However, the second way of
46777 writing the test makes the logic clearer.
46778 </para>
46779 </section>
46780 <section id="SECID173">
46781 <title>The LOGIN authentication mechanism</title>
46782 <para>
46783 <indexterm role="concept">
46784 <primary>LOGIN authentication mechanism</primary>
46785 </indexterm>
46786 <indexterm role="concept">
46787 <primary>authentication</primary>
46788 <secondary>LOGIN mechanism</secondary>
46789 </indexterm>
46790 The LOGIN authentication mechanism is not documented in any RFC, but is in use
46791 in a number of programs. No data is sent with the AUTH command. Instead, a
46792 user name and password are supplied separately, in response to prompts. The
46793 plaintext authenticator can be configured to support this as in this example:
46794 </para>
46795 <literallayout class="monospaced">
46796 fixed_login:
46797   driver = plaintext
46798   public_name = LOGIN
46799   server_prompts = User Name : Password
46800   server_condition = \
46801     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
46802   server_set_id = $auth1
46803 </literallayout>
46804 <para>
46805 Because of the way plaintext operates, this authenticator accepts data supplied
46806 with the AUTH command (in contravention of the specification of LOGIN), but
46807 if the client does not supply it (as is the case for LOGIN clients), the prompt
46808 strings are used to obtain two data items.
46809 </para>
46810 <para>
46811 Some clients are very particular about the precise text of the prompts. For
46812 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
46813 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
46814 strings. It uses the <option>ldapauth</option> expansion condition to check the user
46815 name and password by binding to an LDAP server:
46816 </para>
46817 <literallayout class="monospaced">
46818 login:
46819   driver = plaintext
46820   public_name = LOGIN
46821   server_prompts = Username:: : Password::
46822   server_condition = ${if and{{ \
46823     !eq{}{$auth1} }{ \
46824     ldapauth{\
46825       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
46826       pass=${quote:$auth2} \
46827       ldap://ldap.example.org/} }} }
46828   server_set_id = uid=$auth1,ou=people,o=example.org
46829 </literallayout>
46830 <para>
46831 We have to check that the username is not empty before using it, because LDAP
46832 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
46833 operator to correctly quote the DN for authentication. However, the basic
46834 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
46835 correct one to use for the password, because quoting is needed only to make
46836 the password conform to the Exim syntax. At the LDAP level, the password is an
46837 uninterpreted string.
46838 </para>
46839 </section>
46840 <section id="SECID174">
46841 <title>Support for different kinds of authentication</title>
46842 <para>
46843 A number of string expansion features are provided for the purpose of
46844 interfacing to different ways of user authentication. These include checking
46845 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
46846 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
46847 <xref linkend="SECTexpcond"/>.
46848 </para>
46849 </section>
46850 <section id="SECID175">
46851 <title>Using plaintext in a client</title>
46852 <para>
46853 <indexterm role="concept">
46854 <primary>options</primary>
46855 <secondary><command>plaintext</command> authenticator (client)</secondary>
46856 </indexterm>
46857 The <command>plaintext</command> authenticator has two client options:
46858 </para>
46859 <para>
46860 <indexterm role="option">
46861 <primary><option>client_ignore_invalid_base64</option></primary>
46862 </indexterm>
46863 </para>
46864 <informaltable frame="all">
46865 <tgroup cols="4" colsep="0" rowsep="0">
46866 <colspec colwidth="8*" align="left"/>
46867 <colspec colwidth="6*" align="center"/>
46868 <colspec colwidth="6*" align="center"/>
46869 <colspec colwidth="6*" align="right"/>
46870 <tbody>
46871 <row>
46872 <entry><option>client_ignore_invalid_base64</option></entry>
46873 <entry>Use: <emphasis>plaintext</emphasis></entry>
46874 <entry>Type: <emphasis>boolean</emphasis></entry>
46875 <entry>Default: <emphasis>false</emphasis></entry>
46876 </row>
46877 </tbody>
46878 </tgroup>
46879 </informaltable>
46880 <para>
46881 If the client receives a server prompt that is not a valid base64 string,
46882 authentication is abandoned by default. However, if this option is set true,
46883 the error in the challenge is ignored and the client sends the response as
46884 usual.
46885 </para>
46886 <para>
46887 <indexterm role="option">
46888 <primary><option>client_send</option></primary>
46889 </indexterm>
46890 </para>
46891 <informaltable frame="all">
46892 <tgroup cols="4" colsep="0" rowsep="0">
46893 <colspec colwidth="8*" align="left"/>
46894 <colspec colwidth="6*" align="center"/>
46895 <colspec colwidth="6*" align="center"/>
46896 <colspec colwidth="6*" align="right"/>
46897 <tbody>
46898 <row>
46899 <entry><option>client_send</option></entry>
46900 <entry>Use: <emphasis>plaintext</emphasis></entry>
46901 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46902 <entry>Default: <emphasis>unset</emphasis></entry>
46903 </row>
46904 </tbody>
46905 </tgroup>
46906 </informaltable>
46907 <para>
46908 The string is a colon-separated list of authentication data strings. Each
46909 string is independently expanded before being sent to the server. The first
46910 string is sent with the AUTH command; any more strings are sent in response
46911 to prompts from the server. Before each string is expanded, the value of the
46912 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
46913 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
46914 way. Thus, the prompt that is received in response to sending the first string
46915 (with the AUTH command) can be used in the expansion of the second string, and
46916 so on. If an invalid base64 string is received when
46917 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
46918 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
46919 </para>
46920 <para>
46921 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
46922 splitting takes priority and happens first.
46923 </para>
46924 <para>
46925 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
46926 the data, further processing is applied to each string before it is sent. If
46927 there are any single circumflex characters in the string, they are converted to
46928 NULs. Should an actual circumflex be required as data, it must be doubled in
46929 the string.
46930 </para>
46931 <para>
46932 This is an example of a client configuration that implements the PLAIN
46933 authentication mechanism with a fixed user name and password:
46934 </para>
46935 <literallayout class="monospaced">
46936 fixed_plain:
46937   driver = plaintext
46938   public_name = PLAIN
46939   client_send = ^username^mysecret
46940 </literallayout>
46941 <para>
46942 The lack of colons means that the entire text is sent with the AUTH
46943 command, with the circumflex characters converted to NULs. A similar example
46944 that uses the LOGIN mechanism is:
46945 </para>
46946 <literallayout class="monospaced">
46947 fixed_login:
46948   driver = plaintext
46949   public_name = LOGIN
46950   client_send = : username : mysecret
46951 </literallayout>
46952 <para>
46953 The initial colon means that the first string is empty, so no data is sent with
46954 the AUTH command itself. The remaining strings are sent in response to
46955 prompts.
46956 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
46957 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
46958 </para>
46959 </section>
46960 </chapter>
46961
46962 <chapter id="CHID9">
46963 <title>The cram_md5 authenticator</title>
46964 <para>
46965 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
46966 <primary><command>cram_md5</command> authenticator</primary>
46967 </indexterm>
46968 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
46969 <primary>authenticators</primary>
46970 <secondary><command>cram_md5</command></secondary>
46971 </indexterm>
46972 <indexterm role="concept">
46973 <primary>CRAM-MD5 authentication mechanism</primary>
46974 </indexterm>
46975 <indexterm role="concept">
46976 <primary>authentication</primary>
46977 <secondary>CRAM-MD5 mechanism</secondary>
46978 </indexterm>
46979 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
46980 sends a challenge string to the client, and the response consists of a user
46981 name and the CRAM-MD5 digest of the challenge string combined with a secret
46982 string (password) which is known to both server and client. Thus, the secret
46983 is not sent over the network as plain text, which makes this authenticator more
46984 secure than <command>plaintext</command>. However, the downside is that the secret has to be
46985 available in plain text at either end.
46986 </para>
46987 <section id="SECID176">
46988 <title>Using cram_md5 as a server</title>
46989 <para>
46990 <indexterm role="concept">
46991 <primary>options</primary>
46992 <secondary><command>cram_md5</command> authenticator (server)</secondary>
46993 </indexterm>
46994 This authenticator has one server option, which must be set to configure the
46995 authenticator as a server:
46996 </para>
46997 <para>
46998 <indexterm role="option">
46999 <primary><option>server_secret</option></primary>
47000 </indexterm>
47001 </para>
47002 <informaltable frame="all">
47003 <tgroup cols="4" colsep="0" rowsep="0">
47004 <colspec colwidth="8*" align="left"/>
47005 <colspec colwidth="6*" align="center"/>
47006 <colspec colwidth="6*" align="center"/>
47007 <colspec colwidth="6*" align="right"/>
47008 <tbody>
47009 <row>
47010 <entry><option>server_secret</option></entry>
47011 <entry>Use: <emphasis>cram_md5</emphasis></entry>
47012 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47013 <entry>Default: <emphasis>unset</emphasis></entry>
47014 </row>
47015 </tbody>
47016 </tgroup>
47017 </informaltable>
47018 <para>
47019 <indexterm role="concept">
47020 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47021 <secondary>in <command>cram_md5</command> authenticator</secondary>
47022 </indexterm>
47023 When the server receives the client&#x2019;s response, the user name is placed in
47024 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
47025 obtain the password for that user. The server then computes the CRAM-MD5 digest
47026 that the client should have sent, and checks that it received the correct
47027 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
47028 fails. If the expansion fails for some other reason, a temporary error code is
47029 returned to the client.
47030 </para>
47031 <para>
47032 For compatibility with previous releases of Exim, the user name is also placed
47033 in <varname>$1</varname>. However, the use of this variables for this purpose is now
47034 deprecated, as it can lead to confusion in string expansions that also use
47035 numeric variables for other things.
47036 </para>
47037 <para>
47038 For example, the following authenticator checks that the user name given by the
47039 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
47040 user name, authentication fails.
47041 </para>
47042 <literallayout class="monospaced">
47043 fixed_cram:
47044   driver = cram_md5
47045   public_name = CRAM-MD5
47046   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
47047   server_set_id = $auth1
47048 </literallayout>
47049 <para>
47050 <indexterm role="variable">
47051 <primary><varname>$authenticated_id</varname></primary>
47052 </indexterm>
47053 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
47054 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
47055 secret string in a file, using the user name as the key. For example:
47056 </para>
47057 <literallayout class="monospaced">
47058 lookup_cram:
47059   driver = cram_md5
47060   public_name = CRAM-MD5
47061   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
47062                   {$value}fail}
47063   server_set_id = $auth1
47064 </literallayout>
47065 <para>
47066 Note that this expansion explicitly forces failure if the lookup fails
47067 because <varname>$auth1</varname> contains an unknown user name.
47068 </para>
47069 <para revisionflag="changed">
47070 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
47071 using the relevant libraries, you need to know the realm to specify in the
47072 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
47073 realm, with:
47074 </para>
47075 <literallayout class="monospaced" revisionflag="changed">
47076 cyrusless_crammd5:
47077   driver = cram_md5
47078   public_name = CRAM-MD5
47079   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
47080                   dbmjz{/etc/sasldb2}}
47081   server_set_id = $auth1
47082 </literallayout>
47083 </section>
47084 <section id="SECID177">
47085 <title>Using cram_md5 as a client</title>
47086 <para>
47087 <indexterm role="concept">
47088 <primary>options</primary>
47089 <secondary><command>cram_md5</command> authenticator (client)</secondary>
47090 </indexterm>
47091 When used as a client, the <command>cram_md5</command> authenticator has two options:
47092 </para>
47093 <para>
47094 <indexterm role="option">
47095 <primary><option>client_name</option></primary>
47096 </indexterm>
47097 </para>
47098 <informaltable frame="all">
47099 <tgroup cols="4" colsep="0" rowsep="0">
47100 <colspec colwidth="8*" align="left"/>
47101 <colspec colwidth="6*" align="center"/>
47102 <colspec colwidth="6*" align="center"/>
47103 <colspec colwidth="6*" align="right"/>
47104 <tbody>
47105 <row>
47106 <entry><option>client_name</option></entry>
47107 <entry>Use: <emphasis>cram_md5</emphasis></entry>
47108 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47109 <entry>Default: <emphasis>the primary host name</emphasis></entry>
47110 </row>
47111 </tbody>
47112 </tgroup>
47113 </informaltable>
47114 <para>
47115 This string is expanded, and the result used as the user name data when
47116 computing the response to the server&#x2019;s challenge.
47117 </para>
47118 <para>
47119 <indexterm role="option">
47120 <primary><option>client_secret</option></primary>
47121 </indexterm>
47122 </para>
47123 <informaltable frame="all">
47124 <tgroup cols="4" colsep="0" rowsep="0">
47125 <colspec colwidth="8*" align="left"/>
47126 <colspec colwidth="6*" align="center"/>
47127 <colspec colwidth="6*" align="center"/>
47128 <colspec colwidth="6*" align="right"/>
47129 <tbody>
47130 <row>
47131 <entry><option>client_secret</option></entry>
47132 <entry>Use: <emphasis>cram_md5</emphasis></entry>
47133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47134 <entry>Default: <emphasis>unset</emphasis></entry>
47135 </row>
47136 </tbody>
47137 </tgroup>
47138 </informaltable>
47139 <para>
47140 This option must be set for the authenticator to work as a client. Its value is
47141 expanded and the result used as the secret string when computing the response.
47142 </para>
47143 <para>
47144 <indexterm role="variable">
47145 <primary><varname>$host</varname></primary>
47146 </indexterm>
47147 <indexterm role="variable">
47148 <primary><varname>$host_address</varname></primary>
47149 </indexterm>
47150 Different user names and secrets can be used for different servers by referring
47151 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
47152 expansion string is treated as an indication that this authenticator is not
47153 prepared to handle this case. Exim moves on to the next configured client
47154 authenticator. Any other expansion failure causes Exim to give up trying to
47155 send the message to the current server.
47156 </para>
47157 <para>
47158 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
47159 strings, is:
47160 </para>
47161 <literallayout class="monospaced">
47162 fixed_cram:
47163   driver = cram_md5
47164   public_name = CRAM-MD5
47165   client_name = ph10
47166   client_secret = secret
47167 </literallayout>
47168 <para>
47169 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
47170 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
47171 </para>
47172 </section>
47173 </chapter>
47174
47175 <chapter id="CHID10">
47176 <title>The cyrus_sasl authenticator</title>
47177 <para>
47178 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
47179 <primary><command>cyrus_sasl</command> authenticator</primary>
47180 </indexterm>
47181 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
47182 <primary>authenticators</primary>
47183 <secondary><command>cyrus_sasl</command></secondary>
47184 </indexterm>
47185 <indexterm role="concept">
47186 <primary>Cyrus</primary>
47187 <secondary>SASL library</secondary>
47188 </indexterm>
47189 <indexterm role="concept">
47190 <primary>Kerberos</primary>
47191 </indexterm>
47192 The code for this authenticator was provided by Matthew Byng-Maddick of A L
47193 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
47194 </para>
47195 <para>
47196 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
47197 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
47198 Layer</quote>). This library supports a number of authentication mechanisms,
47199 including PLAIN and LOGIN, but also several others that Exim does not support
47200 directly. In particular, there is support for Kerberos authentication.
47201 </para>
47202 <para>
47203 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
47204 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
47205 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
47206 name of the driver to determine which mechanism to support.
47207 </para>
47208 <para>
47209 Where access to some kind of secret file is required, for example in GSSAPI
47210 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
47211 user, and that the Cyrus SASL library has no way of escalating privileges
47212 by default. You may also find you need to set environment variables,
47213 depending on the driver you are using.
47214 </para>
47215 <para>
47216 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
47217 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
47218 Kerberos, note that because of limitations in the GSSAPI interface,
47219 changing the server keytab might need to be communicated down to the Kerberos
47220 layer independently. The mechanism for doing so is dependent upon the Kerberos
47221 implementation.
47222 </para>
47223 <para revisionflag="changed">
47224 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
47225 may be set to point to an alternative keytab file. Exim will pass this
47226 variable through from its own inherited environment when started as root or the
47227 Exim user. The keytab file needs to be readable by the Exim user.
47228 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
47229 environment variable.  In practice, for those releases, the Cyrus authenticator
47230 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
47231 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
47232 </para>
47233 <section id="SECID178">
47234 <title>Using cyrus_sasl as a server</title>
47235 <para>
47236 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
47237 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
47238 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
47239 use of this variable for this purpose is now deprecated, as it can lead to
47240 confusion in string expansions that also use numeric variables for other
47241 things.
47242 </para>
47243 <para>
47244 <indexterm role="option">
47245 <primary><option>server_hostname</option></primary>
47246 </indexterm>
47247 </para>
47248 <informaltable frame="all">
47249 <tgroup cols="4" colsep="0" rowsep="0">
47250 <colspec colwidth="8*" align="left"/>
47251 <colspec colwidth="6*" align="center"/>
47252 <colspec colwidth="6*" align="center"/>
47253 <colspec colwidth="6*" align="right"/>
47254 <tbody>
47255 <row>
47256 <entry><option>server_hostname</option></entry>
47257 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
47258 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47259 <entry>Default: <emphasis>see below</emphasis></entry>
47260 </row>
47261 </tbody>
47262 </tgroup>
47263 </informaltable>
47264 <para>
47265 This option selects the hostname that is used when communicating with the
47266 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
47267 SASL plug-in what it does with this data.
47268 </para>
47269 <para>
47270 <indexterm role="option">
47271 <primary><option>server_mech</option></primary>
47272 </indexterm>
47273 </para>
47274 <informaltable frame="all">
47275 <tgroup cols="4" colsep="0" rowsep="0">
47276 <colspec colwidth="8*" align="left"/>
47277 <colspec colwidth="6*" align="center"/>
47278 <colspec colwidth="6*" align="center"/>
47279 <colspec colwidth="6*" align="right"/>
47280 <tbody>
47281 <row>
47282 <entry><option>server_mech</option></entry>
47283 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
47284 <entry>Type: <emphasis>string</emphasis></entry>
47285 <entry>Default: <emphasis>see below</emphasis></entry>
47286 </row>
47287 </tbody>
47288 </tgroup>
47289 </informaltable>
47290 <para>
47291 This option selects the authentication mechanism this driver should use. The
47292 default is the value of the generic <option>public_name</option> option. This option allows
47293 you to use a different underlying mechanism from the advertised name. For
47294 example:
47295 </para>
47296 <literallayout class="monospaced">
47297 sasl:
47298   driver = cyrus_sasl
47299   public_name = X-ANYTHING
47300   server_mech = CRAM-MD5
47301   server_set_id = $auth1
47302 </literallayout>
47303 <para revisionflag="changed">
47304 <indexterm role="option">
47305 <primary><option>server_realm</option></primary>
47306 </indexterm>
47307 </para>
47308 <informaltable frame="all" revisionflag="changed">
47309 <tgroup cols="4" colsep="0" rowsep="0">
47310 <colspec colwidth="8*" align="left"/>
47311 <colspec colwidth="6*" align="center"/>
47312 <colspec colwidth="6*" align="center"/>
47313 <colspec colwidth="6*" align="right"/>
47314 <tbody>
47315 <row>
47316 <entry><option>server_realm</option></entry>
47317 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
47318 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47319 <entry>Default: <emphasis>unset</emphasis></entry>
47320 </row>
47321 </tbody>
47322 </tgroup>
47323 </informaltable>
47324 <para revisionflag="changed">
47325 This specifies the SASL realm that the server claims to be in.
47326 </para>
47327 <para>
47328 <indexterm role="option">
47329 <primary><option>server_service</option></primary>
47330 </indexterm>
47331 </para>
47332 <informaltable frame="all">
47333 <tgroup cols="4" colsep="0" rowsep="0">
47334 <colspec colwidth="8*" align="left"/>
47335 <colspec colwidth="6*" align="center"/>
47336 <colspec colwidth="6*" align="center"/>
47337 <colspec colwidth="6*" align="right"/>
47338 <tbody>
47339 <row>
47340 <entry><option>server_service</option></entry>
47341 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
47342 <entry>Type: <emphasis>string</emphasis></entry>
47343 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
47344 </row>
47345 </tbody>
47346 </tgroup>
47347 </informaltable>
47348 <para>
47349 This is the SASL service that the server claims to implement.
47350 </para>
47351 <para>
47352 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
47353 private options. All you need to do is to specify an appropriate mechanism as
47354 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
47355 PLAIN, you could have two authenticators as follows:
47356 </para>
47357 <literallayout class="monospaced">
47358 sasl_cram_md5:
47359   driver = cyrus_sasl
47360   public_name = CRAM-MD5
47361   server_set_id = $auth1
47362
47363 sasl_plain:
47364   driver = cyrus_sasl
47365   public_name = PLAIN
47366   server_set_id = $auth2
47367 </literallayout>
47368 <para>
47369 Cyrus SASL does implement the LOGIN authentication method, even though it is
47370 not a standard method. It is disabled by default in the source distribution,
47371 but it is present in many binary distributions.
47372 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
47373 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
47374 </para>
47375 </section>
47376 </chapter>
47377
47378 <chapter id="CHAPdovecot">
47379 <title>The dovecot authenticator</title>
47380 <para>
47381 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
47382 <primary><command>dovecot</command> authenticator</primary>
47383 </indexterm>
47384 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
47385 <primary>authenticators</primary>
47386 <secondary><command>dovecot</command></secondary>
47387 </indexterm>
47388 This authenticator is an interface to the authentication facility of the
47389 Dovecot POP/IMAP server, which can support a number of authentication methods.
47390 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
47391 to use the same mechanisms for SMTP authentication. This is a server
47392 authenticator only. There is only one option:
47393 </para>
47394 <para>
47395 <indexterm role="option">
47396 <primary><option>server_socket</option></primary>
47397 </indexterm>
47398 </para>
47399 <informaltable frame="all">
47400 <tgroup cols="4" colsep="0" rowsep="0">
47401 <colspec colwidth="8*" align="left"/>
47402 <colspec colwidth="6*" align="center"/>
47403 <colspec colwidth="6*" align="center"/>
47404 <colspec colwidth="6*" align="right"/>
47405 <tbody>
47406 <row>
47407 <entry><option>server_socket</option></entry>
47408 <entry>Use: <emphasis>dovecot</emphasis></entry>
47409 <entry>Type: <emphasis>string</emphasis></entry>
47410 <entry>Default: <emphasis>unset</emphasis></entry>
47411 </row>
47412 </tbody>
47413 </tgroup>
47414 </informaltable>
47415 <para>
47416 This option must specify the socket that is the interface to Dovecot
47417 authentication. The <option>public_name</option> option must specify an authentication
47418 mechanism that Dovecot is configured to support. You can have several
47419 authenticators for different mechanisms. For example:
47420 </para>
47421 <literallayout class="monospaced">
47422 dovecot_plain:
47423   driver = dovecot
47424   public_name = PLAIN
47425   server_socket = /var/run/dovecot/auth-client
47426   server_set_id = $auth2
47427
47428 dovecot_ntlm:
47429   driver = dovecot
47430   public_name = NTLM
47431   server_socket = /var/run/dovecot/auth-client
47432   server_set_id = $auth1
47433 </literallayout>
47434 <para>
47435 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
47436 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
47437 option is passed in the Dovecot authentication command. If, for a TLS
47438 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
47439 option is passed. When authentication succeeds, the identity of the user
47440 who authenticated is placed in <varname>$auth1</varname>.
47441 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
47442 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
47443 </para>
47444 </chapter>
47445
47446 <chapter id="CHAPgsasl" revisionflag="changed">
47447 <title>The gsasl authenticator</title>
47448 <para revisionflag="changed">
47449 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
47450 <primary><command>gsasl</command> authenticator</primary>
47451 </indexterm>
47452 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
47453 <primary>authenticators</primary>
47454 <secondary><command>gsasl</command></secondary>
47455 </indexterm>
47456 <indexterm role="concept">
47457 <primary>authentication</primary>
47458 <secondary>GNU SASL</secondary>
47459 </indexterm>
47460 <indexterm role="concept">
47461 <primary>authentication</primary>
47462 <secondary>SASL</secondary>
47463 </indexterm>
47464 <indexterm role="concept">
47465 <primary>authentication</primary>
47466 <secondary>EXTERNAL</secondary>
47467 </indexterm>
47468 <indexterm role="concept">
47469 <primary>authentication</primary>
47470 <secondary>ANONYMOUS</secondary>
47471 </indexterm>
47472 <indexterm role="concept">
47473 <primary>authentication</primary>
47474 <secondary>PLAIN</secondary>
47475 </indexterm>
47476 <indexterm role="concept">
47477 <primary>authentication</primary>
47478 <secondary>LOGIN</secondary>
47479 </indexterm>
47480 <indexterm role="concept">
47481 <primary>authentication</primary>
47482 <secondary>DIGEST-MD5</secondary>
47483 </indexterm>
47484 <indexterm role="concept">
47485 <primary>authentication</primary>
47486 <secondary>CRAM-MD5</secondary>
47487 </indexterm>
47488 <indexterm role="concept">
47489 <primary>authentication</primary>
47490 <secondary>SCRAM-SHA-1</secondary>
47491 </indexterm>
47492 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
47493 library and the mechanisms it provides.  This is new as of the 4.80 release
47494 and there are a few areas where the library does not let Exim smoothly
47495 scale to handle future authentication mechanisms, so no guarantee can be
47496 made that any particular new authentication mechanism will be supported
47497 without code changes in Exim.
47498 </para>
47499 <para revisionflag="changed">
47500 <indexterm role="option">
47501 <primary><option>server_channelbinding</option></primary>
47502 </indexterm>
47503 </para>
47504 <informaltable frame="all" revisionflag="changed">
47505 <tgroup cols="4" colsep="0" rowsep="0">
47506 <colspec colwidth="8*" align="left"/>
47507 <colspec colwidth="6*" align="center"/>
47508 <colspec colwidth="6*" align="center"/>
47509 <colspec colwidth="6*" align="right"/>
47510 <tbody>
47511 <row>
47512 <entry><option>server_channelbinding</option></entry>
47513 <entry>Use: <emphasis>gsasl</emphasis></entry>
47514 <entry>Type: <emphasis>boolean</emphasis></entry>
47515 <entry>Default: <emphasis>false</emphasis></entry>
47516 </row>
47517 </tbody>
47518 </tgroup>
47519 </informaltable>
47520 <para revisionflag="changed">
47521 Some authentication mechanisms are able to use external context at both ends
47522 of the session to bind the authentication to that context, and fail the
47523 authentication process if that context differs.  Specifically, some TLS
47524 ciphersuites can provide identifying information about the cryptographic
47525 context.
47526 </para>
47527 <para revisionflag="changed">
47528 This means that certificate identity and verification becomes a non-issue,
47529 as a man-in-the-middle attack will cause the correct client and server to
47530 see different identifiers and authentication will fail.
47531 </para>
47532 <para revisionflag="changed">
47533 This is currently only supported when using the GnuTLS library.  This is
47534 only usable by mechanisms which support "channel binding"; at time of
47535 writing, that&#x2019;s the SCRAM family.
47536 </para>
47537 <para revisionflag="changed">
47538 This defaults off to ensure smooth upgrade across Exim releases, in case
47539 this option causes some clients to start failing.  Some future release
47540 of Exim may switch the default to be true.
47541 </para>
47542 <para revisionflag="changed">
47543 <indexterm role="option">
47544 <primary><option>server_hostname</option></primary>
47545 </indexterm>
47546 </para>
47547 <informaltable frame="all" revisionflag="changed">
47548 <tgroup cols="4" colsep="0" rowsep="0">
47549 <colspec colwidth="8*" align="left"/>
47550 <colspec colwidth="6*" align="center"/>
47551 <colspec colwidth="6*" align="center"/>
47552 <colspec colwidth="6*" align="right"/>
47553 <tbody>
47554 <row>
47555 <entry><option>server_hostname</option></entry>
47556 <entry>Use: <emphasis>gsasl</emphasis></entry>
47557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47558 <entry>Default: <emphasis>see below</emphasis></entry>
47559 </row>
47560 </tbody>
47561 </tgroup>
47562 </informaltable>
47563 <para revisionflag="changed">
47564 This option selects the hostname that is used when communicating with the
47565 library. The default value is <literal>$primary_hostname</literal>.
47566 Some mechanisms will use this data.
47567 </para>
47568 <para revisionflag="changed">
47569 <indexterm role="option">
47570 <primary><option>server_mech</option></primary>
47571 </indexterm>
47572 </para>
47573 <informaltable frame="all" revisionflag="changed">
47574 <tgroup cols="4" colsep="0" rowsep="0">
47575 <colspec colwidth="8*" align="left"/>
47576 <colspec colwidth="6*" align="center"/>
47577 <colspec colwidth="6*" align="center"/>
47578 <colspec colwidth="6*" align="right"/>
47579 <tbody>
47580 <row>
47581 <entry><option>server_mech</option></entry>
47582 <entry>Use: <emphasis>gsasl</emphasis></entry>
47583 <entry>Type: <emphasis>string</emphasis></entry>
47584 <entry>Default: <emphasis>see below</emphasis></entry>
47585 </row>
47586 </tbody>
47587 </tgroup>
47588 </informaltable>
47589 <para revisionflag="changed">
47590 This option selects the authentication mechanism this driver should use. The
47591 default is the value of the generic <option>public_name</option> option. This option allows
47592 you to use a different underlying mechanism from the advertised name. For
47593 example:
47594 </para>
47595 <literallayout class="monospaced" revisionflag="changed">
47596 sasl:
47597   driver = gsasl
47598   public_name = X-ANYTHING
47599   server_mech = CRAM-MD5
47600   server_set_id = $auth1
47601 </literallayout>
47602 <para revisionflag="changed">
47603 <indexterm role="option">
47604 <primary><option>server_password</option></primary>
47605 </indexterm>
47606 </para>
47607 <informaltable frame="all" revisionflag="changed">
47608 <tgroup cols="4" colsep="0" rowsep="0">
47609 <colspec colwidth="8*" align="left"/>
47610 <colspec colwidth="6*" align="center"/>
47611 <colspec colwidth="6*" align="center"/>
47612 <colspec colwidth="6*" align="right"/>
47613 <tbody>
47614 <row>
47615 <entry><option>server_password</option></entry>
47616 <entry>Use: <emphasis>gsasl</emphasis></entry>
47617 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47618 <entry>Default: <emphasis>unset</emphasis></entry>
47619 </row>
47620 </tbody>
47621 </tgroup>
47622 </informaltable>
47623 <para revisionflag="changed">
47624 Various mechanisms need access to the cleartext password on the server, so
47625 that proof-of-possession can be demonstrated on the wire, without sending
47626 the password itself.
47627 </para>
47628 <para revisionflag="changed">
47629 The data available for lookup varies per mechanism.
47630 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
47631 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
47632 if available, else the empty string.
47633 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
47634 else the empty string.
47635 </para>
47636 <para revisionflag="changed">
47637 A forced failure will cause authentication to defer.
47638 </para>
47639 <para revisionflag="changed">
47640 If using this option, it may make sense to set the <option>server_condition</option>
47641 option to be simply "true".
47642 </para>
47643 <para revisionflag="changed">
47644 <indexterm role="option">
47645 <primary><option>server_realm</option></primary>
47646 </indexterm>
47647 </para>
47648 <informaltable frame="all" revisionflag="changed">
47649 <tgroup cols="4" colsep="0" rowsep="0">
47650 <colspec colwidth="8*" align="left"/>
47651 <colspec colwidth="6*" align="center"/>
47652 <colspec colwidth="6*" align="center"/>
47653 <colspec colwidth="6*" align="right"/>
47654 <tbody>
47655 <row>
47656 <entry><option>server_realm</option></entry>
47657 <entry>Use: <emphasis>gsasl</emphasis></entry>
47658 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47659 <entry>Default: <emphasis>unset</emphasis></entry>
47660 </row>
47661 </tbody>
47662 </tgroup>
47663 </informaltable>
47664 <para revisionflag="changed">
47665 This specifies the SASL realm that the server claims to be in.
47666 Some mechanisms will use this data.
47667 </para>
47668 <para revisionflag="changed">
47669 <indexterm role="option">
47670 <primary><option>server_scram_iter</option></primary>
47671 </indexterm>
47672 </para>
47673 <informaltable frame="all" revisionflag="changed">
47674 <tgroup cols="4" colsep="0" rowsep="0">
47675 <colspec colwidth="8*" align="left"/>
47676 <colspec colwidth="6*" align="center"/>
47677 <colspec colwidth="6*" align="center"/>
47678 <colspec colwidth="6*" align="right"/>
47679 <tbody>
47680 <row>
47681 <entry><option>server_scram_iter</option></entry>
47682 <entry>Use: <emphasis>gsasl</emphasis></entry>
47683 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47684 <entry>Default: <emphasis>unset</emphasis></entry>
47685 </row>
47686 </tbody>
47687 </tgroup>
47688 </informaltable>
47689 <para revisionflag="changed">
47690 This option provides data for the SCRAM family of mechanisms.
47691 <varname>$auth1</varname> is not available at evaluation time.
47692 (This may change, as we receive feedback on use)
47693 </para>
47694 <para revisionflag="changed">
47695 <indexterm role="option">
47696 <primary><option>server_scram_salt</option></primary>
47697 </indexterm>
47698 </para>
47699 <informaltable frame="all" revisionflag="changed">
47700 <tgroup cols="4" colsep="0" rowsep="0">
47701 <colspec colwidth="8*" align="left"/>
47702 <colspec colwidth="6*" align="center"/>
47703 <colspec colwidth="6*" align="center"/>
47704 <colspec colwidth="6*" align="right"/>
47705 <tbody>
47706 <row>
47707 <entry><option>server_scram_salt</option></entry>
47708 <entry>Use: <emphasis>gsasl</emphasis></entry>
47709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47710 <entry>Default: <emphasis>unset</emphasis></entry>
47711 </row>
47712 </tbody>
47713 </tgroup>
47714 </informaltable>
47715 <para revisionflag="changed">
47716 This option provides data for the SCRAM family of mechanisms.
47717 <varname>$auth1</varname> is not available at evaluation time.
47718 (This may change, as we receive feedback on use)
47719 </para>
47720 <para revisionflag="changed">
47721 <indexterm role="option">
47722 <primary><option>server_service</option></primary>
47723 </indexterm>
47724 </para>
47725 <informaltable frame="all" revisionflag="changed">
47726 <tgroup cols="4" colsep="0" rowsep="0">
47727 <colspec colwidth="8*" align="left"/>
47728 <colspec colwidth="6*" align="center"/>
47729 <colspec colwidth="6*" align="center"/>
47730 <colspec colwidth="6*" align="right"/>
47731 <tbody>
47732 <row>
47733 <entry><option>server_service</option></entry>
47734 <entry>Use: <emphasis>gsasl</emphasis></entry>
47735 <entry>Type: <emphasis>string</emphasis></entry>
47736 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
47737 </row>
47738 </tbody>
47739 </tgroup>
47740 </informaltable>
47741 <para revisionflag="changed">
47742 This is the SASL service that the server claims to implement.
47743 Some mechanisms will use this data.
47744 </para>
47745 <section id="SECTgsaslauthvar" revisionflag="changed">
47746 <title><command>gsasl</command> auth variables</title>
47747 <para revisionflag="changed">
47748 <indexterm role="variable">
47749 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
47750 </indexterm>
47751 These may be set when evaluating specific options, as detailed above.
47752 They will also be set when evaluating <option>server_condition</option>.
47753 </para>
47754 <para revisionflag="changed">
47755 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
47756 meanings for these variables:
47757 </para>
47758 <itemizedlist revisionflag="changed">
47759 <listitem>
47760 <para revisionflag="changed">
47761 <indexterm role="variable">
47762 <primary><varname>$auth1</varname></primary>
47763 </indexterm>
47764 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
47765 </para>
47766 </listitem>
47767 <listitem>
47768 <para revisionflag="changed">
47769 <indexterm role="variable">
47770 <primary><varname>$auth2</varname></primary>
47771 </indexterm>
47772 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
47773 </para>
47774 </listitem>
47775 <listitem>
47776 <para revisionflag="changed">
47777 <indexterm role="variable">
47778 <primary><varname>$auth3</varname></primary>
47779 </indexterm>
47780 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
47781 </para>
47782 </listitem>
47783 </itemizedlist>
47784 <para revisionflag="changed">
47785 On a per-mechanism basis:
47786 </para>
47787 <itemizedlist revisionflag="changed">
47788 <listitem>
47789 <para revisionflag="changed">
47790 <indexterm role="concept">
47791 <primary>authentication</primary>
47792 <secondary>EXTERNAL</secondary>
47793 </indexterm>
47794 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
47795 the <option>server_condition</option> option must be present.
47796 </para>
47797 </listitem>
47798 <listitem>
47799 <para revisionflag="changed">
47800 <indexterm role="concept">
47801 <primary>authentication</primary>
47802 <secondary>ANONYMOUS</secondary>
47803 </indexterm>
47804 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
47805 the <option>server_condition</option> option must be present.
47806 </para>
47807 </listitem>
47808 <listitem>
47809 <para revisionflag="changed">
47810 <indexterm role="concept">
47811 <primary>authentication</primary>
47812 <secondary>GSSAPI</secondary>
47813 </indexterm>
47814 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
47815 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
47816 the <option>server_condition</option> option must be present.
47817 </para>
47818 </listitem>
47819 </itemizedlist>
47820 <para revisionflag="changed">
47821 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
47822 identifier; this is analogous to FTP anonymous authentication passing an
47823 email address, or software-identifier@, as the "password".
47824 </para>
47825 <para revisionflag="changed">
47826 An example showing the password having the realm specified in the callback
47827 and demonstrating a Cyrus SASL to GSASL migration approach is:
47828 </para>
47829 <literallayout class="monospaced" revisionflag="changed">
47830 gsasl_cyrusless_crammd5:
47831   driver = gsasl
47832   public_name = CRAM-MD5
47833   server_realm = imap.example.org
47834   server_password = ${lookup{$auth1:$auth3:userPassword}\
47835                     dbmjz{/etc/sasldb2}{$value}fail}
47836   server_set_id = ${quote:$auth1}
47837   server_condition = yes
47838 </literallayout>
47839 </section>
47840 </chapter>
47841
47842 <chapter id="CHAPheimdalgss" revisionflag="changed">
47843 <title>The heimdal_gssapi authenticator</title>
47844 <para revisionflag="changed">
47845 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
47846 <primary><command>heimdal_gssapi</command> authenticator</primary>
47847 </indexterm>
47848 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
47849 <primary>authenticators</primary>
47850 <secondary><command>heimdal_gssapi</command></secondary>
47851 </indexterm>
47852 <indexterm role="concept">
47853 <primary>authentication</primary>
47854 <secondary>GSSAPI</secondary>
47855 </indexterm>
47856 <indexterm role="concept">
47857 <primary>authentication</primary>
47858 <secondary>Kerberos</secondary>
47859 </indexterm>
47860 The <command>heimdal_gssapi</command> authenticator provides server integration for the
47861 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
47862 reliably.
47863 </para>
47864 <para revisionflag="changed">
47865 <indexterm role="option">
47866 <primary><option>server_hostname</option></primary>
47867 </indexterm>
47868 </para>
47869 <informaltable frame="all" revisionflag="changed">
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_hostname</option></entry>
47878 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
47879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47880 <entry>Default: <emphasis>see below</emphasis></entry>
47881 </row>
47882 </tbody>
47883 </tgroup>
47884 </informaltable>
47885 <para revisionflag="changed">
47886 This option selects the hostname that is used, with <option>server_service</option>,
47887 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
47888 identifier.  The default value is <literal>$primary_hostname</literal>.
47889 </para>
47890 <para revisionflag="changed">
47891 <indexterm role="option">
47892 <primary><option>server_keytab</option></primary>
47893 </indexterm>
47894 </para>
47895 <informaltable frame="all" revisionflag="changed">
47896 <tgroup cols="4" colsep="0" rowsep="0">
47897 <colspec colwidth="8*" align="left"/>
47898 <colspec colwidth="6*" align="center"/>
47899 <colspec colwidth="6*" align="center"/>
47900 <colspec colwidth="6*" align="right"/>
47901 <tbody>
47902 <row>
47903 <entry><option>server_keytab</option></entry>
47904 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
47905 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47906 <entry>Default: <emphasis>unset</emphasis></entry>
47907 </row>
47908 </tbody>
47909 </tgroup>
47910 </informaltable>
47911 <para revisionflag="changed">
47912 If set, then Heimdal will not use the system default keytab (typically
47913 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
47914 The value should be a pathname, with no <quote>file:</quote> prefix.
47915 </para>
47916 <para revisionflag="changed">
47917 <indexterm role="option">
47918 <primary><option>server_service</option></primary>
47919 </indexterm>
47920 </para>
47921 <informaltable frame="all" revisionflag="changed">
47922 <tgroup cols="4" colsep="0" rowsep="0">
47923 <colspec colwidth="8*" align="left"/>
47924 <colspec colwidth="6*" align="center"/>
47925 <colspec colwidth="6*" align="center"/>
47926 <colspec colwidth="6*" align="right"/>
47927 <tbody>
47928 <row>
47929 <entry><option>server_service</option></entry>
47930 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
47931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47932 <entry>Default: <emphasis>smtp</emphasis></entry>
47933 </row>
47934 </tbody>
47935 </tgroup>
47936 </informaltable>
47937 <para revisionflag="changed">
47938 This option specifies the service identifier used, in conjunction with
47939 <option>server_hostname</option>, for building the identifer for finding credentials
47940 from the keytab.
47941 </para>
47942 <section id="SECTheimdalgssauthvar" revisionflag="changed">
47943 <title><command>heimdal_gssapi</command> auth variables</title>
47944 <para revisionflag="changed">
47945 Beware that these variables will typically include a realm, thus will appear
47946 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
47947 not verified, so a malicious client can set it to anything.
47948 </para>
47949 <para revisionflag="changed">
47950 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
47951 Distribution Center.  Note that these are not quite email addresses.
47952 Each identifier is for a role, and so the left-hand-side may include a
47953 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
47954 </para>
47955 <para revisionflag="changed">
47956 <indexterm role="variable">
47957 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
47958 </indexterm>
47959 </para>
47960 <itemizedlist revisionflag="changed">
47961 <listitem>
47962 <para revisionflag="changed">
47963 <indexterm role="variable">
47964 <primary><varname>$auth1</varname></primary>
47965 </indexterm>
47966 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
47967 </para>
47968 </listitem>
47969 <listitem>
47970 <para revisionflag="changed">
47971 <indexterm role="variable">
47972 <primary><varname>$auth2</varname></primary>
47973 </indexterm>
47974 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
47975 authentication.  If that was empty, this will also be set to the
47976 GSS Display Name.
47977 </para>
47978 </listitem>
47979 </itemizedlist>
47980 </section>
47981 </chapter>
47982
47983 <chapter id="CHAPspa">
47984 <title>The spa authenticator</title>
47985 <para>
47986 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
47987 <primary><command>spa</command> authenticator</primary>
47988 </indexterm>
47989 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
47990 <primary>authenticators</primary>
47991 <secondary><command>spa</command></secondary>
47992 </indexterm>
47993 <indexterm role="concept">
47994 <primary>authentication</primary>
47995 <secondary>Microsoft Secure Password</secondary>
47996 </indexterm>
47997 <indexterm role="concept">
47998 <primary>authentication</primary>
47999 <secondary>NTLM</secondary>
48000 </indexterm>
48001 <indexterm role="concept">
48002 <primary>Microsoft Secure Password Authentication</primary>
48003 </indexterm>
48004 <indexterm role="concept">
48005 <primary>NTLM authentication</primary>
48006 </indexterm>
48007 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
48008 Password Authentication</emphasis> mechanism,
48009 which is also sometimes known as NTLM (NT LanMan). The code for client side of
48010 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
48011 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
48012 server side was subsequently contributed by Tom Kistner. The mechanism works as
48013 follows:
48014 </para>
48015 <itemizedlist>
48016 <listitem>
48017 <para>
48018 After the AUTH command has been accepted, the client sends an SPA
48019 authentication request based on the user name and optional domain.
48020 </para>
48021 </listitem>
48022 <listitem>
48023 <para>
48024 The server sends back a challenge.
48025 </para>
48026 </listitem>
48027 <listitem>
48028 <para>
48029 The client builds a challenge response which makes use of the user&#x2019;s password
48030 and sends it to the server, which then accepts or rejects it.
48031 </para>
48032 </listitem>
48033 </itemizedlist>
48034 <para>
48035 Encryption is used to protect the password in transit.
48036 </para>
48037 <section id="SECID179">
48038 <title>Using spa as a server</title>
48039 <para>
48040 <indexterm role="concept">
48041 <primary>options</primary>
48042 <secondary><command>spa</command> authenticator (server)</secondary>
48043 </indexterm>
48044 The <command>spa</command> authenticator has just one server option:
48045 </para>
48046 <para>
48047 <indexterm role="option">
48048 <primary><option>server_password</option></primary>
48049 </indexterm>
48050 </para>
48051 <informaltable frame="all">
48052 <tgroup cols="4" colsep="0" rowsep="0">
48053 <colspec colwidth="8*" align="left"/>
48054 <colspec colwidth="6*" align="center"/>
48055 <colspec colwidth="6*" align="center"/>
48056 <colspec colwidth="6*" align="right"/>
48057 <tbody>
48058 <row>
48059 <entry><option>server_password</option></entry>
48060 <entry>Use: <emphasis>spa</emphasis></entry>
48061 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48062 <entry>Default: <emphasis>unset</emphasis></entry>
48063 </row>
48064 </tbody>
48065 </tgroup>
48066 </informaltable>
48067 <para>
48068 <indexterm role="concept">
48069 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48070 <secondary>in <command>spa</command> authenticator</secondary>
48071 </indexterm>
48072 This option is expanded, and the result must be the cleartext password for the
48073 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
48074 compatibility with previous releases of Exim, the user name is also placed in
48075 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
48076 it can lead to confusion in string expansions that also use numeric variables
48077 for other things. For example:
48078 </para>
48079 <literallayout class="monospaced">
48080 spa:
48081   driver = spa
48082   public_name = NTLM
48083   server_password = \
48084     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
48085 </literallayout>
48086 <para>
48087 If the expansion is forced to fail, authentication fails. Any other expansion
48088 failure causes a temporary error code to be returned.
48089 </para>
48090 </section>
48091 <section id="SECID180">
48092 <title>Using spa as a client</title>
48093 <para>
48094 <indexterm role="concept">
48095 <primary>options</primary>
48096 <secondary><command>spa</command> authenticator (client)</secondary>
48097 </indexterm>
48098 The <command>spa</command> authenticator has the following client options:
48099 </para>
48100 <para>
48101 <indexterm role="option">
48102 <primary><option>client_domain</option></primary>
48103 </indexterm>
48104 </para>
48105 <informaltable frame="all">
48106 <tgroup cols="4" colsep="0" rowsep="0">
48107 <colspec colwidth="8*" align="left"/>
48108 <colspec colwidth="6*" align="center"/>
48109 <colspec colwidth="6*" align="center"/>
48110 <colspec colwidth="6*" align="right"/>
48111 <tbody>
48112 <row>
48113 <entry><option>client_domain</option></entry>
48114 <entry>Use: <emphasis>spa</emphasis></entry>
48115 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48116 <entry>Default: <emphasis>unset</emphasis></entry>
48117 </row>
48118 </tbody>
48119 </tgroup>
48120 </informaltable>
48121 <para>
48122 This option specifies an optional domain for the authentication.
48123 </para>
48124 <para>
48125 <indexterm role="option">
48126 <primary><option>client_password</option></primary>
48127 </indexterm>
48128 </para>
48129 <informaltable frame="all">
48130 <tgroup cols="4" colsep="0" rowsep="0">
48131 <colspec colwidth="8*" align="left"/>
48132 <colspec colwidth="6*" align="center"/>
48133 <colspec colwidth="6*" align="center"/>
48134 <colspec colwidth="6*" align="right"/>
48135 <tbody>
48136 <row>
48137 <entry><option>client_password</option></entry>
48138 <entry>Use: <emphasis>spa</emphasis></entry>
48139 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48140 <entry>Default: <emphasis>unset</emphasis></entry>
48141 </row>
48142 </tbody>
48143 </tgroup>
48144 </informaltable>
48145 <para>
48146 This option specifies the user&#x2019;s password, and must be set.
48147 </para>
48148 <para>
48149 <indexterm role="option">
48150 <primary><option>client_username</option></primary>
48151 </indexterm>
48152 </para>
48153 <informaltable frame="all">
48154 <tgroup cols="4" colsep="0" rowsep="0">
48155 <colspec colwidth="8*" align="left"/>
48156 <colspec colwidth="6*" align="center"/>
48157 <colspec colwidth="6*" align="center"/>
48158 <colspec colwidth="6*" align="right"/>
48159 <tbody>
48160 <row>
48161 <entry><option>client_username</option></entry>
48162 <entry>Use: <emphasis>spa</emphasis></entry>
48163 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48164 <entry>Default: <emphasis>unset</emphasis></entry>
48165 </row>
48166 </tbody>
48167 </tgroup>
48168 </informaltable>
48169 <para>
48170 This option specifies the user name, and must be set. Here is an example of a
48171 configuration of this authenticator for use with the mail servers at
48172 <emphasis>msn.com</emphasis>:
48173 </para>
48174 <literallayout class="monospaced">
48175 msn:
48176   driver = spa
48177   public_name = MSN
48178   client_username = msn/msn_username
48179   client_password = msn_plaintext_password
48180   client_domain = DOMAIN_OR_UNSET
48181 </literallayout>
48182 <para>
48183 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
48184 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
48185 </para>
48186 </section>
48187 </chapter>
48188
48189 <chapter id="CHAPTLS">
48190 <title>Encrypted SMTP connections using TLS/SSL</title>
48191 <titleabbrev>Encrypted SMTP connections</titleabbrev>
48192 <para>
48193 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
48194 <primary>encryption</primary>
48195 <secondary>on SMTP connection</secondary>
48196 </indexterm>
48197 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
48198 <primary>SMTP</primary>
48199 <secondary>encryption</secondary>
48200 </indexterm>
48201 <indexterm role="concept">
48202 <primary>TLS</primary>
48203 <secondary>on SMTP connection</secondary>
48204 </indexterm>
48205 <indexterm role="concept">
48206 <primary>OpenSSL</primary>
48207 </indexterm>
48208 <indexterm role="concept">
48209 <primary>GnuTLS</primary>
48210 </indexterm>
48211 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
48212 Sockets Layer), is implemented by making use of the OpenSSL library or the
48213 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
48214 cryptographic code in the Exim distribution itself for implementing TLS. In
48215 order to use this feature you must install OpenSSL or GnuTLS, and then build a
48216 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
48217 You also need to understand the basic concepts of encryption at a managerial
48218 level, and in particular, the way that public keys, private keys, and
48219 certificates are used.
48220 </para>
48221 <para>
48222 RFC 3207 defines how SMTP connections can make use of encryption. Once a
48223 connection is established, the client issues a STARTTLS command. If the
48224 server accepts this, the client and the server negotiate an encryption
48225 mechanism. If the negotiation succeeds, the data that subsequently passes
48226 between them is encrypted.
48227 </para>
48228 <para>
48229 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
48230 and if so, what cipher suite is in use, whether the client supplied a
48231 certificate, and whether or not that certificate was verified. This makes it
48232 possible for an Exim server to deny or accept certain commands based on the
48233 encryption state.
48234 </para>
48235 <para>
48236 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
48237 disrupt TLS connections. You need to turn off SMTP scanning for these products
48238 in order to get TLS to work.
48239 </para>
48240 <section id="SECID284">
48241 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
48242 <para>
48243 <indexterm role="concept">
48244 <primary>ssmtp protocol</primary>
48245 </indexterm>
48246 <indexterm role="concept">
48247 <primary>smtps protocol</primary>
48248 </indexterm>
48249 <indexterm role="concept">
48250 <primary>SMTP</primary>
48251 <secondary>ssmtp protocol</secondary>
48252 </indexterm>
48253 <indexterm role="concept">
48254 <primary>SMTP</primary>
48255 <secondary>smtps protocol</secondary>
48256 </indexterm>
48257 Early implementations of encrypted SMTP used a different TCP port from normal
48258 SMTP, and expected an encryption negotiation to start immediately, instead of
48259 waiting for a STARTTLS command from the client using the standard SMTP
48260 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
48261 allocated for this purpose.
48262 </para>
48263 <para>
48264 This approach was abandoned when encrypted SMTP was standardized, but there are
48265 still some legacy clients that use it. Exim supports these clients by means of
48266 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
48267 numbers; the most common use is expected to be:
48268 </para>
48269 <literallayout class="monospaced">
48270 tls_on_connect_ports = 465
48271 </literallayout>
48272 <para>
48273 The port numbers specified by this option apply to all SMTP connections, both
48274 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
48275 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
48276 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
48277 an extra port &ndash; rather, it specifies different behaviour on a port that is
48278 defined elsewhere.
48279 </para>
48280 <para>
48281 There is also a <option>-tls-on-connect</option> command line option. This overrides
48282 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
48283 </para>
48284 </section>
48285 <section id="SECTopenvsgnu">
48286 <title>OpenSSL vs GnuTLS</title>
48287 <para>
48288 <indexterm role="concept">
48289 <primary>TLS</primary>
48290 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
48291 </indexterm>
48292 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
48293 followed later, when the first versions of GnuTLS were released. To build Exim
48294 to use GnuTLS, you need to set
48295 </para>
48296 <literallayout class="monospaced">
48297 USE_GNUTLS=yes
48298 </literallayout>
48299 <para>
48300 in Local/Makefile, in addition to
48301 </para>
48302 <literallayout class="monospaced">
48303 SUPPORT_TLS=yes
48304 </literallayout>
48305 <para>
48306 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
48307 include files and libraries for GnuTLS can be found.
48308 </para>
48309 <para>
48310 There are some differences in usage when using GnuTLS instead of OpenSSL:
48311 </para>
48312 <itemizedlist>
48313 <listitem>
48314 <para>
48315 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
48316 name of a directory (for OpenSSL it can be either).
48317 </para>
48318 </listitem>
48319 <listitem>
48320 <para revisionflag="changed">
48321 The default value for <option>tls_dhparam</option> differs for historical reasons.
48322 </para>
48323 </listitem>
48324 <listitem>
48325 <para>
48326 <indexterm role="variable">
48327 <primary><varname>$tls_peerdn</varname></primary>
48328 </indexterm>
48329 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
48330 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
48331 affects the value of the <varname>$tls_peerdn</varname> variable.
48332 </para>
48333 </listitem>
48334 <listitem>
48335 <para>
48336 OpenSSL identifies cipher suites using hyphens as separators, for example:
48337 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
48338 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
48339 in a cipher list. To make life simpler, Exim changes underscores to hyphens
48340 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
48341 to handle its own older variants) when processing lists of cipher suites in the
48342 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
48343 option).
48344 </para>
48345 </listitem>
48346 <listitem>
48347 <para>
48348 The <option>tls_require_ciphers</option> options operate differently, as described in the
48349 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
48350 </para>
48351 </listitem>
48352 <listitem>
48353 <para revisionflag="changed">
48354 Some other recently added features may only be available in one or the other.
48355 This should be documented with the feature.  If the documentation does not
48356 explicitly state that the feature is infeasible in the other TLS
48357 implementation, then patches are welcome.
48358 </para>
48359 </listitem>
48360 </itemizedlist>
48361 </section>
48362 <section id="SECTgnutlsparam">
48363 <title>GnuTLS parameter computation</title>
48364 <para revisionflag="changed">
48365 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
48366 an explicit path; if the latter, then the text about generation still applies,
48367 but not the chosen filename.
48368 By default, as of Exim 4.80 a hard-coded D-H prime is used.
48369 See the documentation of <option>tls_dhparam</option> for more information.
48370 </para>
48371 <para revisionflag="changed">
48372 GnuTLS uses D-H parameters that may take a substantial amount of time
48373 to compute. It is unreasonable to re-compute them for every TLS session.
48374 Therefore, Exim keeps this data in a file in its spool directory, called
48375 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
48376 of bits requested.
48377 The file is owned by the Exim user and is readable only by
48378 its owner. Every Exim process that start up GnuTLS reads the D-H
48379 parameters from this file. If the file does not exist, the first Exim process
48380 that needs it computes the data and writes it to a temporary file which is
48381 renamed once it is complete. It does not matter if several Exim processes do
48382 this simultaneously (apart from wasting a few resources). Once a file is in
48383 place, new Exim processes immediately start using it.
48384 </para>
48385 <para revisionflag="changed">
48386 For maximum security, the parameters that are stored in this file should be
48387 recalculated periodically, the frequency depending on your paranoia level.
48388 If you are avoiding using the fixed D-H primes published in RFCs, then you
48389 are concerned about some advanced attacks and will wish to do this; if you do
48390 not regenerate then you might as well stick to the standard primes.
48391 </para>
48392 <para revisionflag="changed">
48393 Arranging this is easy in principle; just delete the file when you want new
48394 values to be computed. However, there may be a problem. The calculation of new
48395 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
48396 If the system is not very active, <filename>/dev/random</filename> may delay returning data
48397 until enough randomness (entropy) is available. This may cause Exim to hang for
48398 a substantial amount of time, causing timeouts on incoming connections.
48399 </para>
48400 <para revisionflag="changed">
48401 The solution is to generate the parameters externally to Exim. They are stored
48402 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
48403 generated externally using the <command>certtool</command> command that is part of GnuTLS.
48404 </para>
48405 <para revisionflag="changed">
48406 To replace the parameters with new ones, instead of deleting the file
48407 and letting Exim re-create it, you can generate new parameters using
48408 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
48409 renaming. The relevant commands are something like this:
48410 </para>
48411 <literallayout class="monospaced" revisionflag="changed">
48412 # ls
48413 [ look for file; assume gnutls-params-2236 is the most recent ]
48414 # rm -f new-params
48415 # touch new-params
48416 # chown exim:exim new-params
48417 # chmod 0600 new-params
48418 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
48419 # openssl dhparam -noout -text -in new-params | head
48420 [ check the first line, make sure it's not more than 2236;
48421   if it is, then go back to the start ("rm") and repeat
48422   until the size generated is at most the size requested ]
48423 # chmod 0400 new-params
48424 # mv new-params gnutls-params-2236
48425 </literallayout>
48426 <para revisionflag="changed">
48427 If Exim never has to generate the parameters itself, the possibility of
48428 stalling is removed.
48429 </para>
48430 <para revisionflag="changed">
48431 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
48432 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
48433 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
48434 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
48435 and Exim does so.  This attempt to remove Exim from TLS policy decisions
48436 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
48437 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
48438 which applies to all D-H usage, client or server.  If the value returned by
48439 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
48440 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
48441 limit, which is still much higher than Exim historically used.
48442 </para>
48443 <para revisionflag="changed">
48444 The filename and bits used will change as the GnuTLS maintainers change the
48445 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
48446 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
48447 2432 bits, while NSS is limited to 2236 bits.
48448 </para>
48449 <para revisionflag="changed">
48450 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
48451 increase the chance of the generated prime actually being within acceptable
48452 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
48453 procedure above.  There is no sane procedure available to Exim to double-check
48454 the size of the generated prime, so it might still be too large.
48455 </para>
48456 </section>
48457 <section id="SECTreqciphssl">
48458 <title>Requiring specific ciphers in OpenSSL</title>
48459 <para>
48460 <indexterm role="concept">
48461 <primary>TLS</primary>
48462 <secondary>requiring specific ciphers (OpenSSL)</secondary>
48463 </indexterm>
48464 <indexterm role="option">
48465 <primary><option>tls_require_ciphers</option></primary>
48466 <secondary>OpenSSL</secondary>
48467 </indexterm>
48468 There is a function in the OpenSSL library that can be passed a list of cipher
48469 suites before the cipher negotiation takes place. This specifies which ciphers
48470 are acceptable. The list is colon separated and may contain names like
48471 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
48472 directly to this function call.
48473 Many systems will install the OpenSSL manual-pages, so you may have
48474 <emphasis>ciphers(1)</emphasis> available to you.
48475 The following quotation from the OpenSSL
48476 documentation specifies what forms of item are allowed in the cipher string:
48477 </para>
48478 <itemizedlist>
48479 <listitem>
48480 <para>
48481 It can consist of a single cipher suite such as RC4-SHA.
48482 </para>
48483 </listitem>
48484 <listitem>
48485 <para>
48486 It can represent a list of cipher suites containing a certain algorithm,
48487 or cipher suites of a certain type. For example SHA1 represents all
48488 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
48489 SSL v3 algorithms.
48490 </para>
48491 </listitem>
48492 <listitem>
48493 <para>
48494 Lists of cipher suites can be combined in a single cipher string using
48495 the + character. This is used as a logical and operation. For example
48496 SHA1+DES represents all cipher suites containing the SHA1 and the DES
48497 algorithms.
48498 </para>
48499 </listitem>
48500 </itemizedlist>
48501 <para>
48502 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
48503 <literal>-</literal> or <literal>+</literal>.
48504 </para>
48505 <itemizedlist>
48506 <listitem>
48507 <para>
48508 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
48509 ciphers deleted can never reappear in the list even if they are explicitly
48510 stated.
48511 </para>
48512 </listitem>
48513 <listitem>
48514 <para>
48515 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
48516 of the ciphers can be added again by later options.
48517 </para>
48518 </listitem>
48519 <listitem>
48520 <para>
48521 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
48522 option does not add any new ciphers; it just moves matching existing ones.
48523 </para>
48524 </listitem>
48525 </itemizedlist>
48526 <para>
48527 If none of these characters is present, the string is interpreted as
48528 a list of ciphers to be appended to the current preference list. If the list
48529 includes any ciphers already present they will be ignored: that is, they will
48530 not be moved to the end of the list.
48531 </para>
48532 <para revisionflag="changed">
48533 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
48534 string:
48535 </para>
48536 <literallayout class="monospaced" revisionflag="changed">
48537 # note single-quotes to get ! past any shell history expansion
48538 $ openssl ciphers 'HIGH:!MD5:!SHA1'
48539 </literallayout>
48540 <para revisionflag="changed">
48541 This example will let the library defaults be permitted on the MX port, where
48542 there&#x2019;s probably no identity verification anyway, but ups the ante on the
48543 submission ports where the administrator might have some influence on the
48544 choice of clients used:
48545 </para>
48546 <literallayout class="monospaced" revisionflag="changed">
48547 # OpenSSL variant; see man ciphers(1)
48548 tls_require_ciphers = ${if =={$received_port}{25}\
48549                            {DEFAULT}\
48550                            {HIGH:!MD5:!SHA1}}
48551 </literallayout>
48552 </section>
48553 <section id="SECTreqciphgnu" revisionflag="changed">
48554 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
48555 <para revisionflag="changed">
48556 <indexterm role="concept">
48557 <primary>GnuTLS</primary>
48558 <secondary>specifying parameters for</secondary>
48559 </indexterm>
48560 <indexterm role="concept">
48561 <primary>TLS</primary>
48562 <secondary>specifying ciphers (GnuTLS)</secondary>
48563 </indexterm>
48564 <indexterm role="concept">
48565 <primary>TLS</primary>
48566 <secondary>specifying key exchange methods (GnuTLS)</secondary>
48567 </indexterm>
48568 <indexterm role="concept">
48569 <primary>TLS</primary>
48570 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
48571 </indexterm>
48572 <indexterm role="concept">
48573 <primary>TLS</primary>
48574 <secondary>specifying protocols (GnuTLS)</secondary>
48575 </indexterm>
48576 <indexterm role="concept">
48577 <primary>TLS</primary>
48578 <secondary>specifying priority string (GnuTLS)</secondary>
48579 </indexterm>
48580 <indexterm role="option">
48581 <primary><option>tls_require_ciphers</option></primary>
48582 <secondary>GnuTLS</secondary>
48583 </indexterm>
48584 The GnuTLS library allows the caller to provide a "priority string", documented
48585 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
48586 ciphersuite specification in OpenSSL.
48587 </para>
48588 <para revisionflag="changed">
48589 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string.
48590 </para>
48591 <para revisionflag="changed">
48592 The <option>tls_require_ciphers</option> option is available both as an global option,
48593 controlling how Exim behaves as a server, and also as an option of the
48594 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
48595 the value is string expanded.  The resulting string is not an Exim list and
48596 the string is given to the GnuTLS library, so that Exim does not need to be
48597 aware of future feature enhancements of GnuTLS.
48598 </para>
48599 <para revisionflag="changed">
48600 Documentation of the strings accepted may be found in the GnuTLS manual, under
48601 "Priority strings".  This is online as
48602 <emphasis role="bold"><ulink url="http://www.gnu.org/software/gnutls/manual/html_node/Priority-Strings.html">http://www.gnu.org/software/gnutls/manual/html_node/Priority-Strings.html</ulink></emphasis>,
48603 but beware that this relates to GnuTLS 3, which may be newer than the version
48604 installed on your system.  If you are using GnuTLS 3,
48605 <emphasis role="bold"><ulink url="http://www.gnu.org/software/gnutls/manual/html_node/Listing-the-ciphersuites-in-a-priority-string.html">then the example code</ulink></emphasis>
48606 on that site can be used to test a given string.
48607 </para>
48608 <para revisionflag="changed">
48609 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
48610 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
48611 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
48612 </para>
48613 <para revisionflag="changed">
48614 This example will let the library defaults be permitted on the MX port, where
48615 there&#x2019;s probably no identity verification anyway, and lowers security further
48616 by increasing compatibility; but this ups the ante on the submission ports
48617 where the administrator might have some influence on the choice of clients
48618 used:
48619 </para>
48620 <literallayout class="monospaced" revisionflag="changed">
48621 # GnuTLS variant
48622 tls_require_ciphers = ${if =={$received_port}{25}\
48623                            {NORMAL:%COMPAT}\
48624                            {SECURE128}}
48625 </literallayout>
48626 </section>
48627 <section id="SECID182">
48628 <title>Configuring an Exim server to use TLS</title>
48629 <para>
48630 <indexterm role="concept">
48631 <primary>TLS</primary>
48632 <secondary>configuring an Exim server</secondary>
48633 </indexterm>
48634 When Exim has been built with TLS support, it advertises the availability of
48635 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
48636 but not to any others. The default value of this option is unset, which means
48637 that STARTTLS is not advertised at all. This default is chosen because you
48638 need to set some other options in order to make TLS available, and also it is
48639 sensible for systems that want to use TLS only as a client.
48640 </para>
48641 <para>
48642 If a client issues a STARTTLS command and there is some configuration
48643 problem in the server, the command is rejected with a 454 error. If the client
48644 persists in trying to issue SMTP commands, all except QUIT are rejected
48645 with the error
48646 </para>
48647 <literallayout class="monospaced">
48648 554 Security failure
48649 </literallayout>
48650 <para>
48651 If a STARTTLS command is issued within an existing TLS session, it is
48652 rejected with a 554 error code.
48653 </para>
48654 <para>
48655 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
48656 match some hosts. You can, of course, set it to * to match all hosts.
48657 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
48658 without some further configuration at the server end.
48659 </para>
48660 <para>
48661 It is rumoured that all existing clients that support TLS/SSL use RSA
48662 encryption. To make this work you need to set, in the server,
48663 </para>
48664 <literallayout class="monospaced">
48665 tls_certificate = /some/file/name
48666 tls_privatekey = /some/file/name
48667 </literallayout>
48668 <para>
48669 These options are, in fact, expanded strings, so you can make them depend on
48670 the identity of the client that is connected if you wish. The first file
48671 contains the server&#x2019;s X509 certificate, and the second contains the private key
48672 that goes with it. These files need to be readable by the Exim user, and must
48673 always be given as full path names. They can be the same file if both the
48674 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
48675 set, or if its expansion is forced to fail or results in an empty string, this
48676 is assumed to be the case. The certificate file may also contain intermediate
48677 certificates that need to be sent to the client to enable it to authenticate
48678 the server&#x2019;s certificate.
48679 </para>
48680 <para>
48681 If you do not understand about certificates and keys, please try to find a
48682 source of this background information, which is not Exim-specific. (There are a
48683 few comments below in section <xref linkend="SECTcerandall"/>.)
48684 </para>
48685 <para>
48686 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
48687 they apply only in the case of a server. If you need to use a certificate in an
48688 Exim client, you must set the options of the same names in an <command>smtp</command>
48689 transport.
48690 </para>
48691 <para>
48692 With just these options, an Exim server will be able to use TLS. It does not
48693 require the client to have a certificate (but see below for how to insist on
48694 this). There is one other option that may be needed in other situations. If
48695 </para>
48696 <literallayout class="monospaced">
48697 tls_dhparam = /some/file/name
48698 </literallayout>
48699 <para>
48700 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
48701 with the parameters contained in the file.
48702 </para>
48703 <para revisionflag="changed">
48704 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
48705 available:
48706 </para>
48707 <literallayout class="monospaced" revisionflag="changed">
48708 tls_dhparam = none
48709 </literallayout>
48710 <para revisionflag="changed">
48711 This may also be set to a string identifying a standard prime to be used for
48712 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
48713 used is <literal>ike23</literal>.  There are a few standard primes available, see the
48714 documetnation for <option>tls_dhparam</option> for the complete list.
48715 </para>
48716 <para revisionflag="changed">
48717 See the command
48718 </para>
48719 <literallayout class="monospaced" revisionflag="changed">
48720 openssl dhparam
48721 </literallayout>
48722 <para revisionflag="changed">
48723 for a way of generating file data.
48724 </para>
48725 <para>
48726 The strings supplied for these three options are expanded every time a client
48727 host connects. It is therefore possible to use different certificates and keys
48728 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
48729 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
48730 forced to fail, Exim behaves as if the option is not set.
48731 </para>
48732 <para>
48733 <indexterm role="concept">
48734 <primary>cipher</primary>
48735 <secondary>logging</secondary>
48736 </indexterm>
48737 <indexterm role="concept">
48738 <primary>log</primary>
48739 <secondary>TLS cipher</secondary>
48740 </indexterm>
48741 <indexterm role="variable">
48742 <primary><varname>$tls_cipher</varname></primary>
48743 </indexterm>
48744 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
48745 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
48746 incoming message (by default &ndash; you can, of course, change this), and it is
48747 also included in the log line that records a message&#x2019;s arrival, keyed by
48748 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
48749 condition can be used to test for specific cipher suites in ACLs.
48750 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
48751 <xref linkend="SECID185"/>.)
48752 </para>
48753 <para>
48754 Once TLS has been established, the ACLs that run for subsequent SMTP commands
48755 can check the name of the cipher suite and vary their actions accordingly. The
48756 cipher suite names vary, depending on which TLS library is being used. For
48757 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
48758 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
48759 documentation for more details.
48760 </para>
48761 </section>
48762 <section id="SECID183">
48763 <title>Requesting and verifying client certificates</title>
48764 <para>
48765 <indexterm role="concept">
48766 <primary>certificate</primary>
48767 <secondary>verification of client</secondary>
48768 </indexterm>
48769 <indexterm role="concept">
48770 <primary>TLS</primary>
48771 <secondary>client certificate verification</secondary>
48772 </indexterm>
48773 If you want an Exim server to request a certificate when negotiating a TLS
48774 session with a client, you must set either <option>tls_verify_hosts</option> or
48775 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
48776 apply to all TLS connections. For any host that matches one of these options,
48777 Exim requests a certificate as part of the setup of the TLS session. The
48778 contents of the certificate are verified by comparing it with a list of
48779 expected certificates. These must be available in a file or,
48780 for OpenSSL only (not GnuTLS), a directory, identified by
48781 <option>tls_verify_certificates</option>.
48782 </para>
48783 <para>
48784 A file can contain multiple certificates, concatenated end to end. If a
48785 directory is used
48786 (OpenSSL only),
48787 each certificate must be in a separate file, with a name (or a symbolic link)
48788 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
48789 certificate. You can compute the relevant hash by running the command
48790 </para>
48791 <literallayout class="monospaced">
48792 openssl x509 -hash -noout -in /cert/file
48793 </literallayout>
48794 <para>
48795 where <filename>/cert/file</filename> contains a single certificate.
48796 </para>
48797 <para>
48798 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
48799 what happens if the client does not supply a certificate, or if the certificate
48800 does not match any of the certificates in the collection named by
48801 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
48802 attempt to set up a TLS session is aborted, and the incoming connection is
48803 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
48804 session continues. ACLs that run for subsequent SMTP commands can detect the
48805 fact that no certificate was verified, and vary their actions accordingly. For
48806 example, you can insist on a certificate before accepting a message for
48807 relaying, but not when the message is destined for local delivery.
48808 </para>
48809 <para>
48810 <indexterm role="variable">
48811 <primary><varname>$tls_peerdn</varname></primary>
48812 </indexterm>
48813 When a client supplies a certificate (whether it verifies or not), the value of
48814 the Distinguished Name of the certificate is made available in the variable
48815 <varname>$tls_peerdn</varname> during subsequent processing of the message.
48816 </para>
48817 <para>
48818 <indexterm role="concept">
48819 <primary>log</primary>
48820 <secondary>distinguished name</secondary>
48821 </indexterm>
48822 Because it is often a long text string, it is not included in the log line or
48823 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
48824 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
48825 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
48826 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
48827 </para>
48828 </section>
48829 <section id="SECID184">
48830 <title>Revoked certificates</title>
48831 <para>
48832 <indexterm role="concept">
48833 <primary>TLS</primary>
48834 <secondary>revoked certificates</secondary>
48835 </indexterm>
48836 <indexterm role="concept">
48837 <primary>revocation list</primary>
48838 </indexterm>
48839 <indexterm role="concept">
48840 <primary>certificate</primary>
48841 <secondary>revocation list</secondary>
48842 </indexterm>
48843 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
48844 certificates are revoked. If you have such a list, you can pass it to an Exim
48845 server using the global option called <option>tls_crl</option> and to an Exim client using
48846 an identically named option for the <command>smtp</command> transport. In each case, the value
48847 of the option is expanded and must then be the name of a file that contains a
48848 CRL in PEM format.
48849 </para>
48850 </section>
48851 <section id="SECID185">
48852 <title>Configuring an Exim client to use TLS</title>
48853 <para>
48854 <indexterm role="concept">
48855 <primary>cipher</primary>
48856 <secondary>logging</secondary>
48857 </indexterm>
48858 <indexterm role="concept">
48859 <primary>log</primary>
48860 <secondary>TLS cipher</secondary>
48861 </indexterm>
48862 <indexterm role="concept">
48863 <primary>log</primary>
48864 <secondary>distinguished name</secondary>
48865 </indexterm>
48866 <indexterm role="concept">
48867 <primary>TLS</primary>
48868 <secondary>configuring an Exim client</secondary>
48869 </indexterm>
48870 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
48871 deliveries as well as to incoming, the latter one causing logging of the
48872 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
48873 within the <command>smtp</command> transport.
48874 </para>
48875 <para>
48876 It is not necessary to set any options to have TLS work in the <command>smtp</command>
48877 transport. If Exim is built with TLS support, and TLS is advertised by a
48878 server, the <command>smtp</command> transport always tries to start a TLS session. However,
48879 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
48880 transport) to a list of server hosts for which TLS should not be used.
48881 </para>
48882 <para>
48883 If you do not want Exim to attempt to send messages unencrypted when an attempt
48884 to set up an encrypted connection fails in any way, you can set
48885 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
48886 those hosts, delivery is always deferred if an encrypted connection cannot be
48887 set up. If there are any other hosts for the address, they are tried in the
48888 usual way.
48889 </para>
48890 <para>
48891 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
48892 the message unencrypted. It always does this if the response to STARTTLS is
48893 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
48894 session after a success response code, what happens is controlled by the
48895 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
48896 delivery to this host is deferred, and other hosts (if available) are tried. If
48897 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
48898 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
48899 negotiation fails, Exim closes the current connection (because it is in an
48900 unknown state), opens a new one to the same host, and then tries the delivery
48901 unencrypted.
48902 </para>
48903 <para>
48904 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
48905 transport provide the client with a certificate, which is passed to the server
48906 if it requests it. If the server is Exim, it will request a certificate only if
48907 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
48908 </para>
48909 <para>
48910 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
48911 must name a file or,
48912 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
48913 expected server certificates. The client verifies the server&#x2019;s certificate
48914 against this collection, taking into account any revoked certificates that are
48915 in the list defined by <option>tls_crl</option>.
48916 </para>
48917 <para>
48918 If
48919 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
48920 list of permitted cipher suites. If either of these checks fails, delivery to
48921 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
48922 alternative hosts, if any.
48923 </para>
48924 <para>
48925  <emphasis role="bold">Note</emphasis>:
48926 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
48927 is operating as a client. Exim does not assume that a server certificate (set
48928 by the global options of the same name) should also be used when operating as a
48929 client.
48930 </para>
48931 <para>
48932 <indexterm role="variable">
48933 <primary><varname>$host</varname></primary>
48934 </indexterm>
48935 <indexterm role="variable">
48936 <primary><varname>$host_address</varname></primary>
48937 </indexterm>
48938 All the TLS options in the <command>smtp</command> transport are expanded before use, with
48939 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
48940 which the client is connected. Forced failure of an expansion causes Exim to
48941 behave as if the relevant option were unset.
48942 </para>
48943 <para>
48944 <indexterm role="variable">
48945 <primary><varname>$tls_bits</varname></primary>
48946 </indexterm>
48947 <indexterm role="variable">
48948 <primary><varname>$tls_cipher</varname></primary>
48949 </indexterm>
48950 <indexterm role="variable">
48951 <primary><varname>$tls_peerdn</varname></primary>
48952 </indexterm>
48953 <indexterm role="variable">
48954 <primary><varname>$tls_sni</varname></primary>
48955 </indexterm>
48956 Before an SMTP connection is established, the
48957 <varname>$tls_bits</varname>, <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
48958 variables are emptied. (Until the first connection, they contain the values
48959 that were set when the message was received.) If STARTTLS is subsequently
48960 successfully obeyed, these variables are set to the relevant values for the
48961 outgoing connection.
48962 </para>
48963 </section>
48964 <section id="SECTtlssni" revisionflag="changed">
48965 <title>Use of TLS Server Name Indication</title>
48966 <para revisionflag="changed">
48967 <indexterm role="concept">
48968 <primary>TLS</primary>
48969 <secondary>Server Name Indication</secondary>
48970 </indexterm>
48971 <indexterm role="variable">
48972 <primary><varname>$tls_sni</varname></primary>
48973 </indexterm>
48974 <indexterm role="option">
48975 <primary><option>tls_sni</option></primary>
48976 </indexterm>
48977 With TLS1.0 or above, there is an extension mechanism by which extra
48978 information can be included at various points in the protocol.  One of these
48979 extensions, documented in RFC 6066 (and before that RFC 4366) is
48980 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
48981 client in the initial handshake, so that the server can examine the servername
48982 within and possibly choose to use different certificates and keys (and more)
48983 for this session.
48984 </para>
48985 <para revisionflag="changed">
48986 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
48987 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
48988 address.
48989 </para>
48990 <para revisionflag="changed">
48991 With SMTP to MX, there are the same problems here as in choosing the identity
48992 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
48993 provide the identity which you then cryptographically verify.  So this will
48994 be of limited use in that environment.
48995 </para>
48996 <para revisionflag="changed">
48997 With SMTP to Submission, there is a well-defined hostname which clients are
48998 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
48999 choose to include this information in the TLS negotiation.  If this becomes
49000 wide-spread, then hosters can choose to present different certificates to
49001 different clients.  Or even negotiate different cipher suites.
49002 </para>
49003 <para revisionflag="changed">
49004 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
49005 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
49006 nothing more to it.  Choosing a sensible value not derived insecurely is the
49007 only point of caution.  The <varname>$tls_sni</varname> variable will be set to this string
49008 for the lifetime of the client connection (including during authentication).
49009 </para>
49010 <para revisionflag="changed">
49011 Except during SMTP client sessions, if <varname>$tls_sni</varname> is set then it is a string
49012 received from a client.
49013 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
49014 </para>
49015 <para revisionflag="changed">
49016 If the string <literal>tls_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
49017 option (prior to expansion) then the following options will be re-expanded
49018 during TLS session handshake, to permit alternative values to be chosen:
49019 </para>
49020 <itemizedlist revisionflag="changed">
49021 <listitem>
49022 <para revisionflag="changed">
49023 <indexterm role="variable">
49024 <primary><option>tls_certificate</option></primary>
49025 </indexterm>
49026 <option>tls_certificate</option>
49027 </para>
49028 </listitem>
49029 <listitem>
49030 <para revisionflag="changed">
49031 <indexterm role="variable">
49032 <primary><option>tls_crl</option></primary>
49033 </indexterm>
49034 <option>tls_crl</option>
49035 </para>
49036 </listitem>
49037 <listitem>
49038 <para revisionflag="changed">
49039 <indexterm role="variable">
49040 <primary><option>tls_privatekey</option></primary>
49041 </indexterm>
49042 <option>tls_privatekey</option>
49043 </para>
49044 </listitem>
49045 <listitem>
49046 <para revisionflag="changed">
49047 <indexterm role="variable">
49048 <primary><option>tls_verify_certificates</option></primary>
49049 </indexterm>
49050 <option>tls_verify_certificates</option>
49051 </para>
49052 </listitem>
49053 </itemizedlist>
49054 <para revisionflag="changed">
49055 Great care should be taken to deal with matters of case, various injection
49056 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
49057 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
49058 arbitrary unverified data provided prior to authentication.
49059 </para>
49060 <para revisionflag="changed">
49061 The Exim developers are proceeding cautiously and so far no other TLS options
49062 are re-expanded.
49063 </para>
49064 <para revisionflag="changed">
49065 When Exim is built againt OpenSSL, OpenSSL must have been built with support
49066 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
49067 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
49068 see <literal>-servername</literal> in the output, then OpenSSL has support.
49069 </para>
49070 <para revisionflag="changed">
49071 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
49072 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
49073 built, then you have SNI support).
49074 </para>
49075 </section>
49076 <section id="SECTmulmessam">
49077 <title>Multiple messages on the same encrypted TCP/IP connection</title>
49078 <para>
49079 <indexterm role="concept">
49080 <primary>multiple SMTP deliveries with TLS</primary>
49081 </indexterm>
49082 <indexterm role="concept">
49083 <primary>TLS</primary>
49084 <secondary>multiple message deliveries</secondary>
49085 </indexterm>
49086 Exim sends multiple messages down the same TCP/IP connection by starting up
49087 an entirely new delivery process for each message, passing the socket from
49088 one process to the next. This implementation does not fit well with the use
49089 of TLS, because there is quite a lot of state information associated with a TLS
49090 connection, not just a socket identification. Passing all the state information
49091 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
49092 session before passing the socket to a new process. The new process may then
49093 try to start a new TLS session, and if successful, may try to re-authenticate
49094 if AUTH is in use, before sending the next message.
49095 </para>
49096 <para>
49097 The RFC is not clear as to whether or not an SMTP session continues in clear
49098 after TLS has been shut down, or whether TLS may be restarted again later, as
49099 just described. However, if the server is Exim, this shutdown and
49100 reinitialization works. It is not known which (if any) other servers operate
49101 successfully if the client closes a TLS session and continues with unencrypted
49102 SMTP, but there are certainly some that do not work. For such servers, Exim
49103 should not pass the socket to another process, because the failure of the
49104 subsequent attempt to use it would cause Exim to record a temporary host error,
49105 and delay other deliveries to that host.
49106 </para>
49107 <para>
49108 To test for this case, Exim sends an EHLO command to the server after
49109 closing down the TLS session. If this fails in any way, the connection is
49110 closed instead of being passed to a new delivery process, but no retry
49111 information is recorded.
49112 </para>
49113 <para>
49114 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
49115 <command>smtp</command> transport to match those hosts for which Exim should not pass
49116 connections to new processes if TLS has been used.
49117 </para>
49118 </section>
49119 <section id="SECTcerandall">
49120 <title>Certificates and all that</title>
49121 <para>
49122 <indexterm role="concept">
49123 <primary>certificate</primary>
49124 <secondary>references to discussion</secondary>
49125 </indexterm>
49126 In order to understand fully how TLS works, you need to know about
49127 certificates, certificate signing, and certificate authorities. This is not the
49128 place to give a tutorial, especially as I do not know very much about it
49129 myself. Some helpful introduction can be found in the FAQ for the SSL addition
49130 to Apache, currently at
49131 </para>
49132 <literallayout>
49133 <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>
49134 </literallayout>
49135 <para>
49136 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
49137 links to further files.
49138 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
49139 0-201-61598-3), contains both introductory and more in-depth descriptions.
49140 Some sample programs taken from the book are available from
49141 </para>
49142 <literallayout>
49143 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
49144 </literallayout>
49145 </section>
49146 <section id="SECID186">
49147 <title>Certificate chains</title>
49148 <para>
49149 The file named by <option>tls_certificate</option> may contain more than one
49150 certificate. This is useful in the case where the certificate that is being
49151 sent is validated by an intermediate certificate which the other end does
49152 not have. Multiple certificates must be in the correct order in the file.
49153 First the host&#x2019;s certificate itself, then the first intermediate
49154 certificate to validate the issuer of the host certificate, then the next
49155 intermediate certificate to validate the issuer of the first intermediate
49156 certificate, and so on, until finally (optionally) the root certificate.
49157 The root certificate must already be trusted by the recipient for
49158 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
49159 root certificate along with the rest makes it available for the user to
49160 install if the receiving end is a client MUA that can interact with a user.
49161 </para>
49162 </section>
49163 <section id="SECID187">
49164 <title>Self-signed certificates</title>
49165 <para>
49166 <indexterm role="concept">
49167 <primary>certificate</primary>
49168 <secondary>self-signed</secondary>
49169 </indexterm>
49170 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
49171 with OpenSSL, like this:
49172 </para>
49173 <literallayout class="monospaced">
49174 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
49175             -days 9999 -nodes
49176 </literallayout>
49177 <para>
49178 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
49179 delimited and so can be identified independently. The <option>-days</option> option
49180 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
49181 important: if you do not set it, the key is encrypted with a passphrase
49182 that you are prompted for, and any use that is made of the key causes more
49183 prompting for the passphrase. This is not helpful if you are going to use
49184 this certificate and key in an MTA, where prompting is not possible.
49185 </para>
49186 <para>
49187 A self-signed certificate made in this way is sufficient for testing, and
49188 may be adequate for all your requirements if you are mainly interested in
49189 encrypting transfers, and not in secure identification.
49190 </para>
49191 <para>
49192 However, many clients require that the certificate presented by the server be a
49193 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
49194 certificate. In this situation, the self-signed certificate described above
49195 must be installed on the client host as a trusted root <emphasis>certification
49196 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
49197 signed with that self-signed certificate.
49198 </para>
49199 <para>
49200 For information on creating self-signed CA certificates and using them to sign
49201 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
49202 Open-source PKI book, available online at
49203 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
49204 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
49205 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
49206 </para>
49207 </section>
49208 </chapter>
49209
49210 <chapter id="CHAPACL">
49211 <title>Access control lists</title>
49212 <para>
49213 <indexterm role="concept" id="IIDacl" class="startofrange">
49214 <primary>access control lists (ACLs)</primary>
49215 <secondary>description</secondary>
49216 </indexterm>
49217 <indexterm role="concept">
49218 <primary>control of incoming mail</primary>
49219 </indexterm>
49220 <indexterm role="concept">
49221 <primary>message</primary>
49222 <secondary>controlling incoming</secondary>
49223 </indexterm>
49224 <indexterm role="concept">
49225 <primary>policy control</primary>
49226 <secondary>access control lists</secondary>
49227 </indexterm>
49228 Access Control Lists (ACLs) are defined in a separate section of the run time
49229 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
49230 name, terminated by a colon. Here is a complete ACL section that contains just
49231 one very small ACL:
49232 </para>
49233 <literallayout class="monospaced">
49234 begin acl
49235 small_acl:
49236   accept   hosts = one.host.only
49237 </literallayout>
49238 <para>
49239 You can have as many lists as you like in the ACL section, and the order in
49240 which they appear does not matter. The lists are self-terminating.
49241 </para>
49242 <para>
49243 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
49244 certain SMTP commands. This applies both to incoming TCP/IP connections, and
49245 when a local process submits a message using SMTP by specifying the <option>-bs</option>
49246 option. The most common use is for controlling which recipients are accepted
49247 in incoming messages. In addition, you can define an ACL that is used to check
49248 local non-SMTP messages. The default configuration file contains an example of
49249 a realistic ACL for checking RCPT commands. This is discussed in chapter
49250 <xref linkend="CHAPdefconfil"/>.
49251 </para>
49252 <section id="SECID188">
49253 <title>Testing ACLs</title>
49254 <para>
49255 The <option>-bh</option> command line option provides a way of testing your ACL
49256 configuration locally by running a fake SMTP session with which you interact.
49257 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
49258 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
49259 </para>
49260 </section>
49261 <section id="SECID189">
49262 <title>Specifying when ACLs are used</title>
49263 <para>
49264 <indexterm role="concept">
49265 <primary>access control lists (ACLs)</primary>
49266 <secondary>options for specifying</secondary>
49267 </indexterm>
49268 In order to cause an ACL to be used, you have to name it in one of the relevant
49269 options in the main part of the configuration. These options are:
49270 <indexterm role="concept">
49271 <primary>AUTH</primary>
49272 <secondary>ACL for</secondary>
49273 </indexterm>
49274 <indexterm role="concept">
49275 <primary>DATA</primary>
49276 <secondary>ACLs for</secondary>
49277 </indexterm>
49278 <indexterm role="concept">
49279 <primary>ETRN</primary>
49280 <secondary>ACL for</secondary>
49281 </indexterm>
49282 <indexterm role="concept">
49283 <primary>EXPN</primary>
49284 <secondary>ACL for</secondary>
49285 </indexterm>
49286 <indexterm role="concept">
49287 <primary>HELO</primary>
49288 <secondary>ACL for</secondary>
49289 </indexterm>
49290 <indexterm role="concept">
49291 <primary>EHLO</primary>
49292 <secondary>ACL for</secondary>
49293 </indexterm>
49294 <indexterm role="concept">
49295 <primary>MAIL</primary>
49296 <secondary>ACL for</secondary>
49297 </indexterm>
49298 <indexterm role="concept">
49299 <primary>QUIT, ACL for</primary>
49300 </indexterm>
49301 <indexterm role="concept">
49302 <primary>RCPT</primary>
49303 <secondary>ACL for</secondary>
49304 </indexterm>
49305 <indexterm role="concept">
49306 <primary>STARTTLS, ACL for</primary>
49307 </indexterm>
49308 <indexterm role="concept">
49309 <primary>VRFY</primary>
49310 <secondary>ACL for</secondary>
49311 </indexterm>
49312 <indexterm role="concept">
49313 <primary>SMTP</primary>
49314 <secondary>connection, ACL for</secondary>
49315 </indexterm>
49316 <indexterm role="concept">
49317 <primary>non-SMTP messages</primary>
49318 <secondary>ACLs for</secondary>
49319 </indexterm>
49320 <indexterm role="concept">
49321 <primary>MIME content scanning</primary>
49322 <secondary>ACL for</secondary>
49323 </indexterm>
49324 </para>
49325 <informaltable frame="none">
49326 <tgroup cols="2" colsep="0" rowsep="0">
49327 <colspec colwidth="140pt" align="left"/>
49328 <colspec colwidth="254pt" align="left"/>
49329 <tbody>
49330 <row>
49331 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
49332 <entry>ACL for non-SMTP messages</entry>
49333 </row>
49334 <row>
49335 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
49336 <entry>ACL for non-SMTP MIME parts</entry>
49337 </row>
49338 <row>
49339 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
49340 <entry>ACL at start of non-SMTP message</entry>
49341 </row>
49342 <row>
49343 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
49344 <entry>ACL for AUTH</entry>
49345 </row>
49346 <row>
49347 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
49348 <entry>ACL for start of SMTP connection</entry>
49349 </row>
49350 <row>
49351 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
49352 <entry>ACL after DATA is complete</entry>
49353 </row>
49354 <row>
49355 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
49356 <entry>ACL for ETRN</entry>
49357 </row>
49358 <row>
49359 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
49360 <entry>ACL for EXPN</entry>
49361 </row>
49362 <row>
49363 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
49364 <entry>ACL for HELO or EHLO</entry>
49365 </row>
49366 <row>
49367 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
49368 <entry>ACL for MAIL</entry>
49369 </row>
49370 <row>
49371 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
49372 <entry>ACL for the AUTH parameter of MAIL</entry>
49373 </row>
49374 <row>
49375 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
49376 <entry>ACL for content-scanning MIME parts</entry>
49377 </row>
49378 <row>
49379 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
49380 <entry>ACL for non-QUIT terminations</entry>
49381 </row>
49382 <row>
49383 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
49384 <entry>ACL at start of DATA command</entry>
49385 </row>
49386 <row>
49387 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
49388 <entry>ACL for QUIT</entry>
49389 </row>
49390 <row>
49391 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
49392 <entry>ACL for RCPT</entry>
49393 </row>
49394 <row>
49395 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
49396 <entry>ACL for STARTTLS</entry>
49397 </row>
49398 <row>
49399 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
49400 <entry>ACL for VRFY</entry>
49401 </row>
49402 </tbody>
49403 </tgroup>
49404 </informaltable>
49405 <para>
49406 For example, if you set
49407 </para>
49408 <literallayout class="monospaced">
49409 acl_smtp_rcpt = small_acl
49410 </literallayout>
49411 <para>
49412 the little ACL defined above is used whenever Exim receives a RCPT command
49413 in an SMTP dialogue. The majority of policy tests on incoming messages can be
49414 done when RCPT commands arrive. A rejection of RCPT should cause the
49415 sending MTA to give up on the recipient address contained in the RCPT
49416 command, whereas rejection at other times may cause the client MTA to keep on
49417 trying to deliver the message. It is therefore recommended that you do as much
49418 testing as possible at RCPT time.
49419 </para>
49420 </section>
49421 <section id="SECID190">
49422 <title>The non-SMTP ACLs</title>
49423 <para>
49424 <indexterm role="concept">
49425 <primary>non-SMTP messages</primary>
49426 <secondary>ACLs for</secondary>
49427 </indexterm>
49428 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
49429 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
49430 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
49431 the state of the SMTP connection such as encryption and authentication) are not
49432 relevant and are forbidden in these ACLs. However, the sender and recipients
49433 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
49434 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
49435 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
49436 in any of these ACLs.
49437 </para>
49438 <para>
49439 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
49440 non-SMTP message, before any of the message has been read. (This is the
49441 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
49442 batched SMTP input, it runs after the DATA command has been reached. The
49443 result of this ACL is ignored; it cannot be used to reject a message. If you
49444 really need to, you could set a value in an ACL variable here and reject based
49445 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
49446 controls, and in particular, it can be used to set
49447 </para>
49448 <literallayout class="monospaced">
49449 control = suppress_local_fixups
49450 </literallayout>
49451 <para>
49452 This cannot be used in the other non-SMTP ACLs because by the time they are
49453 run, it is too late.
49454 </para>
49455 <para>
49456 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
49457 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
49458 </para>
49459 <para>
49460 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
49461 kind of rejection is treated as permanent, because there is no way of sending a
49462 temporary error for these kinds of message.
49463 </para>
49464 </section>
49465 <section id="SECID191">
49466 <title>The SMTP connect ACL</title>
49467 <para>
49468 <indexterm role="concept">
49469 <primary>SMTP</primary>
49470 <secondary>connection, ACL for</secondary>
49471 </indexterm>
49472 <indexterm role="option">
49473 <primary><option>smtp_banner</option></primary>
49474 </indexterm>
49475 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
49476 session, after the test specified by <option>host_reject_connection</option> (which is now
49477 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
49478 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
49479 the message override the banner message that is otherwise specified by the
49480 <option>smtp_banner</option> option.
49481 </para>
49482 </section>
49483 <section id="SECID192">
49484 <title>The EHLO/HELO ACL</title>
49485 <para>
49486 <indexterm role="concept">
49487 <primary>EHLO</primary>
49488 <secondary>ACL for</secondary>
49489 </indexterm>
49490 <indexterm role="concept">
49491 <primary>HELO</primary>
49492 <secondary>ACL for</secondary>
49493 </indexterm>
49494 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
49495 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
49496 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
49497 Note that a client may issue more than one EHLO or HELO command in an SMTP
49498 session, and indeed is required to issue a new EHLO or HELO after successfully
49499 setting up encryption following a STARTTLS command.
49500 </para>
49501 <para>
49502 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
49503 modifier, the message may not contain more than one line (it will be truncated
49504 at the first newline and a panic logged if it does). Such a message cannot
49505 affect the EHLO options that are listed on the second and subsequent lines of
49506 an EHLO response.
49507 </para>
49508 </section>
49509 <section id="SECID193">
49510 <title>The DATA ACLs</title>
49511 <para>
49512 <indexterm role="concept">
49513 <primary>DATA</primary>
49514 <secondary>ACLs for</secondary>
49515 </indexterm>
49516 Two ACLs are associated with the DATA command, because it is two-stage
49517 command, with two responses being sent to the client.
49518 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
49519 is obeyed. This gives you control after all the RCPT commands, but before
49520 the message itself is received. It offers the opportunity to give a negative
49521 response to the DATA command before the data is transmitted. Header lines
49522 added by MAIL or RCPT ACLs are not visible at this time, but any that
49523 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
49524 </para>
49525 <para>
49526 You cannot test the contents of the message, for example, to verify addresses
49527 in the headers, at RCPT time or when the DATA command is received. Such
49528 tests have to appear in the ACL that is run after the message itself has been
49529 received, before the final response to the DATA command is sent. This is
49530 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
49531 associated with the DATA command.
49532 </para>
49533 <para>
49534 For both of these ACLs, it is not possible to reject individual recipients. An
49535 error response rejects the entire message. Unfortunately, it is known that some
49536 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
49537 before or after the data) correctly &ndash; they keep the message on their queues
49538 and try again later, but that is their problem, though it does waste some of
49539 your resources.
49540 </para>
49541 </section>
49542 <section id="SECTDKIMACL">
49543 <title>The SMTP DKIM ACL</title>
49544 <para>
49545 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
49546 enabled (which is the default).
49547 </para>
49548 <para>
49549 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
49550 received, and is executed for each DKIM signature found in a message.  If not
49551 otherwise specified, the default action is to accept.
49552 </para>
49553 <para>
49554 For details on the operation of DKIM, see chapter <xref linkend="CHID12"/>.
49555 </para>
49556 </section>
49557 <section id="SECID194">
49558 <title>The SMTP MIME ACL</title>
49559 <para>
49560 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
49561 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
49562 </para>
49563 </section>
49564 <section id="SECTQUITACL">
49565 <title>The QUIT ACL</title>
49566 <para>
49567 <indexterm role="concept">
49568 <primary>QUIT, ACL for</primary>
49569 </indexterm>
49570 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
49571 does not affect the response code to QUIT, which is always 221. Thus, the ACL
49572 does not in fact control any access. For this reason, the only verbs that are
49573 permitted are <option>accept</option> and <option>warn</option>.
49574 </para>
49575 <para>
49576 This ACL can be used for tasks such as custom logging at the end of an SMTP
49577 session. For example, you can use ACL variables in other ACLs to count
49578 messages, recipients, etc., and log the totals at QUIT time using one or
49579 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
49580 </para>
49581 <para>
49582 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
49583 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
49584 </para>
49585 <para>
49586 You do not need to have a final <option>accept</option>, but if you do, you can use a
49587 <option>message</option> modifier to specify custom text that is sent as part of the 221
49588 response to QUIT.
49589 </para>
49590 <para>
49591 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
49592 failure (for example, failure to open a log file, or when Exim is bombing out
49593 because it has detected an unrecoverable error), all SMTP commands from the
49594 client are given temporary error responses until QUIT is received or the
49595 connection is closed. In these special cases, the QUIT ACL does not run.
49596 </para>
49597 </section>
49598 <section id="SECTNOTQUITACL">
49599 <title>The not-QUIT ACL</title>
49600 <para>
49601 <indexterm role="variable">
49602 <primary><varname>$acl_smtp_notquit</varname></primary>
49603 </indexterm>
49604 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
49605 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
49606 trouble, such as being unable to write to its log files, this ACL is not run,
49607 because it might try to do things (such as write to log files) that make the
49608 situation even worse.
49609 </para>
49610 <para>
49611 Like the QUIT ACL, this ACL is provided to make it possible to do customized
49612 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
49613 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
49614 and <option>warn</option>.
49615 </para>
49616 <para>
49617 <indexterm role="variable">
49618 <primary><varname>$smtp_notquit_reason</varname></primary>
49619 </indexterm>
49620 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
49621 to a string that indicates the reason for the termination of the SMTP
49622 connection. The possible values are:
49623 </para>
49624 <informaltable frame="none">
49625 <tgroup cols="2" colsep="0" rowsep="0">
49626 <colspec colwidth="196pt" align="left"/>
49627 <colspec colwidth="254pt" align="left"/>
49628 <tbody>
49629 <row>
49630 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
49631 <entry>Another ACL issued a <option>drop</option> command</entry>
49632 </row>
49633 <row>
49634 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
49635 <entry>Too many unknown or non-mail commands</entry>
49636 </row>
49637 <row>
49638 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
49639 <entry>Timeout while reading SMTP commands</entry>
49640 </row>
49641 <row>
49642 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
49643 <entry>The SMTP connection has been lost</entry>
49644 </row>
49645 <row>
49646 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
49647 <entry>Timeout while reading message data</entry>
49648 </row>
49649 <row>
49650 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
49651 <entry>The <function>local_scan()</function> function crashed</entry>
49652 </row>
49653 <row>
49654 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
49655 <entry>The <function>local_scan()</function> function timed out</entry>
49656 </row>
49657 <row>
49658 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
49659 <entry>SIGTERM or SIGINT</entry>
49660 </row>
49661 <row>
49662 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
49663 <entry>SMTP synchronization error</entry>
49664 </row>
49665 <row>
49666 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
49667 <entry>TLS failed to start</entry>
49668 </row>
49669 </tbody>
49670 </tgroup>
49671 </informaltable>
49672 <para>
49673 In most cases when an SMTP connection is closed without having received QUIT,
49674 Exim sends an SMTP response message before actually closing the connection.
49675 With the exception of the <literal>acl-drop</literal> case, the default message can be
49676 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
49677 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
49678 used.
49679 </para>
49680 </section>
49681 <section id="SECID195">
49682 <title>Finding an ACL to use</title>
49683 <para>
49684 <indexterm role="concept">
49685 <primary>access control lists (ACLs)</primary>
49686 <secondary>finding which to use</secondary>
49687 </indexterm>
49688 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
49689 you can use different ACLs in different circumstances. For example,
49690 </para>
49691 <literallayout class="monospaced">
49692 acl_smtp_rcpt = ${if ={25}{$interface_port} \
49693                      {acl_check_rcpt} {acl_check_rcpt_submit} }
49694 </literallayout>
49695 <para>
49696 In the default configuration file there are some example settings for
49697 providing an RFC 4409 message submission service on port 587 and a
49698 non-standard <quote>smtps</quote> service on port 465. You can use a string
49699 expansion like this to choose an ACL for MUAs on these ports which is
49700 more appropriate for this purpose than the default ACL on port 25.
49701 </para>
49702 <para>
49703 The expanded string does not have to be the name of an ACL in the
49704 configuration file; there are other possibilities. Having expanded the
49705 string, Exim searches for an ACL as follows:
49706 </para>
49707 <itemizedlist>
49708 <listitem>
49709 <para>
49710 If the string begins with a slash, Exim uses it as a file name, and reads its
49711 contents as an ACL. The lines are processed in the same way as lines in the
49712 Exim configuration file. In particular, continuation lines are supported, blank
49713 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
49714 If the file does not exist or cannot be read, an error occurs (typically
49715 causing a temporary failure of whatever caused the ACL to be run). For example:
49716 </para>
49717 <literallayout class="monospaced">
49718 acl_smtp_data = /etc/acls/\
49719   ${lookup{$sender_host_address}lsearch\
49720   {/etc/acllist}{$value}{default}}
49721 </literallayout>
49722 <para>
49723 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
49724 back to a default if the lookup fails. If an ACL is successfully read from a
49725 file, it is retained in memory for the duration of the Exim process, so that it
49726 can be re-used without having to re-read the file.
49727 </para>
49728 </listitem>
49729 <listitem>
49730 <para>
49731 If the string does not start with a slash, and does not contain any spaces,
49732 Exim searches the ACL section of the configuration for an ACL whose name
49733 matches the string.
49734 </para>
49735 </listitem>
49736 <listitem>
49737 <para>
49738 If no named ACL is found, or if the string contains spaces, Exim parses
49739 the string as an inline ACL. This can save typing in cases where you just
49740 want to have something like
49741 </para>
49742 <literallayout class="monospaced">
49743 acl_smtp_vrfy = accept
49744 </literallayout>
49745 <para>
49746 in order to allow free use of the VRFY command. Such a string may contain
49747 newlines; it is processed in the same way as an ACL that is read from a file.
49748 </para>
49749 </listitem>
49750 </itemizedlist>
49751 </section>
49752 <section id="SECID196">
49753 <title>ACL return codes</title>
49754 <para>
49755 <indexterm role="concept">
49756 <primary>access control lists (ACLs)</primary>
49757 <secondary>return codes</secondary>
49758 </indexterm>
49759 Except for the QUIT ACL, which does not affect the SMTP return code (see
49760 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
49761 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
49762 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
49763 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
49764 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
49765 This also causes a 4<emphasis>xx</emphasis> return code.
49766 </para>
49767 <para>
49768 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
49769 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
49770 submitters of non-SMTP messages.
49771 </para>
49772 <para>
49773 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
49774 has the effect of <quote>accept</quote>, but causes either the entire message or an
49775 individual recipient address to be discarded. In other words, it is a
49776 blackholing facility. Use it with care.
49777 </para>
49778 <para>
49779 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
49780 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
49781 RCPT ACL is to discard just the one recipient address. If there are no
49782 recipients left when the message&#x2019;s data is received, the DATA ACL is not
49783 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
49784 remaining recipients. The <quote>discard</quote> return is not permitted for the
49785 <option>acl_smtp_predata</option> ACL.
49786 </para>
49787 <para>
49788 <indexterm role="concept">
49789 <primary><function>local_scan()</function> function</primary>
49790 <secondary>when all recipients discarded</secondary>
49791 </indexterm>
49792 The <function>local_scan()</function> function is always run, even if there are no remaining
49793 recipients; it may create new recipients.
49794 </para>
49795 </section>
49796 <section id="SECID197">
49797 <title>Unset ACL options</title>
49798 <para>
49799 <indexterm role="concept">
49800 <primary>access control lists (ACLs)</primary>
49801 <secondary>unset options</secondary>
49802 </indexterm>
49803 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
49804 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
49805 not defined at all. For any defined ACL, the default action when control
49806 reaches the end of the ACL statements is <quote>deny</quote>.
49807 </para>
49808 <para>
49809 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
49810 these two are ACLs that are used only for their side effects. They cannot be
49811 used to accept or reject anything.
49812 </para>
49813 <para>
49814 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
49815 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
49816 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
49817 when the ACL is not defined is <quote>accept</quote>.
49818 </para>
49819 <para>
49820 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
49821 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
49822 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
49823 messages over an SMTP connection. For an example, see the ACL in the default
49824 configuration file.
49825 </para>
49826 </section>
49827 <section id="SECID198">
49828 <title>Data for message ACLs</title>
49829 <para>
49830 <indexterm role="concept">
49831 <primary>access control lists (ACLs)</primary>
49832 <secondary>data for message ACL</secondary>
49833 </indexterm>
49834 <indexterm role="variable">
49835 <primary><varname>$domain</varname></primary>
49836 </indexterm>
49837 <indexterm role="variable">
49838 <primary><varname>$local_part</varname></primary>
49839 </indexterm>
49840 <indexterm role="variable">
49841 <primary><varname>$sender_address</varname></primary>
49842 </indexterm>
49843 <indexterm role="variable">
49844 <primary><varname>$sender_host_address</varname></primary>
49845 </indexterm>
49846 <indexterm role="variable">
49847 <primary><varname>$smtp_command</varname></primary>
49848 </indexterm>
49849 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
49850 that contain information about the host and the message&#x2019;s sender (for example,
49851 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
49852 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
49853 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
49854 is available in <varname>$smtp_command</varname>.
49855 </para>
49856 <para>
49857 When an ACL for the AUTH parameter of MAIL is running, the variables that
49858 contain information about the host are set, but <varname>$sender_address</varname> is not yet
49859 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
49860 how it is used.
49861 </para>
49862 <para>
49863 <indexterm role="variable">
49864 <primary><varname>$message_size</varname></primary>
49865 </indexterm>
49866 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
49867 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
49868 that parameter is not given. The value is updated to the true message size by
49869 the time the final DATA ACL is run (after the message data has been
49870 received).
49871 </para>
49872 <para>
49873 <indexterm role="variable">
49874 <primary><varname>$rcpt_count</varname></primary>
49875 </indexterm>
49876 <indexterm role="variable">
49877 <primary><varname>$recipients_count</varname></primary>
49878 </indexterm>
49879 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
49880 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
49881 accepted, so while an ACL for RCPT is being processed, it contains the number
49882 of previously accepted recipients. At DATA time (for both the DATA ACLs),
49883 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
49884 <varname>$recipients_count</varname> contains the total number of accepted recipients.
49885 </para>
49886 </section>
49887 <section id="SECTdatfornon">
49888 <title>Data for non-message ACLs</title>
49889 <para>
49890 <indexterm role="concept">
49891 <primary>access control lists (ACLs)</primary>
49892 <secondary>data for non-message ACL</secondary>
49893 </indexterm>
49894 <indexterm role="variable">
49895 <primary><varname>$smtp_command_argument</varname></primary>
49896 </indexterm>
49897 <indexterm role="variable">
49898 <primary><varname>$smtp_command</varname></primary>
49899 </indexterm>
49900 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
49901 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
49902 and the entire SMTP command is available in <varname>$smtp_command</varname>.
49903 These variables can be tested using a <option>condition</option> condition. For example,
49904 here is an ACL for use with AUTH, which insists that either the session is
49905 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
49906 does not permit authentication methods that use cleartext passwords on
49907 unencrypted connections.
49908 </para>
49909 <literallayout class="monospaced">
49910 acl_check_auth:
49911   accept encrypted = *
49912   accept condition = ${if eq{${uc:$smtp_command_argument}}\
49913                      {CRAM-MD5}}
49914   deny   message   = TLS encryption or CRAM-MD5 required
49915 </literallayout>
49916 <para>
49917 (Another way of applying this restriction is to arrange for the authenticators
49918 that use cleartext passwords not to be advertised when the connection is not
49919 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
49920 option to do this.)
49921 </para>
49922 </section>
49923 <section id="SECID199">
49924 <title>Format of an ACL</title>
49925 <para>
49926 <indexterm role="concept">
49927 <primary>access control lists (ACLs)</primary>
49928 <secondary>format of</secondary>
49929 </indexterm>
49930 <indexterm role="concept">
49931 <primary>access control lists (ACLs)</primary>
49932 <secondary>verbs, definition of</secondary>
49933 </indexterm>
49934 An individual ACL consists of a number of statements. Each statement starts
49935 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
49936 Modifiers can change the way the verb operates, define error and log messages,
49937 set variables, insert delays, and vary the processing of accepted messages.
49938 </para>
49939 <para>
49940 If all the conditions are met, the verb is obeyed. The same condition may be
49941 used (with different arguments) more than once in the same statement. This
49942 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
49943 example:
49944 </para>
49945 <literallayout class="monospaced">
49946 deny  dnslists = list1.example
49947 dnslists = list2.example
49948 </literallayout>
49949 <para>
49950 If there are no conditions, the verb is always obeyed. Exim stops evaluating
49951 the conditions and modifiers when it reaches a condition that fails. What
49952 happens then depends on the verb (and in one case, on a special modifier). Not
49953 all the conditions make sense at every testing point. For example, you cannot
49954 test a sender address in the ACL that is run for a VRFY command.
49955 </para>
49956 </section>
49957 <section id="SECID200">
49958 <title>ACL verbs</title>
49959 <para>
49960 The ACL verbs are as follows:
49961 </para>
49962 <itemizedlist>
49963 <listitem>
49964 <para>
49965 <indexterm role="concept">
49966 <primary><option>accept</option> ACL verb</primary>
49967 </indexterm>
49968 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
49969 of the conditions are not met, what happens depends on whether <option>endpass</option>
49970 appears among the conditions (for syntax see below). If the failing condition
49971 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
49972 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
49973 check a RCPT command:
49974 </para>
49975 <literallayout class="monospaced">
49976 accept domains = +local_domains
49977 endpass
49978 verify = recipient
49979 </literallayout>
49980 <para>
49981 If the recipient domain does not match the <option>domains</option> condition, control
49982 passes to the next statement. If it does match, the recipient is verified, and
49983 the command is accepted if verification succeeds. However, if verification
49984 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
49985 <option>endpass</option>.
49986 </para>
49987 <para>
49988 The <option>endpass</option> feature has turned out to be confusing to many people, so its
49989 use is not recommended nowadays. It is always possible to rewrite an ACL so
49990 that <option>endpass</option> is not needed, and it is no longer used in the default
49991 configuration.
49992 </para>
49993 <para>
49994 <indexterm role="concept">
49995 <primary><option>message</option> ACL modifier</primary>
49996 <secondary>with <option>accept</option></secondary>
49997 </indexterm>
49998 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
49999 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
50000 (when an <option>accept</option> verb either accepts or passes control to the next
50001 statement), <option>message</option> can be used to vary the message that is sent when an
50002 SMTP command is accepted. For example, in a RCPT ACL you could have:
50003 </para>
50004 <literallayout>
50005 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
50006 <literal>        message = OK, I will allow you through today</literal>
50007 </literallayout>
50008 <para>
50009 You can specify an SMTP response code, optionally followed by an <quote>extended
50010 response code</quote> at the start of the message, but the first digit must be the
50011 same as would be sent by default, which is 2 for an <option>accept</option> verb.
50012 </para>
50013 <para>
50014 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
50015 an error message that is used when access is denied. This behaviour is retained
50016 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
50017 of <option>endpass</option>.
50018 </para>
50019 </listitem>
50020 <listitem>
50021 <para>
50022 <indexterm role="concept">
50023 <primary><option>defer</option> ACL verb</primary>
50024 </indexterm>
50025 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
50026 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
50027 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
50028 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
50029 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
50030 be used in any ACL, and even for a recipient it might be a simpler approach.
50031 </para>
50032 </listitem>
50033 <listitem>
50034 <para>
50035 <indexterm role="concept">
50036 <primary><option>deny</option> ACL verb</primary>
50037 </indexterm>
50038 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
50039 the conditions are not met, control is passed to the next ACL statement. For
50040 example,
50041 </para>
50042 <literallayout class="monospaced">
50043 deny dnslists = blackholes.mail-abuse.org
50044 </literallayout>
50045 <para>
50046 rejects commands from hosts that are on a DNS black list.
50047 </para>
50048 </listitem>
50049 <listitem>
50050 <para>
50051 <indexterm role="concept">
50052 <primary><option>discard</option> ACL verb</primary>
50053 </indexterm>
50054 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
50055 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
50056 that are concerned with receiving messages. When all the conditions are true,
50057 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
50058 recipients to be discarded. If it is used in an ACL for RCPT, just the one
50059 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
50060 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
50061 do not appear in the log line when the <option>received_recipients</option> log selector is set.
50062 </para>
50063 <para>
50064 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
50065 its contents are added to the line that is automatically written to the log.
50066 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
50067 </para>
50068 </listitem>
50069 <listitem>
50070 <para>
50071 <indexterm role="concept">
50072 <primary><option>drop</option> ACL verb</primary>
50073 </indexterm>
50074 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
50075 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
50076 </para>
50077 <literallayout class="monospaced">
50078 drop   message   = I don't take more than 20 RCPTs
50079        condition = ${if &gt; {$rcpt_count}{20}}
50080 </literallayout>
50081 <para>
50082 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
50083 The connection is always dropped after sending a 550 response.
50084 </para>
50085 </listitem>
50086 <listitem>
50087 <para>
50088 <indexterm role="concept">
50089 <primary><option>require</option> ACL verb</primary>
50090 </indexterm>
50091 <option>require</option>: If all the conditions are met, control is passed to the next ACL
50092 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
50093 example, when checking a RCPT command,
50094 </para>
50095 <literallayout class="monospaced">
50096 require message = Sender did not verify
50097         verify  = sender
50098 </literallayout>
50099 <para>
50100 passes control to subsequent statements only if the message&#x2019;s sender can be
50101 verified. Otherwise, it rejects the command. Note the positioning of the
50102 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
50103 discussed in section <xref linkend="SECTcondmodproc"/>.
50104 </para>
50105 </listitem>
50106 <listitem>
50107 <para>
50108 <indexterm role="concept">
50109 <primary><option>warn</option> ACL verb</primary>
50110 </indexterm>
50111 <option>warn</option>: If all the conditions are true, a line specified by the
50112 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
50113 to the next ACL statement. If any condition is false, the log line is not
50114 written. If an identical log line is requested several times in the same
50115 message, only one copy is actually written to the log. If you want to force
50116 duplicates to be written, use the <option>logwrite</option> modifier instead.
50117 </para>
50118 <para>
50119 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
50120 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
50121 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
50122 condition. There is more about adding header lines in section
50123 <xref linkend="SECTaddheadacl"/>.
50124 </para>
50125 <para>
50126 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
50127 some sort of defer), the log line specified by <option>log_message</option> is not written.
50128 This does not include the case of a forced failure from a lookup, which
50129 is considered to be a successful completion. After a defer, no further
50130 conditions or modifiers in the <option>warn</option> statement are processed. The incident
50131 is logged, and the ACL continues to be processed, from the next statement
50132 onwards.
50133 </para>
50134 <para>
50135 <indexterm role="variable">
50136 <primary><varname>$acl_verify_message</varname></primary>
50137 </indexterm>
50138 When one of the <option>warn</option> conditions is an address verification that fails, the
50139 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
50140 want this logged, you must set it up explicitly. For example:
50141 </para>
50142 <literallayout class="monospaced">
50143 warn   !verify = sender
50144        log_message = sender verify failed: $acl_verify_message
50145 </literallayout>
50146 </listitem>
50147 </itemizedlist>
50148 <para>
50149 At the end of each ACL there is an implicit unconditional <option>deny</option>.
50150 </para>
50151 <para>
50152 As you can see from the examples above, the conditions and modifiers are
50153 written one to a line, with the first one on the same line as the verb, and
50154 subsequent ones on following lines. If you have a very long condition, you can
50155 continue it onto several physical lines by the usual backslash continuation
50156 mechanism. It is conventional to align the conditions vertically.
50157 </para>
50158 </section>
50159 <section id="SECTaclvariables">
50160 <title>ACL variables</title>
50161 <para>
50162 <indexterm role="concept">
50163 <primary>access control lists (ACLs)</primary>
50164 <secondary>variables</secondary>
50165 </indexterm>
50166 There are some special variables that can be set during ACL processing. They
50167 can be used to pass information between different ACLs, different invocations
50168 of the same ACL in the same SMTP connection, and between ACLs and the routers,
50169 transports, and filters that are used to deliver a message. The names of these
50170 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
50171 an underscore, but the remainder of the name can be any sequence of
50172 alphanumeric characters and underscores that you choose. There is no limit on
50173 the number of ACL variables. The two sets act as follows:
50174 </para>
50175 <itemizedlist>
50176 <listitem>
50177 <para>
50178 The values of those variables whose names begin with <varname>$acl_c</varname> persist
50179 throughout an SMTP connection. They are never reset. Thus, a value that is set
50180 while receiving one message is still available when receiving the next message
50181 on the same SMTP connection.
50182 </para>
50183 </listitem>
50184 <listitem>
50185 <para>
50186 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
50187 while a message is being received. They are reset afterwards. They are also
50188 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
50189 </para>
50190 </listitem>
50191 </itemizedlist>
50192 <para>
50193 When a message is accepted, the current values of all the ACL variables are
50194 preserved with the message and are subsequently made available at delivery
50195 time. The ACL variables are set by a modifier called <option>set</option>. For example:
50196 </para>
50197 <literallayout class="monospaced">
50198 accept hosts = whatever
50199        set acl_m4 = some value
50200 accept authenticated = *
50201        set acl_c_auth = yes
50202 </literallayout>
50203 <para>
50204 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
50205 be set. If you want to set a variable without taking any action, you can use a
50206 <option>warn</option> verb without any other modifiers or conditions.
50207 </para>
50208 <para>
50209 <indexterm role="option">
50210 <primary><option>strict_acl_vars</option></primary>
50211 </indexterm>
50212 What happens if a syntactically valid but undefined ACL variable is
50213 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
50214 false (the default), an empty string is substituted; if it is true, an
50215 error is generated.
50216 </para>
50217 <para>
50218 Versions of Exim before 4.64 have a limited set of numbered variables, but
50219 their names are compatible, so there is no problem with upgrading.
50220 </para>
50221 </section>
50222 <section id="SECTcondmodproc">
50223 <title>Condition and modifier processing</title>
50224 <para>
50225 <indexterm role="concept">
50226 <primary>access control lists (ACLs)</primary>
50227 <secondary>conditions; processing</secondary>
50228 </indexterm>
50229 <indexterm role="concept">
50230 <primary>access control lists (ACLs)</primary>
50231 <secondary>modifiers; processing</secondary>
50232 </indexterm>
50233 An exclamation mark preceding a condition negates its result. For example:
50234 </para>
50235 <literallayout class="monospaced">
50236 deny   domains = *.dom.example
50237       !verify  = recipient
50238 </literallayout>
50239 <para>
50240 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
50241 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
50242 negation can be used on the right-hand side of a condition. For example, these
50243 two statements are equivalent:
50244 </para>
50245 <literallayout class="monospaced">
50246 deny  hosts = !192.168.3.4
50247 deny !hosts =  192.168.3.4
50248 </literallayout>
50249 <para>
50250 However, for many conditions (<option>verify</option> being a good example), only left-hand
50251 side negation of the whole condition is possible.
50252 </para>
50253 <para>
50254 The arguments of conditions and modifiers are expanded. A forced failure
50255 of an expansion causes a condition to be ignored, that is, it behaves as if the
50256 condition is true. Consider these two statements:
50257 </para>
50258 <literallayout class="monospaced">
50259 accept  senders = ${lookup{$host_name}lsearch\
50260                   {/some/file}{$value}fail}
50261 accept  senders = ${lookup{$host_name}lsearch\
50262                   {/some/file}{$value}{}}
50263 </literallayout>
50264 <para>
50265 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
50266 the returned list is searched, but if the lookup fails the behaviour is
50267 different in the two cases. The <option>fail</option> in the first statement causes the
50268 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
50269 therefore succeeds. The second statement, however, generates an empty list when
50270 the lookup fails. No sender can match an empty list, so the condition fails,
50271 and therefore the <option>accept</option> also fails.
50272 </para>
50273 <para>
50274 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
50275 specify actions that are taken as the conditions for a statement are checked;
50276 others specify text for messages that are used when access is denied or a
50277 warning is generated. The <option>control</option> modifier affects the way an incoming
50278 message is handled.
50279 </para>
50280 <para>
50281 The positioning of the modifiers in an ACL statement important, because the
50282 processing of a verb ceases as soon as its outcome is known. Only those
50283 modifiers that have already been encountered will take effect. For example,
50284 consider this use of the <option>message</option> modifier:
50285 </para>
50286 <literallayout class="monospaced">
50287 require message = Can't verify sender
50288         verify  = sender
50289         message = Can't verify recipient
50290         verify  = recipient
50291         message = This message cannot be used
50292 </literallayout>
50293 <para>
50294 If sender verification fails, Exim knows that the result of the statement is
50295 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
50296 so its text is used as the error message. If sender verification succeeds, but
50297 recipient verification fails, the second message is used. If recipient
50298 verification succeeds, the third message becomes <quote>current</quote>, but is never used
50299 because there are no more conditions to cause failure.
50300 </para>
50301 <para>
50302 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
50303 modifier that is used, because all the conditions must be true for rejection to
50304 happen. Specifying more than one <option>message</option> modifier does not make sense, and
50305 the message can even be specified after all the conditions. For example:
50306 </para>
50307 <literallayout class="monospaced">
50308 deny   hosts = ...
50309       !senders = *@my.domain.example
50310        message = Invalid sender from client host
50311 </literallayout>
50312 <para>
50313 The <quote>deny</quote> result does not happen until the end of the statement is reached,
50314 by which time Exim has set up the message.
50315 </para>
50316 </section>
50317 <section id="SECTACLmodi">
50318 <title>ACL modifiers</title>
50319 <para>
50320 <indexterm role="concept">
50321 <primary>access control lists (ACLs)</primary>
50322 <secondary>modifiers; list of</secondary>
50323 </indexterm>
50324 The ACL modifiers are as follows:
50325 </para>
50326 <variablelist>
50327 <varlistentry>
50328 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50329 <listitem>
50330 <para>
50331 This modifier specifies one or more header lines that are to be added to an
50332 incoming message, assuming, of course, that the message is ultimately
50333 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
50334 </para>
50335 </listitem></varlistentry>
50336 <varlistentry>
50337 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50338 <listitem>
50339 <para>
50340 <indexterm role="concept">
50341 <primary><option>continue</option> ACL modifier</primary>
50342 </indexterm>
50343 <indexterm role="concept">
50344 <primary>database</primary>
50345 <secondary>updating in ACL</secondary>
50346 </indexterm>
50347 This modifier does nothing of itself, and processing of the ACL always
50348 continues with the next condition or modifier. The value of <option>continue</option> is in
50349 the side effects of expanding its argument. Typically this could be used to
50350 update a database. It is really just a syntactic tidiness, to avoid having to
50351 write rather ugly lines like this:
50352 </para>
50353 <literallayout>
50354 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
50355 </literallayout>
50356 <para>
50357 Instead, all you need is
50358 </para>
50359 <literallayout>
50360 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
50361 </literallayout>
50362 </listitem></varlistentry>
50363 <varlistentry>
50364 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50365 <listitem>
50366 <para>
50367 <indexterm role="concept">
50368 <primary><option>control</option> ACL modifier</primary>
50369 </indexterm>
50370 This modifier affects the subsequent processing of the SMTP connection or of an
50371 incoming message that is accepted. The effect of the first type of control
50372 lasts for the duration of the connection, whereas the effect of the second type
50373 lasts only until the current message has been received. The message-specific
50374 controls always apply to the whole message, not to individual recipients,
50375 even if the <option>control</option> modifier appears in a RCPT ACL.
50376 </para>
50377 <para>
50378 As there are now quite a few controls that can be applied, they are described
50379 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
50380 in several different ways. For example:
50381 </para>
50382 <itemizedlist>
50383 <listitem>
50384 <para>
50385 It can be at the end of an <option>accept</option> statement:
50386 </para>
50387 <literallayout class="monospaced">
50388     accept  ...some conditions
50389             control = queue_only
50390 </literallayout>
50391 <para>
50392 In this case, the control is applied when this statement yields <quote>accept</quote>, in
50393 other words, when the conditions are all true.
50394 </para>
50395 </listitem>
50396 <listitem>
50397 <para>
50398 It can be in the middle of an <option>accept</option> statement:
50399 </para>
50400 <literallayout class="monospaced">
50401     accept  ...some conditions...
50402             control = queue_only
50403             ...some more conditions...
50404 </literallayout>
50405 <para>
50406 If the first set of conditions are true, the control is applied, even if the
50407 statement does not accept because one of the second set of conditions is false.
50408 In this case, some subsequent statement must yield <quote>accept</quote> for the control
50409 to be relevant.
50410 </para>
50411 </listitem>
50412 <listitem>
50413 <para>
50414 It can be used with <option>warn</option> to apply the control, leaving the
50415 decision about accepting or denying to a subsequent verb. For
50416 example:
50417 </para>
50418 <literallayout class="monospaced">
50419     warn    ...some conditions...
50420             control = freeze
50421     accept  ...
50422 </literallayout>
50423 <para>
50424 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
50425 <option>logwrite</option>, so it does not add anything to the message and does not write a
50426 log entry.
50427 </para>
50428 </listitem>
50429 <listitem>
50430 <para>
50431 If you want to apply a control unconditionally, you can use it with a
50432 <option>require</option> verb. For example:
50433 </para>
50434 <literallayout class="monospaced">
50435     require  control = no_multiline_responses
50436 </literallayout>
50437 </listitem>
50438 </itemizedlist>
50439 </listitem></varlistentry>
50440 <varlistentry>
50441 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
50442 <listitem>
50443 <para>
50444 <indexterm role="concept">
50445 <primary><option>delay</option> ACL modifier</primary>
50446 </indexterm>
50447 <indexterm role="option">
50448 <primary><option>-bh</option></primary>
50449 </indexterm>
50450 This modifier may appear in any ACL. It causes Exim to wait for the time
50451 interval before proceeding. However, when testing Exim using the <option>-bh</option>
50452 option, the delay is not actually imposed (an appropriate message is output
50453 instead). The time is given in the usual Exim notation, and the delay happens
50454 as soon as the modifier is processed. In an SMTP session, pending output is
50455 flushed before the delay is imposed.
50456 </para>
50457 <para>
50458 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
50459 example:
50460 </para>
50461 <literallayout class="monospaced">
50462 deny    ...some conditions...
50463         delay = 30s
50464 </literallayout>
50465 <para>
50466 The delay happens if all the conditions are true, before the statement returns
50467 <quote>deny</quote>. Compare this with:
50468 </para>
50469 <literallayout class="monospaced">
50470 deny    delay = 30s
50471         ...some conditions...
50472 </literallayout>
50473 <para>
50474 which waits for 30s before processing the conditions. The <option>delay</option> modifier
50475 can also be used with <option>warn</option> and together with <option>control</option>:
50476 </para>
50477 <literallayout class="monospaced">
50478 warn    ...some conditions...
50479         delay = 2m
50480         control = freeze
50481 accept  ...
50482 </literallayout>
50483 <para>
50484 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
50485 responses to several commands are no longer buffered and sent in one packet (as
50486 they would normally be) because all output is flushed before imposing the
50487 delay. This optimization is disabled so that a number of small delays do not
50488 appear to the client as one large aggregated delay that might provoke an
50489 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
50490 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
50491 </para>
50492 </listitem></varlistentry>
50493 <varlistentry>
50494 <term><emphasis role="bold">endpass</emphasis></term>
50495 <listitem>
50496 <para>
50497 <indexterm role="concept">
50498 <primary><option>endpass</option> ACL modifier</primary>
50499 </indexterm>
50500 This modifier, which has no argument, is recognized only in <option>accept</option> and
50501 <option>discard</option> statements. It marks the boundary between the conditions whose
50502 failure causes control to pass to the next statement, and the conditions whose
50503 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
50504 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
50505 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
50506 </para>
50507 </listitem></varlistentry>
50508 <varlistentry>
50509 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50510 <listitem>
50511 <para>
50512 <indexterm role="concept">
50513 <primary><option>log_message</option> ACL modifier</primary>
50514 </indexterm>
50515 This modifier sets up a message that is used as part of the log message if the
50516 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
50517 </para>
50518 <literallayout class="monospaced">
50519 require log_message = wrong cipher suite $tls_cipher
50520         encrypted   = DES-CBC3-SHA
50521 </literallayout>
50522 <para>
50523 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
50524 example:
50525 </para>
50526 <literallayout>
50527 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
50528 <literal>        log_message = Discarded $local_part@$domain because...</literal>
50529 </literallayout>
50530 <para>
50531 When access is denied, <option>log_message</option> adds to any underlying error message
50532 that may exist because of a condition failure. For example, while verifying a
50533 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
50534 message.
50535 </para>
50536 <para>
50537 The message may be defined before the conditions to which it applies, because
50538 the string expansion does not happen until Exim decides that access is to be
50539 denied. This means that any variables that are set by the condition are
50540 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
50541 variables are set after a DNS black list lookup succeeds. If the expansion of
50542 <option>log_message</option> fails, or if the result is an empty string, the modifier is
50543 ignored.
50544 </para>
50545 <para>
50546 <indexterm role="variable">
50547 <primary><varname>$acl_verify_message</varname></primary>
50548 </indexterm>
50549 If you want to use a <option>warn</option> statement to log the result of an address
50550 verification, you can use <varname>$acl_verify_message</varname> to include the verification
50551 error message.
50552 </para>
50553 <para>
50554 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
50555 the start of the logged message. If the same warning log message is requested
50556 more than once while receiving  a single email message, only one copy is
50557 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
50558 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
50559 is logged for a successful <option>warn</option> statement.
50560 </para>
50561 <para>
50562 If <option>log_message</option> is not present and there is no underlying error message (for
50563 example, from the failure of address verification), but <option>message</option> is present,
50564 the <option>message</option> text is used for logging rejections. However, if any text for
50565 logging contains newlines, only the first line is logged. In the absence of
50566 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
50567 logging rejections.
50568 </para>
50569 </listitem></varlistentry>
50570 <varlistentry>
50571 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
50572 <listitem>
50573 <para>
50574 <indexterm role="concept">
50575 <primary><option>log_reject_target</option> ACL modifier</primary>
50576 </indexterm>
50577 <indexterm role="concept">
50578 <primary>logging in ACL</primary>
50579 <secondary>specifying which log</secondary>
50580 </indexterm>
50581 This modifier makes it possible to specify which logs are used for messages
50582 about ACL rejections. Its argument is a colon-separated list of words that can
50583 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
50584 may be empty, in which case a rejection is not logged at all. For example, this
50585 ACL fragment writes no logging information when access is denied:
50586 </para>
50587 <literallayout>
50588 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
50589 <literal>     log_reject_target =</literal>
50590 </literallayout>
50591 <para>
50592 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
50593 permanent and temporary rejections. Its effect lasts for the rest of the
50594 current ACL.
50595 </para>
50596 </listitem></varlistentry>
50597 <varlistentry>
50598 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50599 <listitem>
50600 <para>
50601 <indexterm role="concept">
50602 <primary><option>logwrite</option> ACL modifier</primary>
50603 </indexterm>
50604 <indexterm role="concept">
50605 <primary>logging in ACL</primary>
50606 <secondary>immediate</secondary>
50607 </indexterm>
50608 This modifier writes a message to a log file as soon as it is encountered when
50609 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
50610 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
50611 access.) The <option>logwrite</option> modifier can be used to log special incidents in
50612 ACLs. For example:
50613 </para>
50614 <literallayout>
50615 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
50616 <literal>       control  = freeze</literal>
50617 <literal>       logwrite = froze message because ...</literal>
50618 </literallayout>
50619 <para>
50620 By default, the message is written to the main log. However, it may begin
50621 with a colon, followed by a comma-separated list of log names, and then
50622 another colon, to specify exactly which logs are to be written. For
50623 example:
50624 </para>
50625 <literallayout class="monospaced">
50626 logwrite = :main,reject: text for main and reject logs
50627 logwrite = :panic: text for panic log only
50628 </literallayout>
50629 </listitem></varlistentry>
50630 <varlistentry>
50631 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
50632 <listitem>
50633 <para>
50634 <indexterm role="concept">
50635 <primary><option>message</option> ACL modifier</primary>
50636 </indexterm>
50637 This modifier sets up a text string that is expanded and used as a response
50638 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
50639 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
50640 there is some complication if <option>endpass</option> is involved; see the description of
50641 <option>accept</option> for details.)
50642 </para>
50643 <para>
50644 The expansion of the message happens at the time Exim decides that the ACL is
50645 to end, not at the time it processes <option>message</option>. If the expansion fails, or
50646 generates an empty string, the modifier is ignored. Here is an example where
50647 <option>message</option> must be specified first, because the ACL ends with a rejection if
50648 the <option>hosts</option> condition fails:
50649 </para>
50650 <literallayout class="monospaced">
50651 require  message = Host not recognized
50652          hosts = 10.0.0.0/8
50653 </literallayout>
50654 <para>
50655 (Once a condition has failed, no further conditions or modifiers are
50656 processed.)
50657 </para>
50658 <para>
50659 <indexterm role="concept">
50660 <primary>SMTP</primary>
50661 <secondary>error codes</secondary>
50662 </indexterm>
50663 <indexterm role="option">
50664 <primary><option>smtp_banner</option></primary>
50665 </indexterm>
50666 For ACLs that are triggered by SMTP commands, the message is returned as part
50667 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
50668 is meaningful only for SMTP, as no message is returned when a non-SMTP message
50669 is accepted. In the case of the connect ACL, accepting with a message modifier
50670 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
50671 accept message may not contain more than one line (otherwise it will be
50672 truncated at the first newline and a panic logged), and it cannot affect the
50673 EHLO options.
50674 </para>
50675 <para>
50676 When SMTP is involved, the message may begin with an overriding response code,
50677 consisting of three digits optionally followed by an <quote>extended response code</quote>
50678 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
50679 </para>
50680 <literallayout class="monospaced">
50681 deny  message = 599 1.2.3 Host not welcome
50682       hosts = 192.168.34.0/24
50683 </literallayout>
50684 <para>
50685 The first digit of the supplied response code must be the same as would be sent
50686 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
50687 access, but for the predata ACL, note that the default success code is 354, not
50688 2<emphasis>xx</emphasis>.
50689 </para>
50690 <para>
50691 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
50692 the message modifier cannot override the 221 response code.
50693 </para>
50694 <para>
50695 The text in a <option>message</option> modifier is literal; any quotes are taken as
50696 literals, but because the string is expanded, backslash escapes are processed
50697 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
50698 response.
50699 </para>
50700 <para>
50701 <indexterm role="variable">
50702 <primary><varname>$acl_verify_message</varname></primary>
50703 </indexterm>
50704 If <option>message</option> is used on a statement that verifies an address, the message
50705 specified overrides any message that is generated by the verification process.
50706 However, the original message is available in the variable
50707 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
50708 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
50709 routers to be passed back as part of the SMTP response, you should either not
50710 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
50711 </para>
50712 <para>
50713 For compatibility with previous releases of Exim, a <option>message</option> modifier that
50714 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
50715 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
50716 all the conditions are true, wherever it appears in an ACL command, whereas
50717 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
50718 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
50719 effect.
50720 </para>
50721 </listitem></varlistentry>
50722 <varlistentry>
50723 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
50724 <listitem>
50725 <para>
50726 <indexterm role="concept">
50727 <primary><option>set</option> ACL modifier</primary>
50728 </indexterm>
50729 This modifier puts a value into one of the ACL variables (see section
50730 <xref linkend="SECTaclvariables"/>).
50731 </para>
50732 </listitem></varlistentry>
50733 </variablelist>
50734 </section>
50735 <section id="SECTcontrols">
50736 <title>Use of the control modifier</title>
50737 <para>
50738 <indexterm role="concept">
50739 <primary><option>control</option> ACL modifier</primary>
50740 </indexterm>
50741 The <option>control</option> modifier supports the following settings:
50742 </para>
50743 <variablelist>
50744 <varlistentry>
50745 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
50746 <listitem>
50747 <para>
50748 This modifier allows a client host to use the SMTP AUTH command even when it
50749 has not been advertised in response to EHLO. Furthermore, because there are
50750 apparently some really broken clients that do this, Exim will accept AUTH after
50751 HELO (rather than EHLO) when this control is set. It should be used only if you
50752 really need it, and you should limit its use to those broken clients that do
50753 not work without it. For example:
50754 </para>
50755 <literallayout class="monospaced">
50756 warn hosts   = 192.168.34.25
50757      control = allow_auth_unadvertised
50758 </literallayout>
50759 <para>
50760 Normally, when an Exim server receives an AUTH command, it checks the name of
50761 the authentication mechanism that is given in the command to ensure that it
50762 matches an advertised mechanism. When this control is set, the check that a
50763 mechanism has been advertised is bypassed. Any configured mechanism can be used
50764 by the client. This control is permitted only in the connection and HELO ACLs.
50765 </para>
50766 </listitem></varlistentry>
50767 <varlistentry>
50768 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
50769 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
50770 <listitem>
50771 <para>
50772 <indexterm role="concept">
50773 <primary>access control lists (ACLs)</primary>
50774 <secondary>case of local part in</secondary>
50775 </indexterm>
50776 <indexterm role="concept">
50777 <primary>case of local parts</primary>
50778 </indexterm>
50779 <indexterm role="variable">
50780 <primary><varname>$local_part</varname></primary>
50781 </indexterm>
50782 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
50783 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
50784 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
50785 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
50786 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
50787 is encountered.
50788 </para>
50789 <para>
50790 These controls affect only the current recipient. Moreover, they apply only to
50791 local part handling that takes place directly in the ACL (for example, as a key
50792 in lookups). If a test to verify the recipient is obeyed, the case-related
50793 handling of the local part during the verification is controlled by the router
50794 configuration (see the <option>caseful_local_part</option> generic router option).
50795 </para>
50796 <para>
50797 This facility could be used, for example, to add a spam score to local parts
50798 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
50799 spam score:
50800 </para>
50801 <literallayout class="monospaced">
50802 warn  control = caseful_local_part
50803       set acl_m4 = ${eval:\
50804                      $acl_m4 + \
50805                      ${if match{$local_part}{[A-Z]}{1}{0}}\
50806                     }
50807       control = caselower_local_part
50808 </literallayout>
50809 <para>
50810 Notice that we put back the lower cased version afterwards, assuming that
50811 is what is wanted for subsequent tests.
50812 </para>
50813 </listitem></varlistentry>
50814 <varlistentry>
50815 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50816 <listitem>
50817 <para>
50818 <indexterm role="concept">
50819 <primary>access control lists (ACLs)</primary>
50820 <secondary>enabling debug logging</secondary>
50821 </indexterm>
50822 <indexterm role="concept">
50823 <primary>debugging</primary>
50824 <secondary>enabling from an ACL</secondary>
50825 </indexterm>
50826 This control turns on debug logging, almost as though Exim had been invoked
50827 with <literal>-d</literal>, with the output going to a new logfile, by default called
50828 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
50829 may access any variables already defined.  The logging may be adjusted with
50830 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
50831 option.  Some examples (which depend on variables that don&#x2019;t exist in all
50832 contexts):
50833 </para>
50834 <literallayout class="monospaced">
50835       control = debug
50836       control = debug/tag=.$sender_host_address
50837       control = debug/opts=+expand+acl
50838       control = debug/tag=.$message_exim_id/opts=+expand
50839 </literallayout>
50840 </listitem></varlistentry>
50841 <varlistentry>
50842 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
50843 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
50844 <listitem>
50845 <para>
50846 <indexterm role="concept">
50847 <primary>SMTP</primary>
50848 <secondary>synchronization checking</secondary>
50849 </indexterm>
50850 <indexterm role="concept">
50851 <primary>synchronization checking in SMTP</primary>
50852 </indexterm>
50853 These controls make it possible to be selective about when SMTP synchronization
50854 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
50855 state of the switch (it is true by default). See the description of this option
50856 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
50857 </para>
50858 <para>
50859 The effect of these two controls lasts for the remainder of the SMTP
50860 connection. They can appear in any ACL except the one for the non-SMTP
50861 messages. The most straightforward place to put them is in the ACL defined by
50862 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
50863 before the first synchronization check. The expected use is to turn off the
50864 synchronization checks for badly-behaved hosts that you nevertheless need to
50865 work with.
50866 </para>
50867 </listitem></varlistentry>
50868 <varlistentry>
50869 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
50870 <listitem>
50871 <para>
50872 <indexterm role="concept">
50873 <primary>fake defer</primary>
50874 </indexterm>
50875 <indexterm role="concept">
50876 <primary>defer, fake</primary>
50877 </indexterm>
50878 This control works in exactly the same way as <option>fakereject</option> (described below)
50879 except that it causes an SMTP 450 response after the message data instead of a
50880 550 response. You must take care when using <option>fakedefer</option> because it causes the
50881 messages to be duplicated when the sender retries. Therefore, you should not
50882 use <option>fakedefer</option> if the message is to be delivered normally.
50883 </para>
50884 </listitem></varlistentry>
50885 <varlistentry>
50886 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
50887 <listitem>
50888 <para>
50889 <indexterm role="concept">
50890 <primary>fake rejection</primary>
50891 </indexterm>
50892 <indexterm role="concept">
50893 <primary>rejection, fake</primary>
50894 </indexterm>
50895 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
50896 words, only when an SMTP message is being received. If Exim accepts the
50897 message, instead the final 250 response, a 550 rejection message is sent.
50898 However, Exim proceeds to deliver the message as normal. The control applies
50899 only to the current message, not to any subsequent ones that may be received in
50900 the same SMTP connection.
50901 </para>
50902 <para>
50903 The text for the 550 response is taken from the <option>control</option> modifier. If no
50904 message is supplied, the following is used:
50905 </para>
50906 <literallayout class="monospaced">
50907 550-Your message has been rejected but is being
50908 550-kept for evaluation.
50909 550-If it was a legitimate message, it may still be
50910 550 delivered to the target recipient(s).
50911 </literallayout>
50912 <para>
50913 This facility should be used with extreme caution.
50914 </para>
50915 </listitem></varlistentry>
50916 <varlistentry>
50917 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
50918 <listitem>
50919 <para>
50920 <indexterm role="concept">
50921 <primary>frozen messages</primary>
50922 <secondary>forcing in ACL</secondary>
50923 </indexterm>
50924 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
50925 other words, only when a message is being received. If the message is accepted,
50926 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
50927 current message, not to any subsequent ones that may be received in the same
50928 SMTP connection.
50929 </para>
50930 <para>
50931 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
50932 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
50933 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
50934 are obeyed for the current message have the <literal>/no_tell</literal> option.
50935 </para>
50936 </listitem></varlistentry>
50937 <varlistentry>
50938 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
50939 <listitem>
50940 <para>
50941 <indexterm role="concept">
50942 <primary>SMTP</primary>
50943 <secondary>output flushing, disabling for delay</secondary>
50944 </indexterm>
50945 Exim normally flushes SMTP output before implementing a delay in an ACL, to
50946 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
50947 use. This control, as long as it is encountered before the <option>delay</option> modifier,
50948 disables such output flushing.
50949 </para>
50950 </listitem></varlistentry>
50951 <varlistentry>
50952 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
50953 <listitem>
50954 <para>
50955 <indexterm role="concept">
50956 <primary>SMTP</primary>
50957 <secondary>output flushing, disabling for callout</secondary>
50958 </indexterm>
50959 Exim normally flushes SMTP output before performing a callout in an ACL, to
50960 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
50961 use. This control, as long as it is encountered before the <option>verify</option> condition
50962 that causes the callout, disables such output flushing.
50963 </para>
50964 </listitem></varlistentry>
50965 <varlistentry>
50966 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
50967 <listitem>
50968 <para>
50969 This control is available when Exim is compiled with the content scanning
50970 extension. Content scanning may require a copy of the current message, or parts
50971 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
50972 or spam scanner. Normally, such copies are deleted when they are no longer
50973 needed. If this control is set, the copies are not deleted. The control applies
50974 only to the current message, not to any subsequent ones that may be received in
50975 the same SMTP connection. It is provided for debugging purposes and is unlikely
50976 to be useful in production.
50977 </para>
50978 </listitem></varlistentry>
50979 <varlistentry>
50980 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
50981 <listitem>
50982 <para>
50983 <indexterm role="concept">
50984 <primary>multiline responses, suppressing</primary>
50985 </indexterm>
50986 This control is permitted for any ACL except the one for non-SMTP messages.
50987 It seems that there are broken clients in use that cannot handle multiline
50988 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
50989 </para>
50990 <para>
50991 If this control is set, multiline SMTP responses from ACL rejections are
50992 suppressed. One way of doing this would have been to put out these responses as
50993 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
50994 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
50995 responses might get close to that. So this facility, which is after all only a
50996 sop to broken clients, is implemented by doing two very easy things:
50997 </para>
50998 <itemizedlist>
50999 <listitem>
51000 <para>
51001 Extra information that is normally output as part of a rejection caused by
51002 sender verification failure is omitted. Only the final line (typically <quote>sender
51003 verification failed</quote>) is sent.
51004 </para>
51005 </listitem>
51006 <listitem>
51007 <para>
51008 If a <option>message</option> modifier supplies a multiline response, only the first
51009 line is output.
51010 </para>
51011 </listitem>
51012 </itemizedlist>
51013 <para>
51014 The setting of the switch can, of course, be made conditional on the
51015 calling host. Its effect lasts until the end of the SMTP connection.
51016 </para>
51017 </listitem></varlistentry>
51018 <varlistentry>
51019 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
51020 <listitem>
51021 <para>
51022 <indexterm role="concept">
51023 <primary>PIPELINING</primary>
51024 <secondary>suppressing advertising</secondary>
51025 </indexterm>
51026 This control turns off the advertising of the PIPELINING extension to SMTP in
51027 the current session. To be useful, it must be obeyed before Exim sends its
51028 response to an EHLO command. Therefore, it should normally appear in an ACL
51029 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
51030 <option>pipelining_advertise_hosts</option>.
51031 </para>
51032 </listitem></varlistentry>
51033 <varlistentry>
51034 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
51035 <listitem>
51036 <para>
51037 <indexterm role="option">
51038 <primary><option>queue_only</option></primary>
51039 </indexterm>
51040 <indexterm role="concept">
51041 <primary>queueing incoming messages</primary>
51042 </indexterm>
51043 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
51044 other words, only when a message is being received. If the message is accepted,
51045 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
51046 runner. No immediate delivery process is started. In other words, it has the
51047 effect as the <option>queue_only</option> global option. However, the control applies only
51048 to the current message, not to any subsequent ones that may be received in the
51049 same SMTP connection.
51050 </para>
51051 </listitem></varlistentry>
51052 <varlistentry>
51053 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
51054 <listitem>
51055 <para>
51056 <indexterm role="concept">
51057 <primary>message</primary>
51058 <secondary>submission</secondary>
51059 </indexterm>
51060 <indexterm role="concept">
51061 <primary>submission mode</primary>
51062 </indexterm>
51063 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
51064 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
51065 the current message is a submission from a local MUA. In this case, Exim
51066 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
51067 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
51068 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
51069 late (the message has already been created).
51070 </para>
51071 <para>
51072 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
51073 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
51074 submission mode; the available options for this control are described there.
51075 The control applies only to the current message, not to any subsequent ones
51076 that may be received in the same SMTP connection.
51077 </para>
51078 </listitem></varlistentry>
51079 <varlistentry>
51080 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
51081 <listitem>
51082 <para>
51083 <indexterm role="concept">
51084 <primary>submission fixups, suppressing</primary>
51085 </indexterm>
51086 This control applies to locally submitted (non TCP/IP) messages, and is the
51087 complement of <literal>control = submission</literal>. It disables the fixups that are
51088 normally applied to locally-submitted messages. Specifically:
51089 </para>
51090 <itemizedlist>
51091 <listitem>
51092 <para>
51093 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
51094 dynamic version of <option>local_sender_retain</option>).
51095 </para>
51096 </listitem>
51097 <listitem>
51098 <para>
51099 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
51100 </para>
51101 </listitem>
51102 <listitem>
51103 <para>
51104 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
51105 </para>
51106 </listitem>
51107 </itemizedlist>
51108 <para>
51109 This control may be useful when a remotely-originated message is accepted,
51110 passed to some scanning program, and then re-submitted for delivery. It can be
51111 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
51112 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
51113 data is read.
51114 </para>
51115 <para>
51116 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
51117 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
51118 </para>
51119 </listitem></varlistentry>
51120 </variablelist>
51121 </section>
51122 <section id="SECTsummesfix">
51123 <title>Summary of message fixup control</title>
51124 <para>
51125 All four possibilities for message fixups can be specified:
51126 </para>
51127 <itemizedlist>
51128 <listitem>
51129 <para>
51130 Locally submitted, fixups applied: the default.
51131 </para>
51132 </listitem>
51133 <listitem>
51134 <para>
51135 Locally submitted, no fixups applied: use
51136 <literal>control = suppress_local_fixups</literal>.
51137 </para>
51138 </listitem>
51139 <listitem>
51140 <para>
51141 Remotely submitted, no fixups applied: the default.
51142 </para>
51143 </listitem>
51144 <listitem>
51145 <para>
51146 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
51147 </para>
51148 </listitem>
51149 </itemizedlist>
51150 </section>
51151 <section id="SECTaddheadacl">
51152 <title>Adding header lines in ACLs</title>
51153 <para>
51154 <indexterm role="concept">
51155 <primary>header lines</primary>
51156 <secondary>adding in an ACL</secondary>
51157 </indexterm>
51158 <indexterm role="concept">
51159 <primary>header lines</primary>
51160 <secondary>position of added lines</secondary>
51161 </indexterm>
51162 <indexterm role="concept">
51163 <primary><option>message</option> ACL modifier</primary>
51164 </indexterm>
51165 The <option>add_header</option> modifier can be used to add one or more extra header lines
51166 to an incoming message, as in this example:
51167 </para>
51168 <literallayout class="monospaced">
51169 warn dnslists = sbl.spamhaus.org : \
51170                 dialup.mail-abuse.org
51171      add_header = X-blacklisted-at: $dnslist_domain
51172 </literallayout>
51173 <para>
51174 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
51175 MIME, and non-SMTP ACLs (in other words, those that are concerned with
51176 receiving a message). The message must ultimately be accepted for
51177 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
51178 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
51179 RCPT ACL).
51180 </para>
51181 <para>
51182 If the data for the <option>add_header</option> modifier contains one or more newlines that
51183 are not followed by a space or a tab, it is assumed to contain multiple header
51184 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
51185 front of any line that is not a valid header line.
51186 </para>
51187 <para>
51188 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
51189 They are added to the message before processing the DATA and MIME ACLs.
51190 However, if an identical header line is requested more than once, only one copy
51191 is actually added to the message. Further header lines may be accumulated
51192 during the DATA and MIME ACLs, after which they are added to the message, again
51193 with duplicates suppressed. Thus, it is possible to add two identical header
51194 lines to an SMTP message, but only if one is added before DATA and one after.
51195 In the case of non-SMTP messages, new headers are accumulated during the
51196 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
51197 message is rejected after DATA or by the non-SMTP ACL, all added header lines
51198 are included in the entry that is written to the reject log.
51199 </para>
51200 <para>
51201 <indexterm role="concept">
51202 <primary>header lines</primary>
51203 <secondary>added; visibility of</secondary>
51204 </indexterm>
51205 Header lines are not visible in string expansions until they are added to the
51206 message. It follows that header lines defined in the MAIL, RCPT, and predata
51207 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
51208 header lines that are added by the DATA or MIME ACLs are not visible in those
51209 ACLs. Because of this restriction, you cannot use header lines as a way of
51210 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
51211 this, you can use ACL variables, as described in section
51212 <xref linkend="SECTaclvariables"/>.
51213 </para>
51214 <para>
51215 The <option>add_header</option> modifier acts immediately it is encountered during the
51216 processing of an ACL. Notice the difference between these two cases:
51217 </para>
51218 <literallayout>
51219 <literal>accept add_header = ADDED: some text</literal>
51220 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
51221
51222 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
51223 <literal>       add_header = ADDED: some text</literal>
51224 </literallayout>
51225 <para>
51226 In the first case, the header line is always added, whether or not the
51227 condition is true. In the second case, the header line is added only if the
51228 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
51229 ACL statement. All those that are encountered before a condition fails are
51230 honoured.
51231 </para>
51232 <para>
51233 <indexterm role="concept">
51234 <primary><option>warn</option> ACL verb</primary>
51235 </indexterm>
51236 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
51237 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
51238 effect only if all the conditions are true, even if it appears before some of
51239 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
51240 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
51241 are present on a <option>warn</option> verb, both are processed according to their
51242 specifications.
51243 </para>
51244 <para>
51245 By default, new header lines are added to a message at the end of the existing
51246 header lines. However, you can specify that any particular header line should
51247 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
51248 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
51249 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
51250 </para>
51251 <para>
51252 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
51253 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
51254 header line, respectively. (Header text cannot start with a colon, as there has
51255 to be a header name first.) For example:
51256 </para>
51257 <literallayout class="monospaced">
51258 warn add_header = \
51259        :after_received:X-My-Header: something or other...
51260 </literallayout>
51261 <para>
51262 If more than one header line is supplied in a single <option>add_header</option> modifier,
51263 each one is treated independently and can therefore be placed differently. If
51264 you add more than one line at the start, or after the Received: block, they end
51265 up in reverse order.
51266 </para>
51267 <para>
51268 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
51269 added in an ACL. It does NOT work for header lines that are added in a
51270 system filter or in a router or transport.
51271 </para>
51272 </section>
51273 <section id="SECTaclconditions">
51274 <title>ACL conditions</title>
51275 <para>
51276 <indexterm role="concept">
51277 <primary>access control lists (ACLs)</primary>
51278 <secondary>conditions; list of</secondary>
51279 </indexterm>
51280 Some of conditions listed in this section are available only when Exim is
51281 compiled with the content-scanning extension. They are included here briefly
51282 for completeness. More detailed descriptions can be found in the discussion on
51283 content scanning in chapter <xref linkend="CHAPexiscan"/>.
51284 </para>
51285 <para>
51286 Not all conditions are relevant in all circumstances. For example, testing
51287 senders and recipients does not make sense in an ACL that is being run as the
51288 result of the arrival of an ETRN command, and checks on message headers can be
51289 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
51290 can use the same condition (with different parameters) more than once in the
51291 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
51292 The conditions are as follows:
51293 </para>
51294 <variablelist>
51295 <varlistentry>
51296 <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>
51297 <listitem>
51298 <para>
51299 <indexterm role="concept">
51300 <primary>access control lists (ACLs)</primary>
51301 <secondary>nested</secondary>
51302 </indexterm>
51303 <indexterm role="concept">
51304 <primary>access control lists (ACLs)</primary>
51305 <secondary>indirect</secondary>
51306 </indexterm>
51307 <indexterm role="concept">
51308 <primary><option>acl</option> ACL condition</primary>
51309 </indexterm>
51310 The possible values of the argument are the same as for the
51311 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
51312 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
51313 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
51314 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
51315 condition false. This means that further processing of the <option>warn</option> verb
51316 ceases, but processing of the ACL continues.
51317 </para>
51318 <para>
51319 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
51320 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
51321 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
51322 conditions are tested.
51323 </para>
51324 <para>
51325 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
51326 loops. This condition allows you to use different ACLs in different
51327 circumstances. For example, different ACLs can be used to handle RCPT commands
51328 for different local users or different local domains.
51329 </para>
51330 </listitem></varlistentry>
51331 <varlistentry>
51332 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
51333 <listitem>
51334 <para>
51335 <indexterm role="concept">
51336 <primary><option>authenticated</option> ACL condition</primary>
51337 </indexterm>
51338 <indexterm role="concept">
51339 <primary>authentication</primary>
51340 <secondary>ACL checking</secondary>
51341 </indexterm>
51342 <indexterm role="concept">
51343 <primary>access control lists (ACLs)</primary>
51344 <secondary>testing for authentication</secondary>
51345 </indexterm>
51346 If the SMTP connection is not authenticated, the condition is false. Otherwise,
51347 the name of the authenticator is tested against the list. To test for
51348 authentication by any authenticator, you can set
51349 </para>
51350 <literallayout class="monospaced">
51351 authenticated = *
51352 </literallayout>
51353 </listitem></varlistentry>
51354 <varlistentry>
51355 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
51356 <listitem>
51357 <para>
51358 <indexterm role="concept">
51359 <primary><option>condition</option> ACL condition</primary>
51360 </indexterm>
51361 <indexterm role="concept">
51362 <primary>customizing</primary>
51363 <secondary>ACL condition</secondary>
51364 </indexterm>
51365 <indexterm role="concept">
51366 <primary>access control lists (ACLs)</primary>
51367 <secondary>customized test</secondary>
51368 </indexterm>
51369 <indexterm role="concept">
51370 <primary>access control lists (ACLs)</primary>
51371 <secondary>testing, customized</secondary>
51372 </indexterm>
51373 This feature allows you to make up custom conditions. If the result of
51374 expanding the string is an empty string, the number zero, or one of the strings
51375 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
51376 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
51377 any other value, some error is assumed to have occurred, and the ACL returns
51378 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
51379 ignored. The effect is to treat it as true, whether it is positive or
51380 negative.
51381 </para>
51382 </listitem></varlistentry>
51383 <varlistentry>
51384 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
51385 <listitem>
51386 <para>
51387 <indexterm role="concept">
51388 <primary><option>decode</option> ACL condition</primary>
51389 </indexterm>
51390 This condition is available only when Exim is compiled with the
51391 content-scanning extension, and it is allowed only in the ACL defined by
51392 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
51393 If all goes well, the condition is true. It is false only if there are
51394 problems such as a syntax error or a memory shortage. For more details, see
51395 chapter <xref linkend="CHAPexiscan"/>.
51396 </para>
51397 </listitem></varlistentry>
51398 <varlistentry>
51399 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
51400 <listitem>
51401 <para>
51402 <indexterm role="concept">
51403 <primary><option>demime</option> ACL condition</primary>
51404 </indexterm>
51405 This condition is available only when Exim is compiled with the
51406 content-scanning extension. Its use is described in section
51407 <xref linkend="SECTdemimecond"/>.
51408 </para>
51409 </listitem></varlistentry>
51410 <varlistentry>
51411 <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>
51412 <listitem>
51413 <para>
51414 <indexterm role="concept">
51415 <primary><option>dnslists</option> ACL condition</primary>
51416 </indexterm>
51417 <indexterm role="concept">
51418 <primary>DNS list</primary>
51419 <secondary>in ACL</secondary>
51420 </indexterm>
51421 <indexterm role="concept">
51422 <primary>black list (DNS)</primary>
51423 </indexterm>
51424 <indexterm role="concept">
51425 <primary>access control lists (ACLs)</primary>
51426 <secondary>testing a DNS list</secondary>
51427 </indexterm>
51428 This condition checks for entries in DNS black lists. These are also known as
51429 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
51430 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
51431 different variants of this condition to describe briefly here. See sections
51432 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
51433 </para>
51434 </listitem></varlistentry>
51435 <varlistentry>
51436 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
51437 <listitem>
51438 <para>
51439 <indexterm role="concept">
51440 <primary><option>domains</option> ACL condition</primary>
51441 </indexterm>
51442 <indexterm role="concept">
51443 <primary>domain</primary>
51444 <secondary>ACL checking</secondary>
51445 </indexterm>
51446 <indexterm role="concept">
51447 <primary>access control lists (ACLs)</primary>
51448 <secondary>testing a recipient domain</secondary>
51449 </indexterm>
51450 <indexterm role="variable">
51451 <primary><varname>$domain_data</varname></primary>
51452 </indexterm>
51453 This condition is relevant only after a RCPT command. It checks that the domain
51454 of the recipient address is in the domain list. If percent-hack processing is
51455 enabled, it is done before this test is done. If the check succeeds with a
51456 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
51457 <option>domains</option> test.
51458 </para>
51459 <para>
51460 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
51461 use <option>domains</option> in a DATA ACL.
51462 </para>
51463 </listitem></varlistentry>
51464 <varlistentry>
51465 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
51466 <listitem>
51467 <para>
51468 <indexterm role="concept">
51469 <primary><option>encrypted</option> ACL condition</primary>
51470 </indexterm>
51471 <indexterm role="concept">
51472 <primary>encryption</primary>
51473 <secondary>checking in an ACL</secondary>
51474 </indexterm>
51475 <indexterm role="concept">
51476 <primary>access control lists (ACLs)</primary>
51477 <secondary>testing for encryption</secondary>
51478 </indexterm>
51479 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
51480 name of the cipher suite in use is tested against the list. To test for
51481 encryption without testing for any specific cipher suite(s), set
51482 </para>
51483 <literallayout class="monospaced">
51484 encrypted = *
51485 </literallayout>
51486 </listitem></varlistentry>
51487 <varlistentry>
51488 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
51489 <listitem>
51490 <para>
51491 <indexterm role="concept">
51492 <primary><option>hosts</option> ACL condition</primary>
51493 </indexterm>
51494 <indexterm role="concept">
51495 <primary>host</primary>
51496 <secondary>ACL checking</secondary>
51497 </indexterm>
51498 <indexterm role="concept">
51499 <primary>access control lists (ACLs)</primary>
51500 <secondary>testing the client host</secondary>
51501 </indexterm>
51502 This condition tests that the calling host matches the host list. If you have
51503 name lookups or wildcarded host names and IP addresses in the same host list,
51504 you should normally put the IP addresses first. For example, you could have:
51505 </para>
51506 <literallayout class="monospaced">
51507 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
51508 </literallayout>
51509 <para>
51510 The lookup in this example uses the host name for its key. This is implied by
51511 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
51512 and it wouldn&#x2019;t matter which way round you had these two items.)
51513 </para>
51514 <para>
51515 The reason for the problem with host names lies in the left-to-right way that
51516 Exim processes lists. It can test IP addresses without doing any DNS lookups,
51517 but when it reaches an item that requires a host name, it fails if it cannot
51518 find a host name to compare with the pattern. If the above list is given in the
51519 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
51520 found, even if its IP address is 10.9.8.7.
51521 </para>
51522 <para>
51523 If you really do want to do the name check first, and still recognize the IP
51524 address even if the name lookup fails, you can rewrite the ACL like this:
51525 </para>
51526 <literallayout class="monospaced">
51527 accept hosts = dbm;/etc/friendly/hosts
51528 accept hosts = 10.9.8.7
51529 </literallayout>
51530 <para>
51531 The default action on failing to find the host name is to assume that the host
51532 is not in the list, so the first <option>accept</option> statement fails. The second
51533 statement can then check the IP address.
51534 </para>
51535 <para>
51536 <indexterm role="variable">
51537 <primary><varname>$host_data</varname></primary>
51538 </indexterm>
51539 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
51540 of the lookup is made available in the <varname>$host_data</varname> variable. This
51541 allows you, for example, to set up a statement like this:
51542 </para>
51543 <literallayout class="monospaced">
51544 deny  hosts = net-lsearch;/some/file
51545 message = $host_data
51546 </literallayout>
51547 <para>
51548 which gives a custom error message for each denied host.
51549 </para>
51550 </listitem></varlistentry>
51551 <varlistentry>
51552 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
51553 <listitem>
51554 <para>
51555 <indexterm role="concept">
51556 <primary><option>local_parts</option> ACL condition</primary>
51557 </indexterm>
51558 <indexterm role="concept">
51559 <primary>local part</primary>
51560 <secondary>ACL checking</secondary>
51561 </indexterm>
51562 <indexterm role="concept">
51563 <primary>access control lists (ACLs)</primary>
51564 <secondary>testing a local part</secondary>
51565 </indexterm>
51566 <indexterm role="variable">
51567 <primary><varname>$local_part_data</varname></primary>
51568 </indexterm>
51569 This condition is relevant only after a RCPT command. It checks that the local
51570 part of the recipient address is in the list. If percent-hack processing is
51571 enabled, it is done before this test. If the check succeeds with a lookup, the
51572 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
51573 the next <option>local_parts</option> test.
51574 </para>
51575 </listitem></varlistentry>
51576 <varlistentry>
51577 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
51578 <listitem>
51579 <para>
51580 <indexterm role="concept">
51581 <primary><option>malware</option> ACL condition</primary>
51582 </indexterm>
51583 <indexterm role="concept">
51584 <primary>access control lists (ACLs)</primary>
51585 <secondary>virus scanning</secondary>
51586 </indexterm>
51587 <indexterm role="concept">
51588 <primary>access control lists (ACLs)</primary>
51589 <secondary>scanning for viruses</secondary>
51590 </indexterm>
51591 This condition is available only when Exim is compiled with the
51592 content-scanning extension. It causes the incoming message to be scanned for
51593 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
51594 </para>
51595 </listitem></varlistentry>
51596 <varlistentry>
51597 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
51598 <listitem>
51599 <para>
51600 <indexterm role="concept">
51601 <primary><option>mime_regex</option> ACL condition</primary>
51602 </indexterm>
51603 <indexterm role="concept">
51604 <primary>access control lists (ACLs)</primary>
51605 <secondary>testing by regex matching</secondary>
51606 </indexterm>
51607 This condition is available only when Exim is compiled with the
51608 content-scanning extension, and it is allowed only in the ACL defined by
51609 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
51610 with any of the regular expressions. For details, see chapter
51611 <xref linkend="CHAPexiscan"/>.
51612 </para>
51613 </listitem></varlistentry>
51614 <varlistentry>
51615 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
51616 <listitem>
51617 <para>
51618 <indexterm role="concept">
51619 <primary>rate limiting</primary>
51620 </indexterm>
51621 This condition can be used to limit the rate at which a user or host submits
51622 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
51623 </para>
51624 </listitem></varlistentry>
51625 <varlistentry>
51626 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
51627 <listitem>
51628 <para>
51629 <indexterm role="concept">
51630 <primary><option>recipients</option> ACL condition</primary>
51631 </indexterm>
51632 <indexterm role="concept">
51633 <primary>recipient</primary>
51634 <secondary>ACL checking</secondary>
51635 </indexterm>
51636 <indexterm role="concept">
51637 <primary>access control lists (ACLs)</primary>
51638 <secondary>testing a recipient</secondary>
51639 </indexterm>
51640 This condition is relevant only after a RCPT command. It checks the entire
51641 recipient address against a list of recipients.
51642 </para>
51643 </listitem></varlistentry>
51644 <varlistentry>
51645 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
51646 <listitem>
51647 <para>
51648 <indexterm role="concept">
51649 <primary><option>regex</option> ACL condition</primary>
51650 </indexterm>
51651 <indexterm role="concept">
51652 <primary>access control lists (ACLs)</primary>
51653 <secondary>testing by regex matching</secondary>
51654 </indexterm>
51655 This condition is available only when Exim is compiled with the
51656 content-scanning extension, and is available only in the DATA, MIME, and
51657 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
51658 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
51659 </para>
51660 </listitem></varlistentry>
51661 <varlistentry>
51662 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
51663 <listitem>
51664 <para>
51665 <indexterm role="concept">
51666 <primary><option>sender_domains</option> ACL condition</primary>
51667 </indexterm>
51668 <indexterm role="concept">
51669 <primary>sender</primary>
51670 <secondary>ACL checking</secondary>
51671 </indexterm>
51672 <indexterm role="concept">
51673 <primary>access control lists (ACLs)</primary>
51674 <secondary>testing a sender domain</secondary>
51675 </indexterm>
51676 <indexterm role="variable">
51677 <primary><varname>$domain</varname></primary>
51678 </indexterm>
51679 <indexterm role="variable">
51680 <primary><varname>$sender_address_domain</varname></primary>
51681 </indexterm>
51682 This condition tests the domain of the sender of the message against the given
51683 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
51684 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
51685 of this condition. This is an exception to the general rule for testing domain
51686 lists. It is done this way so that, if this condition is used in an ACL for a
51687 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
51688 influence the sender checking.
51689 </para>
51690 <para>
51691 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
51692 relaying, because sender addresses are easily, and commonly, forged.
51693 </para>
51694 </listitem></varlistentry>
51695 <varlistentry>
51696 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
51697 <listitem>
51698 <para>
51699 <indexterm role="concept">
51700 <primary><option>senders</option> ACL condition</primary>
51701 </indexterm>
51702 <indexterm role="concept">
51703 <primary>sender</primary>
51704 <secondary>ACL checking</secondary>
51705 </indexterm>
51706 <indexterm role="concept">
51707 <primary>access control lists (ACLs)</primary>
51708 <secondary>testing a sender</secondary>
51709 </indexterm>
51710 This condition tests the sender of the message against the given list. To test
51711 for a bounce message, which has an empty sender, set
51712 </para>
51713 <literallayout class="monospaced">
51714 senders = :
51715 </literallayout>
51716 <para>
51717 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
51718 relaying, because sender addresses are easily, and commonly, forged.
51719 </para>
51720 </listitem></varlistentry>
51721 <varlistentry>
51722 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
51723 <listitem>
51724 <para>
51725 <indexterm role="concept">
51726 <primary><option>spam</option> ACL condition</primary>
51727 </indexterm>
51728 <indexterm role="concept">
51729 <primary>access control lists (ACLs)</primary>
51730 <secondary>scanning for spam</secondary>
51731 </indexterm>
51732 This condition is available only when Exim is compiled with the
51733 content-scanning extension. It causes the incoming message to be scanned by
51734 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
51735 </para>
51736 </listitem></varlistentry>
51737 <varlistentry>
51738 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
51739 <listitem>
51740 <para>
51741 <indexterm role="concept">
51742 <primary><option>verify</option> ACL condition</primary>
51743 </indexterm>
51744 <indexterm role="concept">
51745 <primary>TLS</primary>
51746 <secondary>client certificate verification</secondary>
51747 </indexterm>
51748 <indexterm role="concept">
51749 <primary>certificate</primary>
51750 <secondary>verification of client</secondary>
51751 </indexterm>
51752 <indexterm role="concept">
51753 <primary>access control lists (ACLs)</primary>
51754 <secondary>certificate verification</secondary>
51755 </indexterm>
51756 <indexterm role="concept">
51757 <primary>access control lists (ACLs)</primary>
51758 <secondary>testing a TLS certificate</secondary>
51759 </indexterm>
51760 This condition is true in an SMTP session if the session is encrypted, and a
51761 certificate was received from the client, and the certificate was verified. The
51762 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
51763 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
51764 </para>
51765 </listitem></varlistentry>
51766 <varlistentry>
51767 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
51768 <listitem>
51769 <para>
51770 <indexterm role="concept">
51771 <primary>CSA verification</primary>
51772 </indexterm>
51773 This condition checks whether the sending host (the client) is authorized to
51774 send email. Details of how this works are given in section
51775 <xref linkend="SECTverifyCSA"/>.
51776 </para>
51777 </listitem></varlistentry>
51778 <varlistentry>
51779 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
51780 <listitem>
51781 <para>
51782 <indexterm role="concept">
51783 <primary><option>verify</option> ACL condition</primary>
51784 </indexterm>
51785 <indexterm role="concept">
51786 <primary>access control lists (ACLs)</primary>
51787 <secondary>verifying sender in the header</secondary>
51788 </indexterm>
51789 <indexterm role="concept">
51790 <primary>header lines</primary>
51791 <secondary>verifying the sender in</secondary>
51792 </indexterm>
51793 <indexterm role="concept">
51794 <primary>sender</primary>
51795 <secondary>verifying in header</secondary>
51796 </indexterm>
51797 <indexterm role="concept">
51798 <primary>verifying</primary>
51799 <secondary>sender in header</secondary>
51800 </indexterm>
51801 This condition is relevant only in an ACL that is run after a message has been
51802 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
51803 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
51804 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
51805 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
51806 However, an address that appears in one of these headers need not be an address
51807 that accepts bounce messages; only sender addresses in envelopes are required
51808 to accept bounces. Therefore, if you use the callout option on this check, you
51809 might want to arrange for a non-empty address in the MAIL command.
51810 </para>
51811 <para>
51812 Details of address verification and the options are given later, starting at
51813 section <xref linkend="SECTaddressverification"/> (callouts are described in section
51814 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
51815 condition to restrict it to bounce messages only:
51816 </para>
51817 <literallayout class="monospaced">
51818 deny    senders = :
51819         message = A valid sender header is required for bounces
51820        !verify  = header_sender
51821 </literallayout>
51822 </listitem></varlistentry>
51823 <varlistentry>
51824 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
51825 <listitem>
51826 <para>
51827 <indexterm role="concept">
51828 <primary><option>verify</option> ACL condition</primary>
51829 </indexterm>
51830 <indexterm role="concept">
51831 <primary>access control lists (ACLs)</primary>
51832 <secondary>verifying header syntax</secondary>
51833 </indexterm>
51834 <indexterm role="concept">
51835 <primary>header lines</primary>
51836 <secondary>verifying syntax</secondary>
51837 </indexterm>
51838 <indexterm role="concept">
51839 <primary>verifying</primary>
51840 <secondary>header syntax</secondary>
51841 </indexterm>
51842 This condition is relevant only in an ACL that is run after a message has been
51843 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
51844 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
51845 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
51846 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
51847 permitted only in locally generated messages and from hosts that match
51848 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
51849 appropriate.
51850 </para>
51851 <para>
51852 Note that this condition is a syntax check only. However, a common spamming
51853 ploy used to be to send syntactically invalid headers such as
51854 </para>
51855 <literallayout class="monospaced">
51856 To: @
51857 </literallayout>
51858 <para>
51859 and this condition can be used to reject such messages, though they are not as
51860 common as they used to be.
51861 </para>
51862 </listitem></varlistentry>
51863 <varlistentry>
51864 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
51865 <listitem>
51866 <para>
51867 <indexterm role="concept">
51868 <primary><option>verify</option> ACL condition</primary>
51869 </indexterm>
51870 <indexterm role="concept">
51871 <primary>access control lists (ACLs)</primary>
51872 <secondary>verifying HELO/EHLO</secondary>
51873 </indexterm>
51874 <indexterm role="concept">
51875 <primary>HELO</primary>
51876 <secondary>verifying</secondary>
51877 </indexterm>
51878 <indexterm role="concept">
51879 <primary>EHLO</primary>
51880 <secondary>verifying</secondary>
51881 </indexterm>
51882 <indexterm role="concept">
51883 <primary>verifying</primary>
51884 <secondary>EHLO</secondary>
51885 </indexterm>
51886 <indexterm role="concept">
51887 <primary>verifying</primary>
51888 <secondary>HELO</secondary>
51889 </indexterm>
51890 This condition is true if a HELO or EHLO command has been received from the
51891 client host, and its contents have been verified. If there has been no previous
51892 attempt to verify the HELO/EHLO contents, it is carried out when this
51893 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
51894 <option>helo_try_verify_hosts</option> options for details of how to request verification
51895 independently of this condition.
51896 </para>
51897 <para>
51898 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
51899 option), this condition is always true.
51900 </para>
51901 </listitem></varlistentry>
51902 <varlistentry>
51903 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
51904 <listitem>
51905 <para>
51906 <indexterm role="concept">
51907 <primary>verifying</primary>
51908 <secondary>not blind</secondary>
51909 </indexterm>
51910 <indexterm role="concept">
51911 <primary>bcc recipients, verifying none</primary>
51912 </indexterm>
51913 This condition checks that there are no blind (bcc) recipients in the message.
51914 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
51915 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
51916 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
51917 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
51918 used only in a DATA or non-SMTP ACL.
51919 </para>
51920 <para>
51921 There are, of course, many legitimate messages that make use of blind (bcc)
51922 recipients. This check should not be used on its own for blocking messages.
51923 </para>
51924 </listitem></varlistentry>
51925 <varlistentry>
51926 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
51927 <listitem>
51928 <para>
51929 <indexterm role="concept">
51930 <primary><option>verify</option> ACL condition</primary>
51931 </indexterm>
51932 <indexterm role="concept">
51933 <primary>access control lists (ACLs)</primary>
51934 <secondary>verifying recipient</secondary>
51935 </indexterm>
51936 <indexterm role="concept">
51937 <primary>recipient</primary>
51938 <secondary>verifying</secondary>
51939 </indexterm>
51940 <indexterm role="concept">
51941 <primary>verifying</primary>
51942 <secondary>recipient</secondary>
51943 </indexterm>
51944 <indexterm role="variable">
51945 <primary><varname>$address_data</varname></primary>
51946 </indexterm>
51947 This condition is relevant only after a RCPT command. It verifies the current
51948 recipient. Details of address verification are given later, starting at section
51949 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
51950 of <varname>$address_data</varname> is the last value that was set while routing the address.
51951 This applies even if the verification fails. When an address that is being
51952 verified is redirected to a single address, verification continues with the new
51953 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
51954 value for the child address.
51955 </para>
51956 </listitem></varlistentry>
51957 <varlistentry>
51958 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
51959 <listitem>
51960 <para>
51961 <indexterm role="concept">
51962 <primary><option>verify</option> ACL condition</primary>
51963 </indexterm>
51964 <indexterm role="concept">
51965 <primary>access control lists (ACLs)</primary>
51966 <secondary>verifying host reverse lookup</secondary>
51967 </indexterm>
51968 <indexterm role="concept">
51969 <primary>host</primary>
51970 <secondary>verifying reverse lookup</secondary>
51971 </indexterm>
51972 This condition ensures that a verified host name has been looked up from the IP
51973 address of the client host. (This may have happened already if the host name
51974 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
51975 Verification ensures that the host name obtained from a reverse DNS lookup, or
51976 one of its aliases, does, when it is itself looked up in the DNS, yield the
51977 original IP address.
51978 </para>
51979 <para>
51980 If this condition is used for a locally generated message (that is, when there
51981 is no client host involved), it always succeeds.
51982 </para>
51983 </listitem></varlistentry>
51984 <varlistentry>
51985 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
51986 <listitem>
51987 <para>
51988 <indexterm role="concept">
51989 <primary><option>verify</option> ACL condition</primary>
51990 </indexterm>
51991 <indexterm role="concept">
51992 <primary>access control lists (ACLs)</primary>
51993 <secondary>verifying sender</secondary>
51994 </indexterm>
51995 <indexterm role="concept">
51996 <primary>sender</primary>
51997 <secondary>verifying</secondary>
51998 </indexterm>
51999 <indexterm role="concept">
52000 <primary>verifying</primary>
52001 <secondary>sender</secondary>
52002 </indexterm>
52003 This condition is relevant only after a MAIL or RCPT command, or after a
52004 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
52005 the message&#x2019;s sender is empty (that is, this is a bounce message), the
52006 condition is true. Otherwise, the sender address is verified.
52007 </para>
52008 <para>
52009 <indexterm role="variable">
52010 <primary><varname>$address_data</varname></primary>
52011 </indexterm>
52012 <indexterm role="variable">
52013 <primary><varname>$sender_address_data</varname></primary>
52014 </indexterm>
52015 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
52016 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
52017 value can be used in subsequent conditions and modifiers in the same ACL
52018 statement. It does not persist after the end of the current statement. If you
52019 want to preserve the value for longer, you can save it in an ACL variable.
52020 </para>
52021 <para>
52022 Details of verification are given later, starting at section
52023 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
52024 to avoid doing it more than once per message.
52025 </para>
52026 </listitem></varlistentry>
52027 <varlistentry>
52028 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
52029 <listitem>
52030 <para>
52031 <indexterm role="concept">
52032 <primary><option>verify</option> ACL condition</primary>
52033 </indexterm>
52034 This is a variation of the previous option, in which a modified address is
52035 verified as a sender.
52036 </para>
52037 </listitem></varlistentry>
52038 </variablelist>
52039 </section>
52040 <section id="SECTmorednslists">
52041 <title>Using DNS lists</title>
52042 <para>
52043 <indexterm role="concept">
52044 <primary>DNS list</primary>
52045 <secondary>in ACL</secondary>
52046 </indexterm>
52047 <indexterm role="concept">
52048 <primary>black list (DNS)</primary>
52049 </indexterm>
52050 <indexterm role="concept">
52051 <primary>access control lists (ACLs)</primary>
52052 <secondary>testing a DNS list</secondary>
52053 </indexterm>
52054 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
52055 is on at least one of a number of DNS lists by looking up the inverted IP
52056 address in one or more DNS domains. (Note that DNS list domains are not mail
52057 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
52058 special options instead.) For example, if the calling host&#x2019;s IP
52059 address is 192.168.62.43, and the ACL statement is
52060 </para>
52061 <literallayout class="monospaced">
52062 deny dnslists = blackholes.mail-abuse.org : \
52063                 dialups.mail-abuse.org
52064 </literallayout>
52065 <para>
52066 the following records are looked up:
52067 </para>
52068 <literallayout class="monospaced">
52069 43.62.168.192.blackholes.mail-abuse.org
52070 43.62.168.192.dialups.mail-abuse.org
52071 </literallayout>
52072 <para>
52073 As soon as Exim finds an existing DNS record, processing of the list stops.
52074 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
52075 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
52076 use two separate conditions:
52077 </para>
52078 <literallayout class="monospaced">
52079 deny dnslists = blackholes.mail-abuse.org
52080      dnslists = dialups.mail-abuse.org
52081 </literallayout>
52082 <para>
52083 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
52084 behaves as if the host does not match the list item, that is, as if the DNS
52085 record does not exist. If there are further items in the DNS list, they are
52086 processed.
52087 </para>
52088 <para>
52089 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
52090 (which is the most common usage), because it prevents a DNS failure from
52091 blocking mail. However, you can change this behaviour by putting one of the
52092 following special items in the list:
52093 </para>
52094 <literallayout>
52095 <literal>+include_unknown </literal>   behave as if the item is on the list
52096 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
52097 <literal>+defer_unknown   </literal>   give a temporary error
52098 </literallayout>
52099 <para>
52100 <indexterm role="concept">
52101 <primary><literal>+include_unknown</literal></primary>
52102 </indexterm>
52103 <indexterm role="concept">
52104 <primary><literal>+exclude_unknown</literal></primary>
52105 </indexterm>
52106 <indexterm role="concept">
52107 <primary><literal>+defer_unknown</literal></primary>
52108 </indexterm>
52109 Each of these applies to any subsequent items on the list. For example:
52110 </para>
52111 <literallayout class="monospaced">
52112 deny dnslists = +defer_unknown : foo.bar.example
52113 </literallayout>
52114 <para>
52115 Testing the list of domains stops as soon as a match is found. If you want to
52116 warn for one list and block for another, you can use two different statements:
52117 </para>
52118 <literallayout class="monospaced">
52119 deny  dnslists = blackholes.mail-abuse.org
52120 warn  message  = X-Warn: sending host is on dialups list
52121       dnslists = dialups.mail-abuse.org
52122 </literallayout>
52123 <para>
52124 DNS list lookups are cached by Exim for the duration of the SMTP session,
52125 so a lookup based on the IP address is done at most once for any incoming
52126 connection. Exim does not share information between multiple incoming
52127 connections (but your local name server cache should be active).
52128 </para>
52129 </section>
52130 <section id="SECID201">
52131 <title>Specifying the IP address for a DNS list lookup</title>
52132 <para>
52133 <indexterm role="concept">
52134 <primary>DNS list</primary>
52135 <secondary>keyed by explicit IP address</secondary>
52136 </indexterm>
52137 By default, the IP address that is used in a DNS list lookup is the IP address
52138 of the calling host. However, you can specify another IP address by listing it
52139 after the domain name, introduced by a slash. For example:
52140 </para>
52141 <literallayout class="monospaced">
52142 deny dnslists = black.list.tld/192.168.1.2
52143 </literallayout>
52144 <para>
52145 This feature is not very helpful with explicit IP addresses; it is intended for
52146 use with IP addresses that are looked up, for example, the IP addresses of the
52147 MX hosts or nameservers of an email sender address. For an example, see section
52148 <xref linkend="SECTmulkeyfor"/> below.
52149 </para>
52150 </section>
52151 <section id="SECID202">
52152 <title>DNS lists keyed on domain names</title>
52153 <para>
52154 <indexterm role="concept">
52155 <primary>DNS list</primary>
52156 <secondary>keyed by domain name</secondary>
52157 </indexterm>
52158 There are some lists that are keyed on domain names rather than inverted IP
52159 addresses (see for example the <emphasis>domain based zones</emphasis> link at
52160 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
52161 with these lists. You can change the name that is looked up in a DNS list by
52162 listing it after the domain name, introduced by a slash. For example,
52163 </para>
52164 <literallayout class="monospaced">
52165 deny  message  = Sender's domain is listed at $dnslist_domain
52166       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
52167 </literallayout>
52168 <para>
52169 This particular example is useful only in ACLs that are obeyed after the
52170 RCPT or DATA commands, when a sender address is available. If (for
52171 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
52172 up by this example is
52173 </para>
52174 <literallayout class="monospaced">
52175 tld.example.dsn.rfc-ignorant.org
52176 </literallayout>
52177 <para>
52178 A single <option>dnslists</option> condition can contain entries for both names and IP
52179 addresses. For example:
52180 </para>
52181 <literallayout class="monospaced">
52182 deny dnslists = sbl.spamhaus.org : \
52183                 dsn.rfc-ignorant.org/$sender_address_domain
52184 </literallayout>
52185 <para>
52186 The first item checks the sending host&#x2019;s IP address; the second checks a domain
52187 name. The whole condition is true if either of the DNS lookups succeeds.
52188 </para>
52189 </section>
52190 <section id="SECTmulkeyfor">
52191 <title>Multiple explicit keys for a DNS list</title>
52192 <para>
52193 <indexterm role="concept">
52194 <primary>DNS list</primary>
52195 <secondary>multiple keys for</secondary>
52196 </indexterm>
52197 The syntax described above for looking up explicitly-defined values (either
52198 names or IP addresses) in a DNS blacklist is a simplification. After the domain
52199 name for the DNS list, what follows the slash can in fact be a list of items.
52200 As with all lists in Exim, the default separator is a colon. However, because
52201 this is a sublist within the list of DNS blacklist domains, it is necessary
52202 either to double the separators like this:
52203 </para>
52204 <literallayout class="monospaced">
52205 dnslists = black.list.tld/name.1::name.2
52206 </literallayout>
52207 <para>
52208 or to change the separator character, like this:
52209 </para>
52210 <literallayout class="monospaced">
52211 dnslists = black.list.tld/&lt;;name.1;name.2
52212 </literallayout>
52213 <para>
52214 If an item in the list is an IP address, it is inverted before the DNS
52215 blacklist domain is appended. If it is not an IP address, no inversion
52216 occurs. Consider this condition:
52217 </para>
52218 <literallayout class="monospaced">
52219 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
52220 </literallayout>
52221 <para>
52222 The DNS lookups that occur are:
52223 </para>
52224 <literallayout class="monospaced">
52225 2.1.168.192.black.list.tld
52226 a.domain.black.list.tld
52227 </literallayout>
52228 <para>
52229 Once a DNS record has been found (that matches a specific IP return
52230 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
52231 are done. If there is a temporary DNS error, the rest of the sublist of domains
52232 or IP addresses is tried. A temporary error for the whole dnslists item occurs
52233 only if no other DNS lookup in this sublist succeeds. In other words, a
52234 successful lookup for any of the items in the sublist overrides a temporary
52235 error for a previous item.
52236 </para>
52237 <para>
52238 The ability to supply a list of items after the slash is in some sense just a
52239 syntactic convenience. These two examples have the same effect:
52240 </para>
52241 <literallayout class="monospaced">
52242 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
52243 dnslists = black.list.tld/a.domain::b.domain
52244 </literallayout>
52245 <para>
52246 However, when the data for the list is obtained from a lookup, the second form
52247 is usually much more convenient. Consider this example:
52248 </para>
52249 <literallayout class="monospaced">
52250 deny message  = The mail servers for the domain \
52251                 $sender_address_domain \
52252                 are listed at $dnslist_domain ($dnslist_value); \
52253                 see $dnslist_text.
52254      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
52255                                    ${lookup dnsdb {&gt;|mxh=\
52256                                    $sender_address_domain} }} }
52257 </literallayout>
52258 <para>
52259 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
52260 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
52261 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
52262 of expanding the condition might be something like this:
52263 </para>
52264 <literallayout class="monospaced">
52265 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
52266 </literallayout>
52267 <para>
52268 Thus, this example checks whether or not the IP addresses of the sender
52269 domain&#x2019;s mail servers are on the Spamhaus black list.
52270 </para>
52271 <para>
52272 The key that was used for a successful DNS list lookup is put into the variable
52273 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
52274 </para>
52275 </section>
52276 <section id="SECID203">
52277 <title>Data returned by DNS lists</title>
52278 <para>
52279 <indexterm role="concept">
52280 <primary>DNS list</primary>
52281 <secondary>data returned from</secondary>
52282 </indexterm>
52283 DNS lists are constructed using address records in the DNS. The original RBL
52284 just used the address 127.0.0.1 on the right hand side of each record, but the
52285 RBL+ list and some other lists use a number of values with different meanings.
52286 The values used on the RBL+ list are:
52287 </para>
52288 <literallayout>
52289 127.1.0.1  RBL
52290 127.1.0.2  DUL
52291 127.1.0.3  DUL and RBL
52292 127.1.0.4  RSS
52293 127.1.0.5  RSS and RBL
52294 127.1.0.6  RSS and DUL
52295 127.1.0.7  RSS and DUL and RBL
52296 </literallayout>
52297 <para>
52298 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
52299 different values. Some DNS lists may return more than one address record;
52300 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
52301 </para>
52302 </section>
52303 <section id="SECID204">
52304 <title>Variables set from DNS lists</title>
52305 <para>
52306 <indexterm role="concept">
52307 <primary>expansion</primary>
52308 <secondary>variables, set from DNS list</secondary>
52309 </indexterm>
52310 <indexterm role="concept">
52311 <primary>DNS list</primary>
52312 <secondary>variables set from</secondary>
52313 </indexterm>
52314 <indexterm role="variable">
52315 <primary><varname>$dnslist_domain</varname></primary>
52316 </indexterm>
52317 <indexterm role="variable">
52318 <primary><varname>$dnslist_matched</varname></primary>
52319 </indexterm>
52320 <indexterm role="variable">
52321 <primary><varname>$dnslist_text</varname></primary>
52322 </indexterm>
52323 <indexterm role="variable">
52324 <primary><varname>$dnslist_value</varname></primary>
52325 </indexterm>
52326 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
52327 the name of the overall domain that matched (for example,
52328 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
52329 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
52330 the DNS record. When the key is an IP address, it is not reversed in
52331 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
52332 cases, for example:
52333 </para>
52334 <literallayout class="monospaced">
52335 deny dnslists = spamhaus.example
52336 </literallayout>
52337 <para>
52338 the key is also available in another variable (in this case,
52339 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
52340 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
52341 might generate a dnslists lookup like this:
52342 </para>
52343 <literallayout class="monospaced">
52344 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
52345 </literallayout>
52346 <para>
52347 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
52348 <literal>192.168.6.7</literal> (for example).
52349 </para>
52350 <para>
52351 If more than one address record is returned by the DNS lookup, all the IP
52352 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
52353 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
52354 record. For lists such as RBL+ the TXT record for a merged entry is often not
52355 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
52356 information.
52357 </para>
52358 <para>
52359 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
52360 &ndash; although these appear before the condition in the ACL, they are not
52361 expanded until after it has failed. For example:
52362 </para>
52363 <literallayout class="monospaced">
52364 deny    hosts = !+local_networks
52365         message = $sender_host_address is listed \
52366                   at $dnslist_domain
52367         dnslists = rbl-plus.mail-abuse.example
52368 </literallayout>
52369 </section>
52370 <section id="SECTaddmatcon">
52371 <title>Additional matching conditions for DNS lists</title>
52372 <para>
52373 <indexterm role="concept">
52374 <primary>DNS list</primary>
52375 <secondary>matching specific returned data</secondary>
52376 </indexterm>
52377 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
52378 in order to restrict its action to DNS records with a matching right hand side.
52379 For example,
52380 </para>
52381 <literallayout class="monospaced">
52382 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
52383 </literallayout>
52384 <para>
52385 rejects only those hosts that yield 127.0.0.2. Without this additional data,
52386 any address record is considered to be a match. For the moment, we assume
52387 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
52388 describes how multiple records are handled.
52389 </para>
52390 <para>
52391 More than one IP address may be given for checking, using a comma as a
52392 separator. These are alternatives &ndash; if any one of them matches, the
52393 <option>dnslists</option> condition is true. For example:
52394 </para>
52395 <literallayout class="monospaced">
52396 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
52397 </literallayout>
52398 <para>
52399 If you want to specify a constraining address list and also specify names or IP
52400 addresses to be looked up, the constraining address list must be specified
52401 first. For example:
52402 </para>
52403 <literallayout class="monospaced">
52404 deny dnslists = dsn.rfc-ignorant.org\
52405                 =127.0.0.2/$sender_address_domain
52406 </literallayout>
52407 <para>
52408 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
52409 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
52410 In other words, the listed addresses are used as bit masks. The comparison is
52411 true if all the bits in the mask are present in the address that is being
52412 tested. For example:
52413 </para>
52414 <literallayout class="monospaced">
52415 dnslists = a.b.c&amp;0.0.0.3
52416 </literallayout>
52417 <para>
52418 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
52419 want to test whether one bit or another bit is present (as opposed to both
52420 being present), you must use multiple values. For example:
52421 </para>
52422 <literallayout class="monospaced">
52423 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
52424 </literallayout>
52425 <para>
52426 matches if the final component of the address is an odd number or two times
52427 an odd number.
52428 </para>
52429 </section>
52430 <section id="SECID205">
52431 <title>Negated DNS matching conditions</title>
52432 <para>
52433 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
52434 condition. Whereas
52435 </para>
52436 <literallayout class="monospaced">
52437 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
52438 </literallayout>
52439 <para>
52440 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
52441 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
52442 </para>
52443 <literallayout class="monospaced">
52444 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
52445 </literallayout>
52446 <para>
52447 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
52448 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
52449 words, the result of the test is inverted if an exclamation mark appears before
52450 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
52451 </para>
52452 <para>
52453 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
52454 host, or address list (which is why the syntax is different).
52455 </para>
52456 <para>
52457 If you are using just one list, the negation syntax does not gain you much. The
52458 previous example is precisely equivalent to
52459 </para>
52460 <literallayout class="monospaced">
52461 deny  dnslists = a.b.c
52462      !dnslists = a.b.c=127.0.0.2,127.0.0.3
52463 </literallayout>
52464 <para>
52465 However, if you are using multiple lists, the negation syntax is clearer.
52466 Consider this example:
52467 </para>
52468 <literallayout class="monospaced">
52469 deny  dnslists = sbl.spamhaus.org : \
52470                  list.dsbl.org : \
52471                  dnsbl.njabl.org!=127.0.0.3 : \
52472                  relays.ordb.org
52473 </literallayout>
52474 <para>
52475 Using only positive lists, this would have to be:
52476 </para>
52477 <literallayout class="monospaced">
52478 deny  dnslists = sbl.spamhaus.org : \
52479                  list.dsbl.org
52480 deny  dnslists = dnsbl.njabl.org
52481      !dnslists = dnsbl.njabl.org=127.0.0.3
52482 deny  dnslists = relays.ordb.org
52483 </literallayout>
52484 <para>
52485 which is less clear, and harder to maintain.
52486 </para>
52487 </section>
52488 <section id="SECThanmuldnsrec">
52489 <title>Handling multiple DNS records from a DNS list</title>
52490 <para>
52491 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
52492 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
52493 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
52494 the match to specific results from the DNS lookup, there are two ways in which
52495 the checking can be handled. For example, consider the condition:
52496 </para>
52497 <literallayout class="monospaced">
52498 dnslists = a.b.c=127.0.0.1
52499 </literallayout>
52500 <para>
52501 What happens if the DNS lookup for the incoming IP address yields both
52502 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
52503 condition true because at least one given value was found, or is it false
52504 because at least one of the found values was not listed? And how does this
52505 affect negated conditions? Both possibilities are provided for with the help of
52506 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
52507 </para>
52508 <itemizedlist>
52509 <listitem>
52510 <para>
52511 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
52512 IP addresses matches one of the listed addresses. For the example above, the
52513 condition is true because 127.0.0.1 matches.
52514 </para>
52515 </listitem>
52516 <listitem>
52517 <para>
52518 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
52519 looked up IP addresses matches one of the listed addresses. If the condition is
52520 changed to:
52521 </para>
52522 <literallayout class="monospaced">
52523 dnslists = a.b.c==127.0.0.1
52524 </literallayout>
52525 <para>
52526 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
52527 false because 127.0.0.2 is not listed. You would need to have:
52528 </para>
52529 <literallayout class="monospaced">
52530 dnslists = a.b.c==127.0.0.1,127.0.0.2
52531 </literallayout>
52532 <para>
52533 for the condition to be true.
52534 </para>
52535 </listitem>
52536 </itemizedlist>
52537 <para>
52538 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
52539 the precise opposite of the behaviour above. Thus:
52540 </para>
52541 <itemizedlist>
52542 <listitem>
52543 <para>
52544 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
52545 addresses matches one of the listed addresses. Consider:
52546 </para>
52547 <literallayout class="monospaced">
52548 dnslists = a.b.c!&amp;0.0.0.1
52549 </literallayout>
52550 <para>
52551 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
52552 false because 127.0.0.1 matches.
52553 </para>
52554 </listitem>
52555 <listitem>
52556 <para>
52557 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
52558 looked up IP address that does not match. Consider:
52559 </para>
52560 <literallayout class="monospaced">
52561 dnslists = a.b.c!=&amp;0.0.0.1
52562 </literallayout>
52563 <para>
52564 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
52565 true, because 127.0.0.2 does not match. You would need to have:
52566 </para>
52567 <literallayout class="monospaced">
52568 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
52569 </literallayout>
52570 <para>
52571 for the condition to be false.
52572 </para>
52573 </listitem>
52574 </itemizedlist>
52575 <para>
52576 When the DNS lookup yields only a single IP address, there is no difference
52577 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
52578 </para>
52579 </section>
52580 <section id="SECTmordetinf">
52581 <title>Detailed information from merged DNS lists</title>
52582 <para>
52583 <indexterm role="concept">
52584 <primary>DNS list</primary>
52585 <secondary>information from merged</secondary>
52586 </indexterm>
52587 When the facility for restricting the matching IP values in a DNS list is used,
52588 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
52589 the true reason for rejection. This happens when lists are merged and the IP
52590 address in the A record is used to distinguish them; unfortunately there is
52591 only one TXT record. One way round this is not to use merged lists, but that
52592 can be inefficient because it requires multiple DNS lookups where one would do
52593 in the vast majority of cases when the host of interest is not on any of the
52594 lists.
52595 </para>
52596 <para>
52597 A less inefficient way of solving this problem is available. If
52598 two domain names, comma-separated, are given, the second is used first to
52599 do an initial check, making use of any IP value restrictions that are set.
52600 If there is a match, the first domain is used, without any IP value
52601 restrictions, to get the TXT record. As a byproduct of this, there is also
52602 a check that the IP being tested is indeed on the first list. The first
52603 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
52604 </para>
52605 <literallayout class="monospaced">
52606 reject message  = \
52607          rejected because $sender_host_address is blacklisted \
52608          at $dnslist_domain\n$dnslist_text
52609        dnslists = \
52610          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
52611          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
52612 </literallayout>
52613 <para>
52614 For the first blacklist item, this starts by doing a lookup in
52615 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
52616 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
52617 value, and as long as something is found, it looks for the corresponding TXT
52618 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
52619 The second blacklist item is processed similarly.
52620 </para>
52621 <para>
52622 If you are interested in more than one merged list, the same list must be
52623 given several times, but because the results of the DNS lookups are cached,
52624 the DNS calls themselves are not repeated. For example:
52625 </para>
52626 <literallayout class="monospaced">
52627 reject dnslists = \
52628          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
52629          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
52630          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
52631          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
52632 </literallayout>
52633 <para>
52634 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
52635 values matches (or if no record is found), this is the only lookup that is
52636 done. Only if there is a match is one of the more specific lists consulted.
52637 </para>
52638 </section>
52639 <section id="SECTmorednslistslast">
52640 <title>DNS lists and IPv6</title>
52641 <para>
52642 <indexterm role="concept">
52643 <primary>IPv6</primary>
52644 <secondary>DNS black lists</secondary>
52645 </indexterm>
52646 <indexterm role="concept">
52647 <primary>DNS list</primary>
52648 <secondary>IPv6 usage</secondary>
52649 </indexterm>
52650 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
52651 nibble by nibble. For example, if the calling host&#x2019;s IP address is
52652 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
52653 </para>
52654 <literallayout class="monospaced">
52655 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
52656   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
52657 </literallayout>
52658 <para>
52659 (split over two lines here to fit on the page). Unfortunately, some of the DNS
52660 lists contain wildcard records, intended for IPv4, that interact badly with
52661 IPv6. For example, the DNS entry
52662 </para>
52663 <literallayout class="monospaced">
52664 *.3.some.list.example.    A    127.0.0.1
52665 </literallayout>
52666 <para>
52667 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
52668 Unfortunately, it also matches the entire 3::/4 IPv6 network.
52669 </para>
52670 <para>
52671 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
52672 <option>condition</option> condition, as in this example:
52673 </para>
52674 <literallayout class="monospaced">
52675 deny   condition = ${if isip4{$sender_host_address}}
52676        dnslists  = some.list.example
52677 </literallayout>
52678 </section>
52679 <section id="SECTratelimiting">
52680 <title>Rate limiting incoming messages</title>
52681 <para>
52682 <indexterm role="concept">
52683 <primary>rate limiting</primary>
52684 <secondary>client sending</secondary>
52685 </indexterm>
52686 <indexterm role="concept">
52687 <primary>limiting client sending rates</primary>
52688 </indexterm>
52689 <indexterm role="option">
52690 <primary><option>smtp_ratelimit_*</option></primary>
52691 </indexterm>
52692 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
52693 which clients can send email. This is more powerful than the
52694 <option>smtp_ratelimit_*</option> options, because those options control the rate of
52695 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
52696 works across all connections (concurrent and sequential) from the same client
52697 host. The syntax of the <option>ratelimit</option> condition is:
52698 </para>
52699 <literallayout>
52700 <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;
52701 </literallayout>
52702 <para>
52703 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
52704 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
52705 </para>
52706 <para>
52707 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
52708 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
52709 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
52710 of <emphasis>p</emphasis>.
52711 </para>
52712 <para>
52713 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
52714 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
52715 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
52716 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
52717 send in each time interval. It also specifies the number of messages permitted
52718 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
52719 constant, you can allow a client to send more messages in a burst without
52720 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
52721 both small, messages must be sent at an even rate.
52722 </para>
52723 <para>
52724 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
52725 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
52726 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
52727 instructions when it is run with no arguments.
52728 </para>
52729 <para>
52730 The key is used to look up the data for calculating the client&#x2019;s average
52731 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
52732 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
52733 which means Exim computes the sending rate of each client host IP address.
52734 By changing the key you can change how Exim identifies clients for the purpose
52735 of ratelimiting. For example, to limit the sending rate of each authenticated
52736 user, independent of the computer they are sending from, set the key to
52737 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
52738 example, <varname>$authenticated_id</varname> is only meaningful if the client has
52739 authenticated (which you can check with the <option>authenticated</option> ACL condition).
52740 </para>
52741 <para>
52742 The lookup key does not have to identify clients: If you want to limit the
52743 rate at which a recipient receives messages, you can use the key
52744 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
52745 ACL.
52746 </para>
52747 <para>
52748 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
52749 specifies what Exim measures the rate of, for example messages or recipients
52750 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
52751 <option>count=</option> options. You can also control when Exim updates the recorded rate
52752 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
52753 separated by a slash, like the other parameters. They may appear in any order.
52754 </para>
52755 <para>
52756 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
52757 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
52758 stored, so you can alter the configured maximum rate and Exim will still
52759 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
52760 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
52761 behaviour. The lookup key is not affected by changes to the update mode and
52762 the <option>count=</option> option.
52763 </para>
52764 </section>
52765 <section id="ratoptmea">
52766 <title>Ratelimit options for what is being measured</title>
52767 <para>
52768 <indexterm role="concept">
52769 <primary>rate limiting</primary>
52770 <secondary>per_* options</secondary>
52771 </indexterm>
52772 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
52773 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
52774 <option>acl_not_smtp_start</option> ACLs.
52775 </para>
52776 <para>
52777 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
52778 the default if none of the <option>per_*</option> options is specified. It can be used in
52779 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
52780 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
52781 </para>
52782 <para>
52783 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
52784 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
52785 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
52786 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
52787 in its MAIL command, which may be inaccurate or completely missing. You can
52788 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
52789 in kilobytes, megabytes, or gigabytes, respectively.
52790 </para>
52791 <para>
52792 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
52793 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
52794 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
52795 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
52796 ACLs the rate is updated with the total recipient count in one go. Note that
52797 in either case the rate limiting engine will see a message with many
52798 recipients as a large high-speed burst.
52799 </para>
52800 <para>
52801 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
52802 number of different recipients that the client has sent messages to in the
52803 last time period. That is, if the client repeatedly sends messages to the same
52804 recipient, its measured rate is not increased. This option can only be used in
52805 <option>acl_smtp_rcpt</option>.
52806 </para>
52807 <para>
52808 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
52809 condition is processed. This can be used to limit the rate of any SMTP
52810 command. If it is used in multiple ACLs it can limit the aggregate rate of
52811 multiple different commands.
52812 </para>
52813 <para>
52814 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
52815 measured rate. For example, the <option>per_byte</option> option is equivalent to
52816 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
52817 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
52818 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
52819 </para>
52820 <para>
52821 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
52822 </para>
52823 </section>
52824 <section id="ratoptupd">
52825 <title>Ratelimit update modes</title>
52826 <para>
52827 <indexterm role="concept">
52828 <primary>rate limiting</primary>
52829 <secondary>reading data without updating</secondary>
52830 </indexterm>
52831 You can specify one of three options with the <option>ratelimit</option> condition to
52832 control when its database is updated. This section describes the <option>readonly</option>
52833 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
52834 </para>
52835 <para>
52836 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
52837 previously-computed rate to check against the limit.
52838 </para>
52839 <para>
52840 For example, you can test the client&#x2019;s sending rate and deny it access (when
52841 it is too fast) in the connect ACL. If the client passes this check then it
52842 can go on to send a message, in which case its recorded rate will be updated
52843 in the MAIL ACL. Subsequent connections from the same client will check this
52844 new rate.
52845 </para>
52846 <literallayout class="monospaced">
52847 acl_check_connect:
52848  deny ratelimit = 100 / 5m / readonly
52849     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
52850                   (max $sender_rate_limit)
52851 # ...
52852 acl_check_mail:
52853  warn ratelimit = 100 / 5m / strict
52854     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
52855                   (max $sender_rate_limit)
52856 </literallayout>
52857 <para>
52858 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
52859 processing a message then it may increase the client&#x2019;s measured rate more than
52860 it should. For example, this will happen if you check the <option>per_rcpt</option> option
52861 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
52862 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
52863 multiple update problems by using the <option>readonly</option> option on later ratelimit
52864 checks.
52865 </para>
52866 <para>
52867 The <option>per_*</option> options described above do not make sense in some ACLs. If you
52868 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
52869 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
52870 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
52871 next section) so you must specify the <option>readonly</option> option explicitly.
52872 </para>
52873 </section>
52874 <section id="ratoptfast">
52875 <title>Ratelimit options for handling fast clients</title>
52876 <para>
52877 <indexterm role="concept">
52878 <primary>rate limiting</primary>
52879 <secondary>strict and leaky modes</secondary>
52880 </indexterm>
52881 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
52882 engine can react in two possible ways, depending on the presence of the
52883 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
52884 counter-measures (such as rejecting the message) that may be specified by the
52885 rest of the ACL.
52886 </para>
52887 <para>
52888 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
52889 updated if it is above the limit. The effect of this is that Exim measures the
52890 client&#x2019;s average rate of successfully sent email, which cannot be greater than
52891 the maximum allowed. If the client is over the limit it may suffer some
52892 counter-measures (as specified in the ACL), but it will still be able to send
52893 email at the configured maximum rate, whatever the rate of its attempts. This
52894 is generally the better choice if you have clients that retry automatically.
52895 For example, it does not prevent a sender with an over-aggressive retry rate
52896 from getting any email through.
52897 </para>
52898 <para>
52899 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
52900 updated. The effect of this is that Exim measures the client&#x2019;s average rate
52901 of attempts to send email, which can be much higher than the maximum it is
52902 actually allowed. If the client is over the limit it may be subjected to
52903 counter-measures by the ACL. It must slow down and allow sufficient time to
52904 pass that its computed rate falls below the maximum before it can send email
52905 again. The time (the number of smoothing periods) it must wait and not
52906 attempt to send mail can be calculated with this formula:
52907 </para>
52908 <literallayout class="monospaced">
52909         ln(peakrate/maxrate)
52910 </literallayout>
52911 </section>
52912 <section id="ratoptuniq">
52913 <title>Limiting the rate of different events</title>
52914 <para>
52915 <indexterm role="concept">
52916 <primary>rate limiting</primary>
52917 <secondary>counting unique events</secondary>
52918 </indexterm>
52919 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
52920 rate of different events. For example, the <option>per_addr</option> option uses this
52921 mechanism to count the number of different recipients that the client has
52922 sent messages to in the last time period; it is equivalent to
52923 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
52924 measure the rate that a client uses different sender addresses with the
52925 options <literal>per_mail/unique=$sender_address</literal>.
52926 </para>
52927 <para>
52928 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
52929 has seen for that key. The whole set is thrown away when it is older than the
52930 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
52931 per period. In the <option>leaky</option> update mode, an event that causes the client to
52932 go over the limit is not added to the set, in the same way that the client&#x2019;s
52933 recorded rate is not updated in the same situation.
52934 </para>
52935 <para>
52936 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
52937 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
52938 rate.
52939 </para>
52940 <para>
52941 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
52942 other <option>ratelimit</option> options in order to store the event set. The number of
52943 unique values is potentially as large as the rate limit, so the extra space
52944 required increases with larger limits.
52945 </para>
52946 <para>
52947 The uniqueification is not perfect: there is a small probability that Exim
52948 will think a new event has happened before. If the sender&#x2019;s rate is less than
52949 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
52950 the measured rate can go above the limit, in which case Exim may under-count
52951 events by a significant margin. Fortunately, if the rate is high enough (2.7
52952 times the limit) that the false positive rate goes above 9%, then Exim will
52953 throw away the over-full event set before the measured rate falls below the
52954 limit. Therefore the only harm should be that exceptionally high sending rates
52955 are logged incorrectly; any countermeasures you configure will be as effective
52956 as intended.
52957 </para>
52958 </section>
52959 <section id="useratlim">
52960 <title>Using rate limiting</title>
52961 <para>
52962 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
52963 when the rate limit is exceeded. This might be anything from logging a warning
52964 (for example, while measuring existing sending rates in order to define
52965 policy), through time delays to slow down fast senders, up to rejecting the
52966 message. For example:
52967 </para>
52968 <literallayout class="monospaced">
52969 # Log all senders' rates
52970 warn ratelimit = 0 / 1h / strict
52971      log_message = Sender rate $sender_rate / $sender_rate_period
52972
52973 # Slow down fast senders; note the need to truncate $sender_rate
52974 # at the decimal point.
52975 warn ratelimit = 100 / 1h / per_rcpt / strict
52976      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
52977                    $sender_rate_limit }s
52978
52979 # Keep authenticated users under control
52980 deny authenticated = *
52981      ratelimit = 100 / 1d / strict / $authenticated_id
52982
52983 # System-wide rate limit
52984 defer message = Sorry, too busy. Try again later.
52985      ratelimit = 10 / 1s / $primary_hostname
52986
52987 # Restrict incoming rate from each host, with a default
52988 # set using a macro and special cases looked up in a table.
52989 defer message = Sender rate exceeds $sender_rate_limit \
52990                messages per $sender_rate_period
52991      ratelimit = ${lookup {$sender_host_address} \
52992                    cdb {DB/ratelimits.cdb} \
52993                    {$value} {RATELIMIT} }
52994 </literallayout>
52995 <para>
52996 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
52997 especially with the <option>per_rcpt</option> option, you may suffer from a performance
52998 bottleneck caused by locking on the ratelimit hints database. Apart from
52999 making your ACLs less complicated, you can reduce the problem by using a
53000 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
53001 this means that Exim will lose its hints data after a reboot (including retry
53002 hints, the callout cache, and ratelimit data).
53003 </para>
53004 </section>
53005 <section id="SECTaddressverification">
53006 <title>Address verification</title>
53007 <para>
53008 <indexterm role="concept">
53009 <primary>verifying address</primary>
53010 <secondary>options for</secondary>
53011 </indexterm>
53012 <indexterm role="concept">
53013 <primary>policy control</primary>
53014 <secondary>address verification</secondary>
53015 </indexterm>
53016 Several of the <option>verify</option> conditions described in section
53017 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
53018 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
53019 The verification conditions can be followed by options that modify the
53020 verification process. The options are separated from the keyword and from each
53021 other by slashes, and some of them contain parameters. For example:
53022 </para>
53023 <literallayout class="monospaced">
53024 verify = sender/callout
53025 verify = recipient/defer_ok/callout=10s,defer_ok
53026 </literallayout>
53027 <para>
53028 The first stage of address verification, which always happens, is to run the
53029 address through the routers, in <quote>verify mode</quote>. Routers can detect the
53030 difference between verification and routing for delivery, and their actions can
53031 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
53032 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
53033 The available options are as follows:
53034 </para>
53035 <itemizedlist>
53036 <listitem>
53037 <para>
53038 If the <option>callout</option> option is specified, successful routing to one or more
53039 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
53040 check. Callouts and their sub-options are discussed in the next section.
53041 </para>
53042 </listitem>
53043 <listitem>
53044 <para>
53045 If there is a defer error while doing verification routing, the ACL
53046 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
53047 options, the condition is forced to be true instead. Note that this is a main
53048 verification option as well as a suboption for callouts.
53049 </para>
53050 </listitem>
53051 <listitem>
53052 <para>
53053 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
53054 discusses the reporting of sender address verification failures.
53055 </para>
53056 </listitem>
53057 <listitem>
53058 <para>
53059 The <option>success_on_redirect</option> option causes verification always to succeed
53060 immediately after a successful redirection. By default, if a redirection
53061 generates just one address, that address is also verified. See further
53062 discussion in section <xref linkend="SECTredirwhilveri"/>.
53063 </para>
53064 </listitem>
53065 </itemizedlist>
53066 <para>
53067 <indexterm role="concept">
53068 <primary>verifying address</primary>
53069 <secondary>differentiating failures</secondary>
53070 </indexterm>
53071 <indexterm role="variable">
53072 <primary><varname>$recipient_verify_failure</varname></primary>
53073 </indexterm>
53074 <indexterm role="variable">
53075 <primary><varname>$sender_verify_failure</varname></primary>
53076 </indexterm>
53077 <indexterm role="variable">
53078 <primary><varname>$acl_verify_message</varname></primary>
53079 </indexterm>
53080 After an address verification failure, <varname>$acl_verify_message</varname> contains the
53081 error message that is associated with the failure. It can be preserved by
53082 coding like this:
53083 </para>
53084 <literallayout class="monospaced">
53085 warn  !verify = sender
53086        set acl_m0 = $acl_verify_message
53087 </literallayout>
53088 <para>
53089 If you are writing your own custom rejection message or log message when
53090 denying access, you can use this variable to include information about the
53091 verification failure.
53092 </para>
53093 <para>
53094 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
53095 appropriate) contains one of the following words:
53096 </para>
53097 <itemizedlist>
53098 <listitem>
53099 <para>
53100 <option>qualify</option>: The address was unqualified (no domain), and the message
53101 was neither local nor came from an exempted host.
53102 </para>
53103 </listitem>
53104 <listitem>
53105 <para>
53106 <option>route</option>: Routing failed.
53107 </para>
53108 </listitem>
53109 <listitem>
53110 <para>
53111 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
53112 occurred at or before the MAIL command (that is, on initial
53113 connection, HELO, or MAIL).
53114 </para>
53115 </listitem>
53116 <listitem>
53117 <para>
53118 <option>recipient</option>: The RCPT command in a callout was rejected.
53119 </para>
53120 </listitem>
53121 <listitem>
53122 <para>
53123 <option>postmaster</option>: The postmaster check in a callout was rejected.
53124 </para>
53125 </listitem>
53126 </itemizedlist>
53127 <para>
53128 The main use of these variables is expected to be to distinguish between
53129 rejections of MAIL and rejections of RCPT in callouts.
53130 </para>
53131 </section>
53132 <section id="SECTcallver">
53133 <title>Callout verification</title>
53134 <para>
53135 <indexterm role="concept">
53136 <primary>verifying address</primary>
53137 <secondary>by callout</secondary>
53138 </indexterm>
53139 <indexterm role="concept">
53140 <primary>callout</primary>
53141 <secondary>verification</secondary>
53142 </indexterm>
53143 <indexterm role="concept">
53144 <primary>SMTP</primary>
53145 <secondary>callout verification</secondary>
53146 </indexterm>
53147 For non-local addresses, routing verifies the domain, but is unable to do any
53148 checking of the local part. There are situations where some means of verifying
53149 the local part is desirable. One way this can be done is to make an SMTP
53150 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
53151 a subsequent host for a recipient address, to see if the host accepts the
53152 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
53153 sender address, the callback is not to the client host that is trying to
53154 deliver the message, but to one of the hosts that accepts incoming mail for the
53155 sender&#x2019;s domain.
53156 </para>
53157 <para>
53158 Exim does not do callouts by default. If you want them to happen, you must
53159 request them by setting appropriate options on the <option>verify</option> condition, as
53160 described below. This facility should be used with care, because it can add a
53161 lot of resource usage to the cost of verifying an address. However, Exim does
53162 cache the results of callouts, which helps to reduce the cost. Details of
53163 caching are in section <xref linkend="SECTcallvercache"/>.
53164 </para>
53165 <para>
53166 Recipient callouts are usually used only between hosts that are controlled by
53167 the same administration. For example, a corporate gateway host could use
53168 callouts to check for valid recipients on an internal mailserver. A successful
53169 callout does not guarantee that a real delivery to the address would succeed;
53170 on the other hand, a failing callout does guarantee that a delivery would fail.
53171 </para>
53172 <para>
53173 If the <option>callout</option> option is present on a condition that verifies an address, a
53174 second stage of verification occurs if the address is successfully routed to
53175 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
53176 <command>manualroute</command> router, where the router specifies the hosts. However, if a
53177 router that does not set up hosts routes to an <command>smtp</command> transport with a
53178 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
53179 <option>hosts_override</option> set, its hosts are always used, whether or not the router
53180 supplies a host list.
53181 </para>
53182 <para>
53183 The port that is used is taken from the transport, if it is specified and is a
53184 remote transport. (For routers that do verification only, no transport need be
53185 specified.) Otherwise, the default SMTP port is used. If a remote transport
53186 specifies an outgoing interface, this is used; otherwise the interface is not
53187 specified. Likewise, the text that is used for the HELO command is taken from
53188 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
53189 <varname>$smtp_active_hostname</varname> is used.
53190 </para>
53191 <para>
53192 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
53193 test whether a bounce message could be delivered to the sender address. The
53194 following SMTP commands are sent:
53195 </para>
53196 <literallayout>
53197 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
53198 <literal>MAIL FROM:&lt;&gt;</literal>
53199 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
53200 <literal>QUIT</literal>
53201 </literallayout>
53202 <para>
53203 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
53204 set to <quote>lmtp</quote>.
53205 </para>
53206 <para>
53207 A recipient callout check is similar. By default, it also uses an empty address
53208 for the sender. This default is chosen because most hosts do not make use of
53209 the sender address when verifying a recipient. Using the same address means
53210 that a single cache entry can be used for each recipient. Some sites, however,
53211 do make use of the sender address when verifying. These are catered for by the
53212 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
53213 </para>
53214 <para>
53215 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
53216 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
53217 Exim tries the next host, if any. If there is a problem with all the remote
53218 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
53219 <option>callout</option> option is given, in which case the condition is forced to succeed.
53220 </para>
53221 <para>
53222 <indexterm role="concept">
53223 <primary>SMTP</primary>
53224 <secondary>output flushing, disabling for callout</secondary>
53225 </indexterm>
53226 A callout may take a little time. For this reason, Exim normally flushes SMTP
53227 output before performing a callout in an ACL, to avoid unexpected timeouts in
53228 clients when the SMTP PIPELINING extension is in use. The flushing can be
53229 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
53230 </para>
53231 </section>
53232 <section id="CALLaddparcall">
53233 <title>Additional parameters for callouts</title>
53234 <para>
53235 <indexterm role="concept">
53236 <primary>callout</primary>
53237 <secondary>additional parameters for</secondary>
53238 </indexterm>
53239 The <option>callout</option> option can be followed by an equals sign and a number of
53240 optional parameters, separated by commas. For example:
53241 </para>
53242 <literallayout class="monospaced">
53243 verify = recipient/callout=10s,defer_ok
53244 </literallayout>
53245 <para>
53246 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
53247 separate verify options, is retained for backwards compatibility, but is now
53248 deprecated. The additional parameters for <option>callout</option> are as follows:
53249 </para>
53250 <variablelist>
53251 <varlistentry>
53252 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
53253 <listitem>
53254 <para>
53255 <indexterm role="concept">
53256 <primary>callout</primary>
53257 <secondary>timeout, specifying</secondary>
53258 </indexterm>
53259 This specifies the timeout that applies for the callout attempt to each host.
53260 For example:
53261 </para>
53262 <literallayout class="monospaced">
53263 verify = sender/callout=5s
53264 </literallayout>
53265 <para>
53266 The default is 30 seconds. The timeout is used for each response from the
53267 remote host. It is also used for the initial connection, unless overridden by
53268 the <option>connect</option> parameter.
53269 </para>
53270 </listitem></varlistentry>
53271 <varlistentry>
53272 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
53273 <listitem>
53274 <para>
53275 <indexterm role="concept">
53276 <primary>callout</primary>
53277 <secondary>connection timeout, specifying</secondary>
53278 </indexterm>
53279 This parameter makes it possible to set a different (usually smaller) timeout
53280 for making the SMTP connection. For example:
53281 </para>
53282 <literallayout class="monospaced">
53283 verify = sender/callout=5s,connect=1s
53284 </literallayout>
53285 <para>
53286 If not specified, this timeout defaults to the general timeout value.
53287 </para>
53288 </listitem></varlistentry>
53289 <varlistentry>
53290 <term><emphasis role="bold">defer_ok</emphasis></term>
53291 <listitem>
53292 <para>
53293 <indexterm role="concept">
53294 <primary>callout</primary>
53295 <secondary>defer, action on</secondary>
53296 </indexterm>
53297 When this parameter is present, failure to contact any host, or any other kind
53298 of temporary error, is treated as success by the ACL. However, the cache is not
53299 updated in this circumstance.
53300 </para>
53301 </listitem></varlistentry>
53302 <varlistentry>
53303 <term><emphasis role="bold">fullpostmaster</emphasis></term>
53304 <listitem>
53305 <para>
53306 <indexterm role="concept">
53307 <primary>callout</primary>
53308 <secondary>full postmaster check</secondary>
53309 </indexterm>
53310 This operates like the <option>postmaster</option> option (see below), but if the check for
53311 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
53312 accordance with the specification in RFC 2821. The RFC states that the
53313 unqualified address <emphasis>postmaster</emphasis> should be accepted.
53314 </para>
53315 </listitem></varlistentry>
53316 <varlistentry>
53317 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
53318 <listitem>
53319 <para>
53320 <indexterm role="concept">
53321 <primary>callout</primary>
53322 <secondary>sender when verifying header</secondary>
53323 </indexterm>
53324 When verifying addresses in header lines using the <option>header_sender</option>
53325 verification option, Exim behaves by default as if the addresses are envelope
53326 sender addresses from a message. Callout verification therefore tests to see
53327 whether a bounce message could be delivered, by using an empty address in the
53328 MAIL command. However, it is arguable that these addresses might never be used
53329 as envelope senders, and could therefore justifiably reject bounce messages
53330 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
53331 address to use in the MAIL command. For example:
53332 </para>
53333 <literallayout class="monospaced">
53334 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
53335 </literallayout>
53336 <para>
53337 This parameter is available only for the <option>header_sender</option> verification option.
53338 </para>
53339 </listitem></varlistentry>
53340 <varlistentry>
53341 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
53342 <listitem>
53343 <para>
53344 <indexterm role="concept">
53345 <primary>callout</primary>
53346 <secondary>overall timeout, specifying</secondary>
53347 </indexterm>
53348 This parameter sets an overall timeout for performing a callout verification.
53349 For example:
53350 </para>
53351 <literallayout class="monospaced">
53352 verify = sender/callout=5s,maxwait=30s
53353 </literallayout>
53354 <para>
53355 This timeout defaults to four times the callout timeout for individual SMTP
53356 commands. The overall timeout applies when there is more than one host that can
53357 be tried. The timeout is checked before trying the next host. This prevents
53358 very long delays if there are a large number of hosts and all are timing out
53359 (for example, when network connections are timing out).
53360 </para>
53361 </listitem></varlistentry>
53362 <varlistentry>
53363 <term><emphasis role="bold">no_cache</emphasis></term>
53364 <listitem>
53365 <para>
53366 <indexterm role="concept">
53367 <primary>callout</primary>
53368 <secondary>cache, suppressing</secondary>
53369 </indexterm>
53370 <indexterm role="concept">
53371 <primary>caching callout, suppressing</primary>
53372 </indexterm>
53373 When this parameter is given, the callout cache is neither read nor updated.
53374 </para>
53375 </listitem></varlistentry>
53376 <varlistentry>
53377 <term><emphasis role="bold">postmaster</emphasis></term>
53378 <listitem>
53379 <para>
53380 <indexterm role="concept">
53381 <primary>callout</primary>
53382 <secondary>postmaster; checking</secondary>
53383 </indexterm>
53384 When this parameter is set, a successful callout check is followed by a similar
53385 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
53386 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
53387 the postmaster check is recorded in a cache record; if it is a failure, this is
53388 used to fail subsequent callouts for the domain without a connection being
53389 made, until the cache record expires.
53390 </para>
53391 </listitem></varlistentry>
53392 <varlistentry>
53393 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
53394 <listitem>
53395 <para>
53396 The postmaster check uses an empty sender in the MAIL command by default.
53397 You can use this parameter to do a postmaster check using a different address.
53398 For example:
53399 </para>
53400 <literallayout class="monospaced">
53401 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
53402 </literallayout>
53403 <para>
53404 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
53405 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
53406 </para>
53407 <literallayout class="monospaced">
53408 require  verify = sender/callout=postmaster_mailfrom=
53409 </literallayout>
53410 <para>
53411 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
53412 account of the sender address. It is assumed that either the empty address or
53413 a fixed non-empty address will be used. All that Exim remembers is that the
53414 postmaster check for the domain succeeded or failed.
53415 </para>
53416 </listitem></varlistentry>
53417 <varlistentry>
53418 <term><emphasis role="bold">random</emphasis></term>
53419 <listitem>
53420 <para>
53421 <indexterm role="concept">
53422 <primary>callout</primary>
53423 <secondary><quote>random</quote> check</secondary>
53424 </indexterm>
53425 When this parameter is set, before doing the normal callout check, Exim does a
53426 check for a <quote>random</quote> local part at the same domain. The local part is not
53427 really random &ndash; it is defined by the expansion of the option
53428 <option>callout_random_local_part</option>, which defaults to
53429 </para>
53430 <literallayout class="monospaced">
53431 $primary_hostname-$tod_epoch-testing
53432 </literallayout>
53433 <para>
53434 The idea here is to try to determine whether the remote host accepts all local
53435 parts without checking. If it does, there is no point in doing callouts for
53436 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
53437 a cache record, and used to force the current and subsequent callout checks to
53438 succeed without a connection being made, until the cache record expires.
53439 </para>
53440 </listitem></varlistentry>
53441 <varlistentry>
53442 <term><emphasis role="bold">use_postmaster</emphasis></term>
53443 <listitem>
53444 <para>
53445 <indexterm role="concept">
53446 <primary>callout</primary>
53447 <secondary>sender for recipient check</secondary>
53448 </indexterm>
53449 This parameter applies to recipient callouts only. For example:
53450 </para>
53451 <literallayout class="monospaced">
53452 deny  !verify = recipient/callout=use_postmaster
53453 </literallayout>
53454 <para>
53455 <indexterm role="variable">
53456 <primary><varname>$qualify_domain</varname></primary>
53457 </indexterm>
53458 It causes a non-empty postmaster address to be used in the MAIL command when
53459 performing the callout for the recipient, and also for a <quote>random</quote> check if
53460 that is configured. The local part of the address is <literal>postmaster</literal> and the
53461 domain is the contents of <varname>$qualify_domain</varname>.
53462 </para>
53463 </listitem></varlistentry>
53464 <varlistentry>
53465 <term><emphasis role="bold">use_sender</emphasis></term>
53466 <listitem>
53467 <para>
53468 This option applies to recipient callouts only. For example:
53469 </para>
53470 <literallayout class="monospaced">
53471 require  verify = recipient/callout=use_sender
53472 </literallayout>
53473 <para>
53474 It causes the message&#x2019;s actual sender address to be used in the MAIL
53475 command when performing the callout, instead of an empty address. There is no
53476 need to use this option unless you know that the called hosts make use of the
53477 sender when checking recipients. If used indiscriminately, it reduces the
53478 usefulness of callout caching.
53479 </para>
53480 </listitem></varlistentry>
53481 </variablelist>
53482 <para>
53483 If you use any of the parameters that set a non-empty sender for the MAIL
53484 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
53485 <option>use_sender</option>), you should think about possible loops. Recipient checking is
53486 usually done between two hosts that are under the same management, and the host
53487 that receives the callouts is not normally configured to do callouts itself.
53488 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
53489 these circumstances.
53490 </para>
53491 <para>
53492 However, if you use a non-empty sender address for a callout to an arbitrary
53493 host, there is the likelihood that the remote host will itself initiate a
53494 callout check back to your host. As it is checking what appears to be a message
53495 sender, it is likely to use an empty address in MAIL, thus avoiding a
53496 callout loop. However, to be on the safe side it would be best to set up your
53497 own ACLs so that they do not do sender verification checks when the recipient
53498 is the address you use for header sender or postmaster callout checking.
53499 </para>
53500 <para>
53501 Another issue to think about when using non-empty senders for callouts is
53502 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
53503 by the sender/recipient combination; thus, for any given recipient, many more
53504 actual callouts are performed than when an empty sender or postmaster is used.
53505 </para>
53506 </section>
53507 <section id="SECTcallvercache">
53508 <title>Callout caching</title>
53509 <para>
53510 <indexterm role="concept">
53511 <primary>hints database</primary>
53512 <secondary>callout cache</secondary>
53513 </indexterm>
53514 <indexterm role="concept">
53515 <primary>callout</primary>
53516 <secondary>cache, description of</secondary>
53517 </indexterm>
53518 <indexterm role="concept">
53519 <primary>caching</primary>
53520 <secondary>callout</secondary>
53521 </indexterm>
53522 Exim caches the results of callouts in order to reduce the amount of resources
53523 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
53524 option. A hints database called <quote>callout</quote> is used for the cache. Two
53525 different record types are used: one records the result of a callout check for
53526 a specific address, and the other records information that applies to the
53527 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
53528 </para>
53529 <para>
53530 When an original callout fails, a detailed SMTP error message is given about
53531 the failure. However, for subsequent failures use the cache data, this message
53532 is not available.
53533 </para>
53534 <para>
53535 The expiry times for negative and positive address cache records are
53536 independent, and can be set by the global options <option>callout_negative_expire</option>
53537 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
53538 </para>
53539 <para>
53540 If a host gives a negative response to an SMTP connection, or rejects any
53541 commands up to and including
53542 </para>
53543 <literallayout class="monospaced">
53544 MAIL FROM:&lt;&gt;
53545 </literallayout>
53546 <para>
53547 (but not including the MAIL command with a non-empty address),
53548 any callout attempt is bound to fail. Exim remembers such failures in a
53549 domain cache record, which it uses to fail callouts for the domain without
53550 making new connections, until the domain record times out. There are two
53551 separate expiry times for domain cache records:
53552 <option>callout_domain_negative_expire</option> (default 3h) and
53553 <option>callout_domain_positive_expire</option> (default 7d).
53554 </para>
53555 <para>
53556 Domain records expire when the negative expiry time is reached if callouts
53557 cannot be made for the domain, or if the postmaster check failed.
53558 Otherwise, they expire when the positive expiry time is reached. This
53559 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
53560 will eventually be noticed.
53561 </para>
53562 <para>
53563 The callout caching mechanism is based on the domain of the address that is
53564 being tested. If the domain routes to several hosts, it is assumed that their
53565 behaviour will be the same.
53566 </para>
53567 </section>
53568 <section id="SECTsenaddver">
53569 <title>Sender address verification reporting</title>
53570 <para>
53571 <indexterm role="concept">
53572 <primary>verifying</primary>
53573 <secondary>suppressing error details</secondary>
53574 </indexterm>
53575 See section <xref linkend="SECTaddressverification"/> for a general discussion of
53576 verification. When sender verification fails in an ACL, the details of the
53577 failure are given as additional output lines before the 550 response to the
53578 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
53579 you might see:
53580 </para>
53581 <literallayout class="monospaced">
53582 MAIL FROM:&lt;xyz@abc.example&gt;
53583 250 OK
53584 RCPT TO:&lt;pqr@def.example&gt;
53585 550-Verification failed for &lt;xyz@abc.example&gt;
53586 550-Called:   192.168.34.43
53587 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
53588 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
53589 550 Sender verification failed
53590 </literallayout>
53591 <para>
53592 If more than one RCPT command fails in the same way, the details are given
53593 only for the first of them. However, some administrators do not want to send
53594 out this much information. You can suppress the details by adding
53595 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
53596 example:
53597 </para>
53598 <literallayout class="monospaced">
53599 verify = sender/no_details
53600 </literallayout>
53601 </section>
53602 <section id="SECTredirwhilveri">
53603 <title>Redirection while verifying</title>
53604 <para>
53605 <indexterm role="concept">
53606 <primary>verifying</primary>
53607 <secondary>redirection while</secondary>
53608 </indexterm>
53609 <indexterm role="concept">
53610 <primary>address redirection</primary>
53611 <secondary>while verifying</secondary>
53612 </indexterm>
53613 A dilemma arises when a local address is redirected by aliasing or forwarding
53614 during verification: should the generated addresses themselves be verified,
53615 or should the successful expansion of the original address be enough to verify
53616 it? By default, Exim takes the following pragmatic approach:
53617 </para>
53618 <itemizedlist>
53619 <listitem>
53620 <para>
53621 When an incoming address is redirected to just one child address, verification
53622 continues with the child address, and if that fails to verify, the original
53623 verification also fails.
53624 </para>
53625 </listitem>
53626 <listitem>
53627 <para>
53628 When an incoming address is redirected to more than one child address,
53629 verification does not continue. A success result is returned.
53630 </para>
53631 </listitem>
53632 </itemizedlist>
53633 <para>
53634 This seems the most reasonable behaviour for the common use of aliasing as a
53635 way of redirecting different local parts to the same mailbox. It means, for
53636 example, that a pair of alias entries of the form
53637 </para>
53638 <literallayout class="monospaced">
53639 A.Wol:   aw123
53640 aw123:   :fail: Gone away, no forwarding address
53641 </literallayout>
53642 <para>
53643 work as expected, with both local parts causing verification failure. When a
53644 redirection generates more than one address, the behaviour is more like a
53645 mailing list, where the existence of the alias itself is sufficient for
53646 verification to succeed.
53647 </para>
53648 <para>
53649 It is possible, however, to change the default behaviour so that all successful
53650 redirections count as successful verifications, however many new addresses are
53651 generated. This is specified by the <option>success_on_redirect</option> verification
53652 option. For example:
53653 </para>
53654 <literallayout class="monospaced">
53655 require verify = recipient/success_on_redirect/callout=10s
53656 </literallayout>
53657 <para>
53658 In this example, verification succeeds if a router generates a new address, and
53659 the callout does not occur, because no address was routed to a remote host.
53660 </para>
53661 <para>
53662 When verification is being tested via the <option>-bv</option> option, the treatment of
53663 redirections is as just described, unless the <option>-v</option> or any debugging option is
53664 also specified. In that case, full verification is done for every generated
53665 address and a report is output for each of them.
53666 </para>
53667 </section>
53668 <section id="SECTverifyCSA">
53669 <title>Client SMTP authorization (CSA)</title>
53670 <para>
53671 <indexterm role="concept">
53672 <primary>CSA</primary>
53673 <secondary>verifying</secondary>
53674 </indexterm>
53675 Client SMTP Authorization is a system that allows a site to advertise
53676 which machines are and are not permitted to send email. This is done by placing
53677 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
53678 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
53679 Authorization checks in Exim are performed by the ACL condition:
53680 </para>
53681 <literallayout class="monospaced">
53682 verify = csa
53683 </literallayout>
53684 <para>
53685 This fails if the client is not authorized. If there is a DNS problem, or if no
53686 valid CSA SRV record is found, or if the client is authorized, the condition
53687 succeeds. These three cases can be distinguished using the expansion variable
53688 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
53689 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
53690 be likely to cause problems for legitimate email.
53691 </para>
53692 <para>
53693 The error messages produced by the CSA code include slightly more
53694 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
53695 looking up the CSA SRV record, or problems looking up the CSA target
53696 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
53697 </para>
53698 <itemizedlist>
53699 <listitem>
53700 <para>
53701 The client&#x2019;s host name is explicitly not authorized.
53702 </para>
53703 </listitem>
53704 <listitem>
53705 <para>
53706 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
53707 </para>
53708 </listitem>
53709 <listitem>
53710 <para>
53711 The client&#x2019;s host name is authorized but it has no valid target IP addresses
53712 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
53713 </para>
53714 </listitem>
53715 <listitem>
53716 <para>
53717 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
53718 that all subdomains must be explicitly authorized.
53719 </para>
53720 </listitem>
53721 </itemizedlist>
53722 <para>
53723 The <option>csa</option> verification condition can take an argument which is the domain to
53724 use for the DNS query. The default is:
53725 </para>
53726 <literallayout class="monospaced">
53727 verify = csa/$sender_helo_name
53728 </literallayout>
53729 <para>
53730 This implementation includes an extension to CSA. If the query domain
53731 is an address literal such as [192.0.2.95], or if it is a bare IP
53732 address, Exim searches for CSA SRV records in the reverse DNS as if
53733 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
53734 meaningful to say:
53735 </para>
53736 <literallayout class="monospaced">
53737 verify = csa/$sender_host_address
53738 </literallayout>
53739 <para>
53740 In fact, this is the check that Exim performs if the client does not say HELO.
53741 This extension can be turned off by setting the main configuration option
53742 <option>dns_csa_use_reverse</option> to be false.
53743 </para>
53744 <para>
53745 If a CSA SRV record is not found for the domain itself, a search
53746 is performed through its parent domains for a record which might be
53747 making assertions about subdomains. The maximum depth of this search is limited
53748 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
53749 default. Exim does not look for CSA SRV records in a top level domain, so the
53750 default settings handle HELO domains as long as seven
53751 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
53752 of legitimate HELO domains.
53753 </para>
53754 <para>
53755 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
53756 direct SRV lookups, this is not sufficient because of the extra parent domain
53757 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
53758 addresses into lookups in the reverse DNS space. The result of a successful
53759 lookup such as:
53760 </para>
53761 <literallayout class="monospaced">
53762 ${lookup dnsdb {csa=$sender_helo_name}}
53763 </literallayout>
53764 <para>
53765 has two space-separated fields: an authorization code and a target host name.
53766 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
53767 authorization required but absent, or <quote>?</quote> for unknown.
53768 </para>
53769 </section>
53770 <section id="SECTverifyPRVS">
53771 <title>Bounce address tag validation</title>
53772 <para>
53773 <indexterm role="concept">
53774 <primary>BATV, verifying</primary>
53775 </indexterm>
53776 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
53777 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
53778 Genuine incoming bounce messages should therefore always be addressed to
53779 recipients that have a valid tag. This scheme is a way of detecting unwanted
53780 bounce messages caused by sender address forgeries (often called <quote>collateral
53781 spam</quote>), because the recipients of such messages do not include valid tags.
53782 </para>
53783 <para>
53784 There are two expansion items to help with the implementation of the BATV
53785 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
53786 the original envelope sender address by using a simple key to add a hash of the
53787 address and some time-based randomizing information. The <option>prvs</option> expansion
53788 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
53789 The syntax of these expansion items is described in section
53790 <xref linkend="SECTexpansionitems"/>.
53791 </para>
53792 <para>
53793 As an example, suppose the secret per-address keys are stored in an MySQL
53794 database. A query to look up the key for an address could be defined as a macro
53795 like this:
53796 </para>
53797 <literallayout class="monospaced">
53798 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
53799                 WHERE sender='${quote_mysql:$prvscheck_address}'\
53800                 }{$value}}
53801 </literallayout>
53802 <para>
53803 Suppose also that the senders who make use of BATV are defined by an address
53804 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
53805 use this:
53806 </para>
53807 <literallayout class="monospaced">
53808 # Bounces: drop unsigned addresses for BATV senders
53809 deny message = This address does not send an unsigned reverse path
53810      senders = :
53811      recipients = +batv_senders
53812
53813 # Bounces: In case of prvs-signed address, check signature.
53814 deny message = Invalid reverse path signature.
53815      senders = :
53816      condition  = ${prvscheck {$local_part@$domain}\
53817                   {PRVSCHECK_SQL}{1}}
53818      !condition = $prvscheck_result
53819 </literallayout>
53820 <para>
53821 The first statement rejects recipients for bounce messages that are addressed
53822 to plain BATV sender addresses, because it is known that BATV senders do not
53823 send out messages with plain sender addresses. The second statement rejects
53824 recipients that are prvs-signed, but with invalid signatures (either because
53825 the key is wrong, or the signature has timed out).
53826 </para>
53827 <para>
53828 A non-prvs-signed address is not rejected by the second statement, because the
53829 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
53830 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
53831 the first argument is a syntactically valid prvs-signed address, the yield is
53832 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
53833 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
53834 of the checks (empty for failure, <quote>1</quote> for success).
53835 </para>
53836 <para>
53837 There is one more issue you must consider when implementing prvs-signing:
53838 you have to ensure that the routers accept prvs-signed addresses and
53839 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
53840 router to remove the signature with a configuration along these lines:
53841 </para>
53842 <literallayout class="monospaced">
53843 batv_redirect:
53844   driver = redirect
53845   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
53846 </literallayout>
53847 <para>
53848 This works because, if the third argument of <option>prvscheck</option> is empty, the result
53849 of the expansion of a prvs-signed address is the decoded value of the original
53850 address. This router should probably be the first of your routers that handles
53851 local addresses.
53852 </para>
53853 <para>
53854 To create BATV-signed addresses in the first place, a transport of this form
53855 can be used:
53856 </para>
53857 <literallayout class="monospaced">
53858 external_smtp_batv:
53859   driver = smtp
53860   return_path = ${prvs {$return_path} \
53861                        {${lookup mysql{SELECT \
53862                        secret FROM batv_prvs WHERE \
53863                        sender='${quote_mysql:$sender_address}'} \
53864                        {$value}fail}}}
53865 </literallayout>
53866 <para>
53867 If no key can be found for the existing return path, no signing takes place.
53868 </para>
53869 </section>
53870 <section id="SECTrelaycontrol">
53871 <title>Using an ACL to control relaying</title>
53872 <para>
53873 <indexterm role="concept">
53874 <primary>access control lists (ACLs)</primary>
53875 <secondary>relay control</secondary>
53876 </indexterm>
53877 <indexterm role="concept">
53878 <primary>relaying</primary>
53879 <secondary>control by ACL</secondary>
53880 </indexterm>
53881 <indexterm role="concept">
53882 <primary>policy control</primary>
53883 <secondary>relay control</secondary>
53884 </indexterm>
53885 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
53886 delivers it directly to another host as a result of a remote address contained
53887 within it. Redirecting a local address via an alias or forward file and then
53888 passing the message on to another host is not relaying,
53889 <indexterm role="concept">
53890 <primary><quote>percent hack</quote></primary>
53891 </indexterm>
53892 but a redirection as a result of the <quote>percent hack</quote> is.
53893 </para>
53894 <para>
53895 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
53896 A host which is acting as a gateway or an MX backup is concerned with incoming
53897 relaying from arbitrary hosts to a specific set of domains. On the other hand,
53898 a host which is acting as a smart host for a number of clients is concerned
53899 with outgoing relaying from those clients to the Internet at large. Often the
53900 same host is fulfilling both functions,
53901 but in principle these two kinds of relaying are entirely independent. What is
53902 not wanted is the transmission of mail from arbitrary remote hosts through your
53903 system to arbitrary domains.
53904 </para>
53905 <para>
53906 You can implement relay control by means of suitable statements in the ACL that
53907 runs for each RCPT command. For convenience, it is often easiest to use
53908 Exim&#x2019;s named list facility to define the domains and hosts involved. For
53909 example, suppose you want to do the following:
53910 </para>
53911 <itemizedlist>
53912 <listitem>
53913 <para>
53914 Deliver a number of domains to mailboxes on the local host (or process them
53915 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
53916 <emphasis>my.dom2.example</emphasis>.
53917 </para>
53918 </listitem>
53919 <listitem>
53920 <para>
53921 Relay mail for a number of other domains for which you are the secondary MX.
53922 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
53923 </para>
53924 </listitem>
53925 <listitem>
53926 <para>
53927 Relay mail from the hosts on your local LAN, to whatever domains are involved.
53928 Suppose your LAN is 192.168.45.0/24.
53929 </para>
53930 </listitem>
53931 </itemizedlist>
53932 <para>
53933 In the main part of the configuration, you put the following definitions:
53934 </para>
53935 <literallayout class="monospaced">
53936 domainlist local_domains = my.dom1.example : my.dom2.example
53937 domainlist relay_domains = friend1.example : friend2.example
53938 hostlist   relay_hosts   = 192.168.45.0/24
53939 </literallayout>
53940 <para>
53941 Now you can use these definitions in the ACL that is run for every RCPT
53942 command:
53943 </para>
53944 <literallayout class="monospaced">
53945 acl_check_rcpt:
53946   accept domains = +local_domains : +relay_domains
53947   accept hosts   = +relay_hosts
53948 </literallayout>
53949 <para>
53950 The first statement accepts any RCPT command that contains an address in
53951 the local or relay domains. For any other domain, control passes to the second
53952 statement, which accepts the command only if it comes from one of the relay
53953 hosts. In practice, you will probably want to make your ACL more sophisticated
53954 than this, for example, by including sender and recipient verification. The
53955 default configuration includes a more comprehensive example, which is described
53956 in chapter <xref linkend="CHAPdefconfil"/>.
53957 </para>
53958 </section>
53959 <section id="SECTcheralcon">
53960 <title>Checking a relay configuration</title>
53961 <para>
53962 <indexterm role="concept">
53963 <primary>relaying</primary>
53964 <secondary>checking control of</secondary>
53965 </indexterm>
53966 You can check the relay characteristics of your configuration in the same way
53967 that you can test any ACL behaviour for an incoming SMTP connection, by using
53968 the <option>-bh</option> option to run a fake SMTP session with which you interact.
53969 </para>
53970 <para>
53971 For specifically testing for unwanted relaying, the host
53972 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
53973 host from the host on which Exim is running, using the normal telnet port, you
53974 will see a normal telnet connection message and then quite a long delay. Be
53975 patient. The remote host is making an SMTP connection back to your host, and
53976 trying a number of common probes to test for open relay vulnerability. The
53977 results of the tests will eventually appear on your terminal.
53978 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
53979 </para>
53980 </section>
53981 </chapter>
53982
53983 <chapter id="CHAPexiscan">
53984 <title>Content scanning at ACL time</title>
53985 <para>
53986 <indexterm role="concept" id="IIDcosca" class="startofrange">
53987 <primary>content scanning</primary>
53988 <secondary>at ACL time</secondary>
53989 </indexterm>
53990 The extension of Exim to include content scanning at ACL time, formerly known
53991 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
53992 was integrated into the main source for Exim release 4.50, and Tom continues to
53993 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
53994 specification.
53995 </para>
53996 <para>
53997 It is also possible to scan the content of messages at other times. The
53998 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
53999 scanning after all the ACLs have run. A transport filter can be used to scan
54000 messages at delivery time (see the <option>transport_filter</option> option, described in
54001 chapter <xref linkend="CHAPtransportgeneric"/>).
54002 </para>
54003 <para>
54004 If you want to include the ACL-time content-scanning features when you compile
54005 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
54006 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
54007 </para>
54008 <itemizedlist>
54009 <listitem>
54010 <para>
54011 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
54012 for all MIME parts for SMTP and non-SMTP messages, respectively.
54013 </para>
54014 </listitem>
54015 <listitem>
54016 <para>
54017 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
54018 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
54019 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
54020 </para>
54021 </listitem>
54022 <listitem>
54023 <para>
54024 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
54025 of messages, or parts of messages, for debugging purposes.
54026 </para>
54027 </listitem>
54028 <listitem>
54029 <para>
54030 Additional expansion variables that are set in the new ACL and by the new
54031 conditions.
54032 </para>
54033 </listitem>
54034 <listitem>
54035 <para>
54036 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
54037 </para>
54038 </listitem>
54039 </itemizedlist>
54040 <para>
54041 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
54042 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
54043 condition is compiled, in addition to all the other content-scanning features.
54044 </para>
54045 <para>
54046 Content-scanning is continually evolving, and new features are still being
54047 added. While such features are still unstable and liable to incompatible
54048 changes, they are made available in Exim by setting options whose names begin
54049 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
54050 this manual. You can find out about them by reading the file called
54051 <filename>doc/experimental.txt</filename>.
54052 </para>
54053 <para>
54054 All the content-scanning facilities work on a MBOX copy of the message that is
54055 temporarily created in a file called:
54056 </para>
54057 <literallayout>
54058 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
54059 </literallayout>
54060 <para>
54061 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
54062 expect an MBOX-like structure inside that file. The file is created when the
54063 first content scanning facility is called. Subsequent calls to content
54064 scanning conditions open the same file again. The directory is recursively
54065 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
54066 </para>
54067 <literallayout class="monospaced">
54068 control = no_mbox_unspool
54069 </literallayout>
54070 <para>
54071 has been encountered. When the MIME ACL decodes files, they are put into the
54072 same directory by default.
54073 </para>
54074 <section id="SECTscanvirus">
54075 <title>Scanning for viruses</title>
54076 <para>
54077 <indexterm role="concept">
54078 <primary>virus scanning</primary>
54079 </indexterm>
54080 <indexterm role="concept">
54081 <primary>content scanning</primary>
54082 <secondary>for viruses</secondary>
54083 </indexterm>
54084 <indexterm role="concept">
54085 <primary>content scanning</primary>
54086 <secondary>the <option>malware</option> condition</secondary>
54087 </indexterm>
54088 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
54089 It supports a <quote>generic</quote> interface to scanners called via the shell, and
54090 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
54091 in memory and thus are much faster.
54092 </para>
54093 <para>
54094 <indexterm role="option">
54095 <primary><option>av_scanner</option></primary>
54096 </indexterm>
54097 You can set the <option>av_scanner</option> option in first part of the Exim configuration
54098 file to specify which scanner to use, together with any additional options that
54099 are needed. The basic syntax is as follows:
54100 </para>
54101 <literallayout>
54102 <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>
54103 </literallayout>
54104 <para>
54105 If you do not set <option>av_scanner</option>, it defaults to
54106 </para>
54107 <literallayout class="monospaced">
54108 av_scanner = sophie:/var/run/sophie
54109 </literallayout>
54110 <para>
54111 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
54112 before use. The following scanner types are supported in this release:
54113 </para>
54114 <variablelist>
54115 <varlistentry>
54116 <term><option>aveserver</option></term>
54117 <listitem>
54118 <para>
54119 <indexterm role="concept">
54120 <primary>virus scanners</primary>
54121 <secondary>Kaspersky</secondary>
54122 </indexterm>
54123 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
54124 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
54125 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
54126 example:
54127 </para>
54128 <literallayout class="monospaced">
54129 av_scanner = aveserver:/var/run/aveserver
54130 </literallayout>
54131 </listitem></varlistentry>
54132 <varlistentry>
54133 <term><option>clamd</option></term>
54134 <listitem>
54135 <para>
54136 <indexterm role="concept">
54137 <primary>virus scanners</primary>
54138 <secondary>clamd</secondary>
54139 </indexterm>
54140 This daemon-type scanner is GPL and free. You can get it at
54141 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
54142 unpack MIME containers, so it used to be recommended to unpack MIME attachments
54143 in the MIME ACL. This no longer believed to be necessary. One option is
54144 required: either the path and name of a UNIX socket file, or a hostname or IP
54145 number, and a port, separated by space, as in the second of these examples:
54146 </para>
54147 <literallayout class="monospaced">
54148 av_scanner = clamd:/opt/clamd/socket
54149 av_scanner = clamd:192.0.2.3 1234
54150 av_scanner = clamd:192.0.2.3 1234:local
54151 </literallayout>
54152 <para>
54153 If the value of av_scanner points to a UNIX socket file or contains the local
54154 keyword, then the ClamAV interface will pass a filename containing the data
54155 to be scanned, which will should normally result in less I/O happening and be
54156 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
54157 Exim does not assume that there is a common filesystem with the remote host.
54158 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
54159 you be running a version of ClamAV prior to 0.95.
54160 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
54161 contributing the code for this scanner.
54162 </para>
54163 </listitem></varlistentry>
54164 <varlistentry>
54165 <term><option>cmdline</option></term>
54166 <listitem>
54167 <para>
54168 <indexterm role="concept">
54169 <primary>virus scanners</primary>
54170 <secondary>command line interface</secondary>
54171 </indexterm>
54172 This is the keyword for the generic command line scanner interface. It can be
54173 used to attach virus scanners that are invoked from the shell. This scanner
54174 type takes 3 mandatory options:
54175 </para>
54176 <orderedlist numeration="arabic">
54177 <listitem>
54178 <para>
54179 The full path and name of the scanner binary, with all command line options,
54180 and a placeholder (<literal>%s</literal>) for the directory to scan.
54181 </para>
54182 </listitem>
54183 <listitem>
54184 <para>
54185 A regular expression to match against the STDOUT and STDERR output of the
54186 virus scanner. If the expression matches, a virus was found. You must make
54187 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
54188 the <quote>trigger</quote> expression.
54189 </para>
54190 </listitem>
54191 <listitem>
54192 <para>
54193 Another regular expression, containing exactly one pair of parentheses, to
54194 match the name of the virus found in the scanners output. This is called the
54195 <quote>name</quote> expression.
54196 </para>
54197 </listitem>
54198 </orderedlist>
54199 <para>
54200 For example, Sophos Sweep reports a virus on a line like this:
54201 </para>
54202 <literallayout class="monospaced">
54203 Virus 'W32/Magistr-B' found in file ./those.bat
54204 </literallayout>
54205 <para>
54206 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
54207 name expression, we want to extract the W32/Magistr-B string, so we can match
54208 for the single quotes left and right of it. Altogether, this makes the
54209 configuration setting:
54210 </para>
54211 <literallayout class="monospaced">
54212 av_scanner = cmdline:\
54213              /path/to/sweep -ss -all -rec -archive %s:\
54214              found in file:'(.+)'
54215 </literallayout>
54216 </listitem></varlistentry>
54217 <varlistentry>
54218 <term><option>drweb</option></term>
54219 <listitem>
54220 <para>
54221 <indexterm role="concept">
54222 <primary>virus scanners</primary>
54223 <secondary>DrWeb</secondary>
54224 </indexterm>
54225 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
54226 argument, either a full path to a UNIX socket, or an IP address and port
54227 separated by white space, as in these examples:
54228 </para>
54229 <literallayout class="monospaced">
54230 av_scanner = drweb:/var/run/drwebd.sock
54231 av_scanner = drweb:192.168.2.20 31337
54232 </literallayout>
54233 <para>
54234 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
54235 is used. Thanks to Alex Miller for contributing the code for this scanner.
54236 </para>
54237 </listitem></varlistentry>
54238 <varlistentry>
54239 <term><option>fsecure</option></term>
54240 <listitem>
54241 <para>
54242 <indexterm role="concept">
54243 <primary>virus scanners</primary>
54244 <secondary>F-Secure</secondary>
54245 </indexterm>
54246 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
54247 argument which is the path to a UNIX socket. For example:
54248 </para>
54249 <literallayout class="monospaced">
54250 av_scanner = fsecure:/path/to/.fsav
54251 </literallayout>
54252 <para>
54253 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
54254 Thelmen for contributing the code for this scanner.
54255 </para>
54256 </listitem></varlistentry>
54257 <varlistentry>
54258 <term><option>kavdaemon</option></term>
54259 <listitem>
54260 <para>
54261 <indexterm role="concept">
54262 <primary>virus scanners</primary>
54263 <secondary>Kaspersky</secondary>
54264 </indexterm>
54265 This is the scanner daemon of Kaspersky Version 4. This version of the
54266 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
54267 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
54268 For example:
54269 </para>
54270 <literallayout class="monospaced">
54271 av_scanner = kavdaemon:/opt/AVP/AvpCtl
54272 </literallayout>
54273 <para>
54274 The default path is <filename>/var/run/AvpCtl</filename>.
54275 </para>
54276 </listitem></varlistentry>
54277 <varlistentry>
54278 <term><option>mksd</option></term>
54279 <listitem>
54280 <para>
54281 <indexterm role="concept">
54282 <primary>virus scanners</primary>
54283 <secondary>mksd</secondary>
54284 </indexterm>
54285 This is a daemon type scanner that is aimed mainly at Polish users, though some
54286 parts of documentation are now available in English. You can get it at
54287 <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
54288 the maximum number of processes used simultaneously to scan the attachments,
54289 provided that the demime facility is employed and also provided that mksd has
54290 been run with at least the same number of child processes. For example:
54291 </para>
54292 <literallayout class="monospaced">
54293 av_scanner = mksd:2
54294 </literallayout>
54295 <para>
54296 You can safely omit this option (the default value is 1).
54297 </para>
54298 </listitem></varlistentry>
54299 <varlistentry>
54300 <term><option>sophie</option></term>
54301 <listitem>
54302 <para>
54303 <indexterm role="concept">
54304 <primary>virus scanners</primary>
54305 <secondary>Sophos and Sophie</secondary>
54306 </indexterm>
54307 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
54308 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
54309 for this scanner type is the path to the UNIX socket that Sophie uses for
54310 client communication. For example:
54311 </para>
54312 <literallayout class="monospaced">
54313 av_scanner = sophie:/tmp/sophie
54314 </literallayout>
54315 <para>
54316 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
54317 the option.
54318 </para>
54319 </listitem></varlistentry>
54320 </variablelist>
54321 <para>
54322 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
54323 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
54324 ACL.
54325 </para>
54326 <para>
54327 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
54328 makes it possible to use different scanners. See further below for an example.
54329 The <option>malware</option> condition caches its results, so when you use it multiple times
54330 for the same message, the actual scanning process is only carried out once.
54331 However, using expandable items in <option>av_scanner</option> disables this caching, in
54332 which case each use of the <option>malware</option> condition causes a new scan of the
54333 message.
54334 </para>
54335 <para>
54336 The <option>malware</option> condition takes a right-hand argument that is expanded before
54337 use. It can then be one of
54338 </para>
54339 <itemizedlist>
54340 <listitem>
54341 <para>
54342 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
54343 The condition succeeds if a virus was found, and fail otherwise. This is the
54344 recommended usage.
54345 </para>
54346 </listitem>
54347 <listitem>
54348 <para>
54349 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
54350 the condition fails immediately.
54351 </para>
54352 </listitem>
54353 <listitem>
54354 <para>
54355 A regular expression, in which case the message is scanned for viruses. The
54356 condition succeeds if a virus is found and its name matches the regular
54357 expression. This allows you to take special actions on certain types of virus.
54358 </para>
54359 </listitem>
54360 </itemizedlist>
54361 <para>
54362 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
54363 even if there is a problem with the virus scanner. Otherwise, such a problem
54364 causes the ACL to defer.
54365 </para>
54366 <para>
54367 <indexterm role="variable">
54368 <primary><varname>$malware_name</varname></primary>
54369 </indexterm>
54370 When a virus is found, the condition sets up an expansion variable called
54371 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
54372 <option>message</option> modifier that specifies the error returned to the sender, and/or in
54373 logging data.
54374 </para>
54375 <para>
54376 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
54377 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
54378 <option>malware</option> condition.
54379 </para>
54380 <para>
54381 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
54382 imposed by your anti-virus scanner.
54383 </para>
54384 <para>
54385 Here is a very simple scanning example:
54386 </para>
54387 <literallayout class="monospaced">
54388 deny message = This message contains malware ($malware_name)
54389      demime = *
54390      malware = *
54391 </literallayout>
54392 <para>
54393 The next example accepts messages when there is a problem with the scanner:
54394 </para>
54395 <literallayout class="monospaced">
54396 deny message = This message contains malware ($malware_name)
54397      demime = *
54398      malware = */defer_ok
54399 </literallayout>
54400 <para>
54401 The next example shows how to use an ACL variable to scan with both sophie and
54402 aveserver. It assumes you have set:
54403 </para>
54404 <literallayout class="monospaced">
54405 av_scanner = $acl_m0
54406 </literallayout>
54407 <para>
54408 in the main Exim configuration.
54409 </para>
54410 <literallayout class="monospaced">
54411 deny message = This message contains malware ($malware_name)
54412      set acl_m0 = sophie
54413      malware = *
54414
54415 deny message = This message contains malware ($malware_name)
54416      set acl_m0 = aveserver
54417      malware = *
54418 </literallayout>
54419 </section>
54420 <section id="SECTscanspamass">
54421 <title>Scanning with SpamAssassin</title>
54422 <para>
54423 <indexterm role="concept">
54424 <primary>content scanning</primary>
54425 <secondary>for spam</secondary>
54426 </indexterm>
54427 <indexterm role="concept">
54428 <primary>spam scanning</primary>
54429 </indexterm>
54430 <indexterm role="concept">
54431 <primary>SpamAssassin</primary>
54432 </indexterm>
54433 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
54434 score and a report for the message. You can get SpamAssassin at
54435 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
54436 installation, you can use CPAN by running:
54437 </para>
54438 <literallayout class="monospaced">
54439 perl -MCPAN -e 'install Mail::SpamAssassin'
54440 </literallayout>
54441 <para>
54442 SpamAssassin has its own set of configuration files. Please review its
54443 documentation to see how you can tweak it. The default installation should work
54444 nicely, however.
54445 </para>
54446 <para>
54447 <indexterm role="option">
54448 <primary><option>spamd_address</option></primary>
54449 </indexterm>
54450 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
54451 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
54452 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
54453 part of the Exim configuration as follows (example):
54454 </para>
54455 <literallayout class="monospaced">
54456 spamd_address = 192.168.99.45 387
54457 </literallayout>
54458 <para>
54459 You do not need to set this option if you use the default. As of version 2.60,
54460 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
54461 these, supply <option>spamd_address</option> with an absolute file name instead of a
54462 address/port pair:
54463 </para>
54464 <literallayout class="monospaced">
54465 spamd_address = /var/run/spamd_socket
54466 </literallayout>
54467 <para>
54468 You can have multiple <option>spamd</option> servers to improve scalability. These can
54469 reside on other hardware reachable over the network. To specify multiple
54470 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
54471 option, separated with colons:
54472 </para>
54473 <literallayout class="monospaced">
54474 spamd_address = 192.168.2.10 783 : \
54475                 192.168.2.11 783 : \
54476                 192.168.2.12 783
54477 </literallayout>
54478 <para>
54479 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
54480 fashion. When a server fails to respond to the connection attempt, all other
54481 servers are tried until one succeeds. If no server responds, the <option>spam</option>
54482 condition defers.
54483 </para>
54484 <para>
54485 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
54486 multiple <option>spamd</option> servers.
54487 </para>
54488 <para>
54489 The <option>spamd_address</option> variable is expanded before use if it starts with
54490 a dollar sign. In this case, the expansion may return a string that is
54491 used as the list so that multiple spamd servers can be the result of an
54492 expansion.
54493 </para>
54494 </section>
54495 <section id="SECID206">
54496 <title>Calling SpamAssassin from an Exim ACL</title>
54497 <para>
54498 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
54499 </para>
54500 <literallayout class="monospaced">
54501 deny message = This message was classified as SPAM
54502      spam = joe
54503 </literallayout>
54504 <para>
54505 The right-hand side of the <option>spam</option> condition specifies a name. This is
54506 relevant if you have set up multiple SpamAssassin profiles. If you do not want
54507 to scan using a specific profile, but rather use the SpamAssassin system-wide
54508 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
54509 However, you must put something on the right-hand side.
54510 </para>
54511 <para>
54512 The name allows you to use per-domain or per-user antispam profiles in
54513 principle, but this is not straightforward in practice, because a message may
54514 have multiple recipients, not necessarily all in the same domain. Because the
54515 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
54516 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
54517 are not set.
54518 </para>
54519 <para>
54520 The right-hand side of the <option>spam</option> condition is expanded before being used, so
54521 you can put lookups or conditions there. When the right-hand side evaluates to
54522 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
54523 </para>
54524 <para>
54525 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
54526 large ones may cause significant performance degradation. As most spam messages
54527 are quite small, it is recommended that you do not scan the big ones. For
54528 example:
54529 </para>
54530 <literallayout class="monospaced">
54531 deny message = This message was classified as SPAM
54532      condition = ${if &lt; {$message_size}{10K}}
54533      spam = nobody
54534 </literallayout>
54535 <para>
54536 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
54537 SpamAssassin profile has been matched or exceeded. If you want to use the
54538 <option>spam</option> condition for its side effects (see the variables below), you can make
54539 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
54540 </para>
54541 <para>
54542 <indexterm role="concept">
54543 <primary>spam scanning</primary>
54544 <secondary>returned variables</secondary>
54545 </indexterm>
54546 When the <option>spam</option> condition is run, it sets up a number of expansion
54547 variables. These variables are saved with the received message, thus they are
54548 available for use at delivery time.
54549 </para>
54550 <variablelist>
54551 <varlistentry>
54552 <term><varname>$spam_score</varname></term>
54553 <listitem>
54554 <para>
54555 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
54556 for inclusion in log or reject messages.
54557 </para>
54558 </listitem></varlistentry>
54559 <varlistentry>
54560 <term><varname>$spam_score_int</varname></term>
54561 <listitem>
54562 <para>
54563 The spam score of the message, multiplied by ten, as an integer value. For
54564 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
54565 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
54566 The integer value is useful for numeric comparisons in conditions.
54567 </para>
54568 </listitem></varlistentry>
54569 <varlistentry>
54570 <term><varname>$spam_bar</varname></term>
54571 <listitem>
54572 <para>
54573 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
54574 integer part of the spam score value. A spam score of 4.4 would have a
54575 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
54576 headers, since MUAs can match on such strings.
54577 </para>
54578 </listitem></varlistentry>
54579 <varlistentry>
54580 <term><varname>$spam_report</varname></term>
54581 <listitem>
54582 <para>
54583 A multiline text table, containing the full SpamAssassin report for the
54584 message. Useful for inclusion in headers or reject messages.
54585 </para>
54586 </listitem></varlistentry>
54587 </variablelist>
54588 <para>
54589 The <option>spam</option> condition caches its results unless expansion in
54590 spamd_address was used. If you call it again with the same user name, it
54591 does not scan again, but rather returns the same values as before.
54592 </para>
54593 <para>
54594 The <option>spam</option> condition returns DEFER if there is any error while running
54595 the message through SpamAssassin or if the expansion of spamd_address
54596 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
54597 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
54598 spam condition, like this:
54599 </para>
54600 <literallayout class="monospaced">
54601 deny message = This message was classified as SPAM
54602      spam    = joe/defer_ok
54603 </literallayout>
54604 <para>
54605 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
54606 </para>
54607 <para>
54608 Here is a longer, commented example of the use of the <option>spam</option>
54609 condition:
54610 </para>
54611 <literallayout class="monospaced">
54612 # put headers in all messages (no matter if spam or not)
54613 warn  spam = nobody:true
54614       add_header = X-Spam-Score: $spam_score ($spam_bar)
54615       add_header = X-Spam-Report: $spam_report
54616
54617 # add second subject line with *SPAM* marker when message
54618 # is over threshold
54619 warn  spam = nobody
54620       add_header = Subject: *SPAM* $h_Subject:
54621
54622 # reject spam at high scores (&gt; 12)
54623 deny  message = This message scored $spam_score spam points.
54624       spam = nobody:true
54625       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
54626 </literallayout>
54627 </section>
54628 <section id="SECTscanmimepart">
54629 <title>Scanning MIME parts</title>
54630 <para>
54631 <indexterm role="concept">
54632 <primary>content scanning</primary>
54633 <secondary>MIME parts</secondary>
54634 </indexterm>
54635 <indexterm role="concept">
54636 <primary>MIME content scanning</primary>
54637 </indexterm>
54638 <indexterm role="option">
54639 <primary><option>acl_smtp_mime</option></primary>
54640 </indexterm>
54641 <indexterm role="option">
54642 <primary><option>acl_not_smtp_mime</option></primary>
54643 </indexterm>
54644 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
54645 each MIME part of an SMTP message, including multipart types, in the sequence
54646 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
54647 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
54648 options may both refer to the same ACL if you want the same processing in both
54649 cases.
54650 </para>
54651 <para>
54652 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
54653 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
54654 the case of a non-SMTP message. However, a MIME ACL is called only if the
54655 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
54656 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
54657 result code is sent to the client. In the case of an SMTP message, the
54658 <option>acl_smtp_data</option> ACL is not called when this happens.
54659 </para>
54660 <para>
54661 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
54662 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
54663 condition to match against the raw MIME part. You can also use the
54664 <option>mime_regex</option> condition to match against the decoded MIME part (see section
54665 <xref linkend="SECTscanregex"/>).
54666 </para>
54667 <para>
54668 At the start of a MIME ACL, a number of variables are set from the header
54669 information for the relevant MIME part. These are described below. The contents
54670 of the MIME part are not by default decoded into a disk file except for MIME
54671 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
54672 part into a disk file, you can use the <option>decode</option> condition. The general
54673 syntax is:
54674 </para>
54675 <literallayout>
54676 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
54677 </literallayout>
54678 <para>
54679 The right hand side is expanded before use. After expansion,
54680 the value can be:
54681 </para>
54682 <orderedlist numeration="arabic">
54683 <listitem>
54684 <para>
54685 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
54686 </para>
54687 </listitem>
54688 <listitem>
54689 <para>
54690 The string <quote>default</quote>. In that case, the file is put in the temporary
54691 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
54692 a sequential file name consisting of the message id and a sequence number. The
54693 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
54694 </para>
54695 </listitem>
54696 <listitem>
54697 <para>
54698 A full path name starting with a slash. If the full name is an existing
54699 directory, it is used as a replacement for the default directory. The filename
54700 is then sequentially assigned. If the path does not exist, it is used as
54701 the full path and file name.
54702 </para>
54703 </listitem>
54704 <listitem>
54705 <para>
54706 If the string does not start with a slash, it is used as the
54707 filename, and the default path is then used.
54708 </para>
54709 </listitem>
54710 </orderedlist>
54711 <para>
54712 The <option>decode</option> condition normally succeeds. It is only false for syntax
54713 errors or unusual circumstances such as memory shortages. You can easily decode
54714 a file with its original, proposed filename using
54715 </para>
54716 <literallayout class="monospaced">
54717 decode = $mime_filename
54718 </literallayout>
54719 <para>
54720 However, you should keep in mind that <varname>$mime_filename</varname> might contain
54721 anything. If you place files outside of the default path, they are not
54722 automatically unlinked.
54723 </para>
54724 <para>
54725 For RFC822 attachments (these are messages attached to messages, with a
54726 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
54727 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
54728 variable is set (see below). Attached messages are always decoded to disk
54729 before being checked, and the files are unlinked once the check is done.
54730 </para>
54731 <para>
54732 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
54733 used to match regular expressions against raw and decoded MIME parts,
54734 respectively. They are described in section <xref linkend="SECTscanregex"/>.
54735 </para>
54736 <para>
54737 <indexterm role="concept">
54738 <primary>MIME content scanning</primary>
54739 <secondary>returned variables</secondary>
54740 </indexterm>
54741 The following list describes all expansion variables that are
54742 available in the MIME ACL:
54743 </para>
54744 <variablelist>
54745 <varlistentry>
54746 <term><varname>$mime_boundary</varname></term>
54747 <listitem>
54748 <para>
54749 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
54750 have a boundary string, which is stored in this variable. If the current part
54751 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
54752 contains the empty string.
54753 </para>
54754 </listitem></varlistentry>
54755 <varlistentry>
54756 <term><varname>$mime_charset</varname></term>
54757 <listitem>
54758 <para>
54759 This variable contains the character set identifier, if one was found in the
54760 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
54761 </para>
54762 <literallayout class="monospaced">
54763 us-ascii
54764 gb2312 (Chinese)
54765 iso-8859-1
54766 </literallayout>
54767 <para>
54768 Please note that this value is not normalized, so you should do matches
54769 case-insensitively.
54770 </para>
54771 </listitem></varlistentry>
54772 <varlistentry>
54773 <term><varname>$mime_content_description</varname></term>
54774 <listitem>
54775 <para>
54776 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
54777 header. It can contain a human-readable description of the parts content. Some
54778 implementations repeat the filename for attachments here, but they are usually
54779 only used for display purposes.
54780 </para>
54781 </listitem></varlistentry>
54782 <varlistentry>
54783 <term><varname>$mime_content_disposition</varname></term>
54784 <listitem>
54785 <para>
54786 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
54787 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
54788 </para>
54789 </listitem></varlistentry>
54790 <varlistentry>
54791 <term><varname>$mime_content_id</varname></term>
54792 <listitem>
54793 <para>
54794 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
54795 This is a unique ID that can be used to reference a part from another part.
54796 </para>
54797 </listitem></varlistentry>
54798 <varlistentry>
54799 <term><varname>$mime_content_size</varname></term>
54800 <listitem>
54801 <para>
54802 This variable is set only after the <option>decode</option> modifier (see above) has been
54803 successfully run. It contains the size of the decoded part in kilobytes. The
54804 size is always rounded up to full kilobytes, so only a completely empty part
54805 has a <varname>$mime_content_size</varname> of zero.
54806 </para>
54807 </listitem></varlistentry>
54808 <varlistentry>
54809 <term><varname>$mime_content_transfer_encoding</varname></term>
54810 <listitem>
54811 <para>
54812 This variable contains the normalized content of the
54813 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
54814 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
54815 </para>
54816 </listitem></varlistentry>
54817 <varlistentry>
54818 <term><varname>$mime_content_type</varname></term>
54819 <listitem>
54820 <para>
54821 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
54822 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
54823 are some examples of popular MIME types, as they may appear in this variable:
54824 </para>
54825 <literallayout class="monospaced">
54826 text/plain
54827 text/html
54828 application/octet-stream
54829 image/jpeg
54830 audio/midi
54831 </literallayout>
54832 <para>
54833 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
54834 empty string.
54835 </para>
54836 </listitem></varlistentry>
54837 <varlistentry>
54838 <term><varname>$mime_decoded_filename</varname></term>
54839 <listitem>
54840 <para>
54841 This variable is set only after the <option>decode</option> modifier (see above) has been
54842 successfully run. It contains the full path and file name of the file
54843 containing the decoded data.
54844 </para>
54845 </listitem></varlistentry>
54846 </variablelist>
54847 <para>
54848 <indexterm role="concept">
54849 <primary>RFC 2047</primary>
54850 </indexterm>
54851 </para>
54852 <variablelist>
54853 <varlistentry>
54854 <term><varname>$mime_filename</varname></term>
54855 <listitem>
54856 <para>
54857 This is perhaps the most important of the MIME variables. It contains a
54858 proposed filename for an attachment, if one was found in either the
54859 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
54860 RFC2047 decoded, but no additional sanity checks are done. If no filename was
54861 found, this variable contains the empty string.
54862 </para>
54863 </listitem></varlistentry>
54864 <varlistentry>
54865 <term><varname>$mime_is_coverletter</varname></term>
54866 <listitem>
54867 <para>
54868 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
54869 attached data. It can be used to clamp down on flashy or unnecessarily encoded
54870 content in the cover letter, while not restricting attachments at all.
54871 </para>
54872 <para>
54873 The variable contains 1 (true) for a MIME part believed to be part of the
54874 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
54875 follows:
54876 </para>
54877 <orderedlist numeration="arabic">
54878 <listitem>
54879 <para>
54880 The outermost MIME part of a message is always a cover letter.
54881 </para>
54882 </listitem>
54883 <listitem>
54884 <para>
54885 If a multipart/alternative or multipart/related MIME part is a cover letter,
54886 so are all MIME subparts within that multipart.
54887 </para>
54888 </listitem>
54889 <listitem>
54890 <para>
54891 If any other multipart is a cover letter, the first subpart is a cover letter,
54892 and the rest are attachments.
54893 </para>
54894 </listitem>
54895 <listitem>
54896 <para>
54897 All parts contained within an attachment multipart are attachments.
54898 </para>
54899 </listitem>
54900 </orderedlist>
54901 <para>
54902 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
54903 alternative plain text), while allowing HTML files to be attached. HTML
54904 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
54905 </para>
54906 <literallayout class="monospaced">
54907 deny message = HTML mail is not accepted here
54908 !condition = $mime_is_rfc822
54909 condition = $mime_is_coverletter
54910 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
54911 </literallayout>
54912 </listitem></varlistentry>
54913 <varlistentry>
54914 <term><varname>$mime_is_multipart</varname></term>
54915 <listitem>
54916 <para>
54917 This variable has the value 1 (true) when the current part has the main type
54918 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
54919 Since multipart entities only serve as containers for other parts, you may not
54920 want to carry out specific actions on them.
54921 </para>
54922 </listitem></varlistentry>
54923 <varlistentry>
54924 <term><varname>$mime_is_rfc822</varname></term>
54925 <listitem>
54926 <para>
54927 This variable has the value 1 (true) if the current part is not a part of the
54928 checked message itself, but part of an attached message. Attached message
54929 decoding is fully recursive.
54930 </para>
54931 </listitem></varlistentry>
54932 <varlistentry>
54933 <term><varname>$mime_part_count</varname></term>
54934 <listitem>
54935 <para>
54936 This variable is a counter that is raised for each processed MIME part. It
54937 starts at zero for the very first part (which is usually a multipart). The
54938 counter is per-message, so it is reset when processing RFC822 attachments (see
54939 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
54940 complete, so you can use it in the DATA ACL to determine the number of MIME
54941 parts of a message. For non-MIME messages, this variable contains the value -1.
54942 </para>
54943 </listitem></varlistentry>
54944 </variablelist>
54945 </section>
54946 <section id="SECTscanregex">
54947 <title>Scanning with regular expressions</title>
54948 <para>
54949 <indexterm role="concept">
54950 <primary>content scanning</primary>
54951 <secondary>with regular expressions</secondary>
54952 </indexterm>
54953 <indexterm role="concept">
54954 <primary>regular expressions</primary>
54955 <secondary>content scanning with</secondary>
54956 </indexterm>
54957 You can specify your own custom regular expression matches on the full body of
54958 the message, or on individual MIME parts.
54959 </para>
54960 <para>
54961 The <option>regex</option> condition takes one or more regular expressions as arguments and
54962 matches them against the full message (when called in the DATA ACL) or a raw
54963 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
54964 linewise, with a maximum line length of 32K characters. That means you cannot
54965 have multiline matches with the <option>regex</option> condition.
54966 </para>
54967 <para>
54968 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
54969 to 32K of decoded content (the whole content at once, not linewise). If the
54970 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
54971 is decoded automatically when <option>mime_regex</option> is executed (using default path
54972 and filename values). If the decoded data is larger than  32K, only the first
54973 32K characters are checked.
54974 </para>
54975 <para>
54976 The regular expressions are passed as a colon-separated list. To include a
54977 literal colon, you must double it. Since the whole right-hand side string is
54978 expanded before being used, you must also escape dollar signs and backslashes
54979 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
54980 Here is a simple example that contains two regular expressions:
54981 </para>
54982 <literallayout class="monospaced">
54983 deny message = contains blacklisted regex ($regex_match_string)
54984      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
54985 </literallayout>
54986 <para>
54987 The conditions returns true if any one of the regular expressions matches. The
54988 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
54989 matching regular expression.
54990 </para>
54991 <para>
54992 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
54993 CPU-intensive.
54994 </para>
54995 </section>
54996 <section id="SECTdemimecond">
54997 <title>The demime condition</title>
54998 <para>
54999 <indexterm role="concept">
55000 <primary>content scanning</primary>
55001 <secondary>MIME checking</secondary>
55002 </indexterm>
55003 <indexterm role="concept">
55004 <primary>MIME content scanning</primary>
55005 </indexterm>
55006 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
55007 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
55008 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
55009 ACL functionality, but provides no additional facilities. Please note that this
55010 condition is deprecated and kept only for backward compatibility. You must set
55011 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
55012 use the <option>demime</option> condition.
55013 </para>
55014 <para>
55015 The <option>demime</option> condition unpacks MIME containers in the message. It detects
55016 errors in MIME containers and can match file extensions found in the message
55017 against a list. Using this facility produces files containing the unpacked MIME
55018 parts of the message in the temporary scan directory. If you do antivirus
55019 scanning, it is recommended that you use the <option>demime</option> condition before the
55020 antivirus (<option>malware</option>) condition.
55021 </para>
55022 <para>
55023 On the right-hand side of the <option>demime</option> condition you can pass a
55024 colon-separated list of file extensions that it should match against. For
55025 example:
55026 </para>
55027 <literallayout class="monospaced">
55028 deny message = Found blacklisted file attachment
55029      demime  = vbs:com:bat:pif:prf:lnk
55030 </literallayout>
55031 <para>
55032 If one of the file extensions is found, the condition is true, otherwise it is
55033 false. If there is a temporary error while demimeing (for example, <quote>disk
55034 full</quote>), the condition defers, and the message is temporarily rejected (unless
55035 the condition is on a <option>warn</option> verb).
55036 </para>
55037 <para>
55038 The right-hand side is expanded before being treated as a list, so you can have
55039 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
55040 zero (<quote>0</quote>), no demimeing is done and the condition is false.
55041 </para>
55042 <para>
55043 The <option>demime</option> condition set the following variables:
55044 </para>
55045 <variablelist>
55046 <varlistentry>
55047 <term><varname>$demime_errorlevel</varname></term>
55048 <listitem>
55049 <para>
55050 <indexterm role="variable">
55051 <primary><varname>$demime_errorlevel</varname></primary>
55052 </indexterm>
55053 When an error is detected in a MIME container, this variable contains the
55054 severity of the error, as an integer number. The higher the value, the more
55055 severe the error (the current maximum value is 3). If this variable is unset or
55056 zero, no error occurred.
55057 </para>
55058 </listitem></varlistentry>
55059 <varlistentry>
55060 <term><varname>$demime_reason</varname></term>
55061 <listitem>
55062 <para>
55063 <indexterm role="variable">
55064 <primary><varname>$demime_reason</varname></primary>
55065 </indexterm>
55066 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
55067 human-readable text string describing the MIME error that occurred.
55068 </para>
55069 </listitem></varlistentry>
55070 </variablelist>
55071 <variablelist>
55072 <varlistentry>
55073 <term><varname>$found_extension</varname></term>
55074 <listitem>
55075 <para>
55076 <indexterm role="variable">
55077 <primary><varname>$found_extension</varname></primary>
55078 </indexterm>
55079 When the <option>demime</option> condition is true, this variable contains the file
55080 extension it found.
55081 </para>
55082 </listitem></varlistentry>
55083 </variablelist>
55084 <para>
55085 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
55086 the <option>demime</option> condition, and are not changed on subsequent calls.
55087 </para>
55088 <para>
55089 If you do not want to check for file extensions, but rather use the <option>demime</option>
55090 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
55091 right-hand side value. Here is a more elaborate example of how to use this
55092 facility:
55093 </para>
55094 <literallayout class="monospaced">
55095 # Reject messages with serious MIME container errors
55096 deny  message = Found MIME error ($demime_reason).
55097       demime = *
55098       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
55099
55100 # Reject known virus spreading file extensions.
55101 # Accepting these is pretty much braindead.
55102 deny  message = contains $found_extension file (blacklisted).
55103       demime  = com:vbs:bat:pif:scr
55104
55105 # Freeze .exe and .doc files. Postmaster can
55106 # examine them and eventually thaw them.
55107 deny  log_message = Another $found_extension file.
55108       demime = exe:doc
55109       control = freeze
55110 </literallayout>
55111 <para>
55112 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
55113 </para>
55114 </section>
55115 </chapter>
55116
55117 <chapter id="CHAPlocalscan">
55118 <title>Adding a local scan function to Exim</title>
55119 <titleabbrev>Local scan function</titleabbrev>
55120 <para>
55121 <indexterm role="concept" id="IIDlosca" class="startofrange">
55122 <primary><function>local_scan()</function> function</primary>
55123 <secondary>description of</secondary>
55124 </indexterm>
55125 <indexterm role="concept">
55126 <primary>customizing</primary>
55127 <secondary>input scan using C function</secondary>
55128 </indexterm>
55129 <indexterm role="concept">
55130 <primary>policy control</primary>
55131 <secondary>by local scan function</secondary>
55132 </indexterm>
55133 In these days of email worms, viruses, and ever-increasing spam, some sites
55134 want to apply a lot of checking to messages before accepting them.
55135 </para>
55136 <para>
55137 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
55138 passing messages to external virus and spam scanning software. You can also do
55139 a certain amount in Exim itself through string expansions and the <option>condition</option>
55140 condition in the ACL that runs after the SMTP DATA command or the ACL for
55141 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
55142 </para>
55143 <para>
55144 To allow for further customization to a site&#x2019;s own requirements, there is the
55145 possibility of linking Exim with a private message scanning function, written
55146 in C. If you want to run code that is written in something other than C, you
55147 can of course use a little C stub to call it.
55148 </para>
55149 <para>
55150 The local scan function is run once for every incoming message, at the point
55151 when Exim is just about to accept the message.
55152 It can therefore be used to control non-SMTP messages from local processes as
55153 well as messages arriving via SMTP.
55154 </para>
55155 <para>
55156 Exim applies a timeout to calls of the local scan function, and there is an
55157 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
55158 Zero means <quote>no timeout</quote>.
55159 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
55160 before calling the local scan function, so that the most common types of crash
55161 are caught. If the timeout is exceeded or one of those signals is caught, the
55162 incoming message is rejected with a temporary error if it is an SMTP message.
55163 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
55164 code. The incident is logged on the main and reject logs.
55165 </para>
55166 <section id="SECID207">
55167 <title>Building Exim to use a local scan function</title>
55168 <para>
55169 <indexterm role="concept">
55170 <primary><function>local_scan()</function> function</primary>
55171 <secondary>building Exim to use</secondary>
55172 </indexterm>
55173 To make use of the local scan function feature, you must tell Exim where your
55174 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
55175 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
55176 directory, so you might set
55177 </para>
55178 <literallayout class="monospaced">
55179 LOCAL_SCAN_SOURCE=Local/local_scan.c
55180 </literallayout>
55181 <para>
55182 for example. The function must be called <function>local_scan()</function>. It is called by
55183 Exim after it has received a message, when the success return code is about to
55184 be sent. This is after all the ACLs have been run. The return code from your
55185 function controls whether the message is actually accepted or not. There is a
55186 commented template function (that just accepts the message) in the file
55187 _src/local_scan.c_.
55188 </para>
55189 <para>
55190 If you want to make use of Exim&#x2019;s run time configuration file to set options
55191 for your <function>local_scan()</function> function, you must also set
55192 </para>
55193 <literallayout class="monospaced">
55194 LOCAL_SCAN_HAS_OPTIONS=yes
55195 </literallayout>
55196 <para>
55197 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
55198 </para>
55199 </section>
55200 <section id="SECTapiforloc">
55201 <title>API for local_scan()</title>
55202 <para>
55203 <indexterm role="concept">
55204 <primary><function>local_scan()</function> function</primary>
55205 <secondary>API description</secondary>
55206 </indexterm>
55207 You must include this line near the start of your code:
55208 </para>
55209 <literallayout class="monospaced">
55210 #include "local_scan.h"
55211 </literallayout>
55212 <para>
55213 This header file defines a number of variables and other values, and the
55214 prototype for the function itself. Exim is coded to use unsigned char values
55215 almost exclusively, and one of the things this header defines is a shorthand
55216 for <literal>unsigned char</literal> called <literal>uschar</literal>.
55217 It also contains the following macro definitions, to simplify casting character
55218 strings and pointers to character strings:
55219 </para>
55220 <literallayout class="monospaced">
55221 #define CS   (char *)
55222 #define CCS  (const char *)
55223 #define CSS  (char **)
55224 #define US   (unsigned char *)
55225 #define CUS  (const unsigned char *)
55226 #define USS  (unsigned char **)
55227 </literallayout>
55228 <para>
55229 The function prototype for <function>local_scan()</function> is:
55230 </para>
55231 <literallayout class="monospaced">
55232 extern int local_scan(int fd, uschar **return_text);
55233 </literallayout>
55234 <para>
55235 The arguments are as follows:
55236 </para>
55237 <itemizedlist>
55238 <listitem>
55239 <para>
55240 <option>fd</option> is a file descriptor for the file that contains the body of the message
55241 (the -D file). The file is open for reading and writing, but updating it is not
55242 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
55243 </para>
55244 <para>
55245 The descriptor is positioned at character 19 of the file, which is the first
55246 character of the body itself, because the first 19 characters are the message
55247 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
55248 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
55249 case this changes in some future version.
55250 </para>
55251 </listitem>
55252 <listitem>
55253 <para>
55254 <option>return_text</option> is an address which you can use to return a pointer to a text
55255 string at the end of the function. The value it points to on entry is NULL.
55256 </para>
55257 </listitem>
55258 </itemizedlist>
55259 <para>
55260 The function must return an <option>int</option> value which is one of the following macros:
55261 </para>
55262 <variablelist>
55263 <varlistentry>
55264 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
55265 <listitem>
55266 <para>
55267 <indexterm role="variable">
55268 <primary><varname>$local_scan_data</varname></primary>
55269 </indexterm>
55270 The message is accepted. If you pass back a string of text, it is saved with
55271 the message, and made available in the variable <varname>$local_scan_data</varname>. No
55272 newlines are permitted (if there are any, they are turned into spaces) and the
55273 maximum length of text is 1000 characters.
55274 </para>
55275 </listitem></varlistentry>
55276 <varlistentry>
55277 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
55278 <listitem>
55279 <para>
55280 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
55281 queued without immediate delivery, and is frozen.
55282 </para>
55283 </listitem></varlistentry>
55284 <varlistentry>
55285 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
55286 <listitem>
55287 <para>
55288 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
55289 queued without immediate delivery.
55290 </para>
55291 </listitem></varlistentry>
55292 <varlistentry>
55293 <term><literal>LOCAL_SCAN_REJECT</literal></term>
55294 <listitem>
55295 <para>
55296 The message is rejected; the returned text is used as an error message which is
55297 passed back to the sender and which is also logged. Newlines are permitted &ndash;
55298 they cause a multiline response for SMTP rejections, but are converted to
55299 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
55300 used.
55301 </para>
55302 </listitem></varlistentry>
55303 <varlistentry>
55304 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
55305 <listitem>
55306 <para>
55307 The message is temporarily rejected; the returned text is used as an error
55308 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
55309 problem</quote> is used.
55310 </para>
55311 </listitem></varlistentry>
55312 <varlistentry>
55313 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
55314 <listitem>
55315 <para>
55316 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
55317 message is not written to the reject log. It has the effect of unsetting the
55318 <option>rejected_header</option> log selector for just this rejection. If
55319 <option>rejected_header</option> is already unset (see the discussion of the
55320 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
55321 same as LOCAL_SCAN_REJECT.
55322 </para>
55323 </listitem></varlistentry>
55324 <varlistentry>
55325 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
55326 <listitem>
55327 <para>
55328 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
55329 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
55330 </para>
55331 </listitem></varlistentry>
55332 </variablelist>
55333 <para>
55334 If the message is not being received by interactive SMTP, rejections are
55335 reported by writing to <option>stderr</option> or by sending an email, as configured by the
55336 <option>-oe</option> command line options.
55337 </para>
55338 </section>
55339 <section id="SECTconoptloc">
55340 <title>Configuration options for local_scan()</title>
55341 <para>
55342 <indexterm role="concept">
55343 <primary><function>local_scan()</function> function</primary>
55344 <secondary>configuration options</secondary>
55345 </indexterm>
55346 It is possible to have option settings in the main configuration file
55347 that set values in static variables in the <function>local_scan()</function> module. If you
55348 want to do this, you must have the line
55349 </para>
55350 <literallayout class="monospaced">
55351 LOCAL_SCAN_HAS_OPTIONS=yes
55352 </literallayout>
55353 <para>
55354 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
55355 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
55356 file, you must define static variables to hold the option values, and a table
55357 to define them.
55358 </para>
55359 <para>
55360 The table must be a vector called <option>local_scan_options</option>, of type
55361 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
55362 and a pointer to the variable that holds the value. The entries must appear in
55363 alphabetical order. Following <option>local_scan_options</option> you must also define a
55364 variable called <option>local_scan_options_count</option> that contains the number of
55365 entries in the table. Here is a short example, showing two kinds of option:
55366 </para>
55367 <literallayout class="monospaced">
55368 static int my_integer_option = 42;
55369 static uschar *my_string_option = US"a default string";
55370
55371 optionlist local_scan_options[] = {
55372   { "my_integer", opt_int,       &amp;my_integer_option },
55373   { "my_string",  opt_stringptr, &amp;my_string_option }
55374 };
55375
55376 int local_scan_options_count =
55377   sizeof(local_scan_options)/sizeof(optionlist);
55378 </literallayout>
55379 <para>
55380 The values of the variables can now be changed from Exim&#x2019;s runtime
55381 configuration file by including a local scan section as in this example:
55382 </para>
55383 <literallayout class="monospaced">
55384 begin local_scan
55385 my_integer = 99
55386 my_string = some string of text...
55387 </literallayout>
55388 <para>
55389 The available types of option data are as follows:
55390 </para>
55391 <variablelist>
55392 <varlistentry>
55393 <term><emphasis role="bold">opt_bool</emphasis></term>
55394 <listitem>
55395 <para>
55396 This specifies a boolean (true/false) option. The address should point to a
55397 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
55398 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
55399 whether such a variable has been set at all, you can initialize it to
55400 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
55401 values.)
55402 </para>
55403 </listitem></varlistentry>
55404 <varlistentry>
55405 <term><emphasis role="bold">opt_fixed</emphasis></term>
55406 <listitem>
55407 <para>
55408 This specifies a fixed point number, such as is used for load averages.
55409 The address should point to a variable of type <literal>int</literal>. The value is stored
55410 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
55411 </para>
55412 </listitem></varlistentry>
55413 <varlistentry>
55414 <term><emphasis role="bold">opt_int</emphasis></term>
55415 <listitem>
55416 <para>
55417 This specifies an integer; the address should point to a variable of type
55418 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
55419 Exim.
55420 </para>
55421 </listitem></varlistentry>
55422 <varlistentry>
55423 <term><emphasis role="bold">opt_mkint</emphasis></term>
55424 <listitem>
55425 <para>
55426 This is the same as <option>opt_int</option>, except that when such a value is output in a
55427 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
55428 printed with the suffix K or M.
55429 </para>
55430 </listitem></varlistentry>
55431 <varlistentry>
55432 <term><emphasis role="bold">opt_octint</emphasis></term>
55433 <listitem>
55434 <para>
55435 This also specifies an integer, but the value is always interpreted as an
55436 octal integer, whether or not it starts with the digit zero, and it is
55437 always output in octal.
55438 </para>
55439 </listitem></varlistentry>
55440 <varlistentry>
55441 <term><emphasis role="bold">opt_stringptr</emphasis></term>
55442 <listitem>
55443 <para>
55444 This specifies a string value; the address must be a pointer to a
55445 variable that points to a string (for example, of type <literal>uschar *</literal>).
55446 </para>
55447 </listitem></varlistentry>
55448 <varlistentry>
55449 <term><emphasis role="bold">opt_time</emphasis></term>
55450 <listitem>
55451 <para>
55452 This specifies a time interval value. The address must point to a variable of
55453 type <literal>int</literal>. The value that is placed there is a number of seconds.
55454 </para>
55455 </listitem></varlistentry>
55456 </variablelist>
55457 <para>
55458 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
55459 out the values of all the <function>local_scan()</function> options.
55460 </para>
55461 </section>
55462 <section id="SECID208">
55463 <title>Available Exim variables</title>
55464 <para>
55465 <indexterm role="concept">
55466 <primary><function>local_scan()</function> function</primary>
55467 <secondary>available Exim variables</secondary>
55468 </indexterm>
55469 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
55470 are the only ones that are guaranteed to be maintained from release to release.
55471 Note, however, that you can obtain the value of any Exim expansion variable,
55472 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
55473 C variables are as follows:
55474 </para>
55475 <variablelist>
55476 <varlistentry>
55477 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
55478 <listitem>
55479 <para>
55480 This variable contains the number of lines in the message&#x2019;s body.
55481 </para>
55482 </listitem></varlistentry>
55483 <varlistentry>
55484 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
55485 <listitem>
55486 <para>
55487 This variable contains the number of binary zero bytes in the message&#x2019;s body.
55488 </para>
55489 </listitem></varlistentry>
55490 <varlistentry>
55491 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
55492 <listitem>
55493 <para>
55494 This variable is set to zero when no debugging is taking place. Otherwise, it
55495 is a bitmap of debugging selectors. Two bits are identified for use in
55496 <function>local_scan()</function>; they are defined as macros:
55497 </para>
55498 <itemizedlist>
55499 <listitem>
55500 <para>
55501 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
55502 testing option that is not privileged &ndash; any caller may set it. All the
55503 other selector bits can be set only by admin users.
55504 </para>
55505 </listitem>
55506 <listitem>
55507 <para>
55508 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
55509 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
55510 of debugging bits.
55511 </para>
55512 </listitem>
55513 </itemizedlist>
55514 <para>
55515 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
55516 selected, you should use code like this:
55517 </para>
55518 <literallayout class="monospaced">
55519 if ((debug_selector &amp; D_local_scan) != 0)
55520   debug_printf("xxx", ...);
55521 </literallayout>
55522 </listitem></varlistentry>
55523 <varlistentry>
55524 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
55525 <listitem>
55526 <para>
55527 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
55528 variable <option>expand_string_message</option> contains the error message, zero-terminated.
55529 </para>
55530 </listitem></varlistentry>
55531 <varlistentry>
55532 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
55533 <listitem>
55534 <para>
55535 A pointer to a chain of header lines. The <option>header_line</option> structure is
55536 discussed below.
55537 </para>
55538 </listitem></varlistentry>
55539 <varlistentry>
55540 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
55541 <listitem>
55542 <para>
55543 A pointer to the last of the header lines.
55544 </para>
55545 </listitem></varlistentry>
55546 <varlistentry>
55547 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
55548 <listitem>
55549 <para>
55550 The value of the <option>headers_charset</option> configuration option.
55551 </para>
55552 </listitem></varlistentry>
55553 <varlistentry>
55554 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
55555 <listitem>
55556 <para>
55557 This variable is TRUE during a host checking session that is initiated by the
55558 <option>-bh</option> command line option.
55559 </para>
55560 </listitem></varlistentry>
55561 <varlistentry>
55562 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
55563 <listitem>
55564 <para>
55565 The IP address of the interface that received the message, as a string. This
55566 is NULL for locally submitted messages.
55567 </para>
55568 </listitem></varlistentry>
55569 <varlistentry>
55570 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
55571 <listitem>
55572 <para>
55573 The port on which this message was received. When testing with the <option>-bh</option>
55574 command line option, the value of this variable is -1 unless a port has been
55575 specified via the <option>-oMi</option> option.
55576 </para>
55577 </listitem></varlistentry>
55578 <varlistentry>
55579 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
55580 <listitem>
55581 <para>
55582 This variable contains Exim&#x2019;s message id for the incoming message (the value of
55583 <varname>$message_exim_id</varname>) as a zero-terminated string.
55584 </para>
55585 </listitem></varlistentry>
55586 <varlistentry>
55587 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
55588 <listitem>
55589 <para>
55590 The name of the protocol by which the message was received.
55591 </para>
55592 </listitem></varlistentry>
55593 <varlistentry>
55594 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
55595 <listitem>
55596 <para>
55597 The number of accepted recipients.
55598 </para>
55599 </listitem></varlistentry>
55600 <varlistentry>
55601 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
55602 <listitem>
55603 <para>
55604 <indexterm role="concept">
55605 <primary>recipient</primary>
55606 <secondary>adding in local scan</secondary>
55607 </indexterm>
55608 <indexterm role="concept">
55609 <primary>recipient</primary>
55610 <secondary>removing in local scan</secondary>
55611 </indexterm>
55612 The list of accepted recipients, held in a vector of length
55613 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
55614 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
55615 below). You can delete recipients by removing them from the vector and
55616 adjusting the value in <option>recipients_count</option>. In particular, by setting
55617 <option>recipients_count</option> to zero you remove all recipients. If you then return the
55618 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
55619 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
55620 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
55621 </para>
55622 </listitem></varlistentry>
55623 <varlistentry>
55624 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
55625 <listitem>
55626 <para>
55627 The envelope sender address. For bounce messages this is the empty string.
55628 </para>
55629 </listitem></varlistentry>
55630 <varlistentry>
55631 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
55632 <listitem>
55633 <para>
55634 The IP address of the sending host, as a string. This is NULL for
55635 locally-submitted messages.
55636 </para>
55637 </listitem></varlistentry>
55638 <varlistentry>
55639 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
55640 <listitem>
55641 <para>
55642 The name of the authentication mechanism that was used, or NULL if the message
55643 was not received over an authenticated SMTP connection.
55644 </para>
55645 </listitem></varlistentry>
55646 <varlistentry>
55647 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
55648 <listitem>
55649 <para>
55650 The name of the sending host, if known.
55651 </para>
55652 </listitem></varlistentry>
55653 <varlistentry>
55654 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
55655 <listitem>
55656 <para>
55657 The port on the sending host.
55658 </para>
55659 </listitem></varlistentry>
55660 <varlistentry>
55661 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
55662 <listitem>
55663 <para>
55664 This variable is TRUE for all SMTP input, including BSMTP.
55665 </para>
55666 </listitem></varlistentry>
55667 <varlistentry>
55668 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
55669 <listitem>
55670 <para>
55671 This variable is TRUE for BSMTP input.
55672 </para>
55673 </listitem></varlistentry>
55674 <varlistentry>
55675 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
55676 <listitem>
55677 <para>
55678 The contents of this variable control which pool of memory is used for new
55679 requests. See section <xref linkend="SECTmemhanloc"/> for details.
55680 </para>
55681 </listitem></varlistentry>
55682 </variablelist>
55683 </section>
55684 <section id="SECID209">
55685 <title>Structure of header lines</title>
55686 <para>
55687 The <option>header_line</option> structure contains the members listed below.
55688 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
55689 (see below). You can cause header lines to be ignored (deleted) by setting
55690 their type to *.
55691 </para>
55692 <variablelist>
55693 <varlistentry>
55694 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
55695 <listitem>
55696 <para>
55697 A pointer to the next header line, or NULL for the last line.
55698 </para>
55699 </listitem></varlistentry>
55700 <varlistentry>
55701 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
55702 <listitem>
55703 <para>
55704 A code identifying certain headers that Exim recognizes. The codes are printing
55705 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
55706 Notice in particular that any header line whose type is * is not transmitted
55707 with the message. This flagging is used for header lines that have been
55708 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
55709 lines.) Effectively, * means <quote>deleted</quote>.
55710 </para>
55711 </listitem></varlistentry>
55712 <varlistentry>
55713 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
55714 <listitem>
55715 <para>
55716 The number of characters in the header line, including the terminating and any
55717 internal newlines.
55718 </para>
55719 </listitem></varlistentry>
55720 <varlistentry>
55721 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
55722 <listitem>
55723 <para>
55724 A pointer to the text of the header. It always ends with a newline, followed by
55725 a zero byte. Internal newlines are preserved.
55726 </para>
55727 </listitem></varlistentry>
55728 </variablelist>
55729 </section>
55730 <section id="SECID210">
55731 <title>Structure of recipient items</title>
55732 <para>
55733 The <option>recipient_item</option> structure contains these members:
55734 </para>
55735 <variablelist>
55736 <varlistentry>
55737 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
55738 <listitem>
55739 <para>
55740 This is a pointer to the recipient address as it was received.
55741 </para>
55742 </listitem></varlistentry>
55743 <varlistentry>
55744 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
55745 <listitem>
55746 <para>
55747 This is used in later Exim processing when top level addresses are created by
55748 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
55749 and must always contain -1 at this stage.
55750 </para>
55751 </listitem></varlistentry>
55752 <varlistentry>
55753 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
55754 <listitem>
55755 <para>
55756 If this value is not NULL, bounce messages caused by failing to deliver to the
55757 recipient are sent to the address it contains. In other words, it overrides the
55758 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
55759 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
55760 an unqualified address, Exim qualifies it using the domain from
55761 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
55762 is NULL for all recipients.
55763 </para>
55764 </listitem></varlistentry>
55765 </variablelist>
55766 </section>
55767 <section id="SECID211">
55768 <title>Available Exim functions</title>
55769 <para>
55770 <indexterm role="concept">
55771 <primary><function>local_scan()</function> function</primary>
55772 <secondary>available Exim functions</secondary>
55773 </indexterm>
55774 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
55775 These are the only ones that are guaranteed to be maintained from release to
55776 release:
55777 </para>
55778 <variablelist>
55779 <varlistentry>
55780 <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>
55781 <listitem>
55782 <para>
55783 This function creates a child process that runs the command specified by
55784 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
55785 be NULL if no environment variables are to be passed. A new umask is supplied
55786 for the process in <option>newumask</option>.
55787 </para>
55788 <para>
55789 Pipes to the standard input and output of the new process are set up
55790 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
55791 standard error is cloned to the standard output. If there are any file
55792 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
55793 argument is TRUE, the new process is made into a process group leader.
55794 </para>
55795 <para>
55796 The function returns the pid of the new process, or -1 if things go wrong.
55797 </para>
55798 </listitem></varlistentry>
55799 <varlistentry>
55800 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
55801 <listitem>
55802 <para>
55803 This function waits for a child process to terminate, or for a timeout (in
55804 seconds) to expire. A timeout value of zero means wait as long as it takes. The
55805 return value is as follows:
55806 </para>
55807 <itemizedlist>
55808 <listitem>
55809 <para>
55810 &gt;= 0
55811 </para>
55812 <para>
55813 The process terminated by a normal exit and the value is the process
55814 ending status.
55815 </para>
55816 </listitem>
55817 <listitem>
55818 <para>
55819 &lt; 0 and &gt; &ndash;256
55820 </para>
55821 <para>
55822 The process was terminated by a signal and the value is the negation of the
55823 signal number.
55824 </para>
55825 </listitem>
55826 <listitem>
55827 <para>
55828 &ndash;256
55829 </para>
55830 <para>
55831 The process timed out.
55832 </para>
55833 </listitem>
55834 <listitem>
55835 <para>
55836 &ndash;257
55837 </para>
55838 <para>
55839 The was some other error in wait(); <option>errno</option> is still set.
55840 </para>
55841 </listitem>
55842 </itemizedlist>
55843 </listitem></varlistentry>
55844 <varlistentry>
55845 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
55846 <listitem>
55847 <para>
55848 This function provide you with a means of submitting a new message to
55849 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
55850 want, but this packages it all up for you.) The function creates a pipe,
55851 forks a subprocess that is running
55852 </para>
55853 <literallayout class="monospaced">
55854 exim -t -oem -oi -f &lt;&gt;
55855 </literallayout>
55856 <para>
55857 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
55858 that is connected to the standard input. The yield of the function is the PID
55859 of the subprocess. You can then write a message to the file descriptor, with
55860 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
55861 </para>
55862 <para>
55863 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
55864 finish and to collect its ending status. A timeout value of zero is usually
55865 fine in this circumstance. Unless you have made a mistake with the recipient
55866 addresses, you should get a return code of zero.
55867 </para>
55868 </listitem></varlistentry>
55869 <varlistentry>
55870 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
55871 <listitem>
55872 <para>
55873 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
55874 that it runs is:
55875 </para>
55876 <literallayout>
55877 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
55878 </literallayout>
55879 <para>
55880 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
55881 </para>
55882 </listitem></varlistentry>
55883 <varlistentry>
55884 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
55885 <listitem>
55886 <para>
55887 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
55888 output is written to the standard error stream. If no debugging is selected,
55889 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
55890 conditional on the <literal>local_scan</literal> debug selector by coding like this:
55891 </para>
55892 <literallayout class="monospaced">
55893 if ((debug_selector &amp; D_local_scan) != 0)
55894   debug_printf("xxx", ...);
55895 </literallayout>
55896 </listitem></varlistentry>
55897 <varlistentry>
55898 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
55899 <listitem>
55900 <para>
55901 This is an interface to Exim&#x2019;s string expansion code. The return value is the
55902 expanded string, or NULL if there was an expansion failure.
55903 The C variable <option>expand_string_message</option> contains an error message after an
55904 expansion failure. If expansion does not change the string, the return value is
55905 the pointer to the input string. Otherwise, the return value points to a new
55906 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
55907 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
55908 </para>
55909 </listitem></varlistentry>
55910 <varlistentry>
55911 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
55912 <listitem>
55913 <para>
55914 This function allows you to an add additional header line at the end of the
55915 existing ones. The first argument is the type, and should normally be a space
55916 character. The second argument is a format string and any number of
55917 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
55918 if you want, and you must ensure that the string ends with a newline.
55919 </para>
55920 </listitem></varlistentry>
55921 <varlistentry>
55922 <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>
55923 <listitem>
55924 <para>
55925 This function adds a new header line at a specified point in the header
55926 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
55927 </para>
55928 <para>
55929 If <option>name</option> is NULL, the new header is added at the end of the chain if
55930 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
55931 NULL, the header lines are searched for the first non-deleted header that
55932 matches the name. If one is found, the new header is added before it if
55933 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
55934 found header and any adjacent subsequent ones with the same name (even if
55935 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
55936 option controls where the header is added. If it is true, addition is at the
55937 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
55938 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
55939 </para>
55940 <literallayout class="monospaced">
55941 header_add_at_position(TRUE, US"Received", TRUE,
55942   ' ', "X-xxx: ...");
55943 </literallayout>
55944 <para>
55945 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
55946 there may not be if <option>received_header_text</option> expands to an empty string.
55947 </para>
55948 </listitem></varlistentry>
55949 <varlistentry>
55950 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
55951 <listitem>
55952 <para>
55953 This function removes header lines. If <option>occurrence</option> is zero or negative, all
55954 occurrences of the header are removed. If occurrence is greater than zero, that
55955 particular instance of the header is removed. If no header(s) can be found that
55956 match the specification, the function does nothing.
55957 </para>
55958 </listitem></varlistentry>
55959 <varlistentry>
55960 <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>
55961 <listitem>
55962 <para>
55963 This function tests whether the given header has the given name. It is not just
55964 a string comparison, because white space is permitted between the name and the
55965 colon. If the <option>notdel</option> argument is true, a false return is forced for all
55966 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
55967 </para>
55968 <literallayout class="monospaced">
55969 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
55970 </literallayout>
55971 </listitem></varlistentry>
55972 <varlistentry>
55973 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
55974 <listitem>
55975 <para>
55976 <indexterm role="concept">
55977 <primary>base64 encoding</primary>
55978 <secondary>functions for <function>local_scan()</function> use</secondary>
55979 </indexterm>
55980 This function base64-encodes a string, which is passed by address and length.
55981 The text may contain bytes of any value, including zero. The result is passed
55982 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
55983 zero-terminated.
55984 </para>
55985 </listitem></varlistentry>
55986 <varlistentry>
55987 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
55988 <listitem>
55989 <para>
55990 This function decodes a base64-encoded string. Its arguments are a
55991 zero-terminated base64-encoded string and the address of a variable that is set
55992 to point to the result, which is in dynamic memory. The length of the decoded
55993 string is the yield of the function. If the input is invalid base64 data, the
55994 yield is -1. A zero byte is added to the end of the output string to make it
55995 easy to interpret as a C string (assuming it contains no zeros of its own). The
55996 added zero byte is not included in the returned count.
55997 </para>
55998 </listitem></varlistentry>
55999 <varlistentry>
56000 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
56001 <listitem>
56002 <para>
56003 This function checks for a match in a domain list. Domains are always
56004 matched caselessly. The return value is one of the following:
56005 </para>
56006 <literallayout>
56007 <literal>OK     </literal> match succeeded
56008 <literal>FAIL   </literal> match failed
56009 <literal>DEFER  </literal> match deferred
56010 </literallayout>
56011 <para>
56012 DEFER is usually caused by some kind of lookup defer, such as the
56013 inability to contact a database.
56014 </para>
56015 </listitem></varlistentry>
56016 <varlistentry>
56017 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
56018 <listitem>
56019 <para>
56020 This function checks for a match in a local part list. The third argument
56021 controls case-sensitivity. The return values are as for
56022 <emphasis>lss_match_domain()</emphasis>.
56023 </para>
56024 </listitem></varlistentry>
56025 <varlistentry>
56026 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
56027 <listitem>
56028 <para>
56029 This function checks for a match in an address list. The third argument
56030 controls the case-sensitivity of the local part match. The domain is always
56031 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
56032 </para>
56033 </listitem></varlistentry>
56034 <varlistentry>
56035 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
56036 <listitem>
56037 <para>
56038 This function checks for a match in a host list. The most common usage is
56039 expected to be
56040 </para>
56041 <literallayout class="monospaced">
56042 lss_match_host(sender_host_name, sender_host_address, ...)
56043 </literallayout>
56044 <para>
56045 <indexterm role="variable">
56046 <primary><varname>$sender_host_address</varname></primary>
56047 </indexterm>
56048 An empty address field matches an empty item in the host list. If the host name
56049 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
56050 looked up if a host name is required to match an item in the list. The return
56051 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
56052 returns ERROR in the case when it had to look up a host name, but the lookup
56053 failed.
56054 </para>
56055 </listitem></varlistentry>
56056 <varlistentry>
56057 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
56058 <listitem>
56059 <para>
56060 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
56061 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
56062 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
56063 them. It specifies to which log or logs the message is written. The remaining
56064 arguments are a format and relevant insertion arguments. The string should not
56065 contain any newlines, not even at the end.
56066 </para>
56067 </listitem></varlistentry>
56068 <varlistentry>
56069 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
56070 <listitem>
56071 <para>
56072 This function adds an additional recipient to the message. The first argument
56073 is the recipient address. If it is unqualified (has no domain), it is qualified
56074 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
56075 </para>
56076 <para>
56077 This function does not allow you to specify a private <option>errors_to</option> address (as
56078 described with the structure of <option>recipient_item</option> above), because it pre-dates
56079 the addition of that field to the structure. However, it is easy to add such a
56080 value afterwards. For example:
56081 </para>
56082 <literallayout class="monospaced">
56083  receive_add_recipient(US"monitor@mydom.example", -1);
56084  recipients_list[recipients_count-1].errors_to =
56085    US"postmaster@mydom.example";
56086 </literallayout>
56087 </listitem></varlistentry>
56088 <varlistentry>
56089 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
56090 <listitem>
56091 <para>
56092 This is a convenience function to remove a named recipient from the list of
56093 recipients. It returns true if a recipient was removed, and false if no
56094 matching recipient could be found. The argument must be a complete email
56095 address.
56096 </para>
56097 </listitem></varlistentry>
56098 </variablelist>
56099 <para>
56100 <indexterm role="concept">
56101 <primary>RFC 2047</primary>
56102 </indexterm>
56103 </para>
56104 <variablelist>
56105 <varlistentry>
56106 <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>
56107 <listitem>
56108 <para>
56109 This function decodes strings that are encoded according to RFC 2047. Typically
56110 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
56111 from the Q or B encoding into a byte-string. Then, if provided with the name of
56112 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
56113 made  to translate the result to the named character set. If this fails, the
56114 binary string is returned with an error message.
56115 </para>
56116 <para>
56117 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
56118 maximum MIME word length is enforced. The third argument is the target
56119 encoding, or NULL if no translation is wanted.
56120 </para>
56121 <para>
56122 <indexterm role="concept">
56123 <primary>binary zero</primary>
56124 <secondary>in RFC 2047 decoding</secondary>
56125 </indexterm>
56126 <indexterm role="concept">
56127 <primary>RFC 2047</primary>
56128 <secondary>binary zero in</secondary>
56129 </indexterm>
56130 If a binary zero is encountered in the decoded string, it is replaced by the
56131 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
56132 not be 0 because header lines are handled as zero-terminated strings.
56133 </para>
56134 <para>
56135 The function returns the result of processing the string, zero-terminated; if
56136 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
56137 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
56138 </para>
56139 <para>
56140 If an error is encountered, the function returns NULL and uses the <option>error</option>
56141 argument to return an error message. The variable pointed to by <option>error</option> is
56142 set to NULL if there is no error; it may be set non-NULL even when the function
56143 returns a non-NULL value if decoding was successful, but there was a problem
56144 with translation.
56145 </para>
56146 </listitem></varlistentry>
56147 <varlistentry>
56148 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
56149 <listitem>
56150 <para>
56151 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
56152 below.
56153 </para>
56154 </listitem></varlistentry>
56155 <varlistentry>
56156 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
56157 <listitem>
56158 <para>
56159 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
56160 output stream. You should use this function only when there is an SMTP output
56161 stream, that is, when the incoming message is being received via interactive
56162 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
56163 is FALSE. If you want to test for an incoming message from another host (as
56164 opposed to a local process that used the <option>-bs</option> command line option), you can
56165 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
56166 is involved.
56167 </para>
56168 <para>
56169 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
56170 output function, so it can be used for all forms of SMTP connection.
56171 </para>
56172 <para>
56173 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
56174 must start with an appropriate response code: 550 if you are going to return
56175 LOCAL_SCAN_REJECT, 451 if you are going to return
56176 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
56177 initial lines of a multi-line response, the code must be followed by a hyphen
56178 to indicate that the line is not the final response line. You must also ensure
56179 that the lines you write terminate with CRLF. For example:
56180 </para>
56181 <literallayout class="monospaced">
56182 smtp_printf("550-this is some extra info\r\n");
56183 return LOCAL_SCAN_REJECT;
56184 </literallayout>
56185 <para>
56186 Note that you can also create multi-line responses by including newlines in
56187 the data returned via the <option>return_text</option> argument. The added value of using
56188 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
56189 multiple output lines.
56190 </para>
56191 <para>
56192 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
56193 does not automatically flush pending output, and therefore does not test
56194 the state of the stream. (In the main code of Exim, flushing and error
56195 detection is done when Exim is ready for the next SMTP input command.) If
56196 you want to flush the output and check for an error (for example, the
56197 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
56198 arguments. It flushes the output stream, and returns a non-zero value if there
56199 is an error.
56200 </para>
56201 </listitem></varlistentry>
56202 <varlistentry>
56203 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
56204 <listitem>
56205 <para>
56206 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
56207 chunk of memory whose size is given by the argument. Exim bombs out if it ever
56208 runs out of memory. See the next section for a discussion of memory handling.
56209 </para>
56210 </listitem></varlistentry>
56211 <varlistentry>
56212 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
56213 <listitem>
56214 <para>
56215 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
56216 permanent pool. See the next section for a discussion of memory handling.
56217 </para>
56218 </listitem></varlistentry>
56219 <varlistentry>
56220 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
56221 <listitem>
56222 <para>
56223 See below.
56224 </para>
56225 </listitem></varlistentry>
56226 <varlistentry>
56227 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
56228 <listitem>
56229 <para>
56230 See below.
56231 </para>
56232 </listitem></varlistentry>
56233 <varlistentry>
56234 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
56235 <listitem>
56236 <para>
56237 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
56238 The first makes a copy of an entire string. The second copies up to a maximum
56239 number of characters, indicated by the second argument. The third uses a format
56240 and insertion arguments to create a new string. In each case, the result is a
56241 pointer to a new string in the current memory pool. See the next section for
56242 more discussion.
56243 </para>
56244 </listitem></varlistentry>
56245 </variablelist>
56246 </section>
56247 <section id="SECTmemhanloc">
56248 <title>More about Exim&#x2019;s memory handling</title>
56249 <para>
56250 <indexterm role="concept">
56251 <primary><function>local_scan()</function> function</primary>
56252 <secondary>memory handling</secondary>
56253 </indexterm>
56254 No function is provided for freeing memory, because that is never needed.
56255 The dynamic memory that Exim uses when receiving a message is automatically
56256 recycled if another message is received by the same process (this applies only
56257 to incoming SMTP connections &ndash; other input methods can supply only one
56258 message at a time). After receiving the last message, a reception process
56259 terminates.
56260 </para>
56261 <para>
56262 Because it is recycled, the normal dynamic memory cannot be used for holding
56263 data that must be preserved over a number of incoming messages on the same SMTP
56264 connection. However, Exim in fact uses two pools of dynamic memory; the second
56265 one is not recycled, and can be used for this purpose.
56266 </para>
56267 <para>
56268 If you want to allocate memory that remains available for subsequent messages
56269 in the same SMTP connection, you should set
56270 </para>
56271 <literallayout class="monospaced">
56272 store_pool = POOL_PERM
56273 </literallayout>
56274 <para>
56275 before calling the function that does the allocation. There is no need to
56276 restore the value if you do not need to; however, if you do want to revert to
56277 the normal pool, you can either restore the previous value of <option>store_pool</option> or
56278 set it explicitly to POOL_MAIN.
56279 </para>
56280 <para>
56281 The pool setting applies to all functions that get dynamic memory, including
56282 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
56283 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
56284 block of memory from the permanent pool while preserving the value of
56285 <option>store_pool</option>.
56286 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
56287 </para>
56288 </section>
56289 </chapter>
56290
56291 <chapter id="CHAPsystemfilter">
56292 <title>System-wide message filtering</title>
56293 <para>
56294 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
56295 <primary>filter</primary>
56296 <secondary>system filter</secondary>
56297 </indexterm>
56298 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
56299 <primary>filtering all mail</primary>
56300 </indexterm>
56301 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
56302 <primary>system filter</primary>
56303 </indexterm>
56304 The previous chapters (on ACLs and the local scan function) describe checks
56305 that can be applied to messages before they are accepted by a host. There is
56306 also a mechanism for checking messages once they have been received, but before
56307 they are delivered. This is called the <emphasis>system filter</emphasis>.
56308 </para>
56309 <para>
56310 The system filter operates in a similar manner to users&#x2019; filter files, but it
56311 is run just once per message (however many recipients the message has).
56312 It should not normally be used as a substitute for routing, because <option>deliver</option>
56313 commands in a system router provide new envelope recipient addresses.
56314 The system filter must be an Exim filter. It cannot be a Sieve filter.
56315 </para>
56316 <para>
56317 The system filter is run at the start of a delivery attempt, before any routing
56318 is done. If a message fails to be completely delivered at the first attempt,
56319 the system filter is run again at the start of every retry.
56320 If you want your filter to do something only once per message, you can make use
56321 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
56322 prevent it happening on retries.
56323 </para>
56324 <para>
56325 <indexterm role="variable">
56326 <primary><varname>$domain</varname></primary>
56327 </indexterm>
56328 <indexterm role="variable">
56329 <primary><varname>$local_part</varname></primary>
56330 </indexterm>
56331 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
56332 specific to individual recipient addresses, such as <varname>$local_part</varname> and
56333 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
56334 you want to run a centrally-specified filter for each recipient address
56335 independently, you can do so by setting up a suitable <command>redirect</command> router, as
56336 described in section <xref linkend="SECTperaddfil"/> below.
56337 </para>
56338 <section id="SECID212">
56339 <title>Specifying a system filter</title>
56340 <para>
56341 <indexterm role="concept">
56342 <primary>uid (user id)</primary>
56343 <secondary>system filter</secondary>
56344 </indexterm>
56345 <indexterm role="concept">
56346 <primary>gid (group id)</primary>
56347 <secondary>system filter</secondary>
56348 </indexterm>
56349 The name of the file that contains the system filter must be specified by
56350 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
56351 other than root, you must also set <option>system_filter_user</option> and
56352 <option>system_filter_group</option> as appropriate. For example:
56353 </para>
56354 <literallayout class="monospaced">
56355 system_filter = /etc/mail/exim.filter
56356 system_filter_user = exim
56357 </literallayout>
56358 <para>
56359 If a system filter generates any deliveries directly to files or pipes (via the
56360 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
56361 specified by setting <option>system_filter_file_transport</option> and
56362 <option>system_filter_pipe_transport</option>, respectively. Similarly,
56363 <option>system_filter_reply_transport</option> must be set to handle any messages generated
56364 by the <option>reply</option> command.
56365 </para>
56366 </section>
56367 <section id="SECID213">
56368 <title>Testing a system filter</title>
56369 <para>
56370 You can run simple tests of a system filter in the same way as for a user
56371 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
56372 are permitted only in system filters are recognized.
56373 </para>
56374 <para>
56375 If you want to test the combined effect of a system filter and a user filter,
56376 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
56377 </para>
56378 </section>
56379 <section id="SECID214">
56380 <title>Contents of a system filter</title>
56381 <para>
56382 The language used to specify system filters is the same as for users&#x2019; filter
56383 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
56384 mail filtering</emphasis>. However, there are some additional features that are
56385 available only in system filters; these are described in subsequent sections.
56386 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
56387 they cause errors.
56388 </para>
56389 <para>
56390 <indexterm role="concept">
56391 <primary>frozen messages</primary>
56392 <secondary>manual thaw; testing in filter</secondary>
56393 </indexterm>
56394 There are two special conditions which, though available in users&#x2019; filter
56395 files, are designed for use in system filters. The condition <option>first_delivery</option>
56396 is true only for the first attempt at delivering a message, and
56397 <option>manually_thawed</option> is true only if the message has been frozen, and
56398 subsequently thawed by an admin user. An explicit forced delivery counts as a
56399 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
56400 </para>
56401 <para>
56402 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
56403 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
56404 succeed, it will not be tried again.
56405 If you want Exim to retry an unseen delivery until it succeeds, you should
56406 arrange to set it up every time the filter runs.
56407 </para>
56408 <para>
56409 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
56410 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
56411 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
56412 to which users&#x2019; filter files can refer.
56413 </para>
56414 </section>
56415 <section id="SECID215">
56416 <title>Additional variable for system filters</title>
56417 <para>
56418 <indexterm role="variable">
56419 <primary><varname>$recipients</varname></primary>
56420 </indexterm>
56421 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
56422 of the message (separated by commas and white space), is available in system
56423 filters. It is not available in users&#x2019; filters for privacy reasons.
56424 </para>
56425 </section>
56426 <section id="SECID216">
56427 <title>Defer, freeze, and fail commands for system filters</title>
56428 <para>
56429 <indexterm role="concept">
56430 <primary>freezing messages</primary>
56431 </indexterm>
56432 <indexterm role="concept">
56433 <primary>message</primary>
56434 <secondary>freezing</secondary>
56435 </indexterm>
56436 <indexterm role="concept">
56437 <primary>message</primary>
56438 <secondary>forced failure</secondary>
56439 </indexterm>
56440 <indexterm role="concept">
56441 <primary><option>fail</option></primary>
56442 <secondary>in system filter</secondary>
56443 </indexterm>
56444 <indexterm role="concept">
56445 <primary><option>freeze</option> in system filter</primary>
56446 </indexterm>
56447 <indexterm role="concept">
56448 <primary><option>defer</option> in system filter</primary>
56449 </indexterm>
56450 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
56451 always available in system filters, but are not normally enabled in users&#x2019;
56452 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
56453 for the <command>redirect</command> router.) These commands can optionally be followed by the
56454 word <option>text</option> and a string containing an error message, for example:
56455 </para>
56456 <literallayout class="monospaced">
56457 fail text "this message looks like spam to me"
56458 </literallayout>
56459 <para>
56460 The keyword <option>text</option> is optional if the next character is a double quote.
56461 </para>
56462 <para>
56463 The <option>defer</option> command defers delivery of the original recipients of the
56464 message. The <option>fail</option> command causes all the original recipients to be failed,
56465 and a bounce message to be created. The <option>freeze</option> command suspends all
56466 delivery attempts for the original recipients. In all cases, any new deliveries
56467 that are specified by the filter are attempted as normal after the filter has
56468 run.
56469 </para>
56470 <para>
56471 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
56472 not manually frozen since. This means that automatic freezing by a system
56473 filter can be used as a way of checking out suspicious messages. If a message
56474 is found to be all right, manually unfreezing it allows it to be delivered.
56475 </para>
56476 <para>
56477 <indexterm role="concept">
56478 <primary>log</primary>
56479 <secondary><option>fail</option> command log line</secondary>
56480 </indexterm>
56481 <indexterm role="concept">
56482 <primary><option>fail</option></primary>
56483 <secondary>log line; reducing</secondary>
56484 </indexterm>
56485 The text given with a fail command is used as part of the bounce message as
56486 well as being written to the log. If the message is quite long, this can fill
56487 up a lot of log space when such failures are common. To reduce the size of the
56488 log message, Exim interprets the text in a special way if it starts with the
56489 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
56490 strings is written to the log, and the rest of the text is used in the bounce
56491 message. For example:
56492 </para>
56493 <literallayout class="monospaced">
56494 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
56495      because it contains attachments that we are \
56496      not prepared to receive."
56497 </literallayout>
56498 <para>
56499 <indexterm role="concept">
56500 <primary>loop</primary>
56501 <secondary>caused by <option>fail</option></secondary>
56502 </indexterm>
56503 Take great care with the <option>fail</option> command when basing the decision to fail on
56504 the contents of the message, because the bounce message will of course include
56505 the contents of the original message and will therefore trigger the <option>fail</option>
56506 command again (causing a mail loop) unless steps are taken to prevent this.
56507 Testing the <option>error_message</option> condition is one way to prevent this. You could
56508 use, for example
56509 </para>
56510 <literallayout class="monospaced">
56511 if $message_body contains "this is spam" and not error_message
56512 then fail text "spam is not wanted here" endif
56513 </literallayout>
56514 <para>
56515 though of course that might let through unwanted bounce messages. The
56516 alternative is clever checking of the body and/or headers to detect bounces
56517 generated by the filter.
56518 </para>
56519 <para>
56520 The interpretation of a system filter file ceases after a
56521 <option>defer</option>,
56522 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
56523 set up earlier in the filter file are honoured, so you can use a sequence such
56524 as
56525 </para>
56526 <literallayout class="monospaced">
56527 mail ...
56528 freeze
56529 </literallayout>
56530 <para>
56531 to send a specified message when the system filter is freezing (or deferring or
56532 failing) a message. The normal deliveries for the message do not, of course,
56533 take place.
56534 </para>
56535 </section>
56536 <section id="SECTaddremheasys">
56537 <title>Adding and removing headers in a system filter</title>
56538 <para>
56539 <indexterm role="concept">
56540 <primary>header lines</primary>
56541 <secondary>adding; in system filter</secondary>
56542 </indexterm>
56543 <indexterm role="concept">
56544 <primary>header lines</primary>
56545 <secondary>removing; in system filter</secondary>
56546 </indexterm>
56547 <indexterm role="concept">
56548 <primary>filter</primary>
56549 <secondary>header lines; adding/removing</secondary>
56550 </indexterm>
56551 Two filter commands that are available only in system filters are:
56552 </para>
56553 <literallayout class="monospaced">
56554 headers add &lt;string&gt;
56555 headers remove &lt;string&gt;
56556 </literallayout>
56557 <para>
56558 The argument for the <option>headers add</option> is a string that is expanded and then
56559 added to the end of the message&#x2019;s headers. It is the responsibility of the
56560 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
56561 space is ignored, and if the string is otherwise empty, or if the expansion is
56562 forced to fail, the command has no effect.
56563 </para>
56564 <para>
56565 You can use <quote>\n</quote> within the string, followed by white space, to specify
56566 continued header lines. More than one header may be added in one command by
56567 including <quote>\n</quote> within the string without any following white space. For
56568 example:
56569 </para>
56570 <literallayout class="monospaced">
56571 headers add "X-header-1: ....\n  \
56572              continuation of X-header-1 ...\n\
56573              X-header-2: ...."
56574 </literallayout>
56575 <para>
56576 Note that the header line continuation white space after the first newline must
56577 be placed before the backslash that continues the input string, because white
56578 space after input continuations is ignored.
56579 </para>
56580 <para>
56581 The argument for <option>headers remove</option> is a colon-separated list of header names.
56582 This command applies only to those headers that are stored with the message;
56583 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
56584 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
56585 header with the same name, they are all removed.
56586 </para>
56587 <para>
56588 The <option>headers</option> command in a system filter makes an immediate change to the set
56589 of header lines that was received with the message (with possible additions
56590 from ACL processing). Subsequent commands in the system filter operate on the
56591 modified set, which also forms the basis for subsequent message delivery.
56592 Unless further modified during routing or transporting, this set of headers is
56593 used for all recipients of the message.
56594 </para>
56595 <para>
56596 During routing and transporting, the variables that refer to the contents of
56597 header lines refer only to those lines that are in this set. Thus, header lines
56598 that are added by a system filter are visible to users&#x2019; filter files and to all
56599 routers and transports. This contrasts with the manipulation of header lines by
56600 routers and transports, which is not immediate, but which instead is saved up
56601 until the message is actually being written (see section
56602 <xref linkend="SECTheadersaddrem"/>).
56603 </para>
56604 <para>
56605 If the message is not delivered at the first attempt, header lines that were
56606 added by the system filter are stored with the message, and so are still
56607 present at the next delivery attempt. Header lines that were removed are still
56608 present, but marked <quote>deleted</quote> so that they are not transported with the
56609 message. For this reason, it is usual to make the <option>headers</option> command
56610 conditional on <option>first_delivery</option> so that the set of header lines is not
56611 modified more than once.
56612 </para>
56613 <para>
56614 Because header modification in a system filter acts immediately, you have to
56615 use an indirect approach if you want to modify the contents of a header line.
56616 For example:
56617 </para>
56618 <literallayout class="monospaced">
56619 headers add "Old-Subject: $h_subject:"
56620 headers remove "Subject"
56621 headers add "Subject: new subject (was: $h_old-subject:)"
56622 headers remove "Old-Subject"
56623 </literallayout>
56624 </section>
56625 <section id="SECID217">
56626 <title>Setting an errors address in a system filter</title>
56627 <para>
56628 <indexterm role="concept">
56629 <primary>envelope sender</primary>
56630 </indexterm>
56631 In a system filter, if a <option>deliver</option> command is followed by
56632 </para>
56633 <literallayout class="monospaced">
56634 errors_to &lt;some address&gt;
56635 </literallayout>
56636 <para>
56637 in order to change the envelope sender (and hence the error reporting) for that
56638 delivery, any address may be specified. (In a user filter, only the current
56639 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
56640 might use
56641 </para>
56642 <literallayout class="monospaced">
56643 unseen deliver monitor@spying.example errors_to root@local.example
56644 </literallayout>
56645 <para>
56646 to take a copy which would not be sent back to the normal error reporting
56647 address if its delivery failed.
56648 </para>
56649 </section>
56650 <section id="SECTperaddfil">
56651 <title>Per-address filtering</title>
56652 <para>
56653 <indexterm role="variable">
56654 <primary><varname>$domain</varname></primary>
56655 </indexterm>
56656 <indexterm role="variable">
56657 <primary><varname>$local_part</varname></primary>
56658 </indexterm>
56659 In contrast to the system filter, which is run just once per message for each
56660 delivery attempt, it is also possible to set up a system-wide filtering
56661 operation that runs once for each recipient address. In this case, variables
56662 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
56663 filter file could be made dependent on them. This is an example of a router
56664 which implements such a filter:
56665 </para>
56666 <literallayout class="monospaced">
56667 central_filter:
56668   check_local_user
56669   driver = redirect
56670   domains = +local_domains
56671   file = /central/filters/$local_part
56672   no_verify
56673   allow_filter
56674   allow_freeze
56675 </literallayout>
56676 <para>
56677 The filter is run in a separate process under its own uid. Therefore, either
56678 <option>check_local_user</option> must be set (as above), in which case the filter is run as
56679 the local user, or the <option>user</option> option must be used to specify which user to
56680 use. If both are set, <option>user</option> overrides.
56681 </para>
56682 <para>
56683 Care should be taken to ensure that none of the commands in the filter file
56684 specify a significant delivery if the message is to go on to be delivered to
56685 its intended recipient. The router will not then claim to have dealt with the
56686 address, so it will be passed on to subsequent routers to be delivered in the
56687 normal way.
56688 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
56689 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
56690 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
56691 </para>
56692 </section>
56693 </chapter>
56694
56695 <chapter id="CHAPmsgproc">
56696 <title>Message processing</title>
56697 <para>
56698 <indexterm role="concept" id="IIDmesproc" class="startofrange">
56699 <primary>message</primary>
56700 <secondary>general processing</secondary>
56701 </indexterm>
56702 Exim performs various transformations on the sender and recipient addresses of
56703 all messages that it handles, and also on the messages&#x2019; header lines. Some of
56704 these are optional and configurable, while others always take place. All of
56705 this processing, except rewriting as a result of routing, and the addition or
56706 removal of header lines while delivering, happens when a message is received,
56707 before it is placed on Exim&#x2019;s queue.
56708 </para>
56709 <para>
56710 Some of the automatic processing takes place by default only for
56711 <quote>locally-originated</quote> messages. This adjective is used to describe messages
56712 that are not received over TCP/IP, but instead are passed to an Exim process on
56713 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
56714 set up by the <option>-bs</option> command line option.
56715 </para>
56716 <para>
56717 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
56718 or ::1) are not considered to be locally-originated. Exim does not treat the
56719 loopback interface specially in any way.
56720 </para>
56721 <para>
56722 If you want the loopback interface to be treated specially, you must ensure
56723 that there are appropriate entries in your ACLs.
56724 </para>
56725 <section id="SECTsubmodnon">
56726 <title>Submission mode for non-local messages</title>
56727 <para>
56728 <indexterm role="concept">
56729 <primary>message</primary>
56730 <secondary>submission</secondary>
56731 </indexterm>
56732 <indexterm role="concept">
56733 <primary>submission mode</primary>
56734 </indexterm>
56735 Processing that happens automatically for locally-originated messages (unless
56736 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
56737 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
56738 state. Submission mode is set by the modifier
56739 </para>
56740 <literallayout class="monospaced">
56741 control = submission
56742 </literallayout>
56743 <para>
56744 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
56745 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
56746 a local submission, and is normally used when the source of the message is
56747 known to be an MUA running on a client host (as opposed to an MTA). For
56748 example, to set submission mode for messages originating on the IPv4 loopback
56749 interface, you could include the following in the MAIL ACL:
56750 </para>
56751 <literallayout class="monospaced">
56752 warn  hosts = 127.0.0.1
56753       control = submission
56754 </literallayout>
56755 <para>
56756 <indexterm role="concept">
56757 <primary><option>sender_retain</option> submission option</primary>
56758 </indexterm>
56759 There are some options that can be used when setting submission mode. A slash
56760 is used to separate options. For example:
56761 </para>
56762 <literallayout class="monospaced">
56763 control = submission/sender_retain
56764 </literallayout>
56765 <para>
56766 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
56767 true and <option>local_from_check</option> false for the current incoming message. The first
56768 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
56769 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
56770 authenticated sender. With this setting, Exim still fixes up messages by adding
56771 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
56772 attempt to check sender authenticity in header lines.
56773 </para>
56774 <para>
56775 When <option>sender_retain</option> is not set, a submission mode setting may specify a
56776 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
56777 example:
56778 </para>
56779 <literallayout class="monospaced">
56780 control = submission/domain=some.domain
56781 </literallayout>
56782 <para>
56783 The domain may be empty. How this value is used is described in sections
56784 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
56785 that allows you to specify the user&#x2019;s full name for inclusion in a created
56786 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
56787 </para>
56788 <literallayout class="monospaced">
56789 accept authenticated = *
56790        control = submission/domain=wonderland.example/\
56791                             name=${lookup {$authenticated_id} \
56792                                    lsearch {/etc/exim/namelist}}
56793 </literallayout>
56794 <para>
56795 Because the name may contain any characters, including slashes, the <option>name</option>
56796 option must be given last. The remainder of the string is used as the name. For
56797 the example above, if <filename>/etc/exim/namelist</filename> contains:
56798 </para>
56799 <literallayout class="monospaced">
56800 bigegg:  Humpty Dumpty
56801 </literallayout>
56802 <para>
56803 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
56804 line would be:
56805 </para>
56806 <literallayout class="monospaced">
56807 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
56808 </literallayout>
56809 <para>
56810 <indexterm role="concept">
56811 <primary>return path</primary>
56812 <secondary>in submission mode</secondary>
56813 </indexterm>
56814 By default, submission mode forces the return path to the same address as is
56815 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
56816 specified, the return path is also left unchanged.
56817 </para>
56818 <para>
56819 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
56820 ACL. This means that any sender checks performed before the fix-ups use the
56821 untrusted sender address specified by the user, not the trusted sender address
56822 specified by submission mode. Although this might be slightly unexpected, it
56823 does mean that you can configure ACL checks to spot that a user is trying to
56824 spoof another&#x2019;s address.
56825 </para>
56826 </section>
56827 <section id="SECTlineendings">
56828 <title>Line endings</title>
56829 <para>
56830 <indexterm role="concept">
56831 <primary>line endings</primary>
56832 </indexterm>
56833 <indexterm role="concept">
56834 <primary>carriage return</primary>
56835 </indexterm>
56836 <indexterm role="concept">
56837 <primary>linefeed</primary>
56838 </indexterm>
56839 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
56840 linefeed) is the line ending for messages transmitted over the Internet using
56841 SMTP over TCP/IP. However, within individual operating systems, different
56842 conventions are used. For example, Unix-like systems use just LF, but others
56843 use CRLF or just CR.
56844 </para>
56845 <para>
56846 Exim was designed for Unix-like systems, and internally, it stores messages
56847 using the system&#x2019;s convention of a single LF as a line terminator. When
56848 receiving a message, all line endings are translated to this standard format.
56849 Originally, it was thought that programs that passed messages directly to an
56850 MTA within an operating system would use that system&#x2019;s convention. Experience
56851 has shown that this is not the case; for example, there are Unix applications
56852 that use CRLF in this circumstance. For this reason, and for compatibility with
56853 other MTAs, the way Exim handles line endings for all messages is now as
56854 follows:
56855 </para>
56856 <itemizedlist>
56857 <listitem>
56858 <para>
56859 LF not preceded by CR is treated as a line ending.
56860 </para>
56861 </listitem>
56862 <listitem>
56863 <para>
56864 CR is treated as a line ending; if it is immediately followed by LF, the LF
56865 is ignored.
56866 </para>
56867 </listitem>
56868 <listitem>
56869 <para>
56870 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
56871 nor a local message in the state where a line containing only a dot is a
56872 terminator.
56873 </para>
56874 </listitem>
56875 <listitem>
56876 <para>
56877 If a bare CR is encountered within a header line, an extra space is added after
56878 the line terminator so as not to end the header line. The reasoning behind this
56879 is that bare CRs in header lines are most likely either to be mistakes, or
56880 people trying to play silly games.
56881 </para>
56882 </listitem>
56883 <listitem>
56884 <para>
56885 If the first header line received in a message ends with CRLF, a subsequent
56886 bare LF in a header line is treated in the same way as a bare CR in a header
56887 line.
56888 </para>
56889 </listitem>
56890 </itemizedlist>
56891 </section>
56892 <section id="SECID218">
56893 <title>Unqualified addresses</title>
56894 <para>
56895 <indexterm role="concept">
56896 <primary>unqualified addresses</primary>
56897 </indexterm>
56898 <indexterm role="concept">
56899 <primary>address</primary>
56900 <secondary>qualification</secondary>
56901 </indexterm>
56902 By default, Exim expects every envelope address it receives from an external
56903 host to be fully qualified. Unqualified addresses cause negative responses to
56904 SMTP commands. However, because SMTP is used as a means of transporting
56905 messages from MUAs running on personal workstations, there is sometimes a
56906 requirement to accept unqualified addresses from specific hosts or IP networks.
56907 </para>
56908 <para>
56909 Exim has two options that separately control which hosts may send unqualified
56910 sender or recipient addresses in SMTP commands, namely
56911 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
56912 cases, if an unqualified address is accepted, it is qualified by adding the
56913 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
56914 </para>
56915 <para>
56916 <indexterm role="option">
56917 <primary><option>qualify_domain</option></primary>
56918 </indexterm>
56919 <indexterm role="option">
56920 <primary><option>qualify_recipient</option></primary>
56921 </indexterm>
56922 Unqualified addresses in header lines are automatically qualified for messages
56923 that are locally originated, unless the <option>-bnq</option> option is given on the command
56924 line. For messages received over SMTP, unqualified addresses in header lines
56925 are qualified only if unqualified addresses are permitted in SMTP commands. In
56926 other words, such qualification is also controlled by
56927 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
56928 </para>
56929 </section>
56930 <section id="SECID219">
56931 <title>The UUCP From line</title>
56932 <para>
56933 <indexterm role="concept">
56934 <primary><quote>From</quote> line</primary>
56935 </indexterm>
56936 <indexterm role="concept">
56937 <primary>UUCP</primary>
56938 <secondary><quote>From</quote> line</secondary>
56939 </indexterm>
56940 <indexterm role="concept">
56941 <primary>sender</primary>
56942 <secondary>address</secondary>
56943 </indexterm>
56944 <indexterm role="option">
56945 <primary><option>uucp_from_pattern</option></primary>
56946 </indexterm>
56947 <indexterm role="option">
56948 <primary><option>uucp_from_sender</option></primary>
56949 </indexterm>
56950 <indexterm role="concept">
56951 <primary>envelope sender</primary>
56952 </indexterm>
56953 <indexterm role="concept">
56954 <primary>Sendmail compatibility</primary>
56955 <secondary><quote>From</quote> line</secondary>
56956 </indexterm>
56957 Messages that have come from UUCP (and some other applications) often begin
56958 with a line containing the envelope sender and a timestamp, following the word
56959 <quote>From</quote>. Examples of two common formats are:
56960 </para>
56961 <literallayout class="monospaced">
56962 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
56963 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
56964 </literallayout>
56965 <para>
56966 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
56967 Exim recognizes such lines at the start of messages that are submitted to it
56968 via the command line (that is, on the standard input). It does not recognize
56969 such lines in incoming SMTP messages, unless the sending host matches
56970 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
56971 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
56972 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
56973 default value matches the two common cases shown above and puts the address
56974 that follows <quote>From</quote> into <varname>$1</varname>.
56975 </para>
56976 <para>
56977 <indexterm role="concept">
56978 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
56979 <secondary>in <quote>From </quote> line handling</secondary>
56980 </indexterm>
56981 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
56982 a trusted user, the message&#x2019;s sender address is constructed by expanding the
56983 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
56984 then parsed as an RFC 2822 address. If there is no domain, the local part is
56985 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
56986 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
56987 </para>
56988 <para>
56989 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
56990 sender address is not changed. This is also the case for incoming SMTP messages
56991 that are permitted to contain <quote>From</quote> lines.
56992 </para>
56993 <para>
56994 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
56995 treated as a data line that starts the body of the message, as it is not valid
56996 as a header line. This also happens if a <quote>From</quote> line is present in an
56997 incoming SMTP message from a source that is not permitted to send them.
56998 </para>
56999 </section>
57000 <section id="SECID220">
57001 <title>Resent- header lines</title>
57002 <para>
57003 <indexterm role="concept">
57004 <primary><option>Resent-</option> header lines</primary>
57005 </indexterm>
57006 RFC 2822 makes provision for sets of header lines starting with the string
57007 <literal>Resent-</literal> to be added to a message when it is resent by the original
57008 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
57009 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
57010 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
57011 </para>
57012 <blockquote>
57013 <para>
57014 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
57015 processing of replies or other such automatic actions on messages.</emphasis>
57016 </para>
57017 </blockquote>
57018 <para>
57019 This leaves things a bit vague as far as other processing actions such as
57020 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
57021 follows:
57022 </para>
57023 <itemizedlist>
57024 <listitem>
57025 <para>
57026 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
57027 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
57028 </para>
57029 </listitem>
57030 <listitem>
57031 <para>
57032 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
57033 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
57034 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
57035 </para>
57036 </listitem>
57037 <listitem>
57038 <para>
57039 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
57040 also removed.
57041 </para>
57042 </listitem>
57043 <listitem>
57044 <para>
57045 For a locally-submitted message,
57046 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
57047 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
57048 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
57049 included in log lines in this case.
57050 </para>
57051 </listitem>
57052 <listitem>
57053 <para>
57054 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
57055 <option>Resent-</option> header lines are present.
57056 </para>
57057 </listitem>
57058 </itemizedlist>
57059 </section>
57060 <section id="SECID221">
57061 <title>The Auto-Submitted: header line</title>
57062 <para>
57063 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
57064 includes the header line:
57065 </para>
57066 <literallayout class="monospaced">
57067 Auto-Submitted: auto-replied
57068 </literallayout>
57069 </section>
57070 <section id="SECID222">
57071 <title>The Bcc: header line</title>
57072 <para>
57073 <indexterm role="concept">
57074 <primary><emphasis>Bcc:</emphasis> header line</primary>
57075 </indexterm>
57076 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
57077 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
57078 extracting its addresses). If <option>-t</option> is not present on the command line, any
57079 existing <emphasis>Bcc:</emphasis> is not removed.
57080 </para>
57081 </section>
57082 <section id="SECID223">
57083 <title>The Date: header line</title>
57084 <para>
57085 <indexterm role="concept">
57086 <primary><emphasis>Date:</emphasis> header line</primary>
57087 </indexterm>
57088 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
57089 Exim adds one, using the current date and time, unless the
57090 <option>suppress_local_fixups</option> control has been specified.
57091 </para>
57092 </section>
57093 <section id="SECID224">
57094 <title>The Delivery-date: header line</title>
57095 <para>
57096 <indexterm role="concept">
57097 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
57098 </indexterm>
57099 <indexterm role="option">
57100 <primary><option>delivery_date_remove</option></primary>
57101 </indexterm>
57102 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
57103 set. Exim can be configured to add them to the final delivery of messages. (See
57104 the generic <option>delivery_date_add</option> transport option.) They should not be present
57105 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
57106 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
57107 messages.
57108 </para>
57109 </section>
57110 <section id="SECID225">
57111 <title>The Envelope-to: header line</title>
57112 <para>
57113 <indexterm role="concept">
57114 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
57115 </indexterm>
57116 <indexterm role="option">
57117 <primary><option>envelope_to_remove</option></primary>
57118 </indexterm>
57119 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
57120 Exim can be configured to add them to the final delivery of messages. (See the
57121 generic <option>envelope_to_add</option> transport option.) They should not be present in
57122 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
57123 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
57124 messages.
57125 </para>
57126 </section>
57127 <section id="SECTthefrohea">
57128 <title>The From: header line</title>
57129 <para>
57130 <indexterm role="concept">
57131 <primary><emphasis>From:</emphasis> header line</primary>
57132 </indexterm>
57133 <indexterm role="concept">
57134 <primary>Sendmail compatibility</primary>
57135 <secondary><quote>From</quote> line</secondary>
57136 </indexterm>
57137 <indexterm role="concept">
57138 <primary>message</primary>
57139 <secondary>submission</secondary>
57140 </indexterm>
57141 <indexterm role="concept">
57142 <primary>submission mode</primary>
57143 </indexterm>
57144 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
57145 adds one if either of the following conditions is true:
57146 </para>
57147 <itemizedlist>
57148 <listitem>
57149 <para>
57150 The envelope sender address is not empty (that is, this is not a bounce
57151 message). The added header line copies the envelope sender address.
57152 </para>
57153 </listitem>
57154 <listitem>
57155 <para>
57156 <indexterm role="variable">
57157 <primary><varname>$authenticated_id</varname></primary>
57158 </indexterm>
57159 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
57160 </para>
57161 <orderedlist numeration="arabic">
57162 <listitem>
57163 <para>
57164 <indexterm role="variable">
57165 <primary><varname>$qualify_domain</varname></primary>
57166 </indexterm>
57167 If no domain is specified by the submission control, the local part is
57168 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
57169 </para>
57170 </listitem>
57171 <listitem>
57172 <para>
57173 If a non-empty domain is specified by the submission control, the local
57174 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
57175 </para>
57176 </listitem>
57177 <listitem>
57178 <para>
57179 If an empty domain is specified by the submission control,
57180 <varname>$authenticated_id</varname> is assumed to be the complete address.
57181 </para>
57182 </listitem>
57183 </orderedlist>
57184 </listitem>
57185 </itemizedlist>
57186 <para>
57187 A non-empty envelope sender takes precedence.
57188 </para>
57189 <para>
57190 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
57191 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
57192 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
57193 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
57194 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
57195 <option>unknown_login</option> configuration option). The address is qualified with
57196 <option>qualify_domain</option>.
57197 </para>
57198 <para>
57199 For compatibility with Sendmail, if an incoming, non-SMTP message has a
57200 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
57201 user, this is replaced by an address containing the user&#x2019;s login name and full
57202 name as described in section <xref linkend="SECTconstr"/>.
57203 </para>
57204 </section>
57205 <section id="SECID226">
57206 <title>The Message-ID: header line</title>
57207 <para>
57208 <indexterm role="concept">
57209 <primary><emphasis>Message-ID:</emphasis> header line</primary>
57210 </indexterm>
57211 <indexterm role="concept">
57212 <primary>message</primary>
57213 <secondary>submission</secondary>
57214 </indexterm>
57215 <indexterm role="option">
57216 <primary><option>message_id_header_text</option></primary>
57217 </indexterm>
57218 If a locally-generated or submission-mode incoming message does not contain a
57219 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
57220 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
57221 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
57222 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
57223 message id, preceded by the letter E to ensure it starts with a letter, and
57224 followed by @ and the primary host name. Additional information can be included
57225 in this header line by setting the <option>message_id_header_text</option> and/or
57226 <option>message_id_header_domain</option> options.
57227 </para>
57228 </section>
57229 <section id="SECID227">
57230 <title>The Received: header line</title>
57231 <para>
57232 <indexterm role="concept">
57233 <primary><emphasis>Received:</emphasis> header line</primary>
57234 </indexterm>
57235 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
57236 contents are defined by the <option>received_header_text</option> configuration option, and
57237 Exim automatically adds a semicolon and a timestamp to the configured string.
57238 </para>
57239 <para>
57240 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
57241 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
57242 line is the time that the message started to be received. This is the value
57243 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
57244 </para>
57245 <para>
57246 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
57247 changed to the time of acceptance, which is (apart from a small delay while the
57248 -H spool file is written) the earliest time at which delivery could start.
57249 </para>
57250 </section>
57251 <section id="SECID228">
57252 <title>The References: header line</title>
57253 <para>
57254 <indexterm role="concept">
57255 <primary><emphasis>References:</emphasis> header line</primary>
57256 </indexterm>
57257 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
57258 header line. This is constructed according to the rules that are described in
57259 section 3.64 of RFC 2822 (which states that replies should contain such a
57260 header line), and section 3.14 of RFC 3834 (which states that automatic
57261 responses are not different in this respect). However, because some mail
57262 processing software does not cope well with very long header lines, no more
57263 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
57264 incoming message. If there are more than 12, the first one and then the final
57265 11 are copied, before adding the message ID of the incoming message.
57266 </para>
57267 </section>
57268 <section id="SECID229">
57269 <title>The Return-path: header line</title>
57270 <para>
57271 <indexterm role="concept">
57272 <primary><emphasis>Return-path:</emphasis> header line</primary>
57273 </indexterm>
57274 <indexterm role="option">
57275 <primary><option>return_path_remove</option></primary>
57276 </indexterm>
57277 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
57278 it does the final delivery of messages. (See the generic <option>return_path_add</option>
57279 transport option.) Therefore, they should not be present in messages in
57280 transit. If the <option>return_path_remove</option> configuration option is set (the
57281 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
57282 </para>
57283 </section>
57284 <section id="SECTthesenhea">
57285 <title>The Sender: header line</title>
57286 <para>
57287 <indexterm role="concept">
57288 <primary><emphasis>Sender:</emphasis> header line</primary>
57289 </indexterm>
57290 <indexterm role="concept">
57291 <primary>message</primary>
57292 <secondary>submission</secondary>
57293 </indexterm>
57294 For a locally-originated message from an untrusted user, Exim may remove an
57295 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
57296 these actions by setting the <option>local_sender_retain</option> option true, the
57297 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
57298 control setting.
57299 </para>
57300 <para>
57301 When a local message is received from an untrusted user and
57302 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
57303 control has not been set, a check is made to see if the address given in the
57304 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
57305 that is expected has the login name as the local part and the value of
57306 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
57307 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
57308 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
57309 line is added to the message.
57310 </para>
57311 <para>
57312 If you set <option>local_from_check</option> false, this checking does not occur. However,
57313 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
57314 <option>local_sender_retain</option> to be true. It is not possible to set both of these
57315 options true at the same time.
57316 </para>
57317 <para>
57318 <indexterm role="concept">
57319 <primary>submission mode</primary>
57320 </indexterm>
57321 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
57322 received over TCP/IP or for messages submitted by trusted users. However, when
57323 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
57324 not specified on the submission control, the following processing takes place:
57325 </para>
57326 <para>
57327 <indexterm role="variable">
57328 <primary><varname>$authenticated_id</varname></primary>
57329 </indexterm>
57330 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
57331 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
57332 created as follows:
57333 </para>
57334 <itemizedlist>
57335 <listitem>
57336 <para>
57337 <indexterm role="variable">
57338 <primary><varname>$qualify_domain</varname></primary>
57339 </indexterm>
57340 If no domain is specified by the submission control, the local part is
57341 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
57342 </para>
57343 </listitem>
57344 <listitem>
57345 <para>
57346 If a non-empty domain is specified by the submission control, the local part
57347 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
57348 </para>
57349 </listitem>
57350 <listitem>
57351 <para>
57352 If an empty domain is specified by the submission control,
57353 <varname>$authenticated_id</varname> is assumed to be the complete address.
57354 </para>
57355 </listitem>
57356 </itemizedlist>
57357 <para>
57358 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
57359 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
57360 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
57361 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
57362 </para>
57363 <para>
57364 <indexterm role="concept">
57365 <primary>return path</primary>
57366 <secondary>created from <emphasis>Sender:</emphasis></secondary>
57367 </indexterm>
57368 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
57369 the message (the envelope sender address) is changed to be the same address,
57370 except in the case of submission mode when <option>sender_retain</option> is specified.
57371 </para>
57372 </section>
57373 <section id="SECTheadersaddrem">
57374 <title>Adding and removing header lines in routers and transports</title>
57375 <para>
57376 <indexterm role="concept">
57377 <primary>header lines</primary>
57378 <secondary>adding; in router or transport</secondary>
57379 </indexterm>
57380 <indexterm role="concept">
57381 <primary>header lines</primary>
57382 <secondary>removing; in router or transport</secondary>
57383 </indexterm>
57384 When a message is delivered, the addition and removal of header lines can be
57385 specified in a system filter, or on any of the routers and transports that
57386 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
57387 modifying headers in a system filter. Header lines can also be added in an ACL
57388 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
57389 </para>
57390 <para>
57391 In contrast to what happens in a system filter, header modifications that are
57392 specified on routers and transports apply only to the particular recipient
57393 addresses that are being processed by those routers and transports. These
57394 changes do not actually take place until a copy of the message is being
57395 transported. Therefore, they do not affect the basic set of header lines, and
57396 they do not affect the values of the variables that refer to header lines.
57397 </para>
57398 <para>
57399 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
57400 the transport cannot refer to the modified header lines, because such
57401 expansions all occur before the message is actually transported.
57402 </para>
57403 <para>
57404 For both routers and transports, the result of expanding a <option>headers_add</option>
57405 option must be in the form of one or more RFC 2822 header lines, separated by
57406 newlines (coded as <quote>\n</quote>). For example:
57407 </para>
57408 <literallayout class="monospaced">
57409 headers_add = X-added-header: added by $primary_hostname\n\
57410               X-added-second: another added header line
57411 </literallayout>
57412 <para>
57413 Exim does not check the syntax of these added header lines.
57414 </para>
57415 <para>
57416 The result of expanding <option>headers_remove</option> must consist of a colon-separated
57417 list of header names. This is confusing, because header names themselves are
57418 often terminated by colons. In this case, the colons are the list separators,
57419 not part of the names. For example:
57420 </para>
57421 <literallayout class="monospaced">
57422 headers_remove = return-receipt-to:acknowledge-to
57423 </literallayout>
57424 <para>
57425 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
57426 is expanded at routing time, and then associated with all addresses that are
57427 accepted by that router, and also with any new addresses that it generates. If
57428 an address passes through several routers as a result of aliasing or
57429 forwarding, the changes are cumulative.
57430 </para>
57431 <para>
57432 <indexterm role="option">
57433 <primary><option>unseen</option></primary>
57434 </indexterm>
57435 However, this does not apply to multiple routers that result from the use of
57436 the <option>unseen</option> option. Any header modifications that were specified by the
57437 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
57438 </para>
57439 <para>
57440 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
57441 settings cannot be delivered together in a batch, so a transport is always
57442 dealing with a set of addresses that have the same header-processing
57443 requirements.
57444 </para>
57445 <para>
57446 The transport starts by writing the original set of header lines that arrived
57447 with the message, possibly modified by the system filter. As it writes out
57448 these lines, it consults the list of header names that were attached to the
57449 recipient address(es) by <option>headers_remove</option> options in routers, and it also
57450 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
57451 names are on either of these lists are not written out. If there are multiple
57452 instances of any listed header, they are all skipped.
57453 </para>
57454 <para>
57455 After the remaining original header lines have been written, new header
57456 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
57457 the order in which they were attached to the address. These are followed by any
57458 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
57459 </para>
57460 <para>
57461 This way of handling header line modifications in routers and transports has
57462 the following consequences:
57463 </para>
57464 <itemizedlist>
57465 <listitem>
57466 <para>
57467 The original set of header lines, possibly modified by the system filter,
57468 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
57469 to it, at all times.
57470 </para>
57471 </listitem>
57472 <listitem>
57473 <para>
57474 Header lines that are added by a router&#x2019;s
57475 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
57476 expansion syntax in subsequent routers or the transport.
57477 </para>
57478 </listitem>
57479 <listitem>
57480 <para>
57481 Conversely, header lines that are specified for removal by <option>headers_remove</option>
57482 in a router remain visible to subsequent routers and the transport.
57483 </para>
57484 </listitem>
57485 <listitem>
57486 <para>
57487 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
57488 a later router or by a transport.
57489 </para>
57490 </listitem>
57491 <listitem>
57492 <para>
57493 An added header can refer to the contents of an original header that is to be
57494 removed, even it has the same name as the added header. For example:
57495 </para>
57496 <literallayout class="monospaced">
57497 headers_remove = subject
57498 headers_add = Subject: new subject (was: $h_subject:)
57499 </literallayout>
57500 </listitem>
57501 </itemizedlist>
57502 <para>
57503 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
57504 for a <command>redirect</command> router that has the <option>one_time</option> option set.
57505 </para>
57506 </section>
57507 <section id="SECTconstr">
57508 <title>Constructed addresses</title>
57509 <para>
57510 <indexterm role="concept">
57511 <primary>address</primary>
57512 <secondary>constructed</secondary>
57513 </indexterm>
57514 <indexterm role="concept">
57515 <primary>constructed address</primary>
57516 </indexterm>
57517 When Exim constructs a sender address for a locally-generated message, it uses
57518 the form
57519 </para>
57520 <literallayout>
57521 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
57522 </literallayout>
57523 <para>
57524 For example:
57525 </para>
57526 <literallayout class="monospaced">
57527 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
57528 </literallayout>
57529 <para>
57530 The user name is obtained from the <option>-F</option> command line option if set, or
57531 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
57532 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
57533 ampersand character, this is replaced by the login name with the first letter
57534 upper cased, as is conventional in a number of operating systems. See the
57535 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
57536 The <option>unknown_username</option> option can be used to specify user names in cases when
57537 there is no password file entry.
57538 </para>
57539 <para>
57540 <indexterm role="concept">
57541 <primary>RFC 2047</primary>
57542 </indexterm>
57543 In all cases, the user name is made to conform to RFC 2822 by quoting all or
57544 parts of it if necessary. In addition, if it contains any non-printing
57545 characters, it is encoded as described in RFC 2047, which defines a way of
57546 including non-ASCII characters in header lines. The value of the
57547 <option>headers_charset</option> option specifies the name of the encoding that is used (the
57548 characters are assumed to be in this encoding). The setting of
57549 <option>print_topbitchars</option> controls whether characters with the top bit set (that
57550 is, with codes greater than 127) count as printing characters or not.
57551 </para>
57552 </section>
57553 <section id="SECID230">
57554 <title>Case of local parts</title>
57555 <para>
57556 <indexterm role="concept">
57557 <primary>case of local parts</primary>
57558 </indexterm>
57559 <indexterm role="concept">
57560 <primary>local part</primary>
57561 <secondary>case of</secondary>
57562 </indexterm>
57563 RFC 2822 states that the case of letters in the local parts of addresses cannot
57564 be assumed to be non-significant. Exim preserves the case of local parts of
57565 addresses, but by default it uses a lower-cased form when it is routing,
57566 because on most Unix systems, usernames are in lower case and case-insensitive
57567 routing is required. However, any particular router can be made to use the
57568 original case for local parts by setting the <option>caseful_local_part</option> generic
57569 router option.
57570 </para>
57571 <para>
57572 <indexterm role="concept">
57573 <primary>mixed-case login names</primary>
57574 </indexterm>
57575 If you must have mixed-case user names on your system, the best way to proceed,
57576 assuming you want case-independent handling of incoming email, is to set up
57577 your first router to convert incoming local parts in your domains to the
57578 correct case by means of a file lookup. For example:
57579 </para>
57580 <literallayout class="monospaced">
57581 correct_case:
57582   driver = redirect
57583   domains = +local_domains
57584   data = ${lookup{$local_part}cdb\
57585               {/etc/usercased.cdb}{$value}fail}\
57586               @$domain
57587 </literallayout>
57588 <para>
57589 For this router, the local part is forced to lower case by the default action
57590 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
57591 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
57592 on any subsequent routers which process your domains, they will operate on
57593 local parts with the correct case in a case-sensitive manner.
57594 </para>
57595 </section>
57596 <section id="SECID231">
57597 <title>Dots in local parts</title>
57598 <para>
57599 <indexterm role="concept">
57600 <primary>dot</primary>
57601 <secondary>in local part</secondary>
57602 </indexterm>
57603 <indexterm role="concept">
57604 <primary>local part</primary>
57605 <secondary>dots in</secondary>
57606 </indexterm>
57607 RFC 2822 forbids empty components in local parts. That is, an unquoted local
57608 part may not begin or end with a dot, nor have two consecutive dots in the
57609 middle. However, it seems that many MTAs do not enforce this, so Exim permits
57610 empty components for compatibility.
57611 </para>
57612 </section>
57613 <section id="SECID232">
57614 <title>Rewriting addresses</title>
57615 <para>
57616 <indexterm role="concept">
57617 <primary>rewriting</primary>
57618 <secondary>addresses</secondary>
57619 </indexterm>
57620 Rewriting of sender and recipient addresses, and addresses in headers, can
57621 happen automatically, or as the result of configuration options, as described
57622 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
57623 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
57624 </para>
57625 <para>
57626 Automatic rewriting includes qualification, as mentioned above. The other case
57627 in which it can happen is when an incomplete non-local domain is given. The
57628 routing process may cause this to be expanded into the full domain name. For
57629 example, a header such as
57630 </para>
57631 <literallayout class="monospaced">
57632 To: hare@teaparty
57633 </literallayout>
57634 <para>
57635 might get rewritten as
57636 </para>
57637 <literallayout class="monospaced">
57638 To: hare@teaparty.wonderland.fict.example
57639 </literallayout>
57640 <para>
57641 Rewriting as a result of routing is the one kind of message processing that
57642 does not happen at input time, as it cannot be done until the address has
57643 been routed.
57644 </para>
57645 <para>
57646 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
57647 addresses have been routed, in case any of the headers get changed as a
57648 result of routing. However, doing this in practice would hold up many
57649 deliveries for unreasonable amounts of time, just because one address could not
57650 immediately be routed. Exim therefore does not delay other deliveries when
57651 routing of one or more addresses is deferred.
57652 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
57653 </para>
57654 </section>
57655 </chapter>
57656
57657 <chapter id="CHAPSMTP">
57658 <title>SMTP processing</title>
57659 <para>
57660 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
57661 <primary>SMTP</primary>
57662 <secondary>processing details</secondary>
57663 </indexterm>
57664 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
57665 <primary>LMTP</primary>
57666 <secondary>processing details</secondary>
57667 </indexterm>
57668 Exim supports a number of different ways of using the SMTP protocol, and its
57669 LMTP variant, which is an interactive protocol for transferring messages into a
57670 closed mail store application. This chapter contains details of how SMTP is
57671 processed. For incoming mail, the following are available:
57672 </para>
57673 <itemizedlist>
57674 <listitem>
57675 <para>
57676 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
57677 </para>
57678 </listitem>
57679 <listitem>
57680 <para>
57681 SMTP over the standard input and output (the <option>-bs</option> option);
57682 </para>
57683 </listitem>
57684 <listitem>
57685 <para>
57686 Batched SMTP on the standard input (the <option>-bS</option> option).
57687 </para>
57688 </listitem>
57689 </itemizedlist>
57690 <para>
57691 For mail delivery, the following are available:
57692 </para>
57693 <itemizedlist>
57694 <listitem>
57695 <para>
57696 SMTP over TCP/IP (the <command>smtp</command> transport);
57697 </para>
57698 </listitem>
57699 <listitem>
57700 <para>
57701 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
57702 <quote>lmtp</quote>);
57703 </para>
57704 </listitem>
57705 <listitem>
57706 <para>
57707 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
57708 transport);
57709 </para>
57710 </listitem>
57711 <listitem>
57712 <para>
57713 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
57714 the <option>use_bsmtp</option> option set).
57715 </para>
57716 </listitem>
57717 </itemizedlist>
57718 <para>
57719 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
57720 stored in or read from files (or pipes), in a format in which SMTP commands are
57721 used to contain the envelope information.
57722 </para>
57723 <section id="SECToutSMTPTCP">
57724 <title>Outgoing SMTP and LMTP over TCP/IP</title>
57725 <para>
57726 <indexterm role="concept">
57727 <primary>SMTP</primary>
57728 <secondary>outgoing over TCP/IP</secondary>
57729 </indexterm>
57730 <indexterm role="concept">
57731 <primary>outgoing SMTP over TCP/IP</primary>
57732 </indexterm>
57733 <indexterm role="concept">
57734 <primary>LMTP</primary>
57735 <secondary>over TCP/IP</secondary>
57736 </indexterm>
57737 <indexterm role="concept">
57738 <primary>outgoing LMTP over TCP/IP</primary>
57739 </indexterm>
57740 <indexterm role="concept">
57741 <primary>EHLO</primary>
57742 </indexterm>
57743 <indexterm role="concept">
57744 <primary>HELO</primary>
57745 </indexterm>
57746 <indexterm role="concept">
57747 <primary>SIZE option on MAIL command</primary>
57748 </indexterm>
57749 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
57750 The <option>protocol</option> option selects which protocol is to be used, but the actual
57751 processing is the same in both cases.
57752 </para>
57753 <para>
57754 If, in response to its EHLO command, Exim is told that the SIZE
57755 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
57756 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
57757 <option>size_addition</option> option (default 1024) to allow for additions to the message
57758 such as per-transport header lines, or changes made in a
57759 <indexterm role="concept">
57760 <primary>transport</primary>
57761 <secondary>filter</secondary>
57762 </indexterm>
57763 <indexterm role="concept">
57764 <primary>filter</primary>
57765 <secondary>transport filter</secondary>
57766 </indexterm>
57767 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
57768 suppressed.
57769 </para>
57770 <para>
57771 If the remote server advertises support for PIPELINING, Exim uses the
57772 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
57773 required for the transaction.
57774 </para>
57775 <para>
57776 If the remote server advertises support for the STARTTLS command, and Exim
57777 was built to support TLS encryption, it tries to start a TLS session unless the
57778 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
57779 </para>
57780 <para>
57781 If the remote server advertises support for the AUTH command, Exim scans
57782 the authenticators configuration for any suitable client settings, as described
57783 in chapter <xref linkend="CHAPSMTPAUTH"/>.
57784 </para>
57785 <para>
57786 <indexterm role="concept">
57787 <primary>carriage return</primary>
57788 </indexterm>
57789 <indexterm role="concept">
57790 <primary>linefeed</primary>
57791 </indexterm>
57792 Responses from the remote host are supposed to be terminated by CR followed by
57793 LF. However, there are known to be hosts that do not send CR characters, so in
57794 order to be able to interwork with such hosts, Exim treats LF on its own as a
57795 line terminator.
57796 </para>
57797 <para>
57798 If a message contains a number of different addresses, all those with the same
57799 characteristics (for example, the same envelope sender) that resolve to the
57800 same set of hosts, in the same order, are sent in a single SMTP transaction,
57801 even if they are for different domains, unless there are more than the setting
57802 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
57803 they are split into groups containing no more than <option>max_rcpt</option>s addresses
57804 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
57805 in parallel sessions. The order of hosts with identical MX values is not
57806 significant when checking whether addresses can be batched in this way.
57807 </para>
57808 <para>
57809 When the <command>smtp</command> transport suffers a temporary failure that is not
57810 message-related, Exim updates its transport-specific database, which contains
57811 records indexed by host name that remember which messages are waiting for each
57812 particular host. It also updates the retry database with new retry times.
57813 </para>
57814 <para>
57815 <indexterm role="concept">
57816 <primary>hints database</primary>
57817 <secondary>retry keys</secondary>
57818 </indexterm>
57819 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
57820 a multi-homed host is broken, it will soon be skipped most of the time.
57821 See the next section for more detail about error handling.
57822 </para>
57823 <para>
57824 <indexterm role="concept">
57825 <primary>SMTP</primary>
57826 <secondary>passed connection</secondary>
57827 </indexterm>
57828 <indexterm role="concept">
57829 <primary>SMTP</primary>
57830 <secondary>batching over TCP/IP</secondary>
57831 </indexterm>
57832 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
57833 looks in the hints database for the transport to see if there are any queued
57834 messages waiting for the host to which it is connected. If it finds one, it
57835 creates a new Exim process using the <option>-MC</option> option (which can only be used by
57836 a process running as root or the Exim user) and passes the TCP/IP socket to it
57837 so that it can deliver another message using the same socket. The new process
57838 does only those deliveries that are routed to the connected host, and may in
57839 turn pass the socket on to a third process, and so on.
57840 </para>
57841 <para>
57842 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
57843 limit the number of messages sent down a single TCP/IP connection.
57844 </para>
57845 <para>
57846 <indexterm role="concept">
57847 <primary>asterisk</primary>
57848 <secondary>after IP address</secondary>
57849 </indexterm>
57850 The second and subsequent messages delivered down an existing connection are
57851 identified in the main log by the addition of an asterisk after the closing
57852 square bracket of the IP address.
57853 </para>
57854 </section>
57855 <section id="SECToutSMTPerr">
57856 <title>Errors in outgoing SMTP</title>
57857 <para>
57858 <indexterm role="concept">
57859 <primary>error</primary>
57860 <secondary>in outgoing SMTP</secondary>
57861 </indexterm>
57862 <indexterm role="concept">
57863 <primary>SMTP</primary>
57864 <secondary>errors in outgoing</secondary>
57865 </indexterm>
57866 <indexterm role="concept">
57867 <primary>host</primary>
57868 <secondary>error</secondary>
57869 </indexterm>
57870 Three different kinds of error are recognized for outgoing SMTP: host errors,
57871 message errors, and recipient errors.
57872 </para>
57873 <variablelist>
57874 <varlistentry>
57875 <term><emphasis role="bold">Host errors</emphasis></term>
57876 <listitem>
57877 <para>
57878 A host error is not associated with a particular message or with a
57879 particular recipient of a message. The host errors are:
57880 </para>
57881 <itemizedlist>
57882 <listitem>
57883 <para>
57884 Connection refused or timed out,
57885 </para>
57886 </listitem>
57887 <listitem>
57888 <para>
57889 Any error response code on connection,
57890 </para>
57891 </listitem>
57892 <listitem>
57893 <para>
57894 Any error response code to EHLO or HELO,
57895 </para>
57896 </listitem>
57897 <listitem>
57898 <para>
57899 Loss of connection at any time, except after <quote>.</quote>,
57900 </para>
57901 </listitem>
57902 <listitem>
57903 <para>
57904 I/O errors at any time,
57905 </para>
57906 </listitem>
57907 <listitem>
57908 <para>
57909 Timeouts during the session, other than in response to MAIL, RCPT or
57910 the <quote>.</quote> at the end of the data.
57911 </para>
57912 </listitem>
57913 </itemizedlist>
57914 <para>
57915 For a host error, a permanent error response on connection, or in response to
57916 EHLO, causes all addresses routed to the host to be failed. Any other host
57917 error causes all addresses to be deferred, and retry data to be created for the
57918 host. It is not tried again, for any message, until its retry time arrives. If
57919 the current set of addresses are not all delivered in this run (to some
57920 alternative host), the message is added to the list of those waiting for this
57921 host, so if it is still undelivered when a subsequent successful delivery is
57922 made to the host, it will be sent down the same SMTP connection.
57923 </para>
57924 </listitem></varlistentry>
57925 <varlistentry>
57926 <term><emphasis role="bold">Message errors</emphasis></term>
57927 <listitem>
57928 <para>
57929 <indexterm role="concept">
57930 <primary>message</primary>
57931 <secondary>error</secondary>
57932 </indexterm>
57933 A message error is associated with a particular message when sent to a
57934 particular host, but not with a particular recipient of the message. The
57935 message errors are:
57936 </para>
57937 <itemizedlist>
57938 <listitem>
57939 <para>
57940 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
57941 the data,
57942 </para>
57943 </listitem>
57944 <listitem>
57945 <para>
57946 Timeout after MAIL,
57947 </para>
57948 </listitem>
57949 <listitem>
57950 <para>
57951 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
57952 timeout after the DATA command itself is treated as a host error, as is loss of
57953 connection at any other time.
57954 </para>
57955 </listitem>
57956 </itemizedlist>
57957 <para>
57958 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
57959 to be failed, and a delivery error report to be returned to the sender. A
57960 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
57961 addresses to be deferred. Retry data is not created for the host, but instead,
57962 a retry record for the combination of host plus message id is created. The
57963 message is not added to the list of those waiting for this host. This ensures
57964 that the failing message will not be sent to this host again until the retry
57965 time arrives. However, other messages that are routed to the host are not
57966 affected, so if it is some property of the message that is causing the error,
57967 it will not stop the delivery of other mail.
57968 </para>
57969 <para>
57970 If the remote host specified support for the SIZE parameter in its response
57971 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
57972 over-large message will cause a message error because the error arrives as a
57973 response to MAIL.
57974 </para>
57975 </listitem></varlistentry>
57976 <varlistentry>
57977 <term><emphasis role="bold">Recipient errors</emphasis></term>
57978 <listitem>
57979 <para>
57980 <indexterm role="concept">
57981 <primary>recipient</primary>
57982 <secondary>error</secondary>
57983 </indexterm>
57984 A recipient error is associated with a particular recipient of a message. The
57985 recipient errors are:
57986 </para>
57987 <itemizedlist>
57988 <listitem>
57989 <para>
57990 Any error response to RCPT,
57991 </para>
57992 </listitem>
57993 <listitem>
57994 <para>
57995 Timeout after RCPT.
57996 </para>
57997 </listitem>
57998 </itemizedlist>
57999 <para>
58000 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
58001 recipient address to be failed, and a bounce message to be returned to the
58002 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
58003 address to be deferred, and routing retry data to be created for it. This is
58004 used to delay processing of the address in subsequent queue runs, until its
58005 routing retry time arrives. This applies to all messages, but because it
58006 operates only in queue runs, one attempt will be made to deliver a new message
58007 to the failing address before the delay starts to operate. This ensures that,
58008 if the failure is really related to the message rather than the recipient
58009 (<quote>message too big for this recipient</quote> is a possible example), other messages
58010 have a chance of getting delivered. If a delivery to the address does succeed,
58011 the retry information gets cleared, so all stuck messages get tried again, and
58012 the retry clock is reset.
58013 </para>
58014 <para>
58015 The message is not added to the list of those waiting for this host. Use of the
58016 host for other messages is unaffected, and except in the case of a timeout,
58017 other recipients are processed independently, and may be successfully delivered
58018 in the current SMTP session. After a timeout it is of course impossible to
58019 proceed with the session, so all addresses get deferred. However, those other
58020 than the one that failed do not suffer any subsequent retry delays. Therefore,
58021 if one recipient is causing trouble, the others have a chance of getting
58022 through when a subsequent delivery attempt occurs before the failing
58023 recipient&#x2019;s retry time.
58024 </para>
58025 </listitem></varlistentry>
58026 </variablelist>
58027 <para>
58028 In all cases, if there are other hosts (or IP addresses) available for the
58029 current set of addresses (for example, from multiple MX records), they are
58030 tried in this run for any undelivered addresses, subject of course to their
58031 own retry data. In other words, recipient error retry data does not take effect
58032 until the next delivery attempt.
58033 </para>
58034 <para>
58035 Some hosts have been observed to give temporary error responses to every
58036 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
58037 would be nice if such circumstances could be recognized, and defer data for the
58038 host itself created, but this is not possible within the current Exim design.
58039 What actually happens is that retry data for every (host, message) combination
58040 is created.
58041 </para>
58042 <para>
58043 The reason that timeouts after MAIL and RCPT are treated specially is that
58044 these can sometimes arise as a result of the remote host&#x2019;s verification
58045 procedures. Exim makes this assumption, and treats them as if a temporary error
58046 response had been received. A timeout after <quote>.</quote> is treated specially because
58047 it is known that some broken implementations fail to recognize the end of the
58048 message if the last character of the last line is a binary zero. Thus, it is
58049 helpful to treat this case as a message error.
58050 </para>
58051 <para>
58052 Timeouts at other times are treated as host errors, assuming a problem with the
58053 host, or the connection to it. If a timeout after MAIL, RCPT,
58054 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
58055 the timeout is likely to occur at some other point in the dialogue, causing it
58056 then to be treated as a host error.
58057 </para>
58058 <para>
58059 There is experimental evidence that some MTAs drop the connection after the
58060 terminating <quote>.</quote> if they do not like the contents of the message for some
58061 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
58062 should be given. That is why Exim treats this case as a message rather than a
58063 host error, in order not to delay other messages to the same host.
58064 </para>
58065 </section>
58066 <section id="SECID233">
58067 <title>Incoming SMTP messages over TCP/IP</title>
58068 <para>
58069 <indexterm role="concept">
58070 <primary>SMTP</primary>
58071 <secondary>incoming over TCP/IP</secondary>
58072 </indexterm>
58073 <indexterm role="concept">
58074 <primary>incoming SMTP over TCP/IP</primary>
58075 </indexterm>
58076 <indexterm role="concept">
58077 <primary>inetd</primary>
58078 </indexterm>
58079 <indexterm role="concept">
58080 <primary>daemon</primary>
58081 </indexterm>
58082 Incoming SMTP messages can be accepted in one of two ways: by running a
58083 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
58084 <filename>/etc/inetd.conf</filename> should be like this:
58085 </para>
58086 <literallayout class="monospaced">
58087 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
58088 </literallayout>
58089 <para>
58090 Exim distinguishes between this case and the case of a locally running user
58091 agent using the <option>-bs</option> option by checking whether or not the standard input is
58092 a socket. When it is, either the port must be privileged (less than 1024), or
58093 the caller must be root or the Exim user. If any other user passes a socket
58094 with an unprivileged port number, Exim prints a message on the standard error
58095 stream and exits with an error code.
58096 </para>
58097 <para>
58098 By default, Exim does not make a log entry when a remote host connects or
58099 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
58100 unexpected. It can be made to write such log entries by setting the
58101 <option>smtp_connection</option> log selector.
58102 </para>
58103 <para>
58104 <indexterm role="concept">
58105 <primary>carriage return</primary>
58106 </indexterm>
58107 <indexterm role="concept">
58108 <primary>linefeed</primary>
58109 </indexterm>
58110 Commands from the remote host are supposed to be terminated by CR followed by
58111 LF. However, there are known to be hosts that do not send CR characters. In
58112 order to be able to interwork with such hosts, Exim treats LF on its own as a
58113 line terminator.
58114 Furthermore, because common code is used for receiving messages from all
58115 sources, a CR on its own is also interpreted as a line terminator. However, the
58116 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
58117 </para>
58118 <para>
58119 <indexterm role="concept">
58120 <primary>EHLO</primary>
58121 <secondary>invalid data</secondary>
58122 </indexterm>
58123 <indexterm role="concept">
58124 <primary>HELO</primary>
58125 <secondary>invalid data</secondary>
58126 </indexterm>
58127 One area that sometimes gives rise to problems concerns the EHLO or
58128 HELO commands. Some clients send syntactically invalid versions of these
58129 commands, which Exim rejects by default. (This is nothing to do with verifying
58130 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
58131 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
58132 match the broken hosts that send invalid commands.
58133 </para>
58134 <para>
58135 <indexterm role="concept">
58136 <primary>SIZE option on MAIL command</primary>
58137 </indexterm>
58138 <indexterm role="concept">
58139 <primary>MAIL</primary>
58140 <secondary>SIZE option</secondary>
58141 </indexterm>
58142 The amount of disk space available is checked whenever SIZE is received on
58143 a MAIL command, independently of whether <option>message_size_limit</option> or
58144 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
58145 false. A temporary error is given if there is not enough space. If
58146 <option>check_spool_space</option> is set, the check is for that amount of space plus the
58147 value given with SIZE, that is, it checks that the addition of the incoming
58148 message will not reduce the space below the threshold.
58149 </para>
58150 <para>
58151 When a message is successfully received, Exim includes the local message id in
58152 its response to the final <quote>.</quote> that terminates the data. If the remote host
58153 logs this text it can help with tracing what has happened to a message.
58154 </para>
58155 <para>
58156 The Exim daemon can limit the number of simultaneous incoming connections it is
58157 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
58158 number of simultaneous incoming connections from a single remote host (see the
58159 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
58160 rejected using the SMTP temporary error code 421.
58161 </para>
58162 <para>
58163 The Exim daemon does not rely on the SIGCHLD signal to detect when a
58164 subprocess has finished, as this can get lost at busy times. Instead, it looks
58165 for completed subprocesses every time it wakes up. Provided there are other
58166 things happening (new incoming calls, starts of queue runs), completed
58167 processes will be noticed and tidied away. On very quiet systems you may
58168 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
58169 it will be noticed when the daemon next wakes up.
58170 </para>
58171 <para>
58172 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
58173 and can also be set up to reject SMTP calls from non-reserved hosts at times of
58174 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
58175 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
58176 applies in both the daemon and <emphasis>inetd</emphasis> cases.
58177 </para>
58178 <para>
58179 Exim normally starts a delivery process for each message received, though this
58180 can be varied by means of the <option>-odq</option> command line option and the
58181 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
58182 number of simultaneously running delivery processes started in this way from
58183 SMTP input can be limited by the <option>smtp_accept_queue</option> and
58184 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
58185 subsequently received messages are just put on the input queue without starting
58186 a delivery process.
58187 </para>
58188 <para>
58189 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
58190 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
58191 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
58192 handled by an entirely independent Exim process. Control by load average is,
58193 however, available with <emphasis>inetd</emphasis>.
58194 </para>
58195 <para>
58196 Exim can be configured to verify addresses in incoming SMTP commands as they
58197 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
58198 to rewrite addresses at this time &ndash; before any syntax checking is done. See
58199 section <xref linkend="SECTrewriteS"/>.
58200 </para>
58201 <para>
58202 Exim can also be configured to limit the rate at which a client host submits
58203 MAIL and RCPT commands in a single SMTP session. See the
58204 <option>smtp_ratelimit_hosts</option> option.
58205 </para>
58206 </section>
58207 <section id="SECID234">
58208 <title>Unrecognized SMTP commands</title>
58209 <para>
58210 <indexterm role="concept">
58211 <primary>SMTP</primary>
58212 <secondary>unrecognized commands</secondary>
58213 </indexterm>
58214 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
58215 commands during a single SMTP connection, it drops the connection after sending
58216 the error response to the last command. The default value for
58217 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
58218 abuse that subvert web servers into making connections to SMTP ports; in these
58219 circumstances, a number of non-SMTP lines are sent first.
58220 </para>
58221 </section>
58222 <section id="SECID235">
58223 <title>Syntax and protocol errors in SMTP commands</title>
58224 <para>
58225 <indexterm role="concept">
58226 <primary>SMTP</primary>
58227 <secondary>syntax errors</secondary>
58228 </indexterm>
58229 <indexterm role="concept">
58230 <primary>SMTP</primary>
58231 <secondary>protocol errors</secondary>
58232 </indexterm>
58233 A syntax error is detected if an SMTP command is recognized, but there is
58234 something syntactically wrong with its data, for example, a malformed email
58235 address in a RCPT command. Protocol errors include invalid command
58236 sequencing such as RCPT before MAIL. If Exim receives more than
58237 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
58238 drops the connection after sending the error response to the last command. The
58239 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
58240 broken clients that loop sending bad commands (yes, it has been seen).
58241 </para>
58242 </section>
58243 <section id="SECID236">
58244 <title>Use of non-mail SMTP commands</title>
58245 <para>
58246 <indexterm role="concept">
58247 <primary>SMTP</primary>
58248 <secondary>non-mail commands</secondary>
58249 </indexterm>
58250 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
58251 DATA. Exim counts such commands, and drops the connection if there are too
58252 many of them in a single SMTP session. This action catches some
58253 denial-of-service attempts and things like repeated failing AUTHs, or a mad
58254 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
58255 defines what <quote>too many</quote> means. Its default value is 10.
58256 </para>
58257 <para>
58258 When a new message is expected, one occurrence of RSET is not counted. This
58259 allows a client to send one RSET between messages (this is not necessary,
58260 but some clients do it). Exim also allows one uncounted occurrence of HELO
58261 or EHLO, and one occurrence of STARTTLS between messages. After
58262 starting up a TLS session, another EHLO is expected, and so it too is not
58263 counted.
58264 </para>
58265 <para>
58266 The first occurrence of AUTH in a connection, or immediately following
58267 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
58268 RCPT, DATA, and QUIT are counted.
58269 </para>
58270 <para>
58271 You can control which hosts are subject to the limit set by
58272 <option>smtp_accept_max_nonmail</option> by setting
58273 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
58274 the limit apply to all hosts. This option means that you can exclude any
58275 specific badly-behaved hosts that you have to live with.
58276 </para>
58277 </section>
58278 <section id="SECID237">
58279 <title>The VRFY and EXPN commands</title>
58280 <para>
58281 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
58282 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
58283 appropriate) in order to decide whether the command should be accepted or not.
58284 If no ACL is defined, the command is rejected.
58285 </para>
58286 <para>
58287 <indexterm role="concept">
58288 <primary>VRFY</primary>
58289 <secondary>processing</secondary>
58290 </indexterm>
58291 When VRFY is accepted, it runs exactly the same code as when Exim is
58292 called with the <option>-bv</option> option.
58293 </para>
58294 <para>
58295 <indexterm role="concept">
58296 <primary>EXPN</primary>
58297 <secondary>processing</secondary>
58298 </indexterm>
58299 When EXPN is accepted, a single-level expansion of the address is done.
58300 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
58301 than a verification (the <option>-bv</option> option). If an unqualified local part is given
58302 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
58303 of VRFY and EXPN commands are logged on the main and reject logs, and
58304 VRFY verification failures are logged on the main log for consistency with
58305 RCPT failures.
58306 </para>
58307 </section>
58308 <section id="SECTETRN">
58309 <title>The ETRN command</title>
58310 <para>
58311 <indexterm role="concept">
58312 <primary>ETRN</primary>
58313 <secondary>processing</secondary>
58314 </indexterm>
58315 RFC 1985 describes an SMTP command called ETRN that is designed to
58316 overcome the security problems of the TURN command (which has fallen into
58317 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
58318 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
58319 should be accepted or not. If no ACL is defined, the command is rejected.
58320 </para>
58321 <para>
58322 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
58323 delivery to certain hosts. As Exim does not organize its message queue by host,
58324 the only form of ETRN that is supported by default is the one where the
58325 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
58326 specific to the SMTP server. A valid ETRN command causes a run of Exim with
58327 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
58328 argument. For example,
58329 </para>
58330 <literallayout class="monospaced">
58331 ETRN #brigadoon
58332 </literallayout>
58333 <para>
58334 runs the command
58335 </para>
58336 <literallayout class="monospaced">
58337 exim -R brigadoon
58338 </literallayout>
58339 <para>
58340 which causes a delivery attempt on all messages with undelivered addresses
58341 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
58342 default), Exim prevents the simultaneous execution of more than one queue run
58343 for the same argument string as a result of an ETRN command. This stops
58344 a misbehaving client from starting more than one queue runner at once.
58345 </para>
58346 <para>
58347 <indexterm role="concept">
58348 <primary>hints database</primary>
58349 <secondary>ETRN serialization</secondary>
58350 </indexterm>
58351 Exim implements the serialization by means of a hints database in which a
58352 record is written whenever a process is started by ETRN, and deleted when
58353 the process completes. However, Exim does not keep the SMTP session waiting for
58354 the ETRN process to complete. Once ETRN is accepted, the client is sent
58355 a <quote>success</quote> return code. Obviously there is scope for hints records to get
58356 left lying around if there is a system or program crash. To guard against this,
58357 Exim ignores any records that are more than six hours old.
58358 </para>
58359 <para>
58360 <indexterm role="option">
58361 <primary><option>smtp_etrn_command</option></primary>
58362 </indexterm>
58363 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
58364 used. This specifies a command that is run whenever ETRN is received,
58365 whatever the form of its argument. For
58366 example:
58367 </para>
58368 <literallayout class="monospaced">
58369 smtp_etrn_command = /etc/etrn_command $domain \
58370                     $sender_host_address
58371 </literallayout>
58372 <para>
58373 <indexterm role="variable">
58374 <primary><varname>$domain</varname></primary>
58375 </indexterm>
58376 The string is split up into arguments which are independently expanded. The
58377 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
58378 and no syntax checking is done on the contents of this argument. Exim does not
58379 wait for the command to complete, so its status code is not checked. Exim runs
58380 under its own uid and gid when receiving incoming SMTP, so it is not possible
58381 for it to change them before running the command.
58382 </para>
58383 </section>
58384 <section id="SECID238">
58385 <title>Incoming local SMTP</title>
58386 <para>
58387 <indexterm role="concept">
58388 <primary>SMTP</primary>
58389 <secondary>local incoming</secondary>
58390 </indexterm>
58391 Some user agents use SMTP to pass messages to their local MTA using the
58392 standard input and output, as opposed to passing the envelope on the command
58393 line and writing the message to the standard input. This is supported by the
58394 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
58395 messages over TCP/IP (including the use of ACLs), except that the envelope
58396 sender given in a MAIL command is ignored unless the caller is trusted. In
58397 an ACL you can detect this form of SMTP input by testing for an empty host
58398 identification. It is common to have this as the first line in the ACL that
58399 runs for RCPT commands:
58400 </para>
58401 <literallayout class="monospaced">
58402 accept hosts = :
58403 </literallayout>
58404 <para>
58405 This accepts SMTP messages from local processes without doing any other tests.
58406 </para>
58407 </section>
58408 <section id="SECTbatchSMTP">
58409 <title>Outgoing batched SMTP</title>
58410 <para>
58411 <indexterm role="concept">
58412 <primary>SMTP</primary>
58413 <secondary>batched outgoing</secondary>
58414 </indexterm>
58415 <indexterm role="concept">
58416 <primary>batched SMTP output</primary>
58417 </indexterm>
58418 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
58419 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
58420 be output in BSMTP format. No SMTP responses are possible for this form of
58421 delivery. All it is doing is using SMTP commands as a way of transmitting the
58422 envelope along with the message.
58423 </para>
58424 <para>
58425 The message is written to the file or pipe preceded by the SMTP commands
58426 MAIL and RCPT, and followed by a line containing a single dot. Lines in
58427 the message that start with a dot have an extra dot added. The SMTP command
58428 HELO is not normally used. If it is required, the <option>message_prefix</option> option
58429 can be used to specify it.
58430 </para>
58431 <para>
58432 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
58433 one recipient address at a time by default. However, you can arrange for them
58434 to handle several addresses at once by setting the <option>batch_max</option> option. When
58435 this is done for BSMTP, messages may contain multiple RCPT commands. See
58436 chapter <xref linkend="CHAPbatching"/> for more details.
58437 </para>
58438 <para>
58439 <indexterm role="variable">
58440 <primary><varname>$host</varname></primary>
58441 </indexterm>
58442 When one or more addresses are routed to a BSMTP transport by a router that
58443 sets up a host list, the name of the first host on the list is available to the
58444 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
58445 router:
58446 </para>
58447 <literallayout class="monospaced">
58448 begin routers
58449 route_append:
58450   driver = manualroute
58451   transport = smtp_appendfile
58452   route_list = domain.example  batch.host.example
58453
58454 begin transports
58455 smtp_appendfile:
58456   driver = appendfile
58457   directory = /var/bsmtp/$host
58458   batch_max = 1000
58459   use_bsmtp
58460   user = exim
58461 </literallayout>
58462 <para>
58463 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
58464 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
58465 message (unless there are more than 1000 recipients).
58466 </para>
58467 </section>
58468 <section id="SECTincomingbatchedSMTP">
58469 <title>Incoming batched SMTP</title>
58470 <para>
58471 <indexterm role="concept">
58472 <primary>SMTP</primary>
58473 <secondary>batched incoming</secondary>
58474 </indexterm>
58475 <indexterm role="concept">
58476 <primary>batched SMTP input</primary>
58477 </indexterm>
58478 The <option>-bS</option> command line option causes Exim to accept one or more messages by
58479 reading SMTP on the standard input, but to generate no responses. If the caller
58480 is trusted, the senders in the MAIL commands are believed; otherwise the
58481 sender is always the caller of Exim. Unqualified senders and receivers are not
58482 rejected (there seems little point) but instead just get qualified. HELO
58483 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
58484 as NOOP; QUIT quits.
58485 </para>
58486 <para>
58487 Minimal policy checking is done for BSMTP input. Only the non-SMTP
58488 ACL is run in the same way as for non-SMTP local input.
58489 </para>
58490 <para>
58491 If an error is detected while reading a message, including a missing <quote>.</quote> at
58492 the end, Exim gives up immediately. It writes details of the error to the
58493 standard output in a stylized way that the calling program should be able to
58494 make some use of automatically, for example:
58495 </para>
58496 <literallayout class="monospaced">
58497 554 Unexpected end of file
58498 Transaction started in line 10
58499 Error detected in line 14
58500 </literallayout>
58501 <para>
58502 It writes a more verbose version, for human consumption, to the standard error
58503 file, for example:
58504 </para>
58505 <literallayout class="monospaced">
58506 An error was detected while processing a file of BSMTP input.
58507 The error message was:
58508
58509 501 '&gt;' missing at end of address
58510
58511 The SMTP transaction started in line 10.
58512 The error was detected in line 12.
58513 The SMTP command at fault was:
58514
58515 rcpt to:&lt;malformed@in.com.plete
58516
58517 1 previous message was successfully processed.
58518 The rest of the batch was abandoned.
58519 </literallayout>
58520 <para>
58521 The return code from Exim is zero only if there were no errors. It is 1 if some
58522 messages were accepted before an error was detected, and 2 if no messages were
58523 accepted.
58524 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
58525 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
58526 </para>
58527 </section>
58528 </chapter>
58529
58530 <chapter id="CHAPemsgcust">
58531 <title>Customizing bounce and warning messages</title>
58532 <titleabbrev>Customizing messages</titleabbrev>
58533 <para>
58534 When a message fails to be delivered, or remains on the queue for more than a
58535 configured amount of time, Exim sends a message to the original sender, or
58536 to an alternative configured address. The text of these messages is built into
58537 the code of Exim, but it is possible to change it, either by adding a single
58538 string, or by replacing each of the paragraphs by text supplied in a file.
58539 </para>
58540 <para>
58541 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
58542 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
58543 option. Exim also adds the line
58544 </para>
58545 <literallayout class="monospaced">
58546 Auto-Submitted: auto-generated
58547 </literallayout>
58548 <para>
58549 to all warning and bounce messages,
58550 </para>
58551 <section id="SECID239">
58552 <title>Customizing bounce messages</title>
58553 <para>
58554 <indexterm role="concept">
58555 <primary>customizing</primary>
58556 <secondary>bounce message</secondary>
58557 </indexterm>
58558 <indexterm role="concept">
58559 <primary>bounce message</primary>
58560 <secondary>customizing</secondary>
58561 </indexterm>
58562 If <option>bounce_message_text</option> is set, its contents are included in the default
58563 message immediately after <quote>This message was created automatically by mail
58564 delivery software.</quote> The string is not expanded. It is not used if
58565 <option>bounce_message_file</option> is set.
58566 </para>
58567 <para>
58568 When <option>bounce_message_file</option> is set, it must point to a template file for
58569 constructing error messages. The file consists of a series of text items,
58570 separated by lines consisting of exactly four asterisks. If the file cannot be
58571 opened, default text is used and a message is written to the main and panic
58572 logs. If any text item in the file is empty, default text is used for that
58573 item.
58574 </para>
58575 <para>
58576 <indexterm role="variable">
58577 <primary><varname>$bounce_recipient</varname></primary>
58578 </indexterm>
58579 <indexterm role="variable">
58580 <primary><varname>$bounce_return_size_limit</varname></primary>
58581 </indexterm>
58582 Each item of text that is read from the file is expanded, and there are two
58583 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
58584 the recipient of an error message while it is being created, and
58585 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
58586 option, rounded to a whole number.
58587 </para>
58588 <para>
58589 The items must appear in the file in the following order:
58590 </para>
58591 <itemizedlist>
58592 <listitem>
58593 <para>
58594 The first item is included in the headers, and should include at least a
58595 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
58596 </para>
58597 </listitem>
58598 <listitem>
58599 <para>
58600 The second item forms the start of the error message. After it, Exim lists the
58601 failing addresses with their error messages.
58602 </para>
58603 </listitem>
58604 <listitem>
58605 <para>
58606 The third item is used to introduce any text from pipe transports that is to be
58607 returned to the sender. It is omitted if there is no such text.
58608 </para>
58609 </listitem>
58610 <listitem>
58611 <para>
58612 The fourth item is used to introduce the copy of the message that is returned
58613 as part of the error report.
58614 </para>
58615 </listitem>
58616 <listitem>
58617 <para>
58618 The fifth item is added after the fourth one if the returned message is
58619 truncated because it is bigger than <option>return_size_limit</option>.
58620 </para>
58621 </listitem>
58622 <listitem>
58623 <para>
58624 The sixth item is added after the copy of the original message.
58625 </para>
58626 </listitem>
58627 </itemizedlist>
58628 <para>
58629 The default state (<option>bounce_message_file</option> unset) is equivalent to the
58630 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
58631 other lines have been split in order to fit them on the page:
58632 </para>
58633 <literallayout class="monospaced">
58634 Subject: Mail delivery failed
58635   ${if eq{$sender_address}{$bounce_recipient}
58636   {: returning message to sender}}
58637 ****
58638 This message was created automatically by mail delivery software.
58639
58640 A message ${if eq{$sender_address}{$bounce_recipient}
58641   {that you sent }{sent by
58642
58643 &lt;$sender_address&gt;
58644
58645 }}could not be delivered to all of its recipients.
58646 This is a permanent error. The following address(es) failed:
58647 ****
58648 The following text was generated during the delivery attempt(s):
58649 ****
58650 ------ This is a copy of the message, including all the headers.
58651   ------
58652 ****
58653 ------ The body of the message is $message_size characters long;
58654   only the first
58655 ------ $bounce_return_size_limit or so are included here.
58656 ****
58657 </literallayout>
58658 </section>
58659 <section id="SECTcustwarn">
58660 <title>Customizing warning messages</title>
58661 <para>
58662 <indexterm role="concept">
58663 <primary>customizing</primary>
58664 <secondary>warning message</secondary>
58665 </indexterm>
58666 <indexterm role="concept">
58667 <primary>warning of delay</primary>
58668 <secondary>customizing the message</secondary>
58669 </indexterm>
58670 The option <option>warn_message_file</option> can be pointed at a template file for use when
58671 warnings about message delays are created. In this case there are only three
58672 text sections:
58673 </para>
58674 <itemizedlist>
58675 <listitem>
58676 <para>
58677 The first item is included in the headers, and should include at least a
58678 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
58679 </para>
58680 </listitem>
58681 <listitem>
58682 <para>
58683 The second item forms the start of the warning message. After it, Exim lists
58684 the delayed addresses.
58685 </para>
58686 </listitem>
58687 <listitem>
58688 <para>
58689 The third item then ends the message.
58690 </para>
58691 </listitem>
58692 </itemizedlist>
58693 <para>
58694 The default state is equivalent to the following file, except that some lines
58695 have been split here, in order to fit them on the page:
58696 </para>
58697 <literallayout class="monospaced">
58698 Subject: Warning: message $message_exim_id delayed
58699   $warn_message_delay
58700 ****
58701 This message was created automatically by mail delivery software.
58702
58703 A message ${if eq{$sender_address}{$warn_message_recipients}
58704 {that you sent }{sent by
58705
58706 &lt;$sender_address&gt;
58707
58708 }}has not been delivered to all of its recipients after
58709 more than $warn_message_delay on the queue on $primary_hostname.
58710
58711 The message identifier is:     $message_exim_id
58712 The subject of the message is: $h_subject
58713 The date of the message is:    $h_date
58714
58715 The following address(es) have not yet been delivered:
58716 ****
58717 No action is required on your part. Delivery attempts will
58718 continue for some time, and this warning may be repeated at
58719 intervals if the message remains undelivered. Eventually the
58720 mail delivery software will give up, and when that happens,
58721 the message will be returned to you.
58722 </literallayout>
58723 <para>
58724 <indexterm role="variable">
58725 <primary><varname>$warn_message_delay</varname></primary>
58726 </indexterm>
58727 <indexterm role="variable">
58728 <primary><varname>$warn_message_recipients</varname></primary>
58729 </indexterm>
58730 However, in the default state the subject and date lines are omitted if no
58731 appropriate headers exist. During the expansion of this file,
58732 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
58733 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
58734 of recipients for the warning message. There may be more than one if there are
58735 multiple addresses with different <option>errors_to</option> settings on the routers that
58736 handled them.
58737 </para>
58738 </section>
58739 </chapter>
58740
58741 <chapter id="CHAPcomconreq">
58742 <title>Some common configuration settings</title>
58743 <para>
58744 This chapter discusses some configuration settings that seem to be fairly
58745 common. More examples and discussion can be found in the Exim book.
58746 </para>
58747 <section id="SECID240">
58748 <title>Sending mail to a smart host</title>
58749 <para>
58750 <indexterm role="concept">
58751 <primary>smart host</primary>
58752 <secondary>example router</secondary>
58753 </indexterm>
58754 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
58755 should replace the default <command>dnslookup</command> router with a router which does the
58756 routing explicitly:
58757 </para>
58758 <literallayout class="monospaced">
58759 send_to_smart_host:
58760   driver = manualroute
58761   route_list = !+local_domains smart.host.name
58762   transport = remote_smtp
58763 </literallayout>
58764 <para>
58765 You can use the smart host&#x2019;s IP address instead of the name if you wish.
58766 If you are using Exim only to submit messages to a smart host, and not for
58767 receiving incoming messages, you can arrange for it to do the submission
58768 synchronously by setting the <option>mua_wrapper</option> option (see chapter
58769 <xref linkend="CHAPnonqueueing"/>).
58770 </para>
58771 </section>
58772 <section id="SECTmailinglists">
58773 <title>Using Exim to handle mailing lists</title>
58774 <para>
58775 <indexterm role="concept">
58776 <primary>mailing lists</primary>
58777 </indexterm>
58778 Exim can be used to run simple mailing lists, but for large and/or complicated
58779 requirements, the use of additional specialized mailing list software such as
58780 Majordomo or Mailman is recommended.
58781 </para>
58782 <para>
58783 The <command>redirect</command> router can be used to handle mailing lists where each list
58784 is maintained in a separate file, which can therefore be managed by an
58785 independent manager. The <option>domains</option> router option can be used to run these
58786 lists in a separate domain from normal mail. For example:
58787 </para>
58788 <literallayout class="monospaced">
58789 lists:
58790   driver = redirect
58791   domains = lists.example
58792   file = /usr/lists/$local_part
58793   forbid_pipe
58794   forbid_file
58795   errors_to = $local_part-request@lists.example
58796   no_more
58797 </literallayout>
58798 <para>
58799 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
58800 in that domain, it looks for a file that matches the local part. If there is no
58801 such file, the router declines, but because <option>no_more</option> is set, no subsequent
58802 routers are tried, and so the whole delivery fails.
58803 </para>
58804 <para>
58805 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
58806 expanded into a file name or a pipe delivery, which is usually inappropriate in
58807 a mailing list.
58808 </para>
58809 <para>
58810 <indexterm role="option">
58811 <primary><option>errors_to</option></primary>
58812 </indexterm>
58813 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
58814 taken from a mailing list are to be sent to the given address rather than the
58815 original sender of the message. However, before acting on this, Exim verifies
58816 the error address, and ignores it if verification fails.
58817 </para>
58818 <para>
58819 For example, using the configuration above, mail sent to
58820 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
58821 <filename>/usr/lists/dicts</filename>, with error reports directed to
58822 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
58823 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
58824 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
58825 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
58826 or <option>local_part_suffix</option> options) to handle addresses of the form
58827 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
58828 </para>
58829 </section>
58830 <section id="SECID241">
58831 <title>Syntax errors in mailing lists</title>
58832 <para>
58833 <indexterm role="concept">
58834 <primary>mailing lists</primary>
58835 <secondary>syntax errors in</secondary>
58836 </indexterm>
58837 If an entry in redirection data contains a syntax error, Exim normally defers
58838 delivery of the original address. That means that a syntax error in a mailing
58839 list holds up all deliveries to the list. This may not be appropriate when a
58840 list is being maintained automatically from data supplied by users, and the
58841 addresses are not rigorously checked.
58842 </para>
58843 <para>
58844 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
58845 entries that fail to parse, noting the incident in the log. If in addition
58846 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
58847 whenever a broken address is skipped. It is usually appropriate to set
58848 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
58849 </para>
58850 </section>
58851 <section id="SECID242">
58852 <title>Re-expansion of mailing lists</title>
58853 <para>
58854 <indexterm role="concept">
58855 <primary>mailing lists</primary>
58856 <secondary>re-expansion of</secondary>
58857 </indexterm>
58858 Exim remembers every individual address to which a message has been delivered,
58859 in order to avoid duplication, but it normally stores only the original
58860 recipient addresses with a message. If all the deliveries to a mailing list
58861 cannot be done at the first attempt, the mailing list is re-expanded when the
58862 delivery is next tried. This means that alterations to the list are taken into
58863 account at each delivery attempt, so addresses that have been added to
58864 the list since the message arrived will therefore receive a copy of the
58865 message, even though it pre-dates their subscription.
58866 </para>
58867 <para>
58868 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
58869 on the <command>redirect</command> router. If this is done, any addresses generated by the
58870 router that fail to deliver at the first attempt are added to the message as
58871 <quote>top level</quote> addresses, and the parent address that generated them is marked
58872 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
58873 subsequent delivery attempts. The disadvantage of this is that if any of the
58874 failing addresses are incorrect, correcting them in the file has no effect on
58875 pre-existing messages.
58876 </para>
58877 <para>
58878 The original top-level address is remembered with each of the generated
58879 addresses, and is output in any log messages. However, any intermediate parent
58880 addresses are not recorded. This makes a difference to the log only if the
58881 <option>all_parents</option> selector is set, but for mailing lists there is normally only
58882 one level of expansion anyway.
58883 </para>
58884 </section>
58885 <section id="SECID243">
58886 <title>Closed mailing lists</title>
58887 <para>
58888 <indexterm role="concept">
58889 <primary>mailing lists</primary>
58890 <secondary>closed</secondary>
58891 </indexterm>
58892 The examples so far have assumed open mailing lists, to which anybody may
58893 send mail. It is also possible to set up closed lists, where mail is accepted
58894 from specified senders only. This is done by making use of the generic
58895 <option>senders</option> option to restrict the router that handles the list.
58896 </para>
58897 <para>
58898 The following example uses the same file as a list of recipients and as a list
58899 of permitted senders. It requires three routers:
58900 </para>
58901 <literallayout class="monospaced">
58902 lists_request:
58903   driver = redirect
58904   domains = lists.example
58905   local_part_suffix = -request
58906   file = /usr/lists/$local_part$local_part_suffix
58907   no_more
58908
58909 lists_post:
58910   driver = redirect
58911   domains = lists.example
58912   senders = ${if exists {/usr/lists/$local_part}\
58913              {lsearch;/usr/lists/$local_part}{*}}
58914   file = /usr/lists/$local_part
58915   forbid_pipe
58916   forbid_file
58917   errors_to = $local_part-request@lists.example
58918   no_more
58919
58920 lists_closed:
58921   driver = redirect
58922   domains = lists.example
58923   allow_fail
58924   data = :fail: $local_part@lists.example is a closed mailing list
58925 </literallayout>
58926 <para>
58927 All three routers have the same <option>domains</option> setting, so for any other domains,
58928 they are all skipped. The first router runs only if the local part ends in
58929 <option>-request</option>. It handles messages to the list manager(s) by means of an open
58930 mailing list.
58931 </para>
58932 <para>
58933 The second router runs only if the <option>senders</option> precondition is satisfied. It
58934 checks for the existence of a list that corresponds to the local part, and then
58935 checks that the sender is on the list by means of a linear search. It is
58936 necessary to check for the existence of the file before trying to search it,
58937 because otherwise Exim thinks there is a configuration error. If the file does
58938 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
58939 means that the router runs, but because there is no list, declines, and
58940 <option>no_more</option> ensures that no further routers are run. The address fails with an
58941 <quote>unrouteable address</quote> error.
58942 </para>
58943 <para>
58944 The third router runs only if the second router is skipped, which happens when
58945 a mailing list exists, but the sender is not on it. This router forcibly fails
58946 the address, giving a suitable error message.
58947 </para>
58948 </section>
58949 <section id="SECTverp">
58950 <title>Variable Envelope Return Paths (VERP)</title>
58951 <para>
58952 <indexterm role="concept">
58953 <primary>VERP</primary>
58954 </indexterm>
58955 <indexterm role="concept">
58956 <primary>Variable Envelope Return Paths</primary>
58957 </indexterm>
58958 <indexterm role="concept">
58959 <primary>envelope sender</primary>
58960 </indexterm>
58961 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;
58962 are a way of helping mailing list administrators discover which subscription
58963 address is the cause of a particular delivery failure. The idea is to encode
58964 the original recipient address in the outgoing envelope sender address, so that
58965 if the message is forwarded by another host and then subsequently bounces, the
58966 original recipient can be extracted from the recipient address of the bounce.
58967 </para>
58968 <para>
58969 <indexterm role="option">
58970 <primary><option>errors_to</option></primary>
58971 </indexterm>
58972 <indexterm role="option">
58973 <primary><option>return_path</option></primary>
58974 </indexterm>
58975 Envelope sender addresses can be modified by Exim using two different
58976 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
58977 list examples), or the <option>return_path</option> option on a transport. The second of
58978 these is effective only if the message is successfully delivered to another
58979 host; it is not used for errors detected on the local host (see the description
58980 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
58981 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
58982 </para>
58983 <literallayout class="monospaced">
58984 verp_smtp:
58985   driver = smtp
58986   max_rcpt = 1
58987   return_path = \
58988     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
58989       {$1-request+$local_part=$domain@your.dom.example}fail}
58990 </literallayout>
58991 <para>
58992 This has the effect of rewriting the return path (envelope sender) on outgoing
58993 SMTP messages, if the local part of the original return path ends in
58994 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
58995 local part and domain of the recipient into the return path. Suppose, for
58996 example, that a message whose return path has been set to
58997 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
58998 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
58999 rewritten as
59000 </para>
59001 <literallayout class="monospaced">
59002 somelist-request+subscriber=other.dom.example@your.dom.example
59003 </literallayout>
59004 <para>
59005 <indexterm role="variable">
59006 <primary><varname>$local_part</varname></primary>
59007 </indexterm>
59008 For this to work, you must tell Exim to send multiple copies of messages that
59009 have more than one recipient, so that each copy has just one recipient. This is
59010 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
59011 might be sent to several different recipients in the same domain, in which case
59012 <varname>$local_part</varname> is not available in the transport, because it is not unique.
59013 </para>
59014 <para>
59015 Unless your host is doing nothing but mailing list deliveries, you should
59016 probably use a separate transport for the VERP deliveries, so as not to use
59017 extra resources in making one-per-recipient copies for other deliveries. This
59018 can easily be done by expanding the <option>transport</option> option in the router:
59019 </para>
59020 <literallayout class="monospaced">
59021 dnslookup:
59022   driver = dnslookup
59023   domains = ! +local_domains
59024   transport = \
59025     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
59026       {verp_smtp}{remote_smtp}}
59027   no_more
59028 </literallayout>
59029 <para>
59030 If you want to change the return path using <option>errors_to</option> in a router instead
59031 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
59032 routers that handle mailing list addresses. This will ensure that all delivery
59033 errors, including those detected on the local host, are sent to the VERP
59034 address.
59035 </para>
59036 <para>
59037 On a host that does no local deliveries and has no manual routing, only the
59038 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
59039 SMTP deliveries. Every mailing list recipient has its own return path value,
59040 and so Exim must hand them to the transport one at a time. Here is an example
59041 of a <command>dnslookup</command> router that implements VERP:
59042 </para>
59043 <literallayout class="monospaced">
59044 verp_dnslookup:
59045   driver = dnslookup
59046   domains = ! +local_domains
59047   transport = remote_smtp
59048   errors_to = \
59049     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
59050      {$1-request+$local_part=$domain@your.dom.example}fail}
59051   no_more
59052 </literallayout>
59053 <para>
59054 Before you start sending out messages with VERPed return paths, you must also
59055 configure Exim to accept the bounce messages that come back to those paths.
59056 Typically this is done by setting a <option>local_part_suffix</option> option for a
59057 router, and using this to route the messages to wherever you want to handle
59058 them.
59059 </para>
59060 <para>
59061 The overhead incurred in using VERP depends very much on the size of the
59062 message, the number of recipient addresses that resolve to the same remote
59063 host, and the speed of the connection over which the message is being sent. If
59064 a lot of addresses resolve to the same host and the connection is slow, sending
59065 a separate copy of the message for each address may take substantially longer
59066 than sending a single copy with many recipients (for which VERP cannot be
59067 used).
59068 </para>
59069 </section>
59070 <section id="SECTvirtualdomains">
59071 <title>Virtual domains</title>
59072 <para>
59073 <indexterm role="concept">
59074 <primary>virtual domains</primary>
59075 </indexterm>
59076 <indexterm role="concept">
59077 <primary>domain</primary>
59078 <secondary>virtual</secondary>
59079 </indexterm>
59080 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
59081 meanings:
59082 </para>
59083 <itemizedlist>
59084 <listitem>
59085 <para>
59086 A domain for which there are no real mailboxes; all valid local parts are
59087 aliases for other email addresses. Common examples are organizational
59088 top-level domains and <quote>vanity</quote> domains.
59089 </para>
59090 </listitem>
59091 <listitem>
59092 <para>
59093 One of a number of independent domains that are all handled by the same host,
59094 with mailboxes on that host, but where the mailbox owners do not necessarily
59095 have login accounts on that host.
59096 </para>
59097 </listitem>
59098 </itemizedlist>
59099 <para>
59100 The first usage is probably more common, and does seem more <quote>virtual</quote> than
59101 the second. This kind of domain can be handled in Exim with a straightforward
59102 aliasing router. One approach is to create a separate alias file for each
59103 virtual domain. Exim can test for the existence of the alias file to determine
59104 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
59105 to a router of this form:
59106 </para>
59107 <literallayout class="monospaced">
59108 virtual:
59109   driver = redirect
59110   domains = dsearch;/etc/mail/virtual
59111   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
59112   no_more
59113 </literallayout>
59114 <para>
59115 The <option>domains</option> option specifies that the router is to be skipped, unless there
59116 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
59117 domain that is being processed. When the router runs, it looks up the local
59118 part in the file to find a new address (or list of addresses). The <option>no_more</option>
59119 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
59120 string), Exim gives up on the address without trying any subsequent routers.
59121 </para>
59122 <para>
59123 This one router can handle all the virtual domains because the alias file names
59124 follow a fixed pattern. Permissions can be arranged so that appropriate people
59125 can edit the different alias files. A successful aliasing operation results in
59126 a new envelope recipient address, which is then routed from scratch.
59127 </para>
59128 <para>
59129 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
59130 way. One approach is to create a file for each domain containing a list of
59131 valid local parts, and use it in a router like this:
59132 </para>
59133 <literallayout class="monospaced">
59134 my_domains:
59135   driver = accept
59136   domains = dsearch;/etc/mail/domains
59137   local_parts = lsearch;/etc/mail/domains/$domain
59138   transport = my_mailboxes
59139 </literallayout>
59140 <para>
59141 The address is accepted if there is a file for the domain, and the local part
59142 can be found in the file. The <option>domains</option> option is used to check for the
59143 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
59144 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
59145 because that option is tested after <option>local_parts</option>. The transport is as
59146 follows:
59147 </para>
59148 <literallayout class="monospaced">
59149 my_mailboxes:
59150   driver = appendfile
59151   file = /var/mail/$domain/$local_part
59152   user = mail
59153 </literallayout>
59154 <para>
59155 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
59156 required, to specify which uid is to be used for writing to the mailboxes.
59157 </para>
59158 <para>
59159 The configuration shown here is just one example of how you might support this
59160 requirement. There are many other ways this kind of configuration can be set
59161 up, for example, by using a database instead of separate files to hold all the
59162 information about the domains.
59163 </para>
59164 </section>
59165 <section id="SECTmulbox">
59166 <title>Multiple user mailboxes</title>
59167 <para>
59168 <indexterm role="concept">
59169 <primary>multiple mailboxes</primary>
59170 </indexterm>
59171 <indexterm role="concept">
59172 <primary>mailbox</primary>
59173 <secondary>multiple</secondary>
59174 </indexterm>
59175 <indexterm role="concept">
59176 <primary>local part</primary>
59177 <secondary>prefix</secondary>
59178 </indexterm>
59179 <indexterm role="concept">
59180 <primary>local part</primary>
59181 <secondary>suffix</secondary>
59182 </indexterm>
59183 Heavy email users often want to operate with multiple mailboxes, into which
59184 incoming mail is automatically sorted. A popular way of handling this is to
59185 allow users to use multiple sender addresses, so that replies can easily be
59186 identified. Users are permitted to add prefixes or suffixes to their local
59187 parts for this purpose. The wildcard facility of the generic router options
59188 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
59189 example, consider this router:
59190 </para>
59191 <literallayout class="monospaced">
59192 userforward:
59193   driver = redirect
59194   check_local_user
59195   file = $home/.forward
59196   local_part_suffix = -*
59197   local_part_suffix_optional
59198   allow_filter
59199 </literallayout>
59200 <para>
59201 <indexterm role="variable">
59202 <primary><varname>$local_part_suffix</varname></primary>
59203 </indexterm>
59204 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
59205 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
59206 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
59207 </para>
59208 <literallayout class="monospaced">
59209 if $local_part_suffix contains -special then
59210 save /home/$local_part/Mail/special
59211 endif
59212 </literallayout>
59213 <para>
59214 If the filter file does not exist, or does not deal with such addresses, they
59215 fall through to subsequent routers, and, assuming no subsequent use of the
59216 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
59217 control over which suffixes are valid.
59218 </para>
59219 <para>
59220 Alternatively, a suffix can be used to trigger the use of a different
59221 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
59222 another MTA:
59223 </para>
59224 <literallayout class="monospaced">
59225 userforward:
59226   driver = redirect
59227   check_local_user
59228   file = $home/.forward$local_part_suffix
59229   local_part_suffix = -*
59230   local_part_suffix_optional
59231   allow_filter
59232 </literallayout>
59233 <para>
59234 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
59235 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
59236 does not exist, or does not deal with the address, it is passed on to
59237 subsequent routers, which could, if required, look for an unqualified
59238 <filename>.forward</filename> file to use as a default.
59239 </para>
59240 </section>
59241 <section id="SECID244">
59242 <title>Simplified vacation processing</title>
59243 <para>
59244 <indexterm role="concept">
59245 <primary>vacation processing</primary>
59246 </indexterm>
59247 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
59248 a pipe command in a <filename>.forward</filename> file
59249 (see section <xref linkend="SECTspecitredli"/> for syntax details).
59250 This is prone to error by inexperienced users. There are two features of Exim
59251 that can be used to make this process simpler for users:
59252 </para>
59253 <itemizedlist>
59254 <listitem>
59255 <para>
59256 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
59257 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
59258 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
59259 <filename>.forward</filename> file are then much simpler. For example:
59260 </para>
59261 <literallayout class="monospaced">
59262 spqr, vacation-spqr
59263 </literallayout>
59264 </listitem>
59265 <listitem>
59266 <para>
59267 The <option>require_files</option> generic router option can be used to trigger a
59268 vacation delivery by checking for the existence of a certain file in the
59269 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
59270 ensure that the original delivery also proceeds. In this case, all the user has
59271 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
59272 message.
59273 </para>
59274 </listitem>
59275 </itemizedlist>
59276 <para>
59277 Another advantage of both these methods is that they both work even when the
59278 use of arbitrary pipes by users is locked out.
59279 </para>
59280 </section>
59281 <section id="SECID245">
59282 <title>Taking copies of mail</title>
59283 <para>
59284 <indexterm role="concept">
59285 <primary>message</primary>
59286 <secondary>copying every</secondary>
59287 </indexterm>
59288 Some installations have policies that require archive copies of all messages to
59289 be made. A single copy of each message can easily be taken by an appropriate
59290 command in a system filter, which could, for example, use a different file for
59291 each day&#x2019;s messages.
59292 </para>
59293 <para>
59294 There is also a shadow transport mechanism that can be used to take copies of
59295 messages that are successfully delivered by local transports, one copy per
59296 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
59297 notification of delivery by sites that insist on doing such things.
59298 </para>
59299 </section>
59300 <section id="SECID246">
59301 <title>Intermittently connected hosts</title>
59302 <para>
59303 <indexterm role="concept">
59304 <primary>intermittently connected hosts</primary>
59305 </indexterm>
59306 It has become quite common (because it is cheaper) for hosts to connect to the
59307 Internet periodically rather than remain connected all the time. The normal
59308 arrangement is that mail for such hosts accumulates on a system that is
59309 permanently connected.
59310 </para>
59311 <para>
59312 Exim was designed for use on permanently connected hosts, and so it is not
59313 particularly well-suited to use in an intermittently connected environment.
59314 Nevertheless there are some features that can be used.
59315 </para>
59316 </section>
59317 <section id="SECID247">
59318 <title>Exim on the upstream server host</title>
59319 <para>
59320 It is tempting to arrange for incoming mail for the intermittently connected
59321 host to remain on Exim&#x2019;s queue until the client connects. However, this
59322 approach does not scale very well. Two different kinds of waiting message are
59323 being mixed up in the same queue &ndash; those that cannot be delivered because of
59324 some temporary problem, and those that are waiting for their destination host
59325 to connect. This makes it hard to manage the queue, as well as wasting
59326 resources, because each queue runner scans the entire queue.
59327 </para>
59328 <para>
59329 A better approach is to separate off those messages that are waiting for an
59330 intermittently connected host. This can be done by delivering these messages
59331 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
59332 format, from where they are transmitted by other software when their
59333 destination connects. This makes it easy to collect all the mail for one host
59334 in a single directory, and to apply local timeout rules on a per-message basis
59335 if required.
59336 </para>
59337 <para>
59338 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
59339 you are doing this, you should configure Exim with a long retry period for the
59340 intermittent host. For example:
59341 </para>
59342 <literallayout class="monospaced">
59343 cheshire.wonderland.fict.example    *   F,5d,24h
59344 </literallayout>
59345 <para>
59346 This stops a lot of failed delivery attempts from occurring, but Exim remembers
59347 which messages it has queued up for that host. Once the intermittent host comes
59348 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
59349 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
59350 causes all the queued up messages to be delivered, often down a single SMTP
59351 connection. While the host remains connected, any new messages get delivered
59352 immediately.
59353 </para>
59354 <para>
59355 If the connecting hosts do not have fixed IP addresses, that is, if a host is
59356 issued with a different IP address each time it connects, Exim&#x2019;s retry
59357 mechanisms on the holding host get confused, because the IP address is normally
59358 used as part of the key string for holding retry information. This can be
59359 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
59360 Since this has disadvantages for permanently connected hosts, it is best to
59361 arrange a separate transport for the intermittently connected ones.
59362 </para>
59363 </section>
59364 <section id="SECID248">
59365 <title>Exim on the intermittently connected client host</title>
59366 <para>
59367 The value of <option>smtp_accept_queue_per_connection</option> should probably be
59368 increased, or even set to zero (that is, disabled) on the intermittently
59369 connected host, so that all incoming messages down a single connection get
59370 delivered immediately.
59371 </para>
59372 <para>
59373 <indexterm role="concept">
59374 <primary>SMTP</primary>
59375 <secondary>passed connection</secondary>
59376 </indexterm>
59377 <indexterm role="concept">
59378 <primary>SMTP</primary>
59379 <secondary>multiple deliveries</secondary>
59380 </indexterm>
59381 <indexterm role="concept">
59382 <primary>multiple SMTP deliveries</primary>
59383 </indexterm>
59384 Mail waiting to be sent from an intermittently connected host will probably
59385 not have been routed, because without a connection DNS lookups are not
59386 possible. This means that if a normal queue run is done at connection time,
59387 each message is likely to be sent in a separate SMTP session. This can be
59388 avoided by starting the queue run with a command line option beginning with
59389 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
59390 first pass, routing is done but no deliveries take place. The second pass is a
59391 normal queue run; since all the messages have been previously routed, those
59392 destined for the same host are likely to get sent as multiple deliveries in a
59393 single SMTP connection.
59394 </para>
59395 </section>
59396 </chapter>
59397
59398 <chapter id="CHAPnonqueueing">
59399 <title>Using Exim as a non-queueing client</title>
59400 <titleabbrev>Exim as a non-queueing client</titleabbrev>
59401 <para>
59402 <indexterm role="concept">
59403 <primary>client, non-queueing</primary>
59404 </indexterm>
59405 <indexterm role="concept">
59406 <primary>smart host</primary>
59407 <secondary>suppressing queueing</secondary>
59408 </indexterm>
59409 On a personal computer, it is a common requirement for all
59410 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
59411 configured to operate that way, for all the popular operating systems.
59412 However, there are some MUAs for Unix-like systems that cannot be so
59413 configured: they submit messages using the command line interface of
59414 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
59415 messages this way.
59416 </para>
59417 <para>
59418 If the personal computer runs continuously, there is no problem, because it can
59419 run a conventional MTA that handles delivery to the smart host, and deal with
59420 any delays via its queueing mechanism. However, if the computer does not run
59421 continuously or runs different operating systems at different times, queueing
59422 email is not desirable.
59423 </para>
59424 <para>
59425 There is therefore a requirement for something that can provide the
59426 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
59427 any queueing or retrying facilities. Furthermore, the delivery to the smart
59428 host should be synchronous, so that if it fails, the sending MUA is immediately
59429 informed. In other words, we want something that extends an MUA that submits
59430 to a local MTA via the command line so that it behaves like one that submits
59431 to a remote smart host using TCP/SMTP.
59432 </para>
59433 <para>
59434 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
59435 that do this job. However, people have found them to be lacking in various
59436 ways. For instance, you might want to allow aliasing and forwarding to be done
59437 before sending a message to the smart host.
59438 </para>
59439 <para>
59440 Exim already had the necessary infrastructure for doing this job. Just a few
59441 tweaks were needed to make it behave as required, though it is somewhat of an
59442 overkill to use a fully-featured MTA for this purpose.
59443 </para>
59444 <para>
59445 <indexterm role="option">
59446 <primary><option>mua_wrapper</option></primary>
59447 </indexterm>
59448 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
59449 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
59450 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
59451 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
59452 compatible router and transport configuration. Typically there will be just one
59453 router and one transport, sending everything to a smart host.
59454 </para>
59455 <para>
59456 When run in MUA wrapping mode, the behaviour of Exim changes in the
59457 following ways:
59458 </para>
59459 <itemizedlist>
59460 <listitem>
59461 <para>
59462 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
59463 In other words, the only way to submit messages is via the command line.
59464 </para>
59465 </listitem>
59466 <listitem>
59467 <para>
59468 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
59469 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
59470 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
59471 does not finish until the delivery attempt is complete. If the delivery is
59472 successful, a zero return code is given.
59473 </para>
59474 </listitem>
59475 <listitem>
59476 <para>
59477 Address redirection is permitted, but the final routing for all addresses must
59478 be to the same remote transport, and to the same list of hosts. Furthermore,
59479 the return address (envelope sender) must be the same for all recipients, as
59480 must any added or deleted header lines. In other words, it must be possible to
59481 deliver the message in a single SMTP transaction, however many recipients there
59482 are.
59483 </para>
59484 </listitem>
59485 <listitem>
59486 <para>
59487 If these conditions are not met, or if routing any address results in a
59488 failure or defer status, or if Exim is unable to deliver all the recipients
59489 successfully to one of the smart hosts, delivery of the entire message fails.
59490 </para>
59491 </listitem>
59492 <listitem>
59493 <para>
59494 Because no queueing is allowed, all failures are treated as permanent; there
59495 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
59496 smart host. Furthermore, because only a single yes/no response can be given to
59497 the caller, it is not possible to deliver to some recipients and not others. If
59498 there is an error (temporary or permanent) for any recipient, all are failed.
59499 </para>
59500 </listitem>
59501 <listitem>
59502 <para>
59503 If more than one smart host is listed, Exim will try another host after a
59504 connection failure or a timeout, in the normal way. However, if this kind of
59505 failure happens for all the hosts, the delivery fails.
59506 </para>
59507 </listitem>
59508 <listitem>
59509 <para>
59510 When delivery fails, an error message is written to the standard error stream
59511 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
59512 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
59513 are ever generated.
59514 </para>
59515 </listitem>
59516 <listitem>
59517 <para>
59518 No retry data is maintained, and any retry rules are ignored.
59519 </para>
59520 </listitem>
59521 <listitem>
59522 <para>
59523 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
59524 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
59525 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
59526 </para>
59527 </listitem>
59528 </itemizedlist>
59529 <para>
59530 The overall effect is that Exim makes a single synchronous attempt to deliver
59531 the message, failing if there is any kind of problem. Because no local
59532 deliveries are done and no daemon can be run, Exim does not need root
59533 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
59534 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
59535 the advantages and disadvantages of running without root privilege.
59536 </para>
59537 </chapter>
59538
59539 <chapter id="CHAPlog">
59540 <title>Log files</title>
59541 <para>
59542 <indexterm role="concept" id="IIDloggen" class="startofrange">
59543 <primary>log</primary>
59544 <secondary>general description</secondary>
59545 </indexterm>
59546 <indexterm role="concept">
59547 <primary>log</primary>
59548 <secondary>types of</secondary>
59549 </indexterm>
59550 Exim writes three different logs, referred to as the main log, the reject log,
59551 and the panic log:
59552 </para>
59553 <itemizedlist>
59554 <listitem>
59555 <para>
59556 <indexterm role="concept">
59557 <primary>main log</primary>
59558 </indexterm>
59559 The main log records the arrival of each message and each delivery in a single
59560 line in each case. The format is as compact as possible, in an attempt to keep
59561 down the size of log files. Two-character flag sequences make it easy to pick
59562 out these lines. A number of other events are recorded in the main log. Some of
59563 them are optional, in which case the <option>log_selector</option> option controls whether
59564 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
59565 analysis of main log files, is provided in the Exim distribution (see section
59566 <xref linkend="SECTmailstat"/>).
59567 </para>
59568 </listitem>
59569 <listitem>
59570 <para>
59571 <indexterm role="concept">
59572 <primary>reject log</primary>
59573 </indexterm>
59574 The reject log records information from messages that are rejected as a result
59575 of a configuration option (that is, for policy reasons).
59576 The first line of each rejection is a copy of the line that is also written to
59577 the main log. Then, if the message&#x2019;s header has been read at the time the log
59578 is written, its contents are written to this log. Only the original header
59579 lines are available; header lines added by ACLs are not logged. You can use the
59580 reject log to check that your policy controls are working correctly; on a busy
59581 host this may be easier than scanning the main log for rejection messages. You
59582 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
59583 false.
59584 </para>
59585 </listitem>
59586 <listitem>
59587 <para>
59588 <indexterm role="concept">
59589 <primary>panic log</primary>
59590 </indexterm>
59591 <indexterm role="concept">
59592 <primary>system log</primary>
59593 </indexterm>
59594 When certain serious errors occur, Exim writes entries to its panic log. If the
59595 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
59596 are usually written to the main log as well, but can get lost amid the mass of
59597 other entries. The panic log should be empty under normal circumstances. It is
59598 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
59599 regularly, in order to become aware of any problems. When Exim cannot open its
59600 panic log, it tries as a last resort to write to the system log (syslog). This
59601 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
59602 message itself is written at priority LOG_CRIT.
59603 </para>
59604 </listitem>
59605 </itemizedlist>
59606 <para>
59607 Every log line starts with a timestamp, in the format shown in the following
59608 example. Note that many of the examples shown in this chapter are line-wrapped.
59609 In the log file, this would be all on one line:
59610 </para>
59611 <literallayout class="monospaced">
59612 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
59613   by QUIT
59614 </literallayout>
59615 <para>
59616 By default, the timestamps are in the local timezone. There are two
59617 ways of changing this:
59618 </para>
59619 <itemizedlist>
59620 <listitem>
59621 <para>
59622 You can set the <option>timezone</option> option to a different time zone; in particular, if
59623 you set
59624 </para>
59625 <literallayout class="monospaced">
59626 timezone = UTC
59627 </literallayout>
59628 <para>
59629 the timestamps will be in UTC (aka GMT).
59630 </para>
59631 </listitem>
59632 <listitem>
59633 <para>
59634 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
59635 example:
59636 </para>
59637 <literallayout class="monospaced">
59638 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
59639 </literallayout>
59640 </listitem>
59641 </itemizedlist>
59642 <para>
59643 <indexterm role="concept">
59644 <primary>log</primary>
59645 <secondary>process ids in</secondary>
59646 </indexterm>
59647 <indexterm role="concept">
59648 <primary>pid (process id)</primary>
59649 <secondary>in log lines</secondary>
59650 </indexterm>
59651 Exim does not include its process id in log lines by default, but you can
59652 request that it does so by specifying the <literal>pid</literal> log selector (see section
59653 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
59654 brackets, immediately after the time and date.
59655 </para>
59656 <section id="SECTwhelogwri">
59657 <title>Where the logs are written</title>
59658 <para>
59659 <indexterm role="concept">
59660 <primary>log</primary>
59661 <secondary>destination</secondary>
59662 </indexterm>
59663 <indexterm role="concept">
59664 <primary>log</primary>
59665 <secondary>to file</secondary>
59666 </indexterm>
59667 <indexterm role="concept">
59668 <primary>log</primary>
59669 <secondary>to syslog</secondary>
59670 </indexterm>
59671 <indexterm role="concept">
59672 <primary>syslog</primary>
59673 </indexterm>
59674 The logs may be written to local files, or to syslog, or both. However, it
59675 should be noted that many syslog implementations use UDP as a transport, and
59676 are therefore unreliable in the sense that messages are not guaranteed to
59677 arrive at the loghost, nor is the ordering of messages necessarily maintained.
59678 It has also been reported that on large log files (tens of megabytes) you may
59679 need to tweak syslog to prevent it syncing the file with each write &ndash; on
59680 Linux this has been seen to make syslog take 90% plus of CPU time.
59681 </para>
59682 <para>
59683 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
59684 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
59685 configuration. This latter string is expanded, so it can contain, for example,
59686 references to the host name:
59687 </para>
59688 <literallayout class="monospaced">
59689 log_file_path = /var/log/$primary_hostname/exim_%slog
59690 </literallayout>
59691 <para>
59692 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
59693 rather than at run time, because then the setting is available right from the
59694 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
59695 before it has read the configuration file (for example, an error in the
59696 configuration file) it will not use the path you want, and may not be able to
59697 log at all.
59698 </para>
59699 <para>
59700 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
59701 list, currently limited to at most two items. This is one option where the
59702 facility for changing a list separator may not be used. The list must always be
59703 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
59704 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
59705 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
59706 implying the use of a default path.
59707 </para>
59708 <para>
59709 When Exim encounters an empty item in the list, it searches the list defined by
59710 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
59711 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
59712 mean <quote>use the path specified at build time</quote>. It no such item exists, log
59713 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
59714 equivalent to the setting:
59715 </para>
59716 <literallayout class="monospaced">
59717 log_file_path = $spool_directory/log/%slog
59718 </literallayout>
59719 <para>
59720 If you do not specify anything at build time or run time, that is where the
59721 logs are written.
59722 </para>
59723 <para>
59724 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
59725 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
59726 </para>
59727 <para>
59728 Here are some examples of possible settings:
59729 </para>
59730 <literallayout>
59731 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
59732 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
59733 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
59734 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
59735 </literallayout>
59736 <para>
59737 If there are more than two paths in the list, the first is used and a panic
59738 error is logged.
59739 </para>
59740 </section>
59741 <section id="SECID285">
59742 <title>Logging to local files that are periodically <quote>cycled</quote></title>
59743 <para>
59744 <indexterm role="concept">
59745 <primary>log</primary>
59746 <secondary>cycling local files</secondary>
59747 </indexterm>
59748 <indexterm role="concept">
59749 <primary>cycling logs</primary>
59750 </indexterm>
59751 <indexterm role="concept">
59752 <primary><emphasis>exicyclog</emphasis></primary>
59753 </indexterm>
59754 <indexterm role="concept">
59755 <primary>log</primary>
59756 <secondary>local files; writing to</secondary>
59757 </indexterm>
59758 Some operating systems provide centralized and standardized methods for cycling
59759 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
59760 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
59761 main and reject logs each time it is called. The maximum number of old logs to
59762 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
59763 </para>
59764 <para>
59765 An Exim delivery process opens the main log when it first needs to write to it,
59766 and it keeps the file open in case subsequent entries are required &ndash; for
59767 example, if a number of different deliveries are being done for the same
59768 message. However, remote SMTP deliveries can take a long time, and this means
59769 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
59770 something similar is being used to rename log files on a regular basis. To
59771 ensure that a switch of log files is noticed as soon as possible, Exim calls
59772 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
59773 does not exist, or its inode has changed, the old file is closed and Exim
59774 tries to open the main log from scratch. Thus, an old log file may remain open
59775 for quite some time, but no Exim processes should write to it once it has been
59776 renamed.
59777 </para>
59778 </section>
59779 <section id="SECTdatlogfil">
59780 <title>Datestamped log files</title>
59781 <para>
59782 <indexterm role="concept">
59783 <primary>log</primary>
59784 <secondary>datestamped files</secondary>
59785 </indexterm>
59786 Instead of cycling the main and reject log files by renaming them
59787 periodically, some sites like to use files whose names contain a datestamp,
59788 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
59789 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
59790 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
59791 point where the datestamp is required. For example:
59792 </para>
59793 <literallayout class="monospaced">
59794 log_file_path = /var/spool/exim/log/%slog-%D
59795 log_file_path = /var/log/exim-%s-%D.log
59796 log_file_path = /var/spool/exim/log/%D-%slog
59797 log_file_path = /var/log/exim/%s.%M
59798 </literallayout>
59799 <para>
59800 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
59801 examples of names generated by the above examples:
59802 </para>
59803 <literallayout class="monospaced">
59804 /var/spool/exim/log/mainlog-20021225
59805 /var/log/exim-reject-20021225.log
59806 /var/spool/exim/log/20021225-mainlog
59807 /var/log/exim/main.200212
59808 </literallayout>
59809 <para>
59810 When this form of log file is specified, Exim automatically switches to new
59811 files at midnight. It does not make any attempt to compress old logs; you
59812 will need to write your own script if you require this. You should not
59813 run <emphasis>exicyclog</emphasis> with this form of logging.
59814 </para>
59815 <para>
59816 The location of the panic log is also determined by <option>log_file_path</option>, but it
59817 is not datestamped, because rotation of the panic log does not make sense.
59818 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
59819 the string. In addition, if it immediately follows a slash, a following
59820 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
59821 character is removed. Thus, the four examples above would give these panic
59822 log names:
59823 </para>
59824 <literallayout class="monospaced">
59825 /var/spool/exim/log/paniclog
59826 /var/log/exim-panic.log
59827 /var/spool/exim/log/paniclog
59828 /var/log/exim/panic
59829 </literallayout>
59830 </section>
59831 <section id="SECID249">
59832 <title>Logging to syslog</title>
59833 <para>
59834 <indexterm role="concept">
59835 <primary>log</primary>
59836 <secondary>syslog; writing to</secondary>
59837 </indexterm>
59838 The use of syslog does not change what Exim logs or the format of its messages,
59839 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
59840 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
59841 that, the same strings are written to syslog as to log files. The syslog
59842 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
59843 by default, but you can change these by setting the <option>syslog_facility</option> and
59844 <option>syslog_processname</option> options, respectively. If Exim was compiled with
59845 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
59846 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
59847 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
59848 the time and host name to each line.
59849 The three log streams are mapped onto syslog priorities as follows:
59850 </para>
59851 <itemizedlist>
59852 <listitem>
59853 <para>
59854 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
59855 </para>
59856 </listitem>
59857 <listitem>
59858 <para>
59859 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
59860 </para>
59861 </listitem>
59862 <listitem>
59863 <para>
59864 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
59865 </para>
59866 </listitem>
59867 </itemizedlist>
59868 <para>
59869 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
59870 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
59871 these are routed by syslog to the same place. You can suppress this duplication
59872 by setting <option>syslog_duplication</option> false.
59873 </para>
59874 <para>
59875 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
59876 entries contain multiple lines when headers are included. To cope with both
59877 these cases, entries written to syslog are split into separate <function>syslog()</function>
59878 calls at each internal newline, and also after a maximum of
59879 870 data characters. (This allows for a total syslog line length of 1024, when
59880 additions such as timestamps are added.) If you are running a syslog
59881 replacement that can handle lines longer than the 1024 characters allowed by
59882 RFC 3164, you should set
59883 </para>
59884 <literallayout class="monospaced">
59885 SYSLOG_LONG_LINES=yes
59886 </literallayout>
59887 <para>
59888 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
59889 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
59890 </para>
59891 <para>
59892 To make it easy to re-assemble split lines later, each component of a split
59893 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;]
59894 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
59895 components in the entry. The / delimiter is used when the line was split
59896 because it was too long; if it was split because of an internal newline, the \
59897 delimiter is used. For example, supposing the length limit to be 50 instead of
59898 870, the following would be the result of a typical rejection message to
59899 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
59900 name, and pid as added by syslog:
59901 </para>
59902 <literallayout class="monospaced">
59903 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
59904 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
59905 [3/5]  when scanning for sender: missing or malformed lo
59906 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
59907 [5/5] mple&gt;)
59908 </literallayout>
59909 <para>
59910 The same error might cause the following lines to be written to <quote>rejectlog</quote>
59911 (LOG_NOTICE):
59912 </para>
59913 <literallayout class="monospaced">
59914 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
59915 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
59916 [3/18] er when scanning for sender: missing or malformed
59917 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
59918 [5\18] .example&gt;)
59919 [6\18] Recipients: ph10@some.domain.cam.example
59920 [7\18] P Received: from [127.0.0.1] (ident=ph10)
59921 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
59922 [9\18]        id 16RdAL-0006pc-00
59923 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
59924 [11\18] 09:43 +0100
59925 [12\18] F From: &lt;&gt;
59926 [13\18]   Subject: this is a test header
59927 [18\18]   X-something: this is another header
59928 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
59929 [16\18] le&gt;
59930 [17\18] B Bcc:
59931 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
59932 </literallayout>
59933 <para>
59934 Log lines that are neither too long nor contain newlines are written to syslog
59935 without modification.
59936 </para>
59937 <para>
59938 If only syslog is being used, the Exim monitor is unable to provide a log tail
59939 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
59940 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
59941 where it is.
59942 </para>
59943 </section>
59944 <section id="SECID250">
59945 <title>Log line flags</title>
59946 <para>
59947 One line is written to the main log for each message received, and for each
59948 successful, unsuccessful, and delayed delivery. These lines can readily be
59949 picked out by the distinctive two-character flags that immediately follow the
59950 timestamp. The flags are:
59951 </para>
59952 <literallayout>
59953 <literal>&lt;=</literal>     message arrival
59954 <literal>=&gt;</literal>     normal message delivery
59955 <literal>-&gt;</literal>     additional address in same delivery
59956 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
59957 <literal>**</literal>     delivery failed; address bounced
59958 <literal>==</literal>     delivery deferred; temporary problem
59959 </literallayout>
59960 </section>
59961 <section id="SECID251">
59962 <title>Logging message reception</title>
59963 <para>
59964 <indexterm role="concept">
59965 <primary>log</primary>
59966 <secondary>reception line</secondary>
59967 </indexterm>
59968 The format of the single-line entry in the main log that is written for every
59969 message received is shown in the basic example below, which is split over
59970 several lines in order to fit it on the page:
59971 </para>
59972 <literallayout class="monospaced">
59973 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
59974   H=mailer.fict.example [192.168.123.123] U=exim
59975   P=smtp S=5678 id=&lt;incoming message id&gt;
59976 </literallayout>
59977 <para>
59978 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
59979 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
59980 generated, this is followed by an item of the form
59981 </para>
59982 <literallayout class="monospaced">
59983 R=&lt;message id&gt;
59984 </literallayout>
59985 <para>
59986 which is a reference to the message that caused the bounce to be sent.
59987 </para>
59988 <para>
59989 <indexterm role="concept">
59990 <primary>HELO</primary>
59991 </indexterm>
59992 <indexterm role="concept">
59993 <primary>EHLO</primary>
59994 </indexterm>
59995 For messages from other hosts, the H and U fields identify the remote host and
59996 record the RFC 1413 identity of the user that sent the message, if one was
59997 received. The number given in square brackets is the IP address of the sending
59998 host. If there is a single, unparenthesized  host name in the H field, as
59999 above, it has been verified to correspond to the IP address (see the
60000 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
60001 by the remote host in the SMTP HELO or EHLO command, and has not been
60002 verified. If verification yields a different name to that given for HELO or
60003 EHLO, the verified name appears first, followed by the HELO or EHLO
60004 name in parentheses.
60005 </para>
60006 <para>
60007 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
60008 without brackets, in the HELO or EHLO command, leading to entries in
60009 the log containing text like these examples:
60010 </para>
60011 <literallayout class="monospaced">
60012 H=(10.21.32.43) [192.168.8.34]
60013 H=([10.21.32.43]) [192.168.8.34]
60014 </literallayout>
60015 <para>
60016 This can be confusing. Only the final address in square brackets can be relied
60017 on.
60018 </para>
60019 <para>
60020 For locally generated messages (that is, messages not received over TCP/IP),
60021 the H field is omitted, and the U field contains the login name of the caller
60022 of Exim.
60023 </para>
60024 <para>
60025 <indexterm role="concept">
60026 <primary>authentication</primary>
60027 <secondary>logging</secondary>
60028 </indexterm>
60029 <indexterm role="concept">
60030 <primary>AUTH</primary>
60031 <secondary>logging</secondary>
60032 </indexterm>
60033 For all messages, the P field specifies the protocol used to receive the
60034 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
60035 of incoming SMTP messages, the value indicates whether or not any SMTP
60036 extensions (ESMTP), encryption, or authentication were used. If the SMTP
60037 session was encrypted, there is an additional X field that records the cipher
60038 suite that was used.
60039 </para>
60040 <para>
60041 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
60042 hosts that have authenticated themselves using the SMTP AUTH command. The first
60043 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
60044 there is an additional item A= followed by the name of the authenticator that
60045 was used. If an authenticated identification was set up by the authenticator&#x2019;s
60046 <option>server_set_id</option> option, this is logged too, separated by a colon from the
60047 authenticator name.
60048 </para>
60049 <para>
60050 <indexterm role="concept">
60051 <primary>size</primary>
60052 <secondary>of message</secondary>
60053 </indexterm>
60054 The id field records the existing message id, if present. The size of the
60055 received message is given by the S field. When the message is delivered,
60056 headers may be removed or added, so that the size of delivered copies of the
60057 message may not correspond with this value (and indeed may be different to each
60058 other).
60059 </para>
60060 <para>
60061 The <option>log_selector</option> option can be used to request the logging of additional
60062 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
60063 </para>
60064 </section>
60065 <section id="SECID252">
60066 <title>Logging deliveries</title>
60067 <para>
60068 <indexterm role="concept">
60069 <primary>log</primary>
60070 <secondary>delivery line</secondary>
60071 </indexterm>
60072 The format of the single-line entry in the main log that is written for every
60073 delivery is shown in one of the examples below, for local and remote
60074 deliveries, respectively. Each example has been split into two lines in order
60075 to fit it on the page:
60076 </para>
60077 <literallayout class="monospaced">
60078 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
60079   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
60080 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
60081   monk@holistic.fict.example R=dnslookup T=remote_smtp
60082   H=holistic.fict.example [192.168.234.234]
60083 </literallayout>
60084 <para>
60085 For ordinary local deliveries, the original address is given in angle brackets
60086 after the final delivery address, which might be a pipe or a file. If
60087 intermediate address(es) exist between the original and the final address, the
60088 last of these is given in parentheses after the final address. The R and T
60089 fields record the router and transport that were used to process the address.
60090 </para>
60091 <para>
60092 If a shadow transport was run after a successful local delivery, the log line
60093 for the successful delivery has an item added on the end, of the form
60094 </para>
60095 <literallayout>
60096 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
60097 </literallayout>
60098 <para>
60099 If the shadow transport did not succeed, the error message is put in
60100 parentheses afterwards.
60101 </para>
60102 <para>
60103 <indexterm role="concept">
60104 <primary>asterisk</primary>
60105 <secondary>after IP address</secondary>
60106 </indexterm>
60107 When more than one address is included in a single delivery (for example, two
60108 SMTP RCPT commands in one transaction) the second and subsequent addresses are
60109 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
60110 down a single SMTP connection, an asterisk follows the IP address in the log
60111 lines for the second and subsequent messages.
60112 </para>
60113 <para>
60114 The generation of a reply message by a filter file gets logged as a
60115 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
60116 </para>
60117 <para>
60118 The <option>log_selector</option> option can be used to request the logging of additional
60119 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
60120 </para>
60121 </section>
60122 <section id="SECID253">
60123 <title>Discarded deliveries</title>
60124 <para>
60125 <indexterm role="concept">
60126 <primary>discarded messages</primary>
60127 </indexterm>
60128 <indexterm role="concept">
60129 <primary>message</primary>
60130 <secondary>discarded</secondary>
60131 </indexterm>
60132 <indexterm role="concept">
60133 <primary>delivery</primary>
60134 <secondary>discarded; logging</secondary>
60135 </indexterm>
60136 When a message is discarded as a result of the command <quote>seen finish</quote> being
60137 obeyed in a filter file which generates no deliveries, a log entry of the form
60138 </para>
60139 <literallayout class="monospaced">
60140 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
60141   &lt;low.club@bridge.example&gt; R=userforward
60142 </literallayout>
60143 <para>
60144 is written, to record why no deliveries are logged. When a message is discarded
60145 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
60146 </para>
60147 <literallayout class="monospaced">
60148 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
60149   &lt;hole@nowhere.example&gt; R=blackhole_router
60150 </literallayout>
60151 </section>
60152 <section id="SECID254">
60153 <title>Deferred deliveries</title>
60154 <para>
60155 When a delivery is deferred, a line of the following form is logged:
60156 </para>
60157 <literallayout class="monospaced">
60158 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
60159   R=dnslookup T=smtp defer (146): Connection refused
60160 </literallayout>
60161 <para>
60162 In the case of remote deliveries, the error is the one that was given for the
60163 last IP address that was tried. Details of individual SMTP failures are also
60164 written to the log, so the above line would be preceded by something like
60165 </para>
60166 <literallayout class="monospaced">
60167 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
60168   mail1.endrest.example [192.168.239.239]: Connection refused
60169 </literallayout>
60170 <para>
60171 When a deferred address is skipped because its retry time has not been reached,
60172 a message is written to the log, but this can be suppressed by setting an
60173 appropriate value in <option>log_selector</option>.
60174 </para>
60175 </section>
60176 <section id="SECID255">
60177 <title>Delivery failures</title>
60178 <para>
60179 <indexterm role="concept">
60180 <primary>delivery</primary>
60181 <secondary>failure; logging</secondary>
60182 </indexterm>
60183 If a delivery fails because an address cannot be routed, a line of the
60184 following form is logged:
60185 </para>
60186 <literallayout class="monospaced">
60187 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
60188   &lt;jim@trek99.example&gt;: unknown mail domain
60189 </literallayout>
60190 <para>
60191 If a delivery fails at transport time, the router and transport are shown, and
60192 the response from the remote host is included, as in this example:
60193 </para>
60194 <literallayout class="monospaced">
60195 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
60196   R=dnslookup T=remote_smtp: SMTP error from remote mailer
60197   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
60198   pbmail3.py.example [192.168.63.111]: 553 5.3.0
60199   &lt;ace400@pb.example&gt;...Addressee unknown
60200 </literallayout>
60201 <para>
60202 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
60203 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
60204 disabling PIPELINING. The log lines for all forms of delivery failure are
60205 flagged with <literal>**</literal>.
60206 </para>
60207 </section>
60208 <section id="SECID256">
60209 <title>Fake deliveries</title>
60210 <para>
60211 <indexterm role="concept">
60212 <primary>delivery</primary>
60213 <secondary>fake; logging</secondary>
60214 </indexterm>
60215 If a delivery does not actually take place because the <option>-N</option> option has been
60216 used to suppress it, a normal delivery line is written to the log, except that
60217 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
60218 </para>
60219 </section>
60220 <section id="SECID257">
60221 <title>Completion</title>
60222 <para>
60223 A line of the form
60224 </para>
60225 <literallayout class="monospaced">
60226 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
60227 </literallayout>
60228 <para>
60229 is written to the main log when a message is about to be removed from the spool
60230 at the end of its processing.
60231 </para>
60232 </section>
60233 <section id="SECID258">
60234 <title>Summary of Fields in Log Lines</title>
60235 <para>
60236 <indexterm role="concept">
60237 <primary>log</primary>
60238 <secondary>summary of fields</secondary>
60239 </indexterm>
60240 A summary of the field identifiers that are used in log lines is shown in
60241 the following table:
60242 </para>
60243 <literallayout>
60244 <literal>A   </literal>        authenticator name (and optional id)
60245 <literal>C   </literal>        SMTP confirmation on delivery
60246 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
60247 <literal>CV  </literal>        certificate verification status
60248 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
60249 <literal>DN  </literal>        distinguished name from peer certificate
60250 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
60251 <literal>F   </literal>        sender address (on delivery lines)
60252 <literal>H   </literal>        host name and IP address
60253 <literal>I   </literal>        local interface used
60254 <literal>id  </literal>        message id for incoming message
60255 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
60256 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
60257 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
60258 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
60259 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
60260 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
60261 <literal>S   </literal>        size of message
60262 <literal>ST  </literal>        shadow transport name
60263 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
60264 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
60265 <literal>U   </literal>        local user or RFC 1413 identity
60266 <literal>X   </literal>        TLS cipher suite
60267 </literallayout>
60268 </section>
60269 <section id="SECID259">
60270 <title>Other log entries</title>
60271 <para>
60272 Various other types of log entry are written from time to time. Most should be
60273 self-explanatory. Among the more common are:
60274 </para>
60275 <itemizedlist>
60276 <listitem>
60277 <para>
60278 <indexterm role="concept">
60279 <primary>retry</primary>
60280 <secondary>time not reached</secondary>
60281 </indexterm>
60282 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
60283 during routing or local delivery, and the time to retry has not yet arrived.
60284 This message is not written to an individual message log file unless it happens
60285 during the first delivery attempt.
60286 </para>
60287 </listitem>
60288 <listitem>
60289 <para>
60290 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
60291 temporary errors during remote delivery, and the retry time has not yet arrived
60292 for any of the hosts to which it is routed.
60293 </para>
60294 </listitem>
60295 <listitem>
60296 <para>
60297 <indexterm role="concept">
60298 <primary>spool directory</primary>
60299 <secondary>file locked</secondary>
60300 </indexterm>
60301 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
60302 some other Exim process is already working on the message. This can be quite
60303 common if queue running processes are started at frequent intervals. The
60304 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
60305 doing.
60306 </para>
60307 </listitem>
60308 <listitem>
60309 <para>
60310 <indexterm role="concept">
60311 <primary>error</primary>
60312 <secondary>ignored</secondary>
60313 </indexterm>
60314 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
60315 message:
60316 </para>
60317 <orderedlist numeration="arabic">
60318 <listitem>
60319 <para>
60320 Exim failed to deliver a bounce message whose age was greater than
60321 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
60322 </para>
60323 </listitem>
60324 <listitem>
60325 <para>
60326 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
60327 failed. The delivery was discarded.
60328 </para>
60329 </listitem>
60330 <listitem>
60331 <para>
60332 A delivery set up by a router configured with
60333 </para>
60334 <literallayout class="monospaced">
60335     errors_to = &lt;&gt;
60336 </literallayout>
60337 <para>
60338 failed. The delivery was discarded.
60339 </para>
60340 </listitem>
60341 </orderedlist>
60342 </listitem>
60343 </itemizedlist>
60344 </section>
60345 <section id="SECTlogselector">
60346 <title>Reducing or increasing what is logged</title>
60347 <para>
60348 <indexterm role="concept">
60349 <primary>log</primary>
60350 <secondary>selectors</secondary>
60351 </indexterm>
60352 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
60353 default logging, or you can request additional logging. The value of
60354 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
60355 example:
60356 </para>
60357 <literallayout class="monospaced">
60358 log_selector = +arguments -retry_defer
60359 </literallayout>
60360 <para>
60361 The list of optional log items is in the following table, with the default
60362 selection marked by asterisks:
60363 </para>
60364 <literallayout>
60365 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
60366 <literal> address_rewrite            </literal>  address rewriting
60367 <literal> all_parents                </literal>  all parents in =&gt; lines
60368 <literal> arguments                  </literal>  command line arguments
60369 <literal>*connection_reject          </literal>  connection rejections
60370 <literal>*delay_delivery             </literal>  immediate delivery delayed
60371 <literal> deliver_time               </literal>  time taken to perform delivery
60372 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
60373 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
60374 <literal>*etrn                       </literal>  ETRN commands
60375 <literal>*host_lookup_failed         </literal>  as it says
60376 <literal> ident_timeout              </literal>  timeout for ident connection
60377 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
60378 <literal> incoming_port              </literal>  incoming port on &lt;= lines
60379 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
60380 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
60381 <literal>*queue_run                  </literal>  start and end queue runs
60382 <literal> queue_time                 </literal>  time on queue for one recipient
60383 <literal> queue_time_overall         </literal>  time on queue for whole message
60384 <literal> pid                        </literal>  Exim process id
60385 <literal> received_recipients        </literal>  recipients on &lt;= lines
60386 <literal> received_sender            </literal>  sender on &lt;= lines
60387 <literal>*rejected_header            </literal>  header contents on reject log
60388 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
60389 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
60390 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
60391 <literal>*sender_verify_fail         </literal>  sender verification failures
60392 <literal>*size_reject                </literal>  rejection because too big
60393 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
60394 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
60395 <literal> smtp_connection            </literal>  SMTP connections
60396 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
60397 <literal> smtp_no_mail               </literal>  session with no MAIL commands
60398 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
60399 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
60400 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
60401 <literal> tls_certificate_verified   </literal>  certificate verification status
60402 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
60403 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
60404 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
60405 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
60406
60407 <literal> all                        </literal>  all of the above
60408 </literallayout>
60409 <para>
60410 More details on each of these items follows:
60411 </para>
60412 <itemizedlist>
60413 <listitem>
60414 <para>
60415 <indexterm role="concept">
60416 <primary><option>warn</option> ACL verb</primary>
60417 <secondary>log when skipping</secondary>
60418 </indexterm>
60419 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
60420 its conditions cannot be evaluated, a log line to this effect is written if
60421 this log selector is set.
60422 </para>
60423 </listitem>
60424 <listitem>
60425 <para>
60426 <indexterm role="concept">
60427 <primary>log</primary>
60428 <secondary>rewriting</secondary>
60429 </indexterm>
60430 <indexterm role="concept">
60431 <primary>rewriting</primary>
60432 <secondary>logging</secondary>
60433 </indexterm>
60434 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
60435 rewrites, but not to rewrites in filters run as an unprivileged user (because
60436 such users cannot access the log).
60437 </para>
60438 </listitem>
60439 <listitem>
60440 <para>
60441 <indexterm role="concept">
60442 <primary>log</primary>
60443 <secondary>full parentage</secondary>
60444 </indexterm>
60445 <option>all_parents</option>: Normally only the original and final addresses are logged on
60446 delivery lines; with this selector, intermediate parents are given in
60447 parentheses between them.
60448 </para>
60449 </listitem>
60450 <listitem>
60451 <para>
60452 <indexterm role="concept">
60453 <primary>log</primary>
60454 <secondary>Exim arguments</secondary>
60455 </indexterm>
60456 <indexterm role="concept">
60457 <primary>Exim arguments, logging</primary>
60458 </indexterm>
60459 <option>arguments</option>: This causes Exim to write the arguments with which it was called
60460 to the main log, preceded by the current working directory. This is a debugging
60461 feature, added to make it easier to find out how certain MUAs call
60462 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
60463 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
60464 that are empty or that contain white space are quoted. Non-printing characters
60465 are shown as escape sequences. This facility cannot log unrecognized arguments,
60466 because the arguments are checked before the configuration file is read. The
60467 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
60468 between the caller and Exim.
60469 </para>
60470 </listitem>
60471 <listitem>
60472 <para>
60473 <indexterm role="concept">
60474 <primary>log</primary>
60475 <secondary>connection rejections</secondary>
60476 </indexterm>
60477 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
60478 connection is rejected, for whatever reason.
60479 </para>
60480 </listitem>
60481 <listitem>
60482 <para>
60483 <indexterm role="concept">
60484 <primary>log</primary>
60485 <secondary>delayed delivery</secondary>
60486 </indexterm>
60487 <indexterm role="concept">
60488 <primary>delayed delivery, logging</primary>
60489 </indexterm>
60490 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
60491 started for an incoming message because the load is too high or too many
60492 messages were received on one connection. Logging does not occur if no delivery
60493 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
60494 </para>
60495 </listitem>
60496 <listitem>
60497 <para>
60498 <indexterm role="concept">
60499 <primary>log</primary>
60500 <secondary>delivery duration</secondary>
60501 </indexterm>
60502 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
60503 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
60504 </para>
60505 </listitem>
60506 <listitem>
60507 <para>
60508 <indexterm role="concept">
60509 <primary>log</primary>
60510 <secondary>message size on delivery</secondary>
60511 </indexterm>
60512 <indexterm role="concept">
60513 <primary>size</primary>
60514 <secondary>of message</secondary>
60515 </indexterm>
60516 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
60517 the <quote>=&gt;</quote> line, tagged with S=.
60518 </para>
60519 </listitem>
60520 <listitem>
60521 <para>
60522 <indexterm role="concept">
60523 <primary>log</primary>
60524 <secondary>dnslist defer</secondary>
60525 </indexterm>
60526 <indexterm role="concept">
60527 <primary>DNS list</primary>
60528 <secondary>logging defer</secondary>
60529 </indexterm>
60530 <indexterm role="concept">
60531 <primary>black list (DNS)</primary>
60532 </indexterm>
60533 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
60534 DNS black list suffers a temporary error.
60535 </para>
60536 </listitem>
60537 <listitem>
60538 <para>
60539 <indexterm role="concept">
60540 <primary>log</primary>
60541 <secondary>ETRN commands</secondary>
60542 </indexterm>
60543 <indexterm role="concept">
60544 <primary>ETRN</primary>
60545 <secondary>logging</secondary>
60546 </indexterm>
60547 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
60548 is run to determine whether or not it is actually accepted. An invalid ETRN
60549 command, or one received within a message transaction is not logged by this
60550 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
60551 </para>
60552 </listitem>
60553 <listitem>
60554 <para>
60555 <indexterm role="concept">
60556 <primary>log</primary>
60557 <secondary>host lookup failure</secondary>
60558 </indexterm>
60559 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
60560 any addresses, or when a lookup of an IP address fails to find a host name, a
60561 log line is written. This logging does not apply to direct DNS lookups when
60562 routing email addresses, but it does apply to <quote>byname</quote> lookups.
60563 </para>
60564 </listitem>
60565 <listitem>
60566 <para>
60567 <indexterm role="concept">
60568 <primary>log</primary>
60569 <secondary>ident timeout</secondary>
60570 </indexterm>
60571 <indexterm role="concept">
60572 <primary>RFC 1413</primary>
60573 <secondary>logging timeout</secondary>
60574 </indexterm>
60575 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
60576 client&#x2019;s ident port times out.
60577 </para>
60578 </listitem>
60579 <listitem>
60580 <para>
60581 <indexterm role="concept">
60582 <primary>log</primary>
60583 <secondary>incoming interface</secondary>
60584 </indexterm>
60585 <indexterm role="concept">
60586 <primary>interface</primary>
60587 <secondary>logging</secondary>
60588 </indexterm>
60589 <option>incoming_interface</option>: The interface on which a message was received is added
60590 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
60591 followed by a colon and the port number. The local interface and port are also
60592 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
60593 rejection lines.
60594 </para>
60595 </listitem>
60596 <listitem>
60597 <para>
60598 <indexterm role="concept">
60599 <primary>log</primary>
60600 <secondary>incoming remote port</secondary>
60601 </indexterm>
60602 <indexterm role="concept">
60603 <primary>port</primary>
60604 <secondary>logging remote</secondary>
60605 </indexterm>
60606 <indexterm role="concept">
60607 <primary>TCP/IP</primary>
60608 <secondary>logging incoming remote port</secondary>
60609 </indexterm>
60610 <indexterm role="variable">
60611 <primary><varname>$sender_fullhost</varname></primary>
60612 </indexterm>
60613 <indexterm role="variable">
60614 <primary><varname>$sender_rcvhost</varname></primary>
60615 </indexterm>
60616 <option>incoming_port</option>: The remote port number from which a message was received is
60617 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
60618 in square brackets, and separated from it by a colon. This is implemented by
60619 changing the value that is put in the <varname>$sender_fullhost</varname> and
60620 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
60621 important with the widening use of NAT (see RFC 2505).
60622 </para>
60623 </listitem>
60624 <listitem>
60625 <para>
60626 <indexterm role="concept">
60627 <primary>log</primary>
60628 <secondary>dropped connection</secondary>
60629 </indexterm>
60630 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
60631 connection is unexpectedly dropped.
60632 </para>
60633 </listitem>
60634 <listitem>
60635 <para>
60636 <indexterm role="concept">
60637 <primary>log</primary>
60638 <secondary>outgoing remote port</secondary>
60639 </indexterm>
60640 <indexterm role="concept">
60641 <primary>port</primary>
60642 <secondary>logging outgoint remote</secondary>
60643 </indexterm>
60644 <indexterm role="concept">
60645 <primary>TCP/IP</primary>
60646 <secondary>logging ougtoing remote port</secondary>
60647 </indexterm>
60648 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
60649 containing =&gt; tags) following the IP address. This option is not included in
60650 the default setting, because for most ordinary configurations, the remote port
60651 number is always 25 (the SMTP port).
60652 </para>
60653 </listitem>
60654 <listitem>
60655 <para>
60656 <indexterm role="concept">
60657 <primary>log</primary>
60658 <secondary>process ids in</secondary>
60659 </indexterm>
60660 <indexterm role="concept">
60661 <primary>pid (process id)</primary>
60662 <secondary>in log lines</secondary>
60663 </indexterm>
60664 <option>pid</option>: The current process id is added to every log line, in square brackets,
60665 immediately after the time and date.
60666 </para>
60667 </listitem>
60668 <listitem>
60669 <para>
60670 <indexterm role="concept">
60671 <primary>log</primary>
60672 <secondary>queue run</secondary>
60673 </indexterm>
60674 <indexterm role="concept">
60675 <primary>queue runner</primary>
60676 <secondary>logging</secondary>
60677 </indexterm>
60678 <option>queue_run</option>: The start and end of every queue run are logged.
60679 </para>
60680 </listitem>
60681 <listitem>
60682 <para>
60683 <indexterm role="concept">
60684 <primary>log</primary>
60685 <secondary>queue time</secondary>
60686 </indexterm>
60687 <option>queue_time</option>: The amount of time the message has been in the queue on the
60688 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
60689 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
60690 includes reception time as well as the delivery time for the current address.
60691 This means that it may be longer than the difference between the arrival and
60692 delivery log line times, because the arrival log line is not written until the
60693 message has been successfully received.
60694 </para>
60695 </listitem>
60696 <listitem>
60697 <para>
60698 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
60699 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
60700 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
60701 message, so it includes reception time as well as the total delivery time.
60702 </para>
60703 </listitem>
60704 <listitem>
60705 <para>
60706 <indexterm role="concept">
60707 <primary>log</primary>
60708 <secondary>recipients</secondary>
60709 </indexterm>
60710 <option>received_recipients</option>: The recipients of a message are listed in the main log
60711 as soon as the message is received. The list appears at the end of the log line
60712 that is written when a message is received, preceded by the word <quote>for</quote>. The
60713 addresses are listed after they have been qualified, but before any rewriting
60714 has taken place.
60715 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
60716 in the list.
60717 </para>
60718 </listitem>
60719 <listitem>
60720 <para>
60721 <indexterm role="concept">
60722 <primary>log</primary>
60723 <secondary>sender reception</secondary>
60724 </indexterm>
60725 <option>received_sender</option>: The unrewritten original sender of a message is added to
60726 the end of the log line that records the message&#x2019;s arrival, after the word
60727 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
60728 </para>
60729 </listitem>
60730 <listitem>
60731 <para>
60732 <indexterm role="concept">
60733 <primary>log</primary>
60734 <secondary>header lines for rejection</secondary>
60735 </indexterm>
60736 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
60737 rejection is written to the reject log, the complete header is added to the
60738 log. Header logging can be turned off individually for messages that are
60739 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
60740 </para>
60741 </listitem>
60742 <listitem>
60743 <para>
60744 <indexterm role="concept">
60745 <primary>log</primary>
60746 <secondary>retry defer</secondary>
60747 </indexterm>
60748 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
60749 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
60750 message is always omitted from individual message logs after the first delivery
60751 attempt.
60752 </para>
60753 </listitem>
60754 <listitem>
60755 <para>
60756 <indexterm role="concept">
60757 <primary>log</primary>
60758 <secondary>return path</secondary>
60759 </indexterm>
60760 <option>return_path_on_delivery</option>: The return path that is being transmitted with
60761 the message is included in delivery and bounce lines, using the tag P=.
60762 This is omitted if no delivery actually happens, for example, if routing fails,
60763 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
60764 </para>
60765 </listitem>
60766 <listitem>
60767 <para>
60768 <indexterm role="concept">
60769 <primary>log</primary>
60770 <secondary>sender on delivery</secondary>
60771 </indexterm>
60772 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
60773 and bounce line, tagged by F= (for <quote>from</quote>).
60774 This is the original sender that was received with the message; it is not
60775 necessarily the same as the outgoing return path.
60776 </para>
60777 </listitem>
60778 <listitem>
60779 <para>
60780 <indexterm role="concept">
60781 <primary>log</primary>
60782 <secondary>sender verify failure</secondary>
60783 </indexterm>
60784 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
60785 gives details of a sender verification failure is not written. Log lines for
60786 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
60787 detail is lost.
60788 </para>
60789 </listitem>
60790 <listitem>
60791 <para>
60792 <indexterm role="concept">
60793 <primary>log</primary>
60794 <secondary>size rejection</secondary>
60795 </indexterm>
60796 <option>size_reject</option>: A log line is written whenever a message is rejected because
60797 it is too big.
60798 </para>
60799 </listitem>
60800 <listitem>
60801 <para>
60802 <indexterm role="concept">
60803 <primary>log</primary>
60804 <secondary>frozen messages; skipped</secondary>
60805 </indexterm>
60806 <indexterm role="concept">
60807 <primary>frozen messages</primary>
60808 <secondary>logging skipping</secondary>
60809 </indexterm>
60810 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
60811 queue run because it is frozen or because another process is already delivering
60812 it.
60813 <indexterm role="concept">
60814 <primary><quote>spool file is locked</quote></primary>
60815 </indexterm>
60816 The message that is written is <quote>spool file is locked</quote>.
60817 </para>
60818 </listitem>
60819 <listitem>
60820 <para>
60821 <indexterm role="concept">
60822 <primary>log</primary>
60823 <secondary>smtp confirmation</secondary>
60824 </indexterm>
60825 <indexterm role="concept">
60826 <primary>SMTP</primary>
60827 <secondary>logging confirmation</secondary>
60828 </indexterm>
60829 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
60830 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
60831 A number of MTAs (including Exim) return an identifying string in this
60832 response.
60833 </para>
60834 </listitem>
60835 <listitem>
60836 <para>
60837 <indexterm role="concept">
60838 <primary>log</primary>
60839 <secondary>SMTP connections</secondary>
60840 </indexterm>
60841 <indexterm role="concept">
60842 <primary>SMTP</primary>
60843 <secondary>logging connections</secondary>
60844 </indexterm>
60845 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
60846 established or closed, unless the connection is from a host that matches
60847 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
60848 only when the closure is unexpected.) This applies to connections from local
60849 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
60850 dropped in the middle of a message, a log line is always written, whether or
60851 not this selector is set, but otherwise nothing is written at the start and end
60852 of connections unless this selector is enabled.
60853 </para>
60854 <para>
60855 For TCP/IP connections to an Exim daemon, the current number of connections is
60856 included in the log message for each new connection, but note that the count is
60857 reset if the daemon is restarted.
60858 Also, because connections are closed (and the closure is logged) in
60859 subprocesses, the count may not include connections that have been closed but
60860 whose termination the daemon has not yet noticed. Thus, while it is possible to
60861 match up the opening and closing of connections in the log, the value of the
60862 logged counts may not be entirely accurate.
60863 </para>
60864 </listitem>
60865 <listitem>
60866 <para>
60867 <indexterm role="concept">
60868 <primary>log</primary>
60869 <secondary>SMTP transaction; incomplete</secondary>
60870 </indexterm>
60871 <indexterm role="concept">
60872 <primary>SMTP</primary>
60873 <secondary>logging incomplete transactions</secondary>
60874 </indexterm>
60875 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
60876 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
60877 and the message sender plus any accepted recipients are included in the log
60878 line. This can provide evidence of dictionary attacks.
60879 </para>
60880 </listitem>
60881 <listitem>
60882 <para>
60883 <indexterm role="concept">
60884 <primary>log</primary>
60885 <secondary>non-MAIL SMTP sessions</secondary>
60886 </indexterm>
60887 <indexterm role="concept">
60888 <primary>MAIL</primary>
60889 <secondary>logging session without</secondary>
60890 </indexterm>
60891 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
60892 connection terminates without having issued a MAIL command. This includes both
60893 the case when the connection is dropped, and the case when QUIT is used. It
60894 does not include cases where the connection is rejected right at the start (by
60895 an ACL, or because there are too many connections, or whatever). These cases
60896 already have their own log lines.
60897 </para>
60898 <para>
60899 The log line that is written contains the identity of the client in the usual
60900 way, followed by D= and a time, which records the duration of the connection.
60901 If the connection was authenticated, this fact is logged exactly as it is for
60902 an incoming message, with an A= item. If the connection was encrypted, CV=,
60903 DN=, and X= items may appear as they do for an incoming message, controlled by
60904 the same logging options.
60905 </para>
60906 <para>
60907 Finally, if any SMTP commands were issued during the connection, a C= item
60908 is added to the line, listing the commands that were used. For example,
60909 </para>
60910 <literallayout class="monospaced">
60911 C=EHLO,QUIT
60912 </literallayout>
60913 <para>
60914 shows that the client issued QUIT straight after EHLO. If there were fewer
60915 than 20 commands, they are all listed. If there were more than 20 commands,
60916 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
60917 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
60918 have been aborted before 20 non-mail commands are processed.
60919 </para>
60920 </listitem>
60921 <listitem>
60922 <para>
60923 <indexterm role="concept">
60924 <primary>log</primary>
60925 <secondary>SMTP protocol error</secondary>
60926 </indexterm>
60927 <indexterm role="concept">
60928 <primary>SMTP</primary>
60929 <secondary>logging protocol error</secondary>
60930 </indexterm>
60931 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
60932 encountered. Exim does not have perfect detection of all protocol errors
60933 because of transmission delays and the use of pipelining. If PIPELINING has
60934 been advertised to a client, an Exim server assumes that the client will use
60935 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
60936 received after rejecting MAIL) as protocol errors.
60937 </para>
60938 </listitem>
60939 <listitem>
60940 <para>
60941 <indexterm role="concept">
60942 <primary>SMTP</primary>
60943 <secondary>logging syntax errors</secondary>
60944 </indexterm>
60945 <indexterm role="concept">
60946 <primary>SMTP</primary>
60947 <secondary>syntax errors; logging</secondary>
60948 </indexterm>
60949 <indexterm role="concept">
60950 <primary>SMTP</primary>
60951 <secondary>unknown command; logging</secondary>
60952 </indexterm>
60953 <indexterm role="concept">
60954 <primary>log</primary>
60955 <secondary>unknown SMTP command</secondary>
60956 </indexterm>
60957 <indexterm role="concept">
60958 <primary>log</primary>
60959 <secondary>SMTP syntax error</secondary>
60960 </indexterm>
60961 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
60962 encountered. An unrecognized command is treated as a syntax error. For an
60963 external connection, the host identity is given; for an internal connection
60964 using <option>-bs</option> the sender identification (normally the calling user) is given.
60965 </para>
60966 </listitem>
60967 <listitem>
60968 <para>
60969 <indexterm role="concept">
60970 <primary>log</primary>
60971 <secondary>subject</secondary>
60972 </indexterm>
60973 <indexterm role="concept">
60974 <primary>subject, logging</primary>
60975 </indexterm>
60976 <option>subject</option>: The subject of the message is added to the arrival log line,
60977 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
60978 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
60979 specifies whether characters with values greater than 127 should be logged
60980 unchanged, or whether they should be rendered as escape sequences.
60981 </para>
60982 </listitem>
60983 <listitem>
60984 <para>
60985 <indexterm role="concept">
60986 <primary>log</primary>
60987 <secondary>certificate verification</secondary>
60988 </indexterm>
60989 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
60990 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
60991 verified, and <literal>CV=no</literal> if not.
60992 </para>
60993 </listitem>
60994 <listitem>
60995 <para>
60996 <indexterm role="concept">
60997 <primary>log</primary>
60998 <secondary>TLS cipher</secondary>
60999 </indexterm>
61000 <indexterm role="concept">
61001 <primary>TLS</primary>
61002 <secondary>logging cipher</secondary>
61003 </indexterm>
61004 <option>tls_cipher</option>: When a message is sent or received over an encrypted
61005 connection, the cipher suite used is added to the log line, preceded by X=.
61006 </para>
61007 </listitem>
61008 <listitem>
61009 <para>
61010 <indexterm role="concept">
61011 <primary>log</primary>
61012 <secondary>TLS peer DN</secondary>
61013 </indexterm>
61014 <indexterm role="concept">
61015 <primary>TLS</primary>
61016 <secondary>logging peer DN</secondary>
61017 </indexterm>
61018 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
61019 connection, and a certificate is supplied by the remote host, the peer DN is
61020 added to the log line, preceded by DN=.
61021 </para>
61022 </listitem>
61023 <listitem>
61024 <para>
61025 <indexterm role="concept">
61026 <primary>log</primary>
61027 <secondary>TLS SNI</secondary>
61028 </indexterm>
61029 <indexterm role="concept">
61030 <primary>TLS</primary>
61031 <secondary>logging SNI</secondary>
61032 </indexterm>
61033 <option>tls_sni</option>: When a message is received over an encrypted connection, and
61034 the remote host provided the Server Name Indication extension, the SNI is
61035 added to the log line, preceded by SNI=.
61036 </para>
61037 </listitem>
61038 <listitem>
61039 <para>
61040 <indexterm role="concept">
61041 <primary>log</primary>
61042 <secondary>DNS failure in list</secondary>
61043 </indexterm>
61044 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
61045 result of a list match is failure because a DNS lookup failed.
61046 </para>
61047 </listitem>
61048 </itemizedlist>
61049 </section>
61050 <section id="SECID260">
61051 <title>Message log</title>
61052 <para>
61053 <indexterm role="concept">
61054 <primary>message</primary>
61055 <secondary>log file for</secondary>
61056 </indexterm>
61057 <indexterm role="concept">
61058 <primary>log</primary>
61059 <secondary>message log; description of</secondary>
61060 </indexterm>
61061 <indexterm role="concept">
61062 <primary><filename>msglog</filename> directory</primary>
61063 </indexterm>
61064 <indexterm role="option">
61065 <primary><option>preserve_message_logs</option></primary>
61066 </indexterm>
61067 In addition to the general log files, Exim writes a log file for each message
61068 that it handles. The names of these per-message logs are the message ids, and
61069 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
61070 message log contains copies of the log lines that apply to the message. This
61071 makes it easier to inspect the status of an individual message without having
61072 to search the main log. A message log is deleted when processing of the message
61073 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
61074 only with great care because they can fill up your disk very quickly.
61075 </para>
61076 <para>
61077 On a heavily loaded system, it may be desirable to disable the use of
61078 per-message logs, in order to reduce disk I/O. This can be done by setting the
61079 <option>message_logs</option> option false.
61080 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
61081 </para>
61082 </section>
61083 </chapter>
61084
61085 <chapter id="CHAPutils">
61086 <title>Exim utilities</title>
61087 <para>
61088 <indexterm role="concept" id="IIDutils" class="startofrange">
61089 <primary>utilities</primary>
61090 </indexterm>
61091 A number of utility scripts and programs are supplied with Exim and are
61092 described in this chapter. There is also the Exim Monitor, which is covered in
61093 the next chapter. The utilities described here are:
61094 </para>
61095 <informaltable frame="none">
61096 <tgroup cols="3" colsep="0" rowsep="0">
61097 <colspec colwidth="7*" align="left"/>
61098 <colspec colwidth="15*" align="left"/>
61099 <colspec colwidth="40*" align="left"/>
61100 <tbody>
61101 <row>
61102 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
61103 <entry><emphasis>exiwhat</emphasis></entry>
61104 <entry>list what Exim processes are doing</entry>
61105 </row>
61106 <row>
61107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
61108 <entry><emphasis>exiqgrep</emphasis></entry>
61109 <entry>grep the queue</entry>
61110 </row>
61111 <row>
61112 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
61113 <entry><emphasis>exiqsumm</emphasis></entry>
61114 <entry>summarize the queue</entry>
61115 </row>
61116 <row>
61117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
61118 <entry><emphasis>exigrep</emphasis></entry>
61119 <entry>search the main log</entry>
61120 </row>
61121 <row>
61122 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
61123 <entry><emphasis>exipick</emphasis></entry>
61124 <entry>select messages on various criteria</entry>
61125 </row>
61126 <row>
61127 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
61128 <entry><emphasis>exicyclog</emphasis></entry>
61129 <entry>cycle (rotate) log files</entry>
61130 </row>
61131 <row>
61132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
61133 <entry><emphasis>eximstats</emphasis></entry>
61134 <entry>extract statistics from the log</entry>
61135 </row>
61136 <row>
61137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
61138 <entry><emphasis>exim_checkaccess</emphasis></entry>
61139 <entry>check address acceptance from given IP</entry>
61140 </row>
61141 <row>
61142 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
61143 <entry><emphasis>exim_dbmbuild</emphasis></entry>
61144 <entry>build a DBM file</entry>
61145 </row>
61146 <row>
61147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
61148 <entry><emphasis>exinext</emphasis></entry>
61149 <entry>extract retry information</entry>
61150 </row>
61151 <row>
61152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
61153 <entry><emphasis>exim_dumpdb</emphasis></entry>
61154 <entry>dump a hints database</entry>
61155 </row>
61156 <row>
61157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
61158 <entry><emphasis>exim_tidydb</emphasis></entry>
61159 <entry>clean up a hints database</entry>
61160 </row>
61161 <row>
61162 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
61163 <entry><emphasis>exim_fixdb</emphasis></entry>
61164 <entry>patch a hints database</entry>
61165 </row>
61166 <row>
61167 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
61168 <entry><emphasis>exim_lock</emphasis></entry>
61169 <entry>lock a mailbox file</entry>
61170 </row>
61171 </tbody>
61172 </tgroup>
61173 </informaltable>
61174 <para>
61175 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
61176 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
61177 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
61178 </para>
61179 <section id="SECTfinoutwha">
61180 <title>Finding out what Exim processes are doing (exiwhat)</title>
61181 <para>
61182 <indexterm role="concept">
61183 <primary><emphasis>exiwhat</emphasis></primary>
61184 </indexterm>
61185 <indexterm role="concept">
61186 <primary>process, querying</primary>
61187 </indexterm>
61188 <indexterm role="concept">
61189 <primary>SIGUSR1</primary>
61190 </indexterm>
61191 On operating systems that can restart a system call after receiving a signal
61192 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
61193 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
61194 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
61195 processes it can find, having first emptied the file. It then waits for one
61196 second to allow the Exim processes to react before displaying the results. In
61197 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
61198 send the signal to the Exim processes, so it is normally run as root.
61199 </para>
61200 <para>
61201 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
61202 use by system administrators. It is not sensible, for example, to set up a
61203 script that sends SIGUSR1 signals to Exim processes at short intervals.
61204 </para>
61205 <para>
61206 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
61207 varies in different operating systems. Not only are different options used,
61208 but the format of the output is different. For this reason, there are some
61209 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
61210 it doesn&#x2019;t seem to be working for you, check the following compile-time
61211 options:
61212 </para>
61213 <literallayout>
61214 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
61215 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
61216 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
61217 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
61218 </literallayout>
61219 <para>
61220 An example of typical output from <emphasis>exiwhat</emphasis> is
61221 </para>
61222 <literallayout class="monospaced">
61223 164 daemon: -q1h, listening on port 25
61224 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
61225 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
61226   [10.19.42.42] (editor@ref.example)
61227 10592 handling incoming call from [192.168.243.242]
61228 10628 accepting a local non-SMTP message
61229 </literallayout>
61230 <para>
61231 The first number in the output line is the process number. The third line has
61232 been split here, in order to fit it on the page.
61233 </para>
61234 </section>
61235 <section id="SECTgreptheque">
61236 <title>Selective queue listing (exiqgrep)</title>
61237 <para>
61238 <indexterm role="concept">
61239 <primary><emphasis>exiqgrep</emphasis></primary>
61240 </indexterm>
61241 <indexterm role="concept">
61242 <primary>queue</primary>
61243 <secondary>grepping</secondary>
61244 </indexterm>
61245 This utility is a Perl script contributed by Matt Hubbard. It runs
61246 </para>
61247 <literallayout class="monospaced">
61248 exim -bpu
61249 </literallayout>
61250 <para>
61251 to obtain a queue listing with undelivered recipients only, and then greps the
61252 output to select messages that match given criteria. The following selection
61253 options are available:
61254 </para>
61255 <variablelist>
61256 <varlistentry>
61257 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
61258 <listitem>
61259 <para>
61260 Match the sender address. The field that is tested is enclosed in angle
61261 brackets, so you can test for bounce messages with
61262 </para>
61263 <literallayout class="monospaced">
61264 exiqgrep -f '^&lt;&gt;$'
61265 </literallayout>
61266 </listitem></varlistentry>
61267 <varlistentry>
61268 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
61269 <listitem>
61270 <para>
61271 Match a recipient address. The field that is tested is not enclosed in angle
61272 brackets.
61273 </para>
61274 </listitem></varlistentry>
61275 <varlistentry>
61276 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
61277 <listitem>
61278 <para>
61279 Match against the size field.
61280 </para>
61281 </listitem></varlistentry>
61282 <varlistentry>
61283 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
61284 <listitem>
61285 <para>
61286 Match messages that are younger than the given time.
61287 </para>
61288 </listitem></varlistentry>
61289 <varlistentry>
61290 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
61291 <listitem>
61292 <para>
61293 Match messages that are older than the given time.
61294 </para>
61295 </listitem></varlistentry>
61296 <varlistentry>
61297 <term><emphasis role="bold">-z</emphasis></term>
61298 <listitem>
61299 <para>
61300 Match only frozen messages.
61301 </para>
61302 </listitem></varlistentry>
61303 <varlistentry>
61304 <term><emphasis role="bold">-x</emphasis></term>
61305 <listitem>
61306 <para>
61307 Match only non-frozen messages.
61308 </para>
61309 </listitem></varlistentry>
61310 </variablelist>
61311 <para>
61312 The following options control the format of the output:
61313 </para>
61314 <variablelist>
61315 <varlistentry>
61316 <term><emphasis role="bold">-c</emphasis></term>
61317 <listitem>
61318 <para>
61319 Display only the count of matching messages.
61320 </para>
61321 </listitem></varlistentry>
61322 <varlistentry>
61323 <term><emphasis role="bold">-l</emphasis></term>
61324 <listitem>
61325 <para>
61326 Long format &ndash; display the full message information as output by Exim. This is
61327 the default.
61328 </para>
61329 </listitem></varlistentry>
61330 <varlistentry>
61331 <term><emphasis role="bold">-i</emphasis></term>
61332 <listitem>
61333 <para>
61334 Display message ids only.
61335 </para>
61336 </listitem></varlistentry>
61337 <varlistentry>
61338 <term><emphasis role="bold">-b</emphasis></term>
61339 <listitem>
61340 <para>
61341 Brief format &ndash; one line per message.
61342 </para>
61343 </listitem></varlistentry>
61344 <varlistentry>
61345 <term><emphasis role="bold">-R</emphasis></term>
61346 <listitem>
61347 <para>
61348 Display messages in reverse order.
61349 </para>
61350 </listitem></varlistentry>
61351 </variablelist>
61352 <para>
61353 There is one more option, <option>-h</option>, which outputs a list of options.
61354 </para>
61355 </section>
61356 <section id="SECTsumtheque">
61357 <title>Summarizing the queue (exiqsumm)</title>
61358 <para>
61359 <indexterm role="concept">
61360 <primary><emphasis>exiqsumm</emphasis></primary>
61361 </indexterm>
61362 <indexterm role="concept">
61363 <primary>queue</primary>
61364 <secondary>summary</secondary>
61365 </indexterm>
61366 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
61367 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
61368 running a command such as
61369 </para>
61370 <literallayout class="monospaced">
61371 exim -bp | exiqsumm
61372 </literallayout>
61373 <para>
61374 The output consists of one line for each domain that has messages waiting for
61375 it, as in the following example:
61376 </para>
61377 <literallayout class="monospaced">
61378 3   2322   74m   66m  msn.com.example
61379 </literallayout>
61380 <para>
61381 Each line lists the number of pending deliveries for a domain, their total
61382 volume, and the length of time that the oldest and the newest messages have
61383 been waiting. Note that the number of pending deliveries is greater than the
61384 number of messages when messages have more than one recipient.
61385 </para>
61386 <para>
61387 A summary line is output at the end. By default the output is sorted on the
61388 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
61389 the output to be sorted by oldest message and by count of messages,
61390 respectively. There are also three options that split the messages for each
61391 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
61392 separates frozen messages, and <option>-s</option> separates messages according to their
61393 sender.
61394 </para>
61395 <para>
61396 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
61397 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
61398 generated by aliasing or forwarding are included (unless the <option>one_time</option>
61399 option of the <command>redirect</command> router has been used to convert them into <quote>top
61400 level</quote> addresses).
61401 </para>
61402 </section>
61403 <section id="SECTextspeinf">
61404 <title>Extracting specific information from the log (exigrep)</title>
61405 <para>
61406 <indexterm role="concept">
61407 <primary><emphasis>exigrep</emphasis></primary>
61408 </indexterm>
61409 <indexterm role="concept">
61410 <primary>log</primary>
61411 <secondary>extracts; grepping for</secondary>
61412 </indexterm>
61413 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
61414 files for entries that match a given pattern. When it finds a match, it
61415 extracts all the log entries for the relevant message, not just those that
61416 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
61417 given message, or all mail for a given user, or for a given host, for example.
61418 The input files can be in Exim log format or syslog format.
61419 If a matching log line is not associated with a specific message, it is
61420 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
61421 </para>
61422 <literallayout>
61423 <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>
61424 </literallayout>
61425 <para>
61426 If no log file names are given on the command line, the standard input is read.
61427 </para>
61428 <para>
61429 The <option>-t</option> argument specifies a number of seconds. It adds an additional
61430 condition for message selection. Messages that are complete are shown only if
61431 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
61432 </para>
61433 <para>
61434 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
61435 makes it case-sensitive. This may give a performance improvement when searching
61436 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
61437 option; with <option>-I</option> they do not. In both cases it is possible to change the
61438 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
61439 </para>
61440 <para>
61441 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
61442 pattern as standing for themselves. Otherwise the pattern must be a Perl
61443 regular expression.
61444 </para>
61445 <para>
61446 The <option>-v</option> option inverts the matching condition. That is, a line is selected
61447 if it does <emphasis>not</emphasis> match the pattern.
61448 </para>
61449 <para>
61450 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
61451 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
61452 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
61453 </para>
61454 </section>
61455 <section id="SECTexipick">
61456 <title>Selecting messages by various criteria (exipick)</title>
61457 <para>
61458 <indexterm role="concept">
61459 <primary><emphasis>exipick</emphasis></primary>
61460 </indexterm>
61461 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
61462 lists messages from the queue according to a variety of criteria. For details
61463 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
61464 <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
61465 the <option>--help</option> option.
61466 </para>
61467 </section>
61468 <section id="SECTcyclogfil">
61469 <title>Cycling log files (exicyclog)</title>
61470 <para>
61471 <indexterm role="concept">
61472 <primary>log</primary>
61473 <secondary>cycling local files</secondary>
61474 </indexterm>
61475 <indexterm role="concept">
61476 <primary>cycling logs</primary>
61477 </indexterm>
61478 <indexterm role="concept">
61479 <primary><emphasis>exicyclog</emphasis></primary>
61480 </indexterm>
61481 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
61482 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
61483 you are using log files with datestamps in their names (see section
61484 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
61485 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
61486 There are two command line options for <emphasis>exicyclog</emphasis>:
61487 </para>
61488 <itemizedlist>
61489 <listitem>
61490 <para>
61491 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
61492 default that is set when Exim is built. The default default is 10.
61493 </para>
61494 </listitem>
61495 <listitem>
61496 <para>
61497 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
61498 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
61499 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
61500 configuration.
61501 </para>
61502 </listitem>
61503 </itemizedlist>
61504 <para>
61505 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
61506 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
61507 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
61508 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
61509 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
61510 logs are handled similarly.
61511 </para>
61512 <para>
61513 If the limit is greater than 99, the script uses 3-digit numbers such as
61514 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
61515 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
61516 any existing log files.
61517 </para>
61518 <para>
61519 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
61520 the end are deleted. All files with numbers greater than 01 are compressed,
61521 using a compression command which is configured by the COMPRESS_COMMAND
61522 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
61523 root <option>crontab</option> entry of the form
61524 </para>
61525 <literallayout class="monospaced">
61526 1 0 * * * su exim -c /usr/exim/bin/exicyclog
61527 </literallayout>
61528 <para>
61529 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
61530 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
61531 </para>
61532 </section>
61533 <section id="SECTmailstat">
61534 <title>Mail statistics (eximstats)</title>
61535 <para>
61536 <indexterm role="concept">
61537 <primary>statistics</primary>
61538 </indexterm>
61539 <indexterm role="concept">
61540 <primary><emphasis>eximstats</emphasis></primary>
61541 </indexterm>
61542 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
61543 information from log files. The output is either plain text, or HTML.
61544 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
61545 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
61546 </para>
61547 <para>
61548 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
61549 latest version is the result of some extensive revision by Steve Campbell. A
61550 lot of information is given by default, but there are options for suppressing
61551 various parts of it. Following any options, the arguments to the script are a
61552 list of files, which should be main log files. For example:
61553 </para>
61554 <literallayout class="monospaced">
61555 eximstats -nr /var/spool/exim/log/mainlog.01
61556 </literallayout>
61557 <para>
61558 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
61559 messages received from or delivered to various hosts. The information is sorted
61560 both by message count and by volume, and the top fifty hosts in each category
61561 are listed on the standard output. Similar information, based on email
61562 addresses or domains instead of hosts can be requested by means of various
61563 options. For messages delivered and received locally, similar statistics are
61564 also produced per user.
61565 </para>
61566 <para>
61567 The output also includes total counts and statistics about delivery errors, and
61568 histograms showing the number of messages received and deliveries made in each
61569 hour of the day. A delivery with more than one address in its envelope (for
61570 example, an SMTP transaction with more than one RCPT command) is counted
61571 as a single delivery by <emphasis>eximstats</emphasis>.
61572 </para>
61573 <para>
61574 Though normally more deliveries than receipts are reported (as messages may
61575 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
61576 messages received than delivered, even though the queue is empty at the start
61577 and end of the period in question. If an incoming message contains no valid
61578 recipients, no deliveries are recorded for it. A bounce message is handled as
61579 an entirely separate message.
61580 </para>
61581 <para>
61582 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
61583 of messages received and deliveries made, and the number of hosts involved in
61584 each case. It also outputs the number of messages that were delayed (that is,
61585 not completely delivered at the first attempt), and the number that had at
61586 least one address that failed.
61587 </para>
61588 <para>
61589 The remainder of the output is in sections that can be independently disabled
61590 or modified by various options. It consists of a summary of deliveries by
61591 transport, histograms of messages received and delivered per time interval
61592 (default per hour), information about the time messages spent on the queue,
61593 a list of relayed messages, lists of the top fifty sending hosts, local
61594 senders, destination hosts, and destination local users by count and by volume,
61595 and a list of delivery errors that occurred.
61596 </para>
61597 <para>
61598 The relay information lists messages that were actually relayed, that is, they
61599 came from a remote host and were directly delivered to some other remote host,
61600 without being processed (for example, for aliasing or forwarding) locally.
61601 </para>
61602 <para>
61603 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
61604 outputs. These are documented in the Perl script itself, and can be extracted
61605 by running the command <command>perldoc</command> on the script. For example:
61606 </para>
61607 <literallayout class="monospaced">
61608 perldoc /usr/exim/bin/eximstats
61609 </literallayout>
61610 </section>
61611 <section id="SECTcheckaccess">
61612 <title>Checking access policy (exim_checkaccess)</title>
61613 <para>
61614 <indexterm role="concept">
61615 <primary><emphasis>exim_checkaccess</emphasis></primary>
61616 </indexterm>
61617 <indexterm role="concept">
61618 <primary>policy control</primary>
61619 <secondary>checking access</secondary>
61620 </indexterm>
61621 <indexterm role="concept">
61622 <primary>checking access</primary>
61623 </indexterm>
61624 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
61625 debugging output, in order to check what Exim is doing when it is applying
61626 policy controls to incoming SMTP mail. However, not everybody is sufficiently
61627 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
61628 sometimes you just want to answer the question <quote>Does this address have
61629 access?</quote> without bothering with any further details.
61630 </para>
61631 <para>
61632 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
61633 two arguments, an IP address and an email address:
61634 </para>
61635 <literallayout class="monospaced">
61636 exim_checkaccess 10.9.8.7 A.User@a.domain.example
61637 </literallayout>
61638 <para>
61639 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
61640 given email address would be accepted in a RCPT command in a TCP/IP
61641 connection from the host with the given IP address. The output of the utility
61642 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
61643 </para>
61644 <literallayout class="monospaced">
61645 Rejected:
61646 550 Relay not permitted
61647 </literallayout>
61648 <para>
61649 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
61650 for the MAIL command, but you can change this by providing additional
61651 options. These are passed directly to the Exim command. For example, to specify
61652 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
61653 you can use:
61654 </para>
61655 <literallayout class="monospaced">
61656 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
61657                  -f himself@there.example
61658 </literallayout>
61659 <para>
61660 Note that these additional Exim command line items must be given after the two
61661 mandatory arguments.
61662 </para>
61663 <para>
61664 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
61665 while running its checks. You can run checks that include callouts by using
61666 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
61667 </para>
61668 </section>
61669 <section id="SECTdbmbuild">
61670 <title>Making DBM files (exim_dbmbuild)</title>
61671 <para>
61672 <indexterm role="concept">
61673 <primary>DBM</primary>
61674 <secondary>building dbm files</secondary>
61675 </indexterm>
61676 <indexterm role="concept">
61677 <primary>building DBM files</primary>
61678 </indexterm>
61679 <indexterm role="concept">
61680 <primary><emphasis>exim_dbmbuild</emphasis></primary>
61681 </indexterm>
61682 <indexterm role="concept">
61683 <primary>lower casing</primary>
61684 </indexterm>
61685 <indexterm role="concept">
61686 <primary>binary zero</primary>
61687 <secondary>in lookup key</secondary>
61688 </indexterm>
61689 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
61690 the format used by the <command>lsearch</command> lookup (see section
61691 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
61692 names as keys and the remainder of the information as data. The lower-casing
61693 can be prevented by calling the program with the <option>-nolc</option> option.
61694 </para>
61695 <para>
61696 A terminating zero is included as part of the key string. This is expected by
61697 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
61698 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
61699 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
61700 files.
61701 </para>
61702 <para>
61703 The program requires two arguments: the name of the input file (which can be a
61704 single hyphen to indicate the standard input), and the name of the output file.
61705 It creates the output under a temporary name, and then renames it if all went
61706 well.
61707 </para>
61708 <para>
61709 <indexterm role="concept">
61710 <primary>USE_DB</primary>
61711 </indexterm>
61712 If the native DB interface is in use (USE_DB is set in a compile-time
61713 configuration file &ndash; this is common in free versions of Unix) the two file
61714 names must be different, because in this mode the Berkeley DB functions create
61715 a single output file using exactly the name given. For example,
61716 </para>
61717 <literallayout class="monospaced">
61718 exim_dbmbuild /etc/aliases /etc/aliases.db
61719 </literallayout>
61720 <para>
61721 reads the system alias file and creates a DBM version of it in
61722 <filename>/etc/aliases.db</filename>.
61723 </para>
61724 <para>
61725 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
61726 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
61727 environment, the suffixes are added to the second argument of
61728 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
61729 when the Berkeley functions are used in compatibility mode (though this is not
61730 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
61731 </para>
61732 <para>
61733 If a duplicate key is encountered, the program outputs a warning, and when it
61734 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
61735 option is used. By default, only the first of a set of duplicates is used &ndash;
61736 this makes it compatible with <command>lsearch</command> lookups. There is an option
61737 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
61738 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
61739 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
61740 return code is 2.
61741 </para>
61742 </section>
61743 <section id="SECTfinindret">
61744 <title>Finding individual retry times (exinext)</title>
61745 <para>
61746 <indexterm role="concept">
61747 <primary>retry</primary>
61748 <secondary>times</secondary>
61749 </indexterm>
61750 <indexterm role="concept">
61751 <primary><emphasis>exinext</emphasis></primary>
61752 </indexterm>
61753 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
61754 fish specific information out of the retry database. Given a mail domain (or a
61755 complete address), it looks up the hosts for that domain, and outputs any retry
61756 information for the hosts or for the domain. At present, the retry information
61757 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
61758 output. For example:
61759 </para>
61760 <literallayout class="monospaced">
61761 $ exinext piglet@milne.fict.example
61762 kanga.milne.example:192.168.8.1 error 146: Connection refused
61763   first failed: 21-Feb-1996 14:57:34
61764   last tried:   21-Feb-1996 14:57:34
61765   next try at:  21-Feb-1996 15:02:34
61766 roo.milne.example:192.168.8.3 error 146: Connection refused
61767   first failed: 20-Jan-1996 13:12:08
61768   last tried:   21-Feb-1996 11:42:03
61769   next try at:  21-Feb-1996 19:42:03
61770   past final cutoff time
61771 </literallayout>
61772 <para>
61773 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
61774 will give any retry information for that local part in your default domain.
61775 A message id can be used to obtain retry information pertaining to a specific
61776 message. This exists only when an attempt to deliver a message to a remote host
61777 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
61778 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
61779 run very often.
61780 </para>
61781 <para>
61782 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
61783 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
61784 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
61785 configuration file, and the second sets macros for use within the configuration
61786 file. These features are mainly to help in testing, but might also be useful in
61787 environments where more than one configuration file is in use.
61788 </para>
61789 </section>
61790 <section id="SECThindatmai">
61791 <title>Hints database maintenance</title>
61792 <para>
61793 <indexterm role="concept">
61794 <primary>hints database</primary>
61795 <secondary>maintenance</secondary>
61796 </indexterm>
61797 <indexterm role="concept">
61798 <primary>maintaining Exim&#x2019;s hints database</primary>
61799 </indexterm>
61800 Three utility programs are provided for maintaining the DBM files that Exim
61801 uses to contain its delivery hint information. Each program requires two
61802 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
61803 second is the name of the database it is to operate on. These are as follows:
61804 </para>
61805 <itemizedlist>
61806 <listitem>
61807 <para>
61808 <emphasis>retry</emphasis>: the database of retry information
61809 </para>
61810 </listitem>
61811 <listitem>
61812 <para>
61813 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
61814 for remote hosts
61815 </para>
61816 </listitem>
61817 <listitem>
61818 <para>
61819 <emphasis>callout</emphasis>: the callout cache
61820 </para>
61821 </listitem>
61822 <listitem>
61823 <para>
61824 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
61825 </para>
61826 </listitem>
61827 <listitem>
61828 <para>
61829 <emphasis>misc</emphasis>: other hints data
61830 </para>
61831 </listitem>
61832 </itemizedlist>
61833 <para>
61834 The <emphasis>misc</emphasis> database is used for
61835 </para>
61836 <itemizedlist>
61837 <listitem>
61838 <para>
61839 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
61840 </para>
61841 </listitem>
61842 <listitem>
61843 <para>
61844 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
61845 <command>smtp</command> transport)
61846 </para>
61847 </listitem>
61848 </itemizedlist>
61849 </section>
61850 <section id="SECID261">
61851 <title>exim_dumpdb</title>
61852 <para>
61853 <indexterm role="concept">
61854 <primary><emphasis>exim_dumpdb</emphasis></primary>
61855 </indexterm>
61856 The entire contents of a database are written to the standard output by the
61857 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
61858 spool and database names. For example, to dump the retry database:
61859 </para>
61860 <literallayout class="monospaced">
61861 exim_dumpdb /var/spool/exim retry
61862 </literallayout>
61863 <para>
61864 Two lines of output are produced for each entry:
61865 </para>
61866 <literallayout class="monospaced">
61867 T:mail.ref.example:192.168.242.242 146 77 Connection refused
61868 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
61869 </literallayout>
61870 <para>
61871 The first item on the first line is the key of the record. It starts with one
61872 of the letters R, or T, depending on whether it refers to a routing or
61873 transport retry. For a local delivery, the next part is the local address; for
61874 a remote delivery it is the name of the remote host, followed by its failing IP
61875 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
61876 transport). If the remote port is not the standard one (port 25), it is added
61877 to the IP address. Then there follows an error code, an additional error code,
61878 and a textual description of the error.
61879 </para>
61880 <para>
61881 The three times on the second line are the time of first failure, the time of
61882 the last delivery attempt, and the computed time for the next attempt. The line
61883 ends with an asterisk if the cutoff time for the last retry rule has been
61884 exceeded.
61885 </para>
61886 <para>
61887 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
61888 consists of a host name followed by a list of ids for messages that are or were
61889 waiting to be delivered to that host. If there are a very large number for any
61890 one host, continuation records, with a sequence number added to the host name,
61891 may be seen. The data in these records is often out of date, because a message
61892 may be routed to several alternative hosts, and Exim makes no effort to keep
61893 cross-references.
61894 </para>
61895 </section>
61896 <section id="SECID262">
61897 <title>exim_tidydb</title>
61898 <para>
61899 <indexterm role="concept">
61900 <primary><emphasis>exim_tidydb</emphasis></primary>
61901 </indexterm>
61902 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
61903 database. If run with no options, it removes all records that are more than 30
61904 days old. The age is calculated from the date and time that the record was last
61905 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
61906 since the first delivery failure. Information about a host that has been down
61907 for more than 30 days will remain in the database, provided that the record is
61908 updated sufficiently often.
61909 </para>
61910 <para>
61911 The cutoff date can be altered by means of the <option>-t</option> option, which must be
61912 followed by a time. For example, to remove all records older than a week from
61913 the retry database:
61914 </para>
61915 <literallayout class="monospaced">
61916 exim_tidydb -t 7d /var/spool/exim retry
61917 </literallayout>
61918 <para>
61919 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
61920 message ids. In the former these appear as data in records keyed by host &ndash;
61921 they were messages that were waiting for that host &ndash; and in the latter they
61922 are the keys for retry information for messages that have suffered certain
61923 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
61924 message ids in database records are those of messages that are still on the
61925 queue. Message ids for messages that no longer exist are removed from
61926 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
61927 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
61928 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
61929 whenever it removes information from the database.
61930 </para>
61931 <para>
61932 Certain records are automatically removed by Exim when they are no longer
61933 needed, but others are not. For example, if all the MX hosts for a domain are
61934 down, a retry record is created for each one. If the primary MX host comes back
61935 first, its record is removed when Exim successfully delivers to it, but the
61936 records for the others remain because Exim has not tried to use those hosts.
61937 </para>
61938 <para>
61939 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
61940 hints databases. You should do this at a quiet time of day, because it requires
61941 a database to be locked (and therefore inaccessible to Exim) while it does its
61942 work. Removing records from a DBM file does not normally make the file smaller,
61943 but all the common DBM libraries are able to re-use the space that is released.
61944 After an initial phase of increasing in size, the databases normally reach a
61945 point at which they no longer get any bigger, as long as they are regularly
61946 tidied.
61947 </para>
61948 <para>
61949 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
61950 databases is likely to keep on increasing.
61951 </para>
61952 </section>
61953 <section id="SECID263">
61954 <title>exim_fixdb</title>
61955 <para>
61956 <indexterm role="concept">
61957 <primary><emphasis>exim_fixdb</emphasis></primary>
61958 </indexterm>
61959 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
61960 Its main use is for testing Exim, but it might also be occasionally useful for
61961 getting round problems in a live system. It has no options, and its interface
61962 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
61963 key of a database record can then be entered, and the data for that record is
61964 displayed.
61965 </para>
61966 <para>
61967 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
61968 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
61969 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
61970 data for individual fields can be changed by typing the field number followed
61971 by new data, for example:
61972 </para>
61973 <literallayout class="monospaced">
61974 &gt; 4 951102:1000
61975 </literallayout>
61976 <para>
61977 resets the time of the next delivery attempt. Time values are given as a
61978 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
61979 used as optional separators.
61980 </para>
61981 </section>
61982 <section id="SECTmailboxmaint">
61983 <title>Mailbox maintenance (exim_lock)</title>
61984 <para>
61985 <indexterm role="concept">
61986 <primary>mailbox</primary>
61987 <secondary>maintenance</secondary>
61988 </indexterm>
61989 <indexterm role="concept">
61990 <primary><emphasis>exim_lock</emphasis></primary>
61991 </indexterm>
61992 <indexterm role="concept">
61993 <primary>locking mailboxes</primary>
61994 </indexterm>
61995 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
61996 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
61997 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
61998 a user agent while investigating a problem. The utility requires the name of
61999 the file as its first argument. If the locking is successful, the second
62000 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
62001 second argument, the value of the SHELL environment variable is used; if this
62002 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
62003 is unlocked and the utility ends. The following options are available:
62004 </para>
62005 <variablelist>
62006 <varlistentry>
62007 <term><option>-fcntl</option></term>
62008 <listitem>
62009 <para>
62010 Use <function>fcntl()</function> locking on the open mailbox.
62011 </para>
62012 </listitem></varlistentry>
62013 <varlistentry>
62014 <term><option>-flock</option></term>
62015 <listitem>
62016 <para>
62017 Use <function>flock()</function> locking on the open mailbox, provided the operating system
62018 supports it.
62019 </para>
62020 </listitem></varlistentry>
62021 <varlistentry>
62022 <term><option>-interval</option></term>
62023 <listitem>
62024 <para>
62025 This must be followed by a number, which is a number of seconds; it sets the
62026 interval to sleep between retries (default 3).
62027 </para>
62028 </listitem></varlistentry>
62029 <varlistentry>
62030 <term><option>-lockfile</option></term>
62031 <listitem>
62032 <para>
62033 Create a lock file before opening the mailbox.
62034 </para>
62035 </listitem></varlistentry>
62036 <varlistentry>
62037 <term><option>-mbx</option></term>
62038 <listitem>
62039 <para>
62040 Lock the mailbox using MBX rules.
62041 </para>
62042 </listitem></varlistentry>
62043 <varlistentry>
62044 <term><option>-q</option></term>
62045 <listitem>
62046 <para>
62047 Suppress verification output.
62048 </para>
62049 </listitem></varlistentry>
62050 <varlistentry>
62051 <term><option>-retries</option></term>
62052 <listitem>
62053 <para>
62054 This must be followed by a number; it sets the number of times to try to get
62055 the lock (default 10).
62056 </para>
62057 </listitem></varlistentry>
62058 <varlistentry>
62059 <term><option>-restore_time</option></term>
62060 <listitem>
62061 <para>
62062 This option causes <option>exim_lock</option> to restore the modified and read times to the
62063 locked file before exiting. This allows you to access a locked mailbox (for
62064 example, to take a backup copy) without disturbing the times that the user
62065 subsequently sees.
62066 </para>
62067 </listitem></varlistentry>
62068 <varlistentry>
62069 <term><option>-timeout</option></term>
62070 <listitem>
62071 <para>
62072 This must be followed by a number, which is a number of seconds; it sets a
62073 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
62074 default), a non-blocking call is used.
62075 </para>
62076 </listitem></varlistentry>
62077 <varlistentry>
62078 <term><option>-v</option></term>
62079 <listitem>
62080 <para>
62081 Generate verbose output.
62082 </para>
62083 </listitem></varlistentry>
62084 </variablelist>
62085 <para>
62086 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
62087 default is to create a lock file and also to use <function>fcntl()</function> locking on the
62088 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
62089 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
62090 requires that the directory containing the file be writeable. Locking by lock
62091 file does not last for ever; Exim assumes that a lock file is expired if it is
62092 more than 30 minutes old.
62093 </para>
62094 <para>
62095 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
62096 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
62097 to be taken out on the open mailbox, and an exclusive lock on the file
62098 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
62099 number of the mailbox file. When the locking is released, if an exclusive lock
62100 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
62101 </para>
62102 <para>
62103 The default output contains verification of the locking that takes place. The
62104 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
62105 suppresses all output except error messages.
62106 </para>
62107 <para>
62108 A command such as
62109 </para>
62110 <literallayout class="monospaced">
62111 exim_lock /var/spool/mail/spqr
62112 </literallayout>
62113 <para>
62114 runs an interactive shell while the file is locked, whereas
62115 </para>
62116 <literallayout>
62117 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
62118 &lt;<emphasis>some commands</emphasis>&gt;
62119 <literal>End</literal>
62120 </literallayout>
62121 <para>
62122 runs a specific non-interactive sequence of commands while the file is locked,
62123 suppressing all verification output. A single command can be run by a command
62124 such as
62125 </para>
62126 <literallayout class="monospaced">
62127 exim_lock -q /var/spool/mail/spqr \
62128   "cp /var/spool/mail/spqr /some/where"
62129 </literallayout>
62130 <para>
62131 Note that if a command is supplied, it must be entirely contained within the
62132 second argument &ndash; hence the quotes.
62133 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
62134 </para>
62135 </section>
62136 </chapter>
62137
62138 <chapter id="CHAPeximon">
62139 <title>The Exim monitor</title>
62140 <para>
62141 <indexterm role="concept" id="IIDeximon" class="startofrange">
62142 <primary>Exim monitor</primary>
62143 <secondary>description</secondary>
62144 </indexterm>
62145 <indexterm role="concept">
62146 <primary>X-windows</primary>
62147 </indexterm>
62148 <indexterm role="concept">
62149 <primary><emphasis>eximon</emphasis></primary>
62150 </indexterm>
62151 <indexterm role="concept">
62152 <primary>Local/eximon.conf</primary>
62153 </indexterm>
62154 <indexterm role="concept">
62155 <primary><filename>exim_monitor/EDITME</filename></primary>
62156 </indexterm>
62157 The Exim monitor is an application which displays in an X window information
62158 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
62159 perform certain operations on messages from this GUI interface; however all
62160 such facilities are also available from the command line, and indeed, the
62161 monitor itself makes use of the command line to perform any actions requested.
62162 </para>
62163 <section id="SECID264">
62164 <title>Running the monitor</title>
62165 <para>
62166 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
62167 script that sets up a number of environment variables, and then runs the
62168 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
62169 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
62170 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
62171 parameters are for.
62172 </para>
62173 <para>
62174 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
62175 a particular invocation by setting up environment variables of the same names,
62176 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
62177 </para>
62178 <literallayout class="monospaced">
62179 EXIMON_LOG_DEPTH=400 eximon
62180 </literallayout>
62181 <para>
62182 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
62183 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
62184 overrides the Exim log file configuration. This makes it possible to have
62185 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
62186 syslog messages are routed to a file on the local host.
62187 </para>
62188 <para>
62189 X resources can be used to change the appearance of the window in the normal
62190 way. For example, a resource setting of the form
62191 </para>
62192 <literallayout class="monospaced">
62193 Eximon*background: gray94
62194 </literallayout>
62195 <para>
62196 changes the colour of the background to light grey rather than white. The
62197 stripcharts are drawn with both the data lines and the reference lines in
62198 black. This means that the reference lines are not visible when on top of the
62199 data. However, their colour can be changed by setting a resource called
62200 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
62201 For example, if your X server is running Unix, you could set up lighter
62202 reference lines in the stripcharts by obeying
62203 </para>
62204 <literallayout class="monospaced">
62205 xrdb -merge &lt;&lt;End
62206 Eximon*highlight: gray
62207 End
62208 </literallayout>
62209 <para>
62210 <indexterm role="concept">
62211 <primary>admin user</primary>
62212 </indexterm>
62213 In order to see the contents of messages on the queue, and to operate on them,
62214 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
62215 </para>
62216 <para>
62217 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
62218 contain X11 resource parameters interpreted by the X11 library.  In addition,
62219 if the first parameter starts with the string "gdb" then it is removed and the
62220 binary is invoked under gdb (the parameter is used as the gdb command-name, so
62221 versioned variants of gdb can be invoked).
62222 </para>
62223 <para>
62224 The monitor&#x2019;s window is divided into three parts. The first contains one or
62225 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
62226 main log file, and the third is a display of the queue of messages awaiting
62227 delivery, with two more action buttons. The following sections describe these
62228 different parts of the display.
62229 </para>
62230 </section>
62231 <section id="SECID265">
62232 <title>The stripcharts</title>
62233 <para>
62234 <indexterm role="concept">
62235 <primary>stripchart</primary>
62236 </indexterm>
62237 The first stripchart is always a count of messages on the queue. Its name can
62238 be configured by setting QUEUE_STRIPCHART_NAME in the
62239 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
62240 configuration script by regular expression matches on log file entries, making
62241 it possible to display, for example, counts of messages delivered to certain
62242 hosts or using certain transports. The supplied defaults display counts of
62243 received and delivered messages, and of local and SMTP deliveries. The default
62244 period between stripchart updates is one minute; this can be adjusted by a
62245 parameter in the <filename>Local/eximon.conf</filename> file.
62246 </para>
62247 <para>
62248 The stripchart displays rescale themselves automatically as the value they are
62249 displaying changes. There are always 10 horizontal lines in each chart; the
62250 title string indicates the value of each division when it is greater than one.
62251 For example, <quote>x2</quote> means that each division represents a value of 2.
62252 </para>
62253 <para>
62254 It is also possible to have a stripchart which shows the percentage fullness of
62255 a particular disk partition, which is useful when local deliveries are confined
62256 to a single partition.
62257 </para>
62258 <para>
62259 <indexterm role="concept">
62260 <primary><option>statvfs</option> function</primary>
62261 </indexterm>
62262 This relies on the availability of the <function>statvfs()</function> function or equivalent in
62263 the operating system. Most, but not all versions of Unix that support Exim have
62264 this. For this particular stripchart, the top of the chart always represents
62265 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
62266 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
62267 <filename>Local/eximon.conf</filename> file.
62268 </para>
62269 </section>
62270 <section id="SECID266">
62271 <title>Main action buttons</title>
62272 <para>
62273 <indexterm role="concept">
62274 <primary>size</primary>
62275 <secondary>of monitor window</secondary>
62276 </indexterm>
62277 <indexterm role="concept">
62278 <primary>Exim monitor</primary>
62279 <secondary>window size</secondary>
62280 </indexterm>
62281 <indexterm role="concept">
62282 <primary>window size</primary>
62283 </indexterm>
62284 Below the stripcharts there is an action button for quitting the monitor. Next
62285 to this is another button marked <quote>Size</quote>. They are placed here so that
62286 shrinking the window to its default minimum size leaves just the queue count
62287 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
62288 the window to expand to its maximum size, unless it is already at the maximum,
62289 in which case it is reduced to its minimum.
62290 </para>
62291 <para>
62292 When expanding to the maximum, if the window cannot be fully seen where it
62293 currently is, it is moved back to where it was the last time it was at full
62294 size. When it is expanding from its minimum size, the old position is
62295 remembered, and next time it is reduced to the minimum it is moved back there.
62296 </para>
62297 <para>
62298 The idea is that you can keep a reduced window just showing one or two
62299 stripcharts at a convenient place on your screen, easily expand it to show
62300 the full window when required, and just as easily put it back to what it was.
62301 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
62302 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
62303 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
62304 </para>
62305 <para>
62306 Normally, the monitor starts up with the window at its full size, but it can be
62307 built so that it starts up with the window at its smallest size, by setting
62308 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
62309 </para>
62310 </section>
62311 <section id="SECID267">
62312 <title>The log display</title>
62313 <para>
62314 <indexterm role="concept">
62315 <primary>log</primary>
62316 <secondary>tail of; in monitor</secondary>
62317 </indexterm>
62318 The second section of the window is an area in which a display of the tail of
62319 the main log is maintained.
62320 To save space on the screen, the timestamp on each log line is shortened by
62321 removing the date and, if <option>log_timezone</option> is set, the timezone.
62322 The log tail is not available when the only destination for logging data is
62323 syslog, unless the syslog lines are routed to a local file whose name is passed
62324 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
62325 </para>
62326 <para>
62327 The log sub-window has a scroll bar at its lefthand side which can be used to
62328 move back to look at earlier text, and the up and down arrow keys also have a
62329 scrolling effect. The amount of log that is kept depends on the setting of
62330 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
62331 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
62332 much more efficient than throwing it away line by line. The sub-window also has
62333 a horizontal scroll bar for accessing the ends of long log lines. This is the
62334 only means of horizontal scrolling; the right and left arrow keys are not
62335 available. Text can be cut from this part of the window using the mouse in the
62336 normal way. The size of this subwindow is controlled by parameters in the
62337 configuration file <filename>Local/eximon.conf</filename>.
62338 </para>
62339 <para>
62340 Searches of the text in the log window can be carried out by means of the ^R
62341 and ^S keystrokes, which default to a reverse and a forward search,
62342 respectively. The search covers only the text that is displayed in the window.
62343 It cannot go further back up the log.
62344 </para>
62345 <para>
62346 The point from which the search starts is indicated by a caret marker. This is
62347 normally at the end of the text in the window, but can be positioned explicitly
62348 by pointing and clicking with the left mouse button, and is moved automatically
62349 by a successful search. If new text arrives in the window when it is scrolled
62350 back, the caret remains where it is, but if the window is not scrolled back,
62351 the caret is moved to the end of the new text.
62352 </para>
62353 <para>
62354 Pressing ^R or ^S pops up a window into which the search text can be typed.
62355 There are buttons for selecting forward or reverse searching, for carrying out
62356 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
62357 happens and the window remains so that further searches can be done. If the
62358 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
62359 ^C is typed the search is cancelled.
62360 </para>
62361 <para>
62362 The searching facility is implemented using the facilities of the Athena text
62363 widget. By default this pops up a window containing both <quote>search</quote> and
62364 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
62365 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
62366 However, the linkers in BSDI and HP-UX seem unable to handle an externally
62367 provided version of <option>TextPop</option> when the remaining parts of the text widget
62368 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
62369 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
62370 on these systems, at the expense of having unwanted items in the search popup
62371 window.
62372 </para>
62373 </section>
62374 <section id="SECID268">
62375 <title>The queue display</title>
62376 <para>
62377 <indexterm role="concept">
62378 <primary>queue</primary>
62379 <secondary>display in monitor</secondary>
62380 </indexterm>
62381 The bottom section of the monitor window contains a list of all messages that
62382 are on the queue, which includes those currently being received or delivered,
62383 as well as those awaiting delivery. The size of this subwindow is controlled by
62384 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
62385 at which it is updated is controlled by another parameter in the same file &ndash;
62386 the default is 5 minutes, since queue scans can be quite expensive. However,
62387 there is an <quote>Update</quote> action button just above the display which can be used
62388 to force an update of the queue display at any time.
62389 </para>
62390 <para>
62391 When a host is down for some time, a lot of pending mail can build up for it,
62392 and this can make it hard to deal with other messages on the queue. To help
62393 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
62394 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
62395 type anything in here and press <quote>Return</quote>, the text is added to a chain of
62396 such texts, and if every undelivered address in a message matches at least one
62397 of the texts, the message is not displayed.
62398 </para>
62399 <para>
62400 If there is an address that does not match any of the texts, all the addresses
62401 are displayed as normal. The matching happens on the ends of addresses so, for
62402 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
62403 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
62404 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
62405 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
62406 a hide request is automatically cancelled after one hour.
62407 </para>
62408 <para>
62409 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
62410 else to the monitor window. For this reason, if you want to cut text from the
62411 queue display to use in the dialogue box, you have to do the cutting before
62412 pressing the <quote>Hide</quote> button.
62413 </para>
62414 <para>
62415 The queue display contains, for each unhidden queued message, the length of
62416 time it has been on the queue, the size of the message, the message id, the
62417 message sender, and the first undelivered recipient, all on one line. If it is
62418 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
62419 recipient to which the message has not yet been delivered, subsequent ones are
62420 listed on additional lines, up to a maximum configured number, following which
62421 an ellipsis is displayed. Recipients that have already received the message are
62422 not shown.
62423 </para>
62424 <para>
62425 <indexterm role="concept">
62426 <primary>frozen messages</primary>
62427 <secondary>display</secondary>
62428 </indexterm>
62429 If a message is frozen, an asterisk is displayed at the left-hand side.
62430 </para>
62431 <para>
62432 The queue display has a vertical scroll bar, and can also be scrolled by means
62433 of the arrow keys. Text can be cut from it using the mouse in the normal way.
62434 The text searching facilities, as described above for the log window, are also
62435 available, but the caret is always moved to the end of the text when the queue
62436 display is updated.
62437 </para>
62438 </section>
62439 <section id="SECID269">
62440 <title>The queue menu</title>
62441 <para>
62442 <indexterm role="concept">
62443 <primary>queue</primary>
62444 <secondary>menu in monitor</secondary>
62445 </indexterm>
62446 If the <option>shift</option> key is held down and the left button is clicked when the mouse
62447 pointer is over the text for any message, an action menu pops up, and the first
62448 line of the queue display for the message is highlighted. This does not affect
62449 any selected text.
62450 </para>
62451 <para>
62452 If you want to use some other event for popping up the menu, you can set the
62453 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
62454 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
62455 value set in this parameter is a standard X event description. For example, to
62456 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
62457 </para>
62458 <literallayout class="monospaced">
62459 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
62460 </literallayout>
62461 <para>
62462 The title of the menu is the message id, and it contains entries which act as
62463 follows:
62464 </para>
62465 <itemizedlist>
62466 <listitem>
62467 <para>
62468 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
62469 in a new text window.
62470 </para>
62471 </listitem>
62472 <listitem>
62473 <para>
62474 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
62475 information and headers is displayed in a new text window. See chapter
62476 <xref linkend="CHAPspool"/> for a description of the format of spool files.
62477 </para>
62478 </listitem>
62479 <listitem>
62480 <para>
62481 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
62482 displayed in a new text window. There is a default limit of 20,000 bytes to the
62483 amount of data displayed. This can be changed by setting the BODY_MAX
62484 option at compile time, or the EXIMON_BODY_MAX option at run time.
62485 </para>
62486 </listitem>
62487 <listitem>
62488 <para>
62489 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
62490 delivery of the message. This causes an automatic thaw if the message is
62491 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
62492 a new text window. The delivery is run in a separate process, to avoid holding
62493 up the monitor while the delivery proceeds.
62494 </para>
62495 </listitem>
62496 <listitem>
62497 <para>
62498 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
62499 that the message be frozen.
62500 </para>
62501 </listitem>
62502 <listitem>
62503 <para>
62504 <indexterm role="concept">
62505 <primary>thawing messages</primary>
62506 </indexterm>
62507 <indexterm role="concept">
62508 <primary>unfreezing messages</primary>
62509 </indexterm>
62510 <indexterm role="concept">
62511 <primary>frozen messages</primary>
62512 <secondary>thawing</secondary>
62513 </indexterm>
62514 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
62515 that the message be thawed.
62516 </para>
62517 </listitem>
62518 <listitem>
62519 <para>
62520 <indexterm role="concept">
62521 <primary>delivery</primary>
62522 <secondary>forcing failure</secondary>
62523 </indexterm>
62524 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
62525 that Exim gives up trying to deliver the message. A bounce message is generated
62526 for any remaining undelivered addresses.
62527 </para>
62528 </listitem>
62529 <listitem>
62530 <para>
62531 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
62532 that the message be deleted from the system without generating a bounce
62533 message.
62534 </para>
62535 </listitem>
62536 <listitem>
62537 <para>
62538 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
62539 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
62540 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
62541 Otherwise it must be entered as a fully qualified address. Pressing RETURN
62542 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
62543 additional recipient be added to the message, unless the entry box is empty, in
62544 which case no action is taken.
62545 </para>
62546 </listitem>
62547 <listitem>
62548 <para>
62549 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
62550 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
62551 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
62552 Otherwise it must be entered as a fully qualified address. Pressing RETURN
62553 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
62554 recipient address as already delivered, unless the entry box is empty, in which
62555 case no action is taken.
62556 </para>
62557 </listitem>
62558 <listitem>
62559 <para>
62560 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
62561 mark all recipient addresses as already delivered.
62562 </para>
62563 </listitem>
62564 <listitem>
62565 <para>
62566 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
62567 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
62568 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
62569 in which case no action is taken. If you want to set an empty sender (as in
62570 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
62571 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
62572 the address is qualified with that domain.
62573 </para>
62574 </listitem>
62575 </itemizedlist>
62576 <para>
62577 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
62578 other cases when a call to Exim is made, if there is any output from Exim (in
62579 particular, if the command fails) a window containing the command and the
62580 output is displayed. Otherwise, the results of the action are normally apparent
62581 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
62582 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
62583 if no output is generated.
62584 </para>
62585 <para>
62586 The queue display is automatically updated for actions such as freezing and
62587 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
62588 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
62589 force an update of the display after one of these actions.
62590 </para>
62591 <para>
62592 In any text window that is displayed as result of a menu action, the normal
62593 cut-and-paste facility is available, and searching can be carried out using ^R
62594 and ^S, as described above for the log tail window.
62595 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
62596 </para>
62597 </section>
62598 </chapter>
62599
62600 <chapter id="CHAPsecurity">
62601 <title>Security considerations</title>
62602 <para>
62603 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
62604 <primary>security</primary>
62605 <secondary>discussion of</secondary>
62606 </indexterm>
62607 This chapter discusses a number of issues concerned with security, some of
62608 which are also covered in other parts of this manual.
62609 </para>
62610 <para>
62611 For reasons that this author does not understand, some people have promoted
62612 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
62613 existence of this chapter in the documentation. However, the intent of the
62614 chapter is simply to describe the way Exim works in relation to certain
62615 security concerns, not to make any specific claims about the effectiveness of
62616 its security as compared with other MTAs.
62617 </para>
62618 <para>
62619 What follows is a description of the way Exim is supposed to be. Best efforts
62620 have been made to try to ensure that the code agrees with the theory, but an
62621 absence of bugs can never be guaranteed. Any that are reported will get fixed
62622 as soon as possible.
62623 </para>
62624 <section id="SECID286">
62625 <title>Building a more <quote>hardened</quote> Exim</title>
62626 <para>
62627 <indexterm role="concept">
62628 <primary>security</primary>
62629 <secondary>build-time features</secondary>
62630 </indexterm>
62631 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
62632 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
62633 Exim administrator who does not have the root password, or by someone who has
62634 penetrated the Exim (but not the root) account. These options are as follows:
62635 </para>
62636 <itemizedlist>
62637 <listitem>
62638 <para>
62639 ALT_CONFIG_PREFIX can be set to a string that is required to match the
62640 start of any file names used with the <option>-C</option> option. When it is set, these file
62641 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
62642 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
62643 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
62644 default setting for <option>ALT_CONFIG_PREFIX</option>.
62645 </para>
62646 <para>
62647 If the permitted configuration files are confined to a directory to
62648 which only root has access, this guards against someone who has broken
62649 into the Exim account from running a privileged Exim with an arbitrary
62650 configuration file, and using it to break into other accounts.
62651 </para>
62652 </listitem>
62653 <listitem>
62654 <para>
62655 If a non-trusted configuration file (i.e. not the default configuration file
62656 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
62657 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
62658 the next item), then root privilege is retained only if the caller of Exim is
62659 root. This locks out the possibility of testing a configuration using <option>-C</option>
62660 right through message reception and delivery, even if the caller is root. The
62661 reception works, but by that time, Exim is running as the Exim user, so when
62662 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
62663 privilege to be lost. However, root can test reception and delivery using two
62664 separate commands.
62665 </para>
62666 </listitem>
62667 <listitem>
62668 <para>
62669 The WHITELIST_D_MACROS build option declares some macros to be safe to override
62670 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
62671 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
62672 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
62673 the restrictive side.  Requiring build-time selection of safe macros is onerous
62674 but this option is intended solely as a transition mechanism to permit
62675 previously-working configurations to continue to work after release 4.73.
62676 </para>
62677 </listitem>
62678 <listitem>
62679 <para>
62680 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
62681 is disabled.
62682 </para>
62683 </listitem>
62684 <listitem>
62685 <para>
62686 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
62687 never to be used for any deliveries. This is like the <option>never_users</option> runtime
62688 option, but it cannot be overridden; the runtime option adds additional users
62689 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
62690 is permitted to modify the runtime file from using Exim as a way to get root.
62691 </para>
62692 </listitem>
62693 </itemizedlist>
62694 </section>
62695 <section id="SECID270">
62696 <title>Root privilege</title>
62697 <para>
62698 <indexterm role="concept">
62699 <primary>setuid</primary>
62700 </indexterm>
62701 <indexterm role="concept">
62702 <primary>root privilege</primary>
62703 </indexterm>
62704 The Exim binary is normally setuid to root, which means that it gains root
62705 privilege (runs as root) when it starts execution. In some special cases (for
62706 example, when the daemon is not in use and there are no local deliveries), it
62707 may be possible to run Exim setuid to some user other than root. This is
62708 discussed in the next section. However, in most installations, root privilege
62709 is required for two things:
62710 </para>
62711 <itemizedlist>
62712 <listitem>
62713 <para>
62714 To set up a socket connected to the standard SMTP port (25) when initialising
62715 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
62716 not required.
62717 </para>
62718 </listitem>
62719 <listitem>
62720 <para>
62721 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
62722 perform local deliveries as the receiving user or as specified in the
62723 configuration.
62724 </para>
62725 </listitem>
62726 </itemizedlist>
62727 <para>
62728 It is not necessary to be root to do any of the other things Exim does, such as
62729 receiving messages and delivering them externally over SMTP, and it is
62730 obviously more secure if Exim does not run as root except when necessary.
62731 For this reason, a user and group for Exim to use must be defined in
62732 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
62733 group</quote>. Their values can be changed by the run time configuration, though this
62734 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
62735 <emphasis>mail</emphasis> or another user name altogether.
62736 </para>
62737 <para>
62738 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
62739 abdication; the process cannot regain root afterwards. Prior to release 4.00,
62740 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
62741 </para>
62742 <para>
62743 After a new Exim process has interpreted its command line options, it changes
62744 uid and gid in the following cases:
62745 </para>
62746 <itemizedlist>
62747 <listitem>
62748 <para>
62749 <indexterm role="option">
62750 <primary><option>-C</option></primary>
62751 </indexterm>
62752 <indexterm role="option">
62753 <primary><option>-D</option></primary>
62754 </indexterm>
62755 If the <option>-C</option> option is used to specify an alternate configuration file, or if
62756 the <option>-D</option> option is used to define macro values for the configuration, and the
62757 calling process is not running as root, the uid and gid are changed to those of
62758 the calling process.
62759 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
62760 option may not be used at all.
62761 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
62762 can be supplied if the calling process is running as root, the Exim run-time
62763 user or CONFIGURE_OWNER, if defined.
62764 </para>
62765 </listitem>
62766 <listitem>
62767 <para>
62768 <indexterm role="option">
62769 <primary><option>-be</option></primary>
62770 </indexterm>
62771 <indexterm role="option">
62772 <primary><option>-bf</option></primary>
62773 </indexterm>
62774 <indexterm role="option">
62775 <primary><option>-bF</option></primary>
62776 </indexterm>
62777 If the expansion test option (<option>-be</option>) or one of the filter testing options
62778 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
62779 calling process.
62780 </para>
62781 </listitem>
62782 <listitem>
62783 <para>
62784 If the process is not a daemon process or a queue runner process or a delivery
62785 process or a process for testing address routing (started with <option>-bt</option>), the
62786 uid and gid are changed to the Exim user and group. This means that Exim always
62787 runs under its own uid and gid when receiving messages. This also applies when
62788 testing address verification
62789 <indexterm role="option">
62790 <primary><option>-bv</option></primary>
62791 </indexterm>
62792 <indexterm role="option">
62793 <primary><option>-bh</option></primary>
62794 </indexterm>
62795 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
62796 option).
62797 </para>
62798 </listitem>
62799 <listitem>
62800 <para>
62801 For a daemon, queue runner, delivery, or address testing process, the uid
62802 remains as root at this stage, but the gid is changed to the Exim group.
62803 </para>
62804 </listitem>
62805 </itemizedlist>
62806 <para>
62807 The processes that initially retain root privilege behave as follows:
62808 </para>
62809 <itemizedlist>
62810 <listitem>
62811 <para>
62812 A daemon process changes the gid to the Exim group and the uid to the Exim
62813 user after setting up one or more listening sockets. The <function>initgroups()</function>
62814 function is called, so that if the Exim user is in any additional groups, they
62815 will be used during message reception.
62816 </para>
62817 </listitem>
62818 <listitem>
62819 <para>
62820 A queue runner process retains root privilege throughout its execution. Its
62821 job is to fork a controlled sequence of delivery processes.
62822 </para>
62823 </listitem>
62824 <listitem>
62825 <para>
62826 A delivery process retains root privilege throughout most of its execution,
62827 but any actual deliveries (that is, the transports themselves) are run in
62828 subprocesses which always change to a non-root uid and gid. For local
62829 deliveries this is typically the uid and gid of the owner of the mailbox; for
62830 remote deliveries, the Exim uid and gid are used. Once all the delivery
62831 subprocesses have been run, a delivery process changes to the Exim uid and gid
62832 while doing post-delivery tidying up such as updating the retry database and
62833 generating bounce and warning messages.
62834 </para>
62835 <para>
62836 While the recipient addresses in a message are being routed, the delivery
62837 process runs as root. However, if a user&#x2019;s filter file has to be processed,
62838 this is done in a subprocess that runs under the individual user&#x2019;s uid and
62839 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
62840 </para>
62841 </listitem>
62842 <listitem>
62843 <para>
62844 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
62845 the routing is done in the same environment as a message delivery.
62846 </para>
62847 </listitem>
62848 </itemizedlist>
62849 </section>
62850 <section id="SECTrunexiwitpri">
62851 <title>Running Exim without privilege</title>
62852 <para>
62853 <indexterm role="concept">
62854 <primary>privilege, running without</primary>
62855 </indexterm>
62856 <indexterm role="concept">
62857 <primary>unprivileged running</primary>
62858 </indexterm>
62859 <indexterm role="concept">
62860 <primary>root privilege</primary>
62861 <secondary>running without</secondary>
62862 </indexterm>
62863 Some installations like to run Exim in an unprivileged state for more of its
62864 operation, for added security. Support for this mode of operation is provided
62865 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
62866 gid are changed to the Exim user and group at the start of a delivery process
62867 (and also queue runner and address testing processes). This means that address
62868 routing is no longer run as root, and the deliveries themselves cannot change
62869 to any other uid.
62870 </para>
62871 <para>
62872 <indexterm role="concept">
62873 <primary>SIGHUP</primary>
62874 </indexterm>
62875 <indexterm role="concept">
62876 <primary>daemon</primary>
62877 <secondary>restarting</secondary>
62878 </indexterm>
62879 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
62880 that the daemon can still be started in the usual way, and it can respond
62881 correctly to SIGHUP because the re-invocation regains root privilege.
62882 </para>
62883 <para>
62884 An alternative approach is to make Exim setuid to the Exim user and also setgid
62885 to the Exim group. If you do this, the daemon must be started from a root
62886 process. (Calling Exim from a root process makes it behave in the way it does
62887 when it is setuid root.) However, the daemon cannot restart itself after a
62888 SIGHUP signal because it cannot regain privilege.
62889 </para>
62890 <para>
62891 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
62892 stops Exim from trying to re-invoke itself to do a delivery after a message has
62893 been received. Such a re-invocation is a waste of resources because it has no
62894 effect.
62895 </para>
62896 <para>
62897 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
62898 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
62899 to the Exim user seems a clean approach, but there is one complication:
62900 </para>
62901 <para>
62902 In this style of operation, Exim is running with the real uid and gid set to
62903 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
62904 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
62905 that is, the real uid/gid should be reset to the effective values so as to
62906 discard any privileges that the caller may have. While some operating systems
62907 have a function that permits this action for a non-root effective uid, quite a
62908 number of them do not. Because of this lack of standardization, Exim does not
62909 address this problem at this time.
62910 </para>
62911 <para>
62912 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
62913 is to keep the Exim binary setuid to root, and to set
62914 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
62915 be used in the most straightforward way.
62916 </para>
62917 <para>
62918 If you configure Exim not to run delivery processes as root, there are a
62919 number of restrictions on what you can do:
62920 </para>
62921 <itemizedlist>
62922 <listitem>
62923 <para>
62924 You can deliver only as the Exim user/group. You should  explicitly use the
62925 <option>user</option> and <option>group</option> options to override routers or local transports that
62926 normally deliver as the recipient. This makes sure that configurations that
62927 work in this mode function the same way in normal mode. Any implicit or
62928 explicit specification of another user causes an error.
62929 </para>
62930 </listitem>
62931 <listitem>
62932 <para>
62933 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
62934 not worthwhile to include them in the configuration.
62935 </para>
62936 </listitem>
62937 <listitem>
62938 <para>
62939 Users who wish to use <filename>.forward</filename> would have to make their home directory and
62940 the file itself accessible to the Exim user. Pipe and append-to-file entries,
62941 and their equivalents in Exim filters, cannot be used. While they could be
62942 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
62943 </para>
62944 </listitem>
62945 <listitem>
62946 <para>
62947 Unless the local user mailboxes are all owned by the Exim user (possible in
62948 some POP3 or IMAP-only environments):
62949 </para>
62950 <orderedlist numeration="arabic">
62951 <listitem>
62952 <para>
62953 They must be owned by the Exim group and be writeable by that group. This
62954 implies you must set <option>mode</option> in the appendfile configuration, as well as the
62955 mode of the mailbox files themselves.
62956 </para>
62957 </listitem>
62958 <listitem>
62959 <para>
62960 You must set <option>no_check_owner</option>, since most or all of the files will not be
62961 owned by the Exim user.
62962 </para>
62963 </listitem>
62964 <listitem>
62965 <para>
62966 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
62967 on a newly created mailbox when unprivileged. This also implies that new
62968 mailboxes need to be created manually.
62969 </para>
62970 </listitem>
62971 </orderedlist>
62972 </listitem>
62973 </itemizedlist>
62974 <para>
62975 These restrictions severely restrict what can be done in local deliveries.
62976 However, there are no restrictions on remote deliveries. If you are running a
62977 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
62978 gives more security at essentially no cost.
62979 </para>
62980 <para>
62981 If you are using the <option>mua_wrapper</option> facility (see chapter
62982 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
62983 </para>
62984 </section>
62985 <section id="SECID271">
62986 <title>Delivering to local files</title>
62987 <para>
62988 Full details of the checks applied by <command>appendfile</command> before it writes to a file
62989 are given in chapter <xref linkend="CHAPappendfile"/>.
62990 </para>
62991 </section>
62992 <section id="SECID272">
62993 <title>IPv4 source routing</title>
62994 <para>
62995 <indexterm role="concept">
62996 <primary>source routing</primary>
62997 <secondary>in IP packets</secondary>
62998 </indexterm>
62999 <indexterm role="concept">
63000 <primary>IP source routing</primary>
63001 </indexterm>
63002 Many operating systems suppress IP source-routed packets in the kernel, but
63003 some cannot be made to do this, so Exim does its own check. It logs incoming
63004 IPv4 source-routed TCP calls, and then drops them. Things are all different in
63005 IPv6. No special checking is currently done.
63006 </para>
63007 </section>
63008 <section id="SECID273">
63009 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
63010 <para>
63011 Support for these SMTP commands is disabled by default. If required, they can
63012 be enabled by defining suitable ACLs.
63013 </para>
63014 </section>
63015 <section id="SECID274">
63016 <title>Privileged users</title>
63017 <para>
63018 <indexterm role="concept">
63019 <primary>trusted users</primary>
63020 </indexterm>
63021 <indexterm role="concept">
63022 <primary>admin user</primary>
63023 </indexterm>
63024 <indexterm role="concept">
63025 <primary>privileged user</primary>
63026 </indexterm>
63027 <indexterm role="concept">
63028 <primary>user</primary>
63029 <secondary>trusted</secondary>
63030 </indexterm>
63031 <indexterm role="concept">
63032 <primary>user</primary>
63033 <secondary>admin</secondary>
63034 </indexterm>
63035 Exim recognizes two sets of users with special privileges. Trusted users are
63036 able to submit new messages to Exim locally, but supply their own sender
63037 addresses and information about a sending host. For other users submitting
63038 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
63039 permit a remote host to be specified.
63040 </para>
63041 <para>
63042 <indexterm role="option">
63043 <primary><option>-f</option></primary>
63044 </indexterm>
63045 However, an untrusted user is permitted to use the <option>-f</option> command line option
63046 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
63047 message should not cause an error report. This affects the message&#x2019;s envelope,
63048 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
63049 permitted to use specific forms of address with the <option>-f</option> option by setting
63050 the <option>untrusted_set_sender</option> option.
63051 </para>
63052 <para>
63053 Trusted users are used to run processes that receive mail messages from some
63054 other mail domain and pass them on to Exim for delivery either locally, or over
63055 the Internet. Exim trusts a caller that is running as root, as the Exim user,
63056 as any user listed in the <option>trusted_users</option> configuration option, or under any
63057 group listed in the <option>trusted_groups</option> option.
63058 </para>
63059 <para>
63060 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
63061 can freeze or thaw messages, cause them to be returned to their senders, remove
63062 them entirely, or modify them in various ways. In addition, admin users can run
63063 the Exim monitor and see all the information it is capable of providing, which
63064 includes the contents of files on the spool.
63065 </para>
63066 <para>
63067 <indexterm role="option">
63068 <primary><option>-M</option></primary>
63069 </indexterm>
63070 <indexterm role="option">
63071 <primary><option>-q</option></primary>
63072 </indexterm>
63073 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
63074 delivery of messages on its queue is restricted to admin users. This
63075 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
63076 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
63077 queue is also restricted to admin users. This restriction can be relaxed by
63078 setting <option>no_queue_list_requires_admin</option>.
63079 </para>
63080 <para>
63081 Exim recognizes an admin user if the calling process is running as root or as
63082 the Exim user or if any of the groups associated with the calling process is
63083 the Exim group. It is not necessary actually to be running under the Exim
63084 group. However, if admin users who are not root or the Exim user are to access
63085 the contents of files on the spool via the Exim monitor (which runs
63086 unprivileged), Exim must be built to allow group read access to its spool
63087 files.
63088 </para>
63089 </section>
63090 <section id="SECID275">
63091 <title>Spool files</title>
63092 <para>
63093 <indexterm role="concept">
63094 <primary>spool directory</primary>
63095 <secondary>files</secondary>
63096 </indexterm>
63097 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
63098 set to the Exim group. The mode for spool files is defined in the
63099 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
63100 any user who is a member of the Exim group can access these files.
63101 </para>
63102 </section>
63103 <section id="SECID276">
63104 <title>Use of argv[0]</title>
63105 <para>
63106 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
63107 of specific strings, Exim assumes certain options. For example, calling Exim
63108 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
63109 to calling it with the option <option>-bS</option>. There are no security implications in
63110 this.
63111 </para>
63112 </section>
63113 <section id="SECID277">
63114 <title>Use of %f formatting</title>
63115 <para>
63116 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
63117 are actually stored in integer variables as 1000 times the load average.
63118 Consequently, their range is limited and so therefore is the length of the
63119 converted output.
63120 </para>
63121 </section>
63122 <section id="SECID278">
63123 <title>Embedded Exim path</title>
63124 <para>
63125 Exim uses its own path name, which is embedded in the code, only when it needs
63126 to re-exec in order to regain root privilege. Therefore, it is not root when it
63127 does so. If some bug allowed the path to get overwritten, it would lead to an
63128 arbitrary program&#x2019;s being run as exim, not as root.
63129 </para>
63130 </section>
63131 <section id="SECTdynmoddir">
63132 <title>Dynamic module directory</title>
63133 <para>
63134 Any dynamically loadable modules must be installed into the directory
63135 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
63136 loading it.
63137 </para>
63138 </section>
63139 <section id="SECID279">
63140 <title>Use of sprintf()</title>
63141 <para>
63142 <indexterm role="concept">
63143 <primary><function>sprintf()</function></primary>
63144 </indexterm>
63145 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
63146 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
63147 The intermediate formatting is done into a large fixed buffer by a function
63148 that runs through the format string itself, and checks the length of each
63149 conversion before performing it, thus preventing buffer overruns.
63150 </para>
63151 <para>
63152 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
63153 the output buffer is known to be sufficiently long to contain the converted
63154 string.
63155 </para>
63156 </section>
63157 <section id="SECID280">
63158 <title>Use of debug_printf() and log_write()</title>
63159 <para>
63160 Arbitrary strings are passed to both these functions, but they do their
63161 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
63162 the format string itself, and checks the length of each conversion.
63163 </para>
63164 </section>
63165 <section id="SECID281">
63166 <title>Use of strcat() and strcpy()</title>
63167 <para>
63168 These are used only in cases where the output buffer is known to be large
63169 enough to hold the result.
63170 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
63171 </para>
63172 </section>
63173 </chapter>
63174
63175 <chapter id="CHAPspool">
63176 <title>Format of spool files</title>
63177 <para>
63178 <indexterm role="concept" id="IIDforspo1" class="startofrange">
63179 <primary>format</primary>
63180 <secondary>spool files</secondary>
63181 </indexterm>
63182 <indexterm role="concept" id="IIDforspo2" class="startofrange">
63183 <primary>spool directory</primary>
63184 <secondary>format of files</secondary>
63185 </indexterm>
63186 <indexterm role="concept" id="IIDforspo3" class="startofrange">
63187 <primary>spool files</primary>
63188 <secondary>format of</secondary>
63189 </indexterm>
63190 <indexterm role="concept">
63191 <primary>spool files</primary>
63192 <secondary>editing</secondary>
63193 </indexterm>
63194 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
63195 followed by -D and -H, respectively. The data portion of the message is kept in
63196 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
63197 kept in the -H file, whose format is described in this chapter. Each of these
63198 two files contains the final component of its own name as its first line. This
63199 is insurance against disk crashes where the directory is lost but the files
63200 themselves are recoverable.
63201 </para>
63202 <para>
63203 Some people are tempted into editing -D files in order to modify messages. You
63204 need to be extremely careful if you do this; it is not recommended and you are
63205 on your own if you do it. Here are some of the pitfalls:
63206 </para>
63207 <itemizedlist>
63208 <listitem>
63209 <para>
63210 You must ensure that Exim does not try to deliver the message while you are
63211 fiddling with it. The safest way is to take out a write lock on the -D file,
63212 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
63213 place, the lock will be retained. If you write a new file and rename it, the
63214 lock will be lost at the instant of rename.
63215 </para>
63216 </listitem>
63217 <listitem>
63218 <para>
63219 <indexterm role="variable">
63220 <primary><varname>$body_linecount</varname></primary>
63221 </indexterm>
63222 If you change the number of lines in the file, the value of
63223 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
63224 present, this value is not used by Exim, but there is no guarantee that this
63225 will always be the case.
63226 </para>
63227 </listitem>
63228 <listitem>
63229 <para>
63230 If the message is in MIME format, you must take care not to break it.
63231 </para>
63232 </listitem>
63233 <listitem>
63234 <para>
63235 If the message is cryptographically signed, any change will invalidate the
63236 signature.
63237 </para>
63238 </listitem>
63239 </itemizedlist>
63240 <para>
63241 All in all, modifying -D files is fraught with danger.
63242 </para>
63243 <para>
63244 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
63245 its subdirectories when <option>split_spool_directory</option> is set). These are journal
63246 files, used to record addresses to which the message has been delivered during
63247 the course of a delivery attempt. If there are still undelivered recipients at
63248 the end, the -H file is updated, and the -J file is deleted. If, however, there
63249 is some kind of crash (for example, a power outage) before this happens, the -J
63250 file remains in existence. When Exim next processes the message, it notices the
63251 -J file and uses it to update the -H file before starting the next delivery
63252 attempt.
63253 </para>
63254 <section id="SECID282">
63255 <title>Format of the -H file</title>
63256 <para>
63257 <indexterm role="concept">
63258 <primary>uid (user id)</primary>
63259 <secondary>in spool file</secondary>
63260 </indexterm>
63261 <indexterm role="concept">
63262 <primary>gid (group id)</primary>
63263 <secondary>in spool file</secondary>
63264 </indexterm>
63265 The second line of the -H file contains the login name for the uid of the
63266 process that called Exim to read the message, followed by the numerical uid and
63267 gid. For a locally generated message, this is normally the user who sent the
63268 message. For a message received over TCP/IP via the daemon, it is
63269 normally the Exim user.
63270 </para>
63271 <para>
63272 The third line of the file contains the address of the message&#x2019;s sender as
63273 transmitted in the envelope, contained in angle brackets. The sender address is
63274 empty for bounce messages. For incoming SMTP mail, the sender address is given
63275 in the MAIL command. For locally generated mail, the sender address is
63276 created by Exim from the login name of the current user and the configured
63277 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
63278 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
63279 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
63280 </para>
63281 <para>
63282 The fourth line contains two numbers. The first is the time that the message
63283 was received, in the conventional Unix form &ndash; the number of seconds since the
63284 start of the epoch. The second number is a count of the number of messages
63285 warning of delayed delivery that have been sent to the sender.
63286 </para>
63287 <para>
63288 There follow a number of lines starting with a hyphen. These can appear in any
63289 order, and are omitted when not relevant:
63290 </para>
63291 <variablelist>
63292 <varlistentry>
63293 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
63294 <listitem>
63295 <para>
63296 This item is obsolete, and is not generated from Exim release 4.61 onwards;
63297 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
63298 recognized, to provide backward compatibility. In the old format, a line of
63299 this form is present for every ACL variable that is not empty. The number
63300 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
63301 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
63302 the data string for the variable. The string itself starts at the beginning of
63303 the next line, and is followed by a newline character. It may contain internal
63304 newlines.
63305 </para>
63306 </listitem></varlistentry>
63307 <varlistentry>
63308 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
63309 <listitem>
63310 <para>
63311 A line of this form is present for every ACL connection variable that is
63312 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
63313 The length is the length of the data string for the variable. The string itself
63314 starts at the beginning of the next line, and is followed by a newline
63315 character. It may contain internal newlines.
63316 </para>
63317 </listitem></varlistentry>
63318 <varlistentry>
63319 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
63320 <listitem>
63321 <para>
63322 A line of this form is present for every ACL message variable that is defined.
63323 Note that there is a space between <option>-aclm</option> and the rest of the name. The
63324 length is the length of the data string for the variable. The string itself
63325 starts at the beginning of the next line, and is followed by a newline
63326 character. It may contain internal newlines.
63327 </para>
63328 </listitem></varlistentry>
63329 <varlistentry>
63330 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
63331 <listitem>
63332 <para>
63333 This is present if, when the message was received over SMTP, the value of
63334 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
63335 </para>
63336 </listitem></varlistentry>
63337 <varlistentry>
63338 <term><option>-allow_unqualified_recipient</option></term>
63339 <listitem>
63340 <para>
63341 This is present if unqualified recipient addresses are permitted in header
63342 lines (to stop such addresses from being qualified if rewriting occurs at
63343 transport time). Local messages that were input using <option>-bnq</option> and remote
63344 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
63345 </para>
63346 </listitem></varlistentry>
63347 <varlistentry>
63348 <term><option>-allow_unqualified_sender</option></term>
63349 <listitem>
63350 <para>
63351 This is present if unqualified sender addresses are permitted in header lines
63352 (to stop such addresses from being qualified if rewriting occurs at transport
63353 time). Local messages that were input using <option>-bnq</option> and remote messages from
63354 hosts that match <option>sender_unqualified_hosts</option> set this flag.
63355 </para>
63356 </listitem></varlistentry>
63357 <varlistentry>
63358 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
63359 <listitem>
63360 <para>
63361 The id information for a message received on an authenticated SMTP connection
63362 &ndash; the value of the <varname>$authenticated_id</varname> variable.
63363 </para>
63364 </listitem></varlistentry>
63365 <varlistentry>
63366 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
63367 <listitem>
63368 <para>
63369 The address of an authenticated sender &ndash; the value of the
63370 <varname>$authenticated_sender</varname> variable.
63371 </para>
63372 </listitem></varlistentry>
63373 <varlistentry>
63374 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
63375 <listitem>
63376 <para>
63377 This records the number of lines in the body of the message, and is always
63378 present.
63379 </para>
63380 </listitem></varlistentry>
63381 <varlistentry>
63382 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
63383 <listitem>
63384 <para>
63385 This records the number of binary zero bytes in the body of the message, and is
63386 present if the number is greater than zero.
63387 </para>
63388 </listitem></varlistentry>
63389 <varlistentry>
63390 <term><option>-deliver_firsttime</option></term>
63391 <listitem>
63392 <para>
63393 This is written when a new message is first added to the spool. When the spool
63394 file is updated after a deferral, it is omitted.
63395 </para>
63396 </listitem></varlistentry>
63397 <varlistentry>
63398 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
63399 <listitem>
63400 <para>
63401 <indexterm role="concept">
63402 <primary>frozen messages</primary>
63403 <secondary>spool data</secondary>
63404 </indexterm>
63405 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
63406 </para>
63407 </listitem></varlistentry>
63408 <varlistentry>
63409 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
63410 <listitem>
63411 <para>
63412 This records the host name as specified by a remote host in a HELO or EHLO
63413 command.
63414 </para>
63415 </listitem></varlistentry>
63416 <varlistentry>
63417 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
63418 <listitem>
63419 <para>
63420 This records the IP address of the host from which the message was received and
63421 the remote port number that was used. It is omitted for locally generated
63422 messages.
63423 </para>
63424 </listitem></varlistentry>
63425 <varlistentry>
63426 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
63427 <listitem>
63428 <para>
63429 If the message was received on an authenticated SMTP connection, this records
63430 the name of the authenticator &ndash; the value of the
63431 <varname>$sender_host_authenticated</varname> variable.
63432 </para>
63433 </listitem></varlistentry>
63434 <varlistentry>
63435 <term><option>-host_lookup_failed</option></term>
63436 <listitem>
63437 <para>
63438 This is present if an attempt to look up the sending host&#x2019;s name from its IP
63439 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
63440 </para>
63441 </listitem></varlistentry>
63442 <varlistentry>
63443 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
63444 <listitem>
63445 <para>
63446 <indexterm role="concept">
63447 <primary>reverse DNS lookup</primary>
63448 </indexterm>
63449 <indexterm role="concept">
63450 <primary>DNS</primary>
63451 <secondary>reverse lookup</secondary>
63452 </indexterm>
63453 This records the name of the remote host from which the message was received,
63454 if the host name was looked up from the IP address when the message was being
63455 received. It is not present if no reverse lookup was done.
63456 </para>
63457 </listitem></varlistentry>
63458 <varlistentry>
63459 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
63460 <listitem>
63461 <para>
63462 For locally submitted messages, this records the login of the originating user,
63463 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
63464 ident value. For messages received over TCP/IP, this records the ident string
63465 supplied by the remote host, if any.
63466 </para>
63467 </listitem></varlistentry>
63468 <varlistentry>
63469 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
63470 <listitem>
63471 <para>
63472 This records the IP address of the local interface and the port number through
63473 which a message was received from a remote host. It is omitted for locally
63474 generated messages.
63475 </para>
63476 </listitem></varlistentry>
63477 <varlistentry>
63478 <term><option>-local</option></term>
63479 <listitem>
63480 <para>
63481 The message is from a local sender.
63482 </para>
63483 </listitem></varlistentry>
63484 <varlistentry>
63485 <term><option>-localerror</option></term>
63486 <listitem>
63487 <para>
63488 The message is a locally-generated bounce message.
63489 </para>
63490 </listitem></varlistentry>
63491 <varlistentry>
63492 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
63493 <listitem>
63494 <para>
63495 This records the data string that was returned by the <function>local_scan()</function> function
63496 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
63497 variable. It is omitted if no data was returned.
63498 </para>
63499 </listitem></varlistentry>
63500 <varlistentry>
63501 <term><option>-manual_thaw</option></term>
63502 <listitem>
63503 <para>
63504 The message was frozen but has been thawed manually, that is, by an explicit
63505 Exim command rather than via the auto-thaw process.
63506 </para>
63507 </listitem></varlistentry>
63508 <varlistentry>
63509 <term><option>-N</option></term>
63510 <listitem>
63511 <para>
63512 A testing delivery process was started using the <option>-N</option> option to suppress any
63513 actual deliveries, but delivery was deferred. At any further delivery attempts,
63514 <option>-N</option> is assumed.
63515 </para>
63516 </listitem></varlistentry>
63517 <varlistentry>
63518 <term><option>-received_protocol</option></term>
63519 <listitem>
63520 <para>
63521 This records the value of the <varname>$received_protocol</varname> variable, which contains
63522 the name of the protocol by which the message was received.
63523 </para>
63524 </listitem></varlistentry>
63525 <varlistentry>
63526 <term><option>-sender_set_untrusted</option></term>
63527 <listitem>
63528 <para>
63529 The envelope sender of this message was set by an untrusted local caller (used
63530 to ensure that the caller is displayed in queue listings).
63531 </para>
63532 </listitem></varlistentry>
63533 <varlistentry>
63534 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
63535 <listitem>
63536 <para>
63537 If a message was scanned by SpamAssassin, this is present. It records the value
63538 of <varname>$spam_score_int</varname>.
63539 </para>
63540 </listitem></varlistentry>
63541 <varlistentry>
63542 <term><option>-tls_certificate_verified</option></term>
63543 <listitem>
63544 <para>
63545 A TLS certificate was received from the client that sent this message, and the
63546 certificate was verified by the server.
63547 </para>
63548 </listitem></varlistentry>
63549 <varlistentry>
63550 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
63551 <listitem>
63552 <para>
63553 When the message was received over an encrypted connection, this records the
63554 name of the cipher suite that was used.
63555 </para>
63556 </listitem></varlistentry>
63557 <varlistentry>
63558 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
63559 <listitem>
63560 <para>
63561 When the message was received over an encrypted connection, and a certificate
63562 was received from the client, this records the Distinguished Name from that
63563 certificate.
63564 </para>
63565 </listitem></varlistentry>
63566 </variablelist>
63567 <para>
63568 Following the options there is a list of those addresses to which the message
63569 is not to be delivered. This set of addresses is initialized from the command
63570 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
63571 is set; otherwise it starts out empty. Whenever a successful delivery is made,
63572 the address is added to this set. The addresses are kept internally as a
63573 balanced binary tree, and it is a representation of that tree which is written
63574 to the spool file. If an address is expanded via an alias or forward file, the
63575 original address is added to the tree when deliveries to all its child
63576 addresses are complete.
63577 </para>
63578 <para>
63579 If the tree is empty, there is a single line in the spool file containing just
63580 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
63581 Y or N, followed by an address. The address is the value for the node of the
63582 tree, and the letters indicate whether the node has a left branch and/or a
63583 right branch attached to it, respectively. If branches exist, they immediately
63584 follow. Here is an example of a three-node tree:
63585 </para>
63586 <literallayout class="monospaced">
63587 YY darcy@austen.fict.example
63588 NN alice@wonderland.fict.example
63589 NN editor@thesaurus.ref.example
63590 </literallayout>
63591 <para>
63592 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
63593 This is a simple list, preceded by a count. It includes all the original
63594 recipients of the message, including those to whom the message has already been
63595 delivered. In the simplest case, the list contains one address per line. For
63596 example:
63597 </para>
63598 <literallayout class="monospaced">
63599 4
63600 editor@thesaurus.ref.example
63601 darcy@austen.fict.example
63602 rdo@foundation
63603 alice@wonderland.fict.example
63604 </literallayout>
63605 <para>
63606 However, when a child address has been added to the top-level addresses as a
63607 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
63608 line is of the following form:
63609 </para>
63610 <literallayout>
63611 &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;
63612 </literallayout>
63613 <para>
63614 The 01 flag bit indicates the presence of the three other fields that follow
63615 the top-level address. Other bits may be used in future to support additional
63616 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
63617 original parent of the <quote>one time</quote> address. The first two fields are the
63618 envelope sender that is associated with this address and its length. If the
63619 length is zero, there is no special envelope sender (there are then two space
63620 characters in the line). A non-empty field can arise from a <command>redirect</command> router
63621 that has an <option>errors_to</option> setting.
63622 </para>
63623 <para>
63624 A blank line separates the envelope and status information from the headers
63625 which follow. A header may occupy several lines of the file, and to save effort
63626 when reading it in, each header is preceded by a number and an identifying
63627 character. The number is the number of characters in the header, including any
63628 embedded newlines and the terminating newline. The character is one of the
63629 following:
63630 </para>
63631 <informaltable frame="none">
63632 <tgroup cols="2" colsep="0" rowsep="0">
63633 <colspec colwidth="50pt" align="left"/>
63634 <colspec colwidth="254pt" align="left"/>
63635 <tbody>
63636 <row>
63637 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
63638 <entry>header in which Exim has no special interest</entry>
63639 </row>
63640 <row>
63641 <entry><literal>B</literal></entry>
63642 <entry><emphasis>Bcc:</emphasis> header</entry>
63643 </row>
63644 <row>
63645 <entry><literal>C</literal></entry>
63646 <entry><emphasis>Cc:</emphasis> header</entry>
63647 </row>
63648 <row>
63649 <entry><literal>F</literal></entry>
63650 <entry><emphasis>From:</emphasis> header</entry>
63651 </row>
63652 <row>
63653 <entry><literal>I</literal></entry>
63654 <entry><emphasis>Message-id:</emphasis> header</entry>
63655 </row>
63656 <row>
63657 <entry><literal>P</literal></entry>
63658 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
63659 </row>
63660 <row>
63661 <entry><literal>R</literal></entry>
63662 <entry><emphasis>Reply-To:</emphasis> header</entry>
63663 </row>
63664 <row>
63665 <entry><literal>S</literal></entry>
63666 <entry><emphasis>Sender:</emphasis> header</entry>
63667 </row>
63668 <row>
63669 <entry><literal>T</literal></entry>
63670 <entry><emphasis>To:</emphasis> header</entry>
63671 </row>
63672 <row>
63673 <entry><literal>*</literal></entry>
63674 <entry>replaced or deleted header</entry>
63675 </row>
63676 </tbody>
63677 </tgroup>
63678 </informaltable>
63679 <para>
63680 Deleted or replaced (rewritten) headers remain in the spool file for debugging
63681 purposes. They are not transmitted when the message is delivered. Here is a
63682 typical set of headers:
63683 </para>
63684 <literallayout class="monospaced">
63685 111P Received: by hobbit.fict.example with local (Exim 4.00)
63686 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
63687 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
63688 038* X-rewrote-sender: bb@hobbit.fict.example
63689 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
63690 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
63691 099* To: alice@wonderland.fict.example, rdo@foundation,
63692 darcy@austen.fict.example, editor@thesaurus.ref.example
63693 104T To: alice@wonderland.fict.example, rdo@foundation.example,
63694 darcy@austen.fict.example, editor@thesaurus.ref.example
63695 038  Date: Fri, 11 May 2001 10:28:59 +0100
63696 </literallayout>
63697 <para>
63698 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
63699 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
63700 unqualified domain <emphasis>foundation</emphasis>.
63701 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
63702 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
63703 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
63704 </para>
63705 </section>
63706 </chapter>
63707
63708 <chapter id="CHID12">
63709 <title>Support for DKIM (DomainKeys Identified Mail)</title>
63710 <titleabbrev>DKIM Support</titleabbrev>
63711 <para>
63712 <indexterm role="concept">
63713 <primary>DKIM</primary>
63714 </indexterm>
63715 </para>
63716 <para>
63717 DKIM is a mechanism by which messages sent by some entity can be provably
63718 linked to a domain which that entity controls.  It permits reputation to
63719 be tracked on a per-domain basis, rather than merely upon source IP address.
63720 DKIM is documented in RFC 4871.
63721 </para>
63722 <para>
63723 Since version 4.70, DKIM support is compiled into Exim by default. It can be
63724 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
63725 </para>
63726 <para>
63727 Exim&#x2019;s DKIM implementation allows to
63728 </para>
63729 <orderedlist numeration="arabic">
63730 <listitem>
63731 <para>
63732 Sign outgoing messages: This function is implemented in the SMTP transport.
63733 It can co-exist with all other Exim features, including transport filters.
63734 </para>
63735 </listitem>
63736 <listitem>
63737 <para>
63738 Verify signatures in incoming messages: This is implemented by an additional
63739 ACL (acl_smtp_dkim), which can be called several times per message, with
63740 different signature contexts.
63741 </para>
63742 </listitem>
63743 </orderedlist>
63744 <para>
63745 In typical Exim style, the verification implementation does not include any
63746 default "policy". Instead it enables you to build your own policy using
63747 Exim&#x2019;s standard controls.
63748 </para>
63749 <para>
63750 Please note that verification of DKIM signatures in incoming mail is turned
63751 on by default for logging purposes. For each signature in incoming email,
63752 exim will log a line displaying the most important signature details, and the
63753 signature status. Here is an example (with line-breaks added for clarity):
63754 </para>
63755 <literallayout class="monospaced">
63756 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
63757     d=facebookmail.com s=q1-2009b
63758     c=relaxed/relaxed a=rsa-sha1
63759     i=@facebookmail.com t=1252484542 [verification succeeded]
63760 </literallayout>
63761 <para>
63762 You might want to turn off DKIM verification processing entirely for internal
63763 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
63764 control modifier. This should typically be done in the RCPT ACL, at points
63765 where you accept mail from relay sources (internal hosts or authenticated
63766 senders).
63767 </para>
63768 <section id="SECID513">
63769 <title>Signing outgoing messages</title>
63770 <para>
63771 <indexterm role="concept">
63772 <primary>DKIM</primary>
63773 <secondary>signing</secondary>
63774 </indexterm>
63775 </para>
63776 <para>
63777 Signing is implemented by setting private options on the SMTP transport.
63778 These options take (expandable) strings as arguments.
63779 </para>
63780 <para>
63781 <indexterm role="option">
63782 <primary><option>dkim_domain</option></primary>
63783 </indexterm>
63784 </para>
63785 <informaltable frame="all">
63786 <tgroup cols="4" colsep="0" rowsep="0">
63787 <colspec colwidth="8*" align="left"/>
63788 <colspec colwidth="6*" align="center"/>
63789 <colspec colwidth="6*" align="center"/>
63790 <colspec colwidth="6*" align="right"/>
63791 <tbody>
63792 <row>
63793 <entry><option>dkim_domain</option></entry>
63794 <entry>Use: <emphasis>smtp</emphasis></entry>
63795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63796 <entry>Default: <emphasis>unset</emphasis></entry>
63797 </row>
63798 </tbody>
63799 </tgroup>
63800 </informaltable>
63801 <para>
63802 MANDATORY:
63803 The domain you want to sign with. The result of this expanded
63804 option is put into the <option>$dkim_domain</option> expansion variable.
63805 </para>
63806 <para>
63807 <indexterm role="option">
63808 <primary><option>dkim_selector</option></primary>
63809 </indexterm>
63810 </para>
63811 <informaltable frame="all">
63812 <tgroup cols="4" colsep="0" rowsep="0">
63813 <colspec colwidth="8*" align="left"/>
63814 <colspec colwidth="6*" align="center"/>
63815 <colspec colwidth="6*" align="center"/>
63816 <colspec colwidth="6*" align="right"/>
63817 <tbody>
63818 <row>
63819 <entry><option>dkim_selector</option></entry>
63820 <entry>Use: <emphasis>smtp</emphasis></entry>
63821 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63822 <entry>Default: <emphasis>unset</emphasis></entry>
63823 </row>
63824 </tbody>
63825 </tgroup>
63826 </informaltable>
63827 <para>
63828 MANDATORY:
63829 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
63830 variable to look up a matching selector. The result is put in the expansion
63831 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
63832 option along with <option>$dkim_domain</option>.
63833 </para>
63834 <para>
63835 <indexterm role="option">
63836 <primary><option>dkim_private_key</option></primary>
63837 </indexterm>
63838 </para>
63839 <informaltable frame="all">
63840 <tgroup cols="4" colsep="0" rowsep="0">
63841 <colspec colwidth="8*" align="left"/>
63842 <colspec colwidth="6*" align="center"/>
63843 <colspec colwidth="6*" align="center"/>
63844 <colspec colwidth="6*" align="right"/>
63845 <tbody>
63846 <row>
63847 <entry><option>dkim_private_key</option></entry>
63848 <entry>Use: <emphasis>smtp</emphasis></entry>
63849 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63850 <entry>Default: <emphasis>unset</emphasis></entry>
63851 </row>
63852 </tbody>
63853 </tgroup>
63854 </informaltable>
63855 <para>
63856 MANDATORY:
63857 This sets the private key to use. You can use the <option>$dkim_domain</option> and
63858 <option>$dkim_selector</option> expansion variables to determine the private key to use.
63859 The result can either
63860 </para>
63861 <itemizedlist>
63862 <listitem>
63863 <para>
63864 be a valid RSA private key in ASCII armor, including line breaks.
63865 </para>
63866 </listitem>
63867 <listitem>
63868 <para>
63869 start with a slash, in which case it is treated as a file that contains
63870 the private key.
63871 </para>
63872 </listitem>
63873 <listitem>
63874 <para>
63875 be "0", "false" or the empty string, in which case the message will not
63876 be signed. This case will not result in an error, even if <option>dkim_strict</option>
63877 is set.
63878 </para>
63879 </listitem>
63880 </itemizedlist>
63881 <para>
63882 <indexterm role="option">
63883 <primary><option>dkim_canon</option></primary>
63884 </indexterm>
63885 </para>
63886 <informaltable frame="all">
63887 <tgroup cols="4" colsep="0" rowsep="0">
63888 <colspec colwidth="8*" align="left"/>
63889 <colspec colwidth="6*" align="center"/>
63890 <colspec colwidth="6*" align="center"/>
63891 <colspec colwidth="6*" align="right"/>
63892 <tbody>
63893 <row>
63894 <entry><option>dkim_canon</option></entry>
63895 <entry>Use: <emphasis>smtp</emphasis></entry>
63896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63897 <entry>Default: <emphasis>unset</emphasis></entry>
63898 </row>
63899 </tbody>
63900 </tgroup>
63901 </informaltable>
63902 <para>
63903 OPTIONAL:
63904 This option sets the canonicalization method used when signing a message.
63905 The DKIM RFC currently supports two methods: "simple" and "relaxed".
63906 The option defaults to "relaxed" when unset. Note: the current implementation
63907 only supports using the same canonicalization method for both headers and body.
63908 </para>
63909 <para>
63910 <indexterm role="option">
63911 <primary><option>dkim_strict</option></primary>
63912 </indexterm>
63913 </para>
63914 <informaltable frame="all">
63915 <tgroup cols="4" colsep="0" rowsep="0">
63916 <colspec colwidth="8*" align="left"/>
63917 <colspec colwidth="6*" align="center"/>
63918 <colspec colwidth="6*" align="center"/>
63919 <colspec colwidth="6*" align="right"/>
63920 <tbody>
63921 <row>
63922 <entry><option>dkim_strict</option></entry>
63923 <entry>Use: <emphasis>smtp</emphasis></entry>
63924 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63925 <entry>Default: <emphasis>unset</emphasis></entry>
63926 </row>
63927 </tbody>
63928 </tgroup>
63929 </informaltable>
63930 <para>
63931 OPTIONAL:
63932 This  option  defines  how  Exim  behaves  when  signing a message that
63933 should be signed fails for some reason.  When the expansion evaluates to
63934 either "1" or "true", Exim will defer. Otherwise Exim will send the message
63935 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
63936 variables here.
63937 </para>
63938 <para>
63939 <indexterm role="option">
63940 <primary><option>dkim_sign_headers</option></primary>
63941 </indexterm>
63942 </para>
63943 <informaltable frame="all">
63944 <tgroup cols="4" colsep="0" rowsep="0">
63945 <colspec colwidth="8*" align="left"/>
63946 <colspec colwidth="6*" align="center"/>
63947 <colspec colwidth="6*" align="center"/>
63948 <colspec colwidth="6*" align="right"/>
63949 <tbody>
63950 <row>
63951 <entry><option>dkim_sign_headers</option></entry>
63952 <entry>Use: <emphasis>smtp</emphasis></entry>
63953 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
63954 <entry>Default: <emphasis>unset</emphasis></entry>
63955 </row>
63956 </tbody>
63957 </tgroup>
63958 </informaltable>
63959 <para>
63960 OPTIONAL:
63961 When set, this option must expand to (or be specified as) a colon-separated
63962 list of header names. Headers with these names will be included in the message
63963 signature. When unspecified, the header names recommended in RFC4871 will be
63964 used.
63965 </para>
63966 </section>
63967 <section id="SECID514">
63968 <title>Verifying DKIM signatures in incoming mail</title>
63969 <para>
63970 <indexterm role="concept">
63971 <primary>DKIM</primary>
63972 <secondary>verification</secondary>
63973 </indexterm>
63974 </para>
63975 <para>
63976 Verification of DKIM signatures in incoming email is implemented via the
63977 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
63978 syntactically(!) correct signature in the incoming message.
63979 </para>
63980 <para>
63981 To evaluate the signature in the ACL a large number of expansion variables
63982 containing the signature status and its details are set up during the
63983 runtime of the ACL.
63984 </para>
63985 <para>
63986 Calling the ACL only for existing signatures is not sufficient to build
63987 more advanced policies. For that reason, the global option
63988 <option>dkim_verify_signers</option>, and a global expansion variable
63989 <option>$dkim_signers</option> exist.
63990 </para>
63991 <para>
63992 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
63993 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
63994 called. It is expanded when the message has been received. At this point,
63995 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
63996 list of signer domains and identities for the message. When
63997 <option>dkim_verify_signers</option> is not specified in the main configuration,
63998 it defaults as:
63999 </para>
64000 <literallayout class="monospaced">
64001 dkim_verify_signers = $dkim_signers
64002 </literallayout>
64003 <para>
64004 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
64005 DKIM signature in the message. Current DKIM verifiers may want to explicitly
64006 call the ACL for known domains or identities. This would be achieved as follows:
64007 </para>
64008 <literallayout class="monospaced">
64009 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
64010 </literallayout>
64011 <para>
64012 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
64013 and "ebay.com", plus all domains and identities that have signatures in the message.
64014 You can also be more creative in constructing your policy. For example:
64015 </para>
64016 <literallayout class="monospaced">
64017 dkim_verify_signers = $sender_address_domain:$dkim_signers
64018 </literallayout>
64019 <para>
64020 If a domain or identity is listed several times in the (expanded) value of
64021 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
64022 </para>
64023 <para>
64024 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
64025 available (from most to least important):
64026 </para>
64027 <variablelist>
64028 <varlistentry>
64029 <term><option>$dkim_cur_signer</option></term>
64030 <listitem>
64031 <para>
64032 The signer that is being evaluated in this ACL run. This can be a domain or
64033 an identity. This is one of the list items from the expanded main option
64034 <option>dkim_verify_signers</option> (see above).
64035 </para>
64036 </listitem></varlistentry>
64037 <varlistentry>
64038 <term><option>$dkim_verify_status</option></term>
64039 <listitem>
64040 <para>
64041 A string describing the general status of the signature. One of
64042 </para>
64043 <itemizedlist>
64044 <listitem>
64045 <para>
64046 <option>none</option>: There is no signature in the message for the current domain or
64047 identity (as reflected by <option>$dkim_cur_signer</option>).
64048 </para>
64049 </listitem>
64050 <listitem>
64051 <para>
64052 <option>invalid</option>: The signature could not be verified due to a processing error.
64053 More detail is available in <option>$dkim_verify_reason</option>.
64054 </para>
64055 </listitem>
64056 <listitem>
64057 <para>
64058 <option>fail</option>: Verification of the signature failed.  More detail is
64059 available in <option>$dkim_verify_reason</option>.
64060 </para>
64061 </listitem>
64062 <listitem>
64063 <para>
64064 <option>pass</option>: The signature passed verification. It is valid.
64065 </para>
64066 </listitem>
64067 </itemizedlist>
64068 </listitem></varlistentry>
64069 <varlistentry>
64070 <term><option>$dkim_verify_reason</option></term>
64071 <listitem>
64072 <para>
64073 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
64074 "fail" or "invalid". One of
64075 </para>
64076 <itemizedlist>
64077 <listitem>
64078 <para>
64079 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
64080 key for the domain could not be retrieved. This may be a temporary problem.
64081 </para>
64082 </listitem>
64083 <listitem>
64084 <para>
64085 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
64086 record for the domain is syntactically invalid.
64087 </para>
64088 </listitem>
64089 <listitem>
64090 <para>
64091 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
64092 body hash does not match the one specified in the signature header. This
64093 means that the message body was modified in transit.
64094 </para>
64095 </listitem>
64096 <listitem>
64097 <para>
64098 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
64099 could not be verified. This may mean that headers were modified,
64100 re-written or otherwise changed in a way which is incompatible with
64101 DKIM verification. It may of course also mean that the signature is forged.
64102 </para>
64103 </listitem>
64104 </itemizedlist>
64105 </listitem></varlistentry>
64106 <varlistentry>
64107 <term><option>$dkim_domain</option></term>
64108 <listitem>
64109 <para>
64110 The signing domain. IMPORTANT: This variable is only populated if there is
64111 an actual signature in the message for the current domain or identity (as
64112 reflected by <option>$dkim_cur_signer</option>).
64113 </para>
64114 </listitem></varlistentry>
64115 <varlistentry>
64116 <term><option>$dkim_identity</option></term>
64117 <listitem>
64118 <para>
64119 The signing identity, if present. IMPORTANT: This variable is only populated
64120 if there is an actual signature in the message for the current domain or
64121 identity (as reflected by <option>$dkim_cur_signer</option>).
64122 </para>
64123 </listitem></varlistentry>
64124 <varlistentry>
64125 <term><option>$dkim_selector</option></term>
64126 <listitem>
64127 <para>
64128 The key record selector string.
64129 </para>
64130 </listitem></varlistentry>
64131 <varlistentry>
64132 <term><option>$dkim_algo</option></term>
64133 <listitem>
64134 <para>
64135 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
64136 </para>
64137 </listitem></varlistentry>
64138 <varlistentry>
64139 <term><option>$dkim_canon_body</option></term>
64140 <listitem>
64141 <para>
64142 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
64143 </para>
64144 </listitem></varlistentry>
64145 <varlistentry>
64146 <term><option>dkim_canon_headers</option></term>
64147 <listitem>
64148 <para>
64149 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
64150 </para>
64151 </listitem></varlistentry>
64152 <varlistentry>
64153 <term><option>$dkim_copiedheaders</option></term>
64154 <listitem>
64155 <para>
64156 A transcript of headers and their values which are included in the signature
64157 (copied from the &#x2019;z=&#x2019; tag of the signature).
64158 </para>
64159 </listitem></varlistentry>
64160 <varlistentry>
64161 <term><option>$dkim_bodylength</option></term>
64162 <listitem>
64163 <para>
64164 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
64165 limit was set by the signer, "9999999999999" is returned. This makes sure
64166 that this variable always expands to an integer value.
64167 </para>
64168 </listitem></varlistentry>
64169 <varlistentry>
64170 <term><option>$dkim_created</option></term>
64171 <listitem>
64172 <para>
64173 UNIX timestamp reflecting the date and time when the signature was created.
64174 When this was not specified by the signer, "0" is returned.
64175 </para>
64176 </listitem></varlistentry>
64177 <varlistentry>
64178 <term><option>$dkim_expires</option></term>
64179 <listitem>
64180 <para>
64181 UNIX timestamp reflecting the date and time when the signer wants the
64182 signature to be treated as "expired". When this was not specified by the
64183 signer, "9999999999999" is returned. This makes it possible to do useful
64184 integer size comparisons against this value.
64185 </para>
64186 </listitem></varlistentry>
64187 <varlistentry>
64188 <term><option>$dkim_headernames</option></term>
64189 <listitem>
64190 <para>
64191 A colon-separated list of names of headers included in the signature.
64192 </para>
64193 </listitem></varlistentry>
64194 <varlistentry>
64195 <term><option>$dkim_key_testing</option></term>
64196 <listitem>
64197 <para>
64198 "1" if the key record has the "testing" flag set, "0" if not.
64199 </para>
64200 </listitem></varlistentry>
64201 <varlistentry>
64202 <term><option>$nosubdomains</option></term>
64203 <listitem>
64204 <para>
64205 "1" if the key record forbids subdomaining, "0" otherwise.
64206 </para>
64207 </listitem></varlistentry>
64208 <varlistentry>
64209 <term><option>$dkim_key_srvtype</option></term>
64210 <listitem>
64211 <para>
64212 Service type (tag s=) from the key record. Defaults to "*" if not specified
64213 in the key record.
64214 </para>
64215 </listitem></varlistentry>
64216 <varlistentry>
64217 <term><option>$dkim_key_granularity</option></term>
64218 <listitem>
64219 <para>
64220 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
64221 in the key record.
64222 </para>
64223 </listitem></varlistentry>
64224 <varlistentry>
64225 <term><option>$dkim_key_notes</option></term>
64226 <listitem>
64227 <para>
64228 Notes from the key record (tag n=).
64229 </para>
64230 </listitem></varlistentry>
64231 </variablelist>
64232 <para>
64233 In addition, two ACL conditions are provided:
64234 </para>
64235 <variablelist>
64236 <varlistentry>
64237 <term><option>dkim_signers</option></term>
64238 <listitem>
64239 <para>
64240 ACL condition that checks a colon-separated list of domains or identities
64241 for a match against the domain or identity that the ACL is currently verifying
64242 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
64243 verb to a group of domains or identities. For example:
64244 </para>
64245 <literallayout class="monospaced">
64246 # Warn when Mail purportedly from GMail has no signature at all
64247 warn log_message = GMail sender without DKIM signature
64248      sender_domains = gmail.com
64249      dkim_signers = gmail.com
64250      dkim_status = none
64251 </literallayout>
64252 </listitem></varlistentry>
64253 <varlistentry>
64254 <term><option>dkim_status</option></term>
64255 <listitem>
64256 <para>
64257 ACL condition that checks a colon-separated list of possible DKIM verification
64258 results agains the actual result of verification. This is typically used
64259 to restrict an ACL verb to a list of verification outcomes, for example:
64260 </para>
64261 <literallayout class="monospaced">
64262 deny message = Mail from Paypal with invalid/missing signature
64263      sender_domains = paypal.com:paypal.de
64264      dkim_signers = paypal.com:paypal.de
64265      dkim_status = none:invalid:fail
64266 </literallayout>
64267 <para>
64268 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
64269 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
64270 for more information of what they mean.
64271 </para>
64272 </listitem></varlistentry>
64273 </variablelist>
64274 </section>
64275 </chapter>
64276
64277 <chapter id="CHID13">
64278 <title>Adding new drivers or lookup types</title>
64279 <titleabbrev>Adding drivers or lookups</titleabbrev>
64280 <para>
64281 <indexterm role="concept">
64282 <primary>adding drivers</primary>
64283 </indexterm>
64284 <indexterm role="concept">
64285 <primary>new drivers, adding</primary>
64286 </indexterm>
64287 <indexterm role="concept">
64288 <primary>drivers</primary>
64289 <secondary>adding new</secondary>
64290 </indexterm>
64291 The following actions have to be taken in order to add a new router, transport,
64292 authenticator, or lookup type to Exim:
64293 </para>
64294 <orderedlist numeration="arabic">
64295 <listitem>
64296 <para>
64297 Choose a name for the driver or lookup type that does not conflict with any
64298 existing name; I will use <quote>newdriver</quote> in what follows.
64299 </para>
64300 </listitem>
64301 <listitem>
64302 <para>
64303 Add to <filename>src/EDITME</filename> the line:
64304 </para>
64305 <literallayout>
64306 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
64307 </literallayout>
64308 <para>
64309 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
64310 code is not to be included in the binary by default, comment this line out. You
64311 should also add any relevant comments about the driver or lookup type.
64312 </para>
64313 </listitem>
64314 <listitem>
64315 <para>
64316 Add to <filename>src/config.h.defaults</filename> the line:
64317 </para>
64318 <literallayout class="monospaced">
64319 #define &lt;type&gt;_NEWDRIVER
64320 </literallayout>
64321 </listitem>
64322 <listitem>
64323 <para>
64324 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
64325 and create a table entry as is done for all the other drivers and lookup types.
64326 </para>
64327 </listitem>
64328 <listitem>
64329 <para>
64330 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
64331 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
64332 driver or lookup type and add it to the definition of OBJ.
64333 </para>
64334 </listitem>
64335 <listitem>
64336 <para>
64337 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
64338 <filename>src</filename>.
64339 </para>
64340 </listitem>
64341 <listitem>
64342 <para>
64343 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
64344 as for other drivers and lookups.
64345 </para>
64346 </listitem>
64347 </orderedlist>
64348 <para>
64349 Then all you need to do is write the code! A good way to start is to make a
64350 proforma by copying an existing module of the same type, globally changing all
64351 occurrences of the name, and cutting out most of the code. Note that any
64352 options you create must be listed in alphabetical order, because the tables are
64353 searched using a binary chop procedure.
64354 </para>
64355 <para>
64356 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
64357 the interface that is expected.
64358 </para>
64359 <?sdop
64360   format="newpage"
64361   foot_right_recto="&chaptertitle;"
64362   foot_right_verso="&chaptertitle;"
64363 ?>
64364 </chapter>
64365
64366 <index role="option">
64367 <title>Options index</title>
64368 </index>
64369
64370 <index role="variable">
64371 <title>Variables index</title>
64372 </index>
64373
64374 <index role="concept">
64375 <title>Concept index</title>
64376 </index>
64377
64378 </book>