Fix typos in CVE text
[exim-website.git] / docbook / 4.70 / 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>5 November 2009</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19   <revnumber>4.70</revnumber>
20   <date>5 November 2009</date>
21   <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2009</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.70 of Exim.
202 Substantive changes from the 4.69 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-users@exim.org</emphasis></entry>
372 <entry>General discussion list</entry>
373 </row>
374 <row>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>Discussion of bugs, enhancements, etc.</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-future@exim.org</emphasis></entry>
384 <entry>Discussion of long-term development</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 revisionflag="changed">
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 </para>
2011 <para>
2012 <indexterm role="concept">
2013 <primary>hints database</primary>
2014 </indexterm>
2015 Exim makes a note in its hints database, and whenever a successful
2016 SMTP delivery has happened, it looks to see if any other messages are waiting
2017 for the same host. If any are found, they are sent over the same SMTP
2018 connection, subject to a configuration limit as to the maximum number in any
2019 one connection.
2020 </para>
2021 </section>
2022 <section id="SECID21">
2023 <title>Permanent delivery failure</title>
2024 <para>
2025 <indexterm role="concept">
2026 <primary>delivery</primary>
2027 <secondary>permanent failure</secondary>
2028 </indexterm>
2029 <indexterm role="concept">
2030 <primary>bounce message</primary>
2031 <secondary>when generated</secondary>
2032 </indexterm>
2033 When a message cannot be delivered to some or all of its intended recipients, a
2034 bounce message is generated. Temporary delivery failures turn into permanent
2035 errors when their timeout expires. All the addresses that fail in a given
2036 delivery attempt are listed in a single message. If the original message has
2037 many recipients, it is possible for some addresses to fail in one delivery
2038 attempt and others to fail subsequently, giving rise to more than one bounce
2039 message. The wording of bounce messages can be customized by the administrator.
2040 See chapter <xref linkend="CHAPemsgcust"/> for details.
2041 </para>
2042 <para>
2043 <indexterm role="concept">
2044 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2045 </indexterm>
2046 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2047 failed addresses, for the benefit of programs that try to analyse such messages
2048 automatically.
2049 </para>
2050 <para>
2051 <indexterm role="concept">
2052 <primary>bounce message</primary>
2053 <secondary>recipient of</secondary>
2054 </indexterm>
2055 A bounce message is normally sent to the sender of the original message, as
2056 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2057 address given in the MAIL command. However, when an address is expanded via a
2058 forward or alias file, an alternative address can be specified for delivery
2059 failures of the generated addresses. For a mailing list expansion (see section
2060 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2061 of the list.
2062 </para>
2063 </section>
2064 <section id="SECID22">
2065 <title>Failures to deliver bounce messages</title>
2066 <para>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>failure to deliver</secondary>
2070 </indexterm>
2071 If a bounce message (either locally generated or received from a remote host)
2072 itself suffers a permanent delivery failure, the message is left on the queue,
2073 but it is frozen, awaiting the attention of an administrator. There are options
2074 that can be used to make Exim discard such failed messages, or to keep them
2075 for only a short time (see <option>timeout_frozen_after</option> and
2076 <option>ignore_bounce_errors_after</option>).
2077 </para>
2078 </section>
2079 </chapter>
2080
2081 <chapter id="CHID3">
2082 <title>Building and installing Exim</title>
2083 <para>
2084 <indexterm role="concept" id="IIDbuex" class="startofrange">
2085 <primary>building Exim</primary>
2086 </indexterm>
2087 </para>
2088 <section id="SECID23">
2089 <title>Unpacking</title>
2090 <para>
2091 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2092 creates a directory with the name of the current release (for example,
2093 <filename>exim-4.70</filename>) into which the following files are placed:
2094 </para>
2095 <informaltable frame="none">
2096 <tgroup cols="2" colsep="0" rowsep="0">
2097 <colspec colwidth="140pt" align="left"/>
2098 <colspec colwidth="254pt" align="left"/>
2099 <tbody>
2100 <row>
2101 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2102 <entry>contains some acknowledgments</entry>
2103 </row>
2104 <row>
2105 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2106 <entry>contains a reference to where changes are documented</entry>
2107 </row>
2108 <row>
2109 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2110 <entry>the GNU General Public Licence</entry>
2111 </row>
2112 <row>
2113 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2114 <entry>top-level make file</entry>
2115 </row>
2116 <row>
2117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2118 <entry>conditions for the use of Exim</entry>
2119 </row>
2120 <row>
2121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2122 <entry>list of files, directories and simple build instructions</entry>
2123 </row>
2124 </tbody>
2125 </tgroup>
2126 </informaltable>
2127 <para>
2128 Other files whose names begin with <filename>README</filename> may also be present. The
2129 following subdirectories are created:
2130 </para>
2131 <informaltable frame="none">
2132 <tgroup cols="2" colsep="0" rowsep="0">
2133 <colspec colwidth="140pt" align="left"/>
2134 <colspec colwidth="254pt" align="left"/>
2135 <tbody>
2136 <row>
2137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2138 <entry>an empty directory for local configuration files</entry>
2139 </row>
2140 <row>
2141 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2142 <entry>OS-specific files</entry>
2143 </row>
2144 <row>
2145 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2146 <entry>documentation files</entry>
2147 </row>
2148 <row>
2149 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2150 <entry>source files for the Exim monitor</entry>
2151 </row>
2152 <row>
2153 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2154 <entry>scripts used in the build process</entry>
2155 </row>
2156 <row>
2157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2158 <entry>remaining source files</entry>
2159 </row>
2160 <row>
2161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2162 <entry>independent utilities</entry>
2163 </row>
2164 </tbody>
2165 </tgroup>
2166 </informaltable>
2167 <para>
2168 The main utility programs are contained in the <filename>src</filename> directory, and are built
2169 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2170 that may be useful to some sites.
2171 </para>
2172 </section>
2173 <section id="SECID24">
2174 <title>Multiple machine architectures and operating systems</title>
2175 <para>
2176 <indexterm role="concept">
2177 <primary>building Exim</primary>
2178 <secondary>multiple OS/architectures</secondary>
2179 </indexterm>
2180 The building process for Exim is arranged to make it easy to build binaries for
2181 a number of different architectures and operating systems from the same set of
2182 source files. Compilation does not take place in the <filename>src</filename> directory.
2183 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2184 system.
2185 <indexterm role="concept">
2186 <primary>symbolic link</primary>
2187 <secondary>to build directory</secondary>
2188 </indexterm>
2189 Symbolic links to the sources are installed in this directory, which is where
2190 the actual building takes place. In most cases, Exim can discover the machine
2191 architecture and operating system for itself, but the defaults can be
2192 overridden if necessary.
2193 </para>
2194 </section>
2195 <section id="SECTpcre">
2196 <title>PCRE library</title>
2197 <para>
2198 <indexterm role="concept">
2199 <primary>PCRE library</primary>
2200 </indexterm>
2201 Exim no longer has an embedded PCRE library as the vast majority of
2202 modern systems include PCRE as a system library, although you may need
2203 to install the PCRE or PCRE development package for your operating
2204 system. If your system has a normal PCRE installation the Exim build
2205 process will need no further configuration. If the library or the
2206 headers are in an unusual location you will need to set the PCRE_LIBS
2207 and INCLUDE directives appropriately. 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 </para>
2211 </section>
2212 <section id="SECTdb">
2213 <title>DBM libraries</title>
2214 <para>
2215 <indexterm role="concept">
2216 <primary>DBM libraries</primary>
2217 <secondary>discussion of</secondary>
2218 </indexterm>
2219 <indexterm role="concept">
2220 <primary>hints database</primary>
2221 <secondary>DBM files used for</secondary>
2222 </indexterm>
2223 Even if you do not use any DBM files in your configuration, Exim still needs a
2224 DBM library in order to operate, because it uses indexed files for its hints
2225 databases. Unfortunately, there are a number of DBM libraries in existence, and
2226 different operating systems often have different ones installed.
2227 </para>
2228 <para>
2229 <indexterm role="concept">
2230 <primary>Solaris</primary>
2231 <secondary>DBM library for</secondary>
2232 </indexterm>
2233 <indexterm role="concept">
2234 <primary>IRIX, DBM library for</primary>
2235 </indexterm>
2236 <indexterm role="concept">
2237 <primary>BSD, DBM library for</primary>
2238 </indexterm>
2239 <indexterm role="concept">
2240 <primary>Linux, DBM library for</primary>
2241 </indexterm>
2242 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2243 Linux distribution, the DBM configuration should happen automatically, and you
2244 may be able to ignore this section. Otherwise, you may have to learn more than
2245 you would like about DBM libraries from what follows.
2246 </para>
2247 <para>
2248 <indexterm role="concept">
2249 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2250 </indexterm>
2251 Licensed versions of Unix normally contain a library of DBM functions operating
2252 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2253 versions of Unix seem to vary in what they contain as standard. In particular,
2254 some early versions of Linux have no default DBM library, and different
2255 distributors have chosen to bundle different libraries with their packaged
2256 versions. However, the more recent releases seem to have standardized on the
2257 Berkeley DB library.
2258 </para>
2259 <para>
2260 Different DBM libraries have different conventions for naming the files they
2261 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2262 possibilities:
2263 </para>
2264 <orderedlist numeration="arabic">
2265 <listitem>
2266 <para>
2267 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2268 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2269 </para>
2270 </listitem>
2271 <listitem>
2272 <para>
2273 <indexterm role="concept">
2274 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2275 </indexterm>
2276 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2277 compatibility interface it makes two different hard links to it with names
2278 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2279 file name is used unmodified.
2280 </para>
2281 </listitem>
2282 <listitem>
2283 <para>
2284 <indexterm role="concept">
2285 <primary>Berkeley DB library</primary>
2286 </indexterm>
2287 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2288 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2289 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2290 </para>
2291 </listitem>
2292 <listitem>
2293 <para>
2294 If the Berkeley package is used in its native mode, it operates on a single
2295 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2296 the traditional <emphasis>ndbm</emphasis> interface.
2297 </para>
2298 </listitem>
2299 <listitem>
2300 <para>
2301 To complicate things further, there are several very different versions of the
2302 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2303 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2304 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2305 versions of Berkeley DB can be obtained from
2306 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2307 </para>
2308 </listitem>
2309 <listitem>
2310 <para>
2311 <indexterm role="concept">
2312 <primary><emphasis>tdb</emphasis> DBM library</primary>
2313 </indexterm>
2314 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2315 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2316 operates on a single file.
2317 </para>
2318 </listitem>
2319 </orderedlist>
2320 <para>
2321 <indexterm role="concept">
2322 <primary>USE_DB</primary>
2323 </indexterm>
2324 <indexterm role="concept">
2325 <primary>DBM libraries</primary>
2326 <secondary>configuration for building</secondary>
2327 </indexterm>
2328 Exim and its utilities can be compiled to use any of these interfaces. In order
2329 to use any version of the Berkeley DB package in native mode, you must set
2330 USE_DB in an appropriate configuration file (typically
2331 <filename>Local/Makefile</filename>). For example:
2332 </para>
2333 <literallayout class="monospaced">
2334 USE_DB=yes
2335 </literallayout>
2336 <para>
2337 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2338 error is diagnosed if you set more than one of these.
2339 </para>
2340 <para>
2341 At the lowest level, the build-time configuration sets none of these options,
2342 thereby assuming an interface of type (1). However, some operating system
2343 configuration files (for example, those for the BSD operating systems and
2344 Linux) assume type (4) by setting USE_DB as their default, and the
2345 configuration files for Cygwin set USE_GDBM. Anything you set in
2346 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2347 </para>
2348 <para>
2349 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2350 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2351 in one of these lines:
2352 </para>
2353 <literallayout class="monospaced">
2354 DBMLIB = -ldb
2355 DBMLIB = -ltdb
2356 </literallayout>
2357 <para>
2358 Settings like that will work if the DBM library is installed in the standard
2359 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2360 the default path. You may need to set INCLUDE to specify where the header
2361 file is, and to specify the path to the library more fully in DBMLIB, as in
2362 this example:
2363 </para>
2364 <literallayout class="monospaced">
2365 INCLUDE=-I/usr/local/include/db-4.1
2366 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2367 </literallayout>
2368 <para>
2369 There is further detailed discussion about the various DBM libraries in the
2370 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2371 </para>
2372 </section>
2373 <section id="SECID25">
2374 <title>Pre-building configuration</title>
2375 <para>
2376 <indexterm role="concept">
2377 <primary>building Exim</primary>
2378 <secondary>pre-building configuration</secondary>
2379 </indexterm>
2380 <indexterm role="concept">
2381 <primary>configuration for building Exim</primary>
2382 </indexterm>
2383 <indexterm role="concept">
2384 <primary><filename>Local/Makefile</filename></primary>
2385 </indexterm>
2386 <indexterm role="concept">
2387 <primary><filename>src/EDITME</filename></primary>
2388 </indexterm>
2389 Before building Exim, a local configuration file that specifies options
2390 independent of any operating system has to be created with the name
2391 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2392 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2393 therein. These descriptions are therefore not repeated here. If you are
2394 building Exim for the first time, the simplest thing to do is to copy
2395 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2396 </para>
2397 <para>
2398 There are three settings that you must supply, because Exim will not build
2399 without them. They are the location of the run time configuration file
2400 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2401 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2402 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2403 a colon-separated list of file names; Exim uses the first of them that exists.
2404 </para>
2405 <para>
2406 There are a few other parameters that can be specified either at build time or
2407 at run time, to enable the same binary to be used on a number of different
2408 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2409 directory (if not within the spool directory) are fixed, it is recommended that
2410 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2411 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2412 be logged.
2413 </para>
2414 <para>
2415 <indexterm role="concept">
2416 <primary>content scanning</primary>
2417 <secondary>specifying at build time</secondary>
2418 </indexterm>
2419 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2420 access control lists are not compiled by default. If you want to include these
2421 facilities, you need to set
2422 </para>
2423 <literallayout class="monospaced">
2424 WITH_CONTENT_SCAN=yes
2425 </literallayout>
2426 <para>
2427 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2428 chapter <xref linkend="CHAPexiscan"/>.
2429 </para>
2430 <para>
2431 <indexterm role="concept">
2432 <primary><filename>Local/eximon.conf</filename></primary>
2433 </indexterm>
2434 <indexterm role="concept">
2435 <primary><filename>exim_monitor/EDITME</filename></primary>
2436 </indexterm>
2437 If you are going to build the Exim monitor, a similar configuration process is
2438 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2439 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2440 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2441 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2442 </para>
2443 <para>
2444 This is all the configuration that is needed in straightforward cases for known
2445 operating systems. However, the building process is set up so that it is easy
2446 to override options that are set by default or by operating-system-specific
2447 configuration files, for example to change the name of the C compiler, which
2448 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2449 do this.
2450 </para>
2451 </section>
2452 <section id="SECID26">
2453 <title>Support for iconv()</title>
2454 <para>
2455 <indexterm role="concept">
2456 <primary><function>iconv()</function> support</primary>
2457 </indexterm>
2458 <indexterm role="concept">
2459 <primary>RFC 2047</primary>
2460 </indexterm>
2461 The contents of header lines in messages may be encoded according to the rules
2462 described RFC 2047. This makes it possible to transmit characters that are not
2463 in the ASCII character set, and to label them as being in a particular
2464 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2465 mechanism, it decodes them, and translates them into a specified character set
2466 (default ISO-8859-1). The translation is possible only if the operating system
2467 supports the <function>iconv()</function> function.
2468 </para>
2469 <para>
2470 However, some of the operating systems that supply <function>iconv()</function> do not support
2471 very many conversions. The GNU <option>libiconv</option> library (available from
2472 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2473 systems to remedy this deficiency, as well as on systems that do not supply
2474 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2475 </para>
2476 <literallayout class="monospaced">
2477 HAVE_ICONV=yes
2478 </literallayout>
2479 <para>
2480 to your <filename>Local/Makefile</filename> and rebuild Exim.
2481 </para>
2482 </section>
2483 <section id="SECTinctlsssl">
2484 <title>Including TLS/SSL encryption support</title>
2485 <para>
2486 <indexterm role="concept">
2487 <primary>TLS</primary>
2488 <secondary>including support for TLS</secondary>
2489 </indexterm>
2490 <indexterm role="concept">
2491 <primary>encryption</primary>
2492 <secondary>including support for</secondary>
2493 </indexterm>
2494 <indexterm role="concept">
2495 <primary>SUPPORT_TLS</primary>
2496 </indexterm>
2497 <indexterm role="concept">
2498 <primary>OpenSSL</primary>
2499 <secondary>building Exim with</secondary>
2500 </indexterm>
2501 <indexterm role="concept">
2502 <primary>GnuTLS</primary>
2503 <secondary>building Exim with</secondary>
2504 </indexterm>
2505 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2506 command as per RFC 2487. It can also support legacy clients that expect to
2507 start a TLS session immediately on connection to a non-standard port (see the
2508 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2509 line option).
2510 </para>
2511 <para>
2512 If you want to build Exim with TLS support, you must first install either the
2513 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2514 implementing SSL.
2515 </para>
2516 <para>
2517 If OpenSSL is installed, you should set
2518 </para>
2519 <literallayout class="monospaced">
2520 SUPPORT_TLS=yes
2521 TLS_LIBS=-lssl -lcrypto
2522 </literallayout>
2523 <para>
2524 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2525 OpenSSL library and include files. For example:
2526 </para>
2527 <literallayout class="monospaced">
2528 SUPPORT_TLS=yes
2529 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2530 TLS_INCLUDE=-I/usr/local/openssl/include/
2531 </literallayout>
2532 <para>
2533 <indexterm role="concept">
2534 <primary>USE_GNUTLS</primary>
2535 </indexterm>
2536 If GnuTLS is installed, you should set
2537 </para>
2538 <literallayout class="monospaced">
2539 SUPPORT_TLS=yes
2540 USE_GNUTLS=yes
2541 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2542 </literallayout>
2543 <para>
2544 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2545 library and include files. For example:
2546 </para>
2547 <literallayout class="monospaced">
2548 SUPPORT_TLS=yes
2549 USE_GNUTLS=yes
2550 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2551 TLS_INCLUDE=-I/usr/gnu/include
2552 </literallayout>
2553 <para>
2554 You do not need to set TLS_INCLUDE if the relevant directory is already
2555 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2556 given in chapter <xref linkend="CHAPTLS"/>.
2557 </para>
2558 </section>
2559 <section id="SECID27">
2560 <title>Use of tcpwrappers</title>
2561 <para>
2562 <indexterm role="concept">
2563 <primary>tcpwrappers, building Exim to support</primary>
2564 </indexterm>
2565 <indexterm role="concept">
2566 <primary>USE_TCP_WRAPPERS</primary>
2567 </indexterm>
2568 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2569 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2570 alternative to Exim&#x2019;s own checking facilities for installations that are
2571 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2572 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2573 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2574 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2575 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2576 you might have
2577 </para>
2578 <literallayout class="monospaced">
2579 USE_TCP_WRAPPERS=yes
2580 CFLAGS=-O -I/usr/local/include
2581 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2582 </literallayout>
2583 <para>
2584 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2585 <quote>exim</quote>. For example, the line
2586 </para>
2587 <literallayout class="monospaced">
2588 exim : LOCAL  192.168.1.  .friendly.domain.example
2589 </literallayout>
2590 <para>
2591 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2592 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2593 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2594 further details.
2595 </para>
2596 </section>
2597 <section id="SECID28">
2598 <title>Including support for IPv6</title>
2599 <para>
2600 <indexterm role="concept">
2601 <primary>IPv6</primary>
2602 <secondary>including support for</secondary>
2603 </indexterm>
2604 Exim contains code for use on systems that have IPv6 support. Setting
2605 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2606 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2607 where the IPv6 support is not fully integrated into the normal include and
2608 library files.
2609 </para>
2610 <para>
2611 Two different types of DNS record for handling IPv6 addresses have been
2612 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2613 currently seen as the mainstream. Another record type called A6 was proposed
2614 as better than AAAA because it had more flexibility. However, it was felt to be
2615 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2616 if anyone is actually using A6 records. Exim has support for A6 records, but
2617 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2618 support has not been tested for some time.
2619 </para>
2620 </section>
2621 <section id="SECID29">
2622 <title>The building process</title>
2623 <para>
2624 <indexterm role="concept">
2625 <primary>build directory</primary>
2626 </indexterm>
2627 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2628 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2629 operating system types, and creates a build directory if one does not exist.
2630 For example, on a Sun system running Solaris 8, the directory
2631 <filename>build-SunOS5-5.8-sparc</filename> is created.
2632 <indexterm role="concept">
2633 <primary>symbolic link</primary>
2634 <secondary>to source files</secondary>
2635 </indexterm>
2636 Symbolic links to relevant source files are installed in the build directory.
2637 </para>
2638 <para>
2639 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2640 building process fails if it is set.
2641 </para>
2642 <para>
2643 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2644 a make file inside the build directory, using the configuration files from the
2645 <filename>Local</filename> directory. The new make file is then passed to another instance of
2646 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2647 then compiling and linking the binaries for the Exim monitor (if configured), a
2648 number of utility programs, and finally Exim itself. The command <literal>make
2649 makefile</literal> can be used to force a rebuild of the make file in the build
2650 directory, should this ever be necessary.
2651 </para>
2652 <para>
2653 If you have problems building Exim, check for any comments there may be in the
2654 <filename>README</filename> file concerning your operating system, and also take a look at the
2655 FAQ, where some common problems are covered.
2656 </para>
2657 </section>
2658 <section id="SECID283">
2659 <title>Output from <quote>make</quote></title>
2660 <para>
2661 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2662 unreadable, because these lines can be very long. For this reason, the normal
2663 output is suppressed by default, and instead output similar to that which
2664 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2665 each module that is being compiled or linked. However, it is still possible to
2666 get the full output, by calling <emphasis>make</emphasis> like this:
2667 </para>
2668 <literallayout class="monospaced">
2669 FULLECHO='' make -e
2670 </literallayout>
2671 <para>
2672 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2673 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2674 given in addition to the short output.
2675 </para>
2676 </section>
2677 <section id="SECToverride">
2678 <title>Overriding build-time options for Exim</title>
2679 <para>
2680 <indexterm role="concept">
2681 <primary>build-time options, overriding</primary>
2682 </indexterm>
2683 The main make file that is created at the beginning of the building process
2684 consists of the concatenation of a number of files which set configuration
2685 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2686 more than once, the last setting overrides any previous ones. This provides a
2687 convenient way of overriding defaults. The files that are concatenated are, in
2688 order:
2689 </para>
2690 <literallayout>
2691 <filename>OS/Makefile-Default</filename>
2692 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2693 <filename>Local/Makefile</filename>
2694 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2695 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2696 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2697 <filename>OS/Makefile-Base</filename>
2698 </literallayout>
2699 <para>
2700 <indexterm role="concept">
2701 <primary><filename>Local/Makefile</filename></primary>
2702 </indexterm>
2703 <indexterm role="concept">
2704 <primary>building Exim</primary>
2705 <secondary>operating system type</secondary>
2706 </indexterm>
2707 <indexterm role="concept">
2708 <primary>building Exim</primary>
2709 <secondary>architecture type</secondary>
2710 </indexterm>
2711 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2712 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2713 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2714 and are often not needed.
2715 </para>
2716 <para>
2717 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2718 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2719 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2720 values are used, thereby providing a means of forcing particular settings.
2721 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2722 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2723 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2724 that Exim expects. You can run these scripts directly from the shell in order
2725 to find out what values are being used on your system.
2726 </para>
2727 <para>
2728 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2729 therein. Some (but not all) are mentioned below. If there is something that
2730 needs changing, review the contents of this file and the contents of the make
2731 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2732 default values are.
2733 </para>
2734 <para>
2735 <indexterm role="concept">
2736 <primary>building Exim</primary>
2737 <secondary>overriding default settings</secondary>
2738 </indexterm>
2739 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2740 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2741 need to change the original files. Instead, you should make the changes by
2742 putting the new values in an appropriate <filename>Local</filename> file. For example,
2743 <indexterm role="concept">
2744 <primary>Tru64-Unix build-time settings</primary>
2745 </indexterm>
2746 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2747 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2748 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2749 called with the option <option>-std1</option>, to make it recognize some of the features of
2750 Standard C that Exim uses. (Most other compilers recognize Standard C by
2751 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2752 containing the lines
2753 </para>
2754 <literallayout class="monospaced">
2755 CC=cc
2756 CFLAGS=-std1
2757 </literallayout>
2758 <para>
2759 If you are compiling for just one operating system, it may be easier to put
2760 these lines directly into <filename>Local/Makefile</filename>.
2761 </para>
2762 <para>
2763 Keeping all your local configuration settings separate from the distributed
2764 files makes it easy to transfer them to new versions of Exim simply by copying
2765 the contents of the <filename>Local</filename> directory.
2766 </para>
2767 <para>
2768 <indexterm role="concept">
2769 <primary>NIS lookup type</primary>
2770 <secondary>including support for</secondary>
2771 </indexterm>
2772 <indexterm role="concept">
2773 <primary>NIS+ lookup type</primary>
2774 <secondary>including support for</secondary>
2775 </indexterm>
2776 <indexterm role="concept">
2777 <primary>LDAP</primary>
2778 <secondary>including support for</secondary>
2779 </indexterm>
2780 <indexterm role="concept">
2781 <primary>lookup</primary>
2782 <secondary>inclusion in binary</secondary>
2783 </indexterm>
2784 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2785 lookup, but not all systems have these components installed, so the default is
2786 not to include the relevant code in the binary. All the different kinds of file
2787 and database lookup that Exim supports are implemented as separate code modules
2788 which are included only if the relevant compile-time options are set. In the
2789 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2790 </para>
2791 <literallayout class="monospaced">
2792 LOOKUP_LDAP=yes
2793 LOOKUP_NIS=yes
2794 LOOKUP_NISPLUS=yes
2795 </literallayout>
2796 <para>
2797 and similar settings apply to the other lookup types. They are all listed in
2798 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2799 libraries need to be installed before compiling Exim.
2800 <indexterm role="concept">
2801 <primary>cdb</primary>
2802 <secondary>including support for</secondary>
2803 </indexterm>
2804 However, there are some optional lookup types (such as cdb) for which
2805 the code is entirely contained within Exim, and no external include
2806 files or libraries are required. When a lookup type is not included in the
2807 binary, attempts to configure Exim to use it cause run time configuration
2808 errors.
2809 </para>
2810 <para>
2811 <indexterm role="concept">
2812 <primary>Perl</primary>
2813 <secondary>including support for</secondary>
2814 </indexterm>
2815 Exim can be linked with an embedded Perl interpreter, allowing Perl
2816 subroutines to be called during string expansion. To enable this facility,
2817 </para>
2818 <literallayout class="monospaced">
2819 EXIM_PERL=perl.o
2820 </literallayout>
2821 <para>
2822 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2823 chapter <xref linkend="CHAPperl"/>.
2824 </para>
2825 <para>
2826 <indexterm role="concept">
2827 <primary>X11 libraries, location of</primary>
2828 </indexterm>
2829 The location of the X11 libraries is something that varies a lot between
2830 operating systems, and there may be different versions of X11 to cope
2831 with. Exim itself makes no use of X11, but if you are compiling the Exim
2832 monitor, the X11 libraries must be available.
2833 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2834 </para>
2835 <literallayout class="monospaced">
2836 X11=/usr/X11R6
2837 XINCLUDE=-I$(X11)/include
2838 XLFLAGS=-L$(X11)/lib
2839 </literallayout>
2840 <para>
2841 These are overridden in some of the operating-system configuration files. For
2842 example, in <filename>OS/Makefile-SunOS5</filename> there is
2843 </para>
2844 <literallayout class="monospaced">
2845 X11=/usr/openwin
2846 XINCLUDE=-I$(X11)/include
2847 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2848 </literallayout>
2849 <para>
2850 If you need to override the default setting for your operating system, place a
2851 definition of all three of these variables into your
2852 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2853 </para>
2854 <para>
2855 <indexterm role="concept">
2856 <primary>EXTRALIBS</primary>
2857 </indexterm>
2858 If you need to add any extra libraries to the link steps, these can be put in a
2859 variable called EXTRALIBS, which appears in all the link commands, but by
2860 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2861 command for linking the main Exim binary, and not for any associated utilities.
2862 </para>
2863 <para>
2864 <indexterm role="concept">
2865 <primary>DBM libraries</primary>
2866 <secondary>configuration for building</secondary>
2867 </indexterm>
2868 There is also DBMLIB, which appears in the link commands for binaries that
2869 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2870 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2871 binary, and which can be used, for example, to include additional X11
2872 libraries.
2873 </para>
2874 <para>
2875 <indexterm role="concept">
2876 <primary>configuration file</primary>
2877 <secondary>editing</secondary>
2878 </indexterm>
2879 The make file copes with rebuilding Exim correctly if any of the configuration
2880 files are edited. However, if an optional configuration file is deleted, it is
2881 necessary to touch the associated non-optional file (that is,
2882 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2883 </para>
2884 </section>
2885 <section id="SECID30">
2886 <title>OS-specific header files</title>
2887 <para>
2888 <indexterm role="concept">
2889 <primary><filename>os.h</filename></primary>
2890 </indexterm>
2891 <indexterm role="concept">
2892 <primary>building Exim</primary>
2893 <secondary>OS-specific C header files</secondary>
2894 </indexterm>
2895 The <filename>OS</filename> directory contains a number of files with names of the form
2896 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2897 normally need to be changed. There is a list of macro settings that are
2898 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2899 are porting Exim to a new operating system.
2900 </para>
2901 </section>
2902 <section id="SECID31">
2903 <title>Overriding build-time options for the monitor</title>
2904 <para>
2905 <indexterm role="concept">
2906 <primary>building Eximon</primary>
2907 </indexterm>
2908 A similar process is used for overriding things when building the Exim monitor,
2909 where the files that are involved are
2910 </para>
2911 <literallayout>
2912 <filename>OS/eximon.conf-Default</filename>
2913 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2914 <filename>Local/eximon.conf</filename>
2915 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2916 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2917 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2918 </literallayout>
2919 <para>
2920 <indexterm role="concept">
2921 <primary><filename>Local/eximon.conf</filename></primary>
2922 </indexterm>
2923 As with Exim itself, the final three files need not exist, and in this case the
2924 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2925 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2926 variables of the same name, preceded by EXIMON_. For example, setting
2927 EXIMON_LOG_DEPTH in the environment overrides the value of
2928 LOG_DEPTH at run time.
2929 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2930 </para>
2931 </section>
2932 <section id="SECID32">
2933 <title>Installing Exim binaries and scripts</title>
2934 <para>
2935 <indexterm role="concept">
2936 <primary>installing Exim</primary>
2937 </indexterm>
2938 <indexterm role="concept">
2939 <primary>BIN_DIRECTORY</primary>
2940 </indexterm>
2941 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2942 arguments. The script copies binaries and utility scripts into the directory
2943 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2944 <indexterm role="concept">
2945 <primary>setuid</primary>
2946 <secondary>installing Exim with</secondary>
2947 </indexterm>
2948 The install script copies files only if they are newer than the files they are
2949 going to replace. The Exim binary is required to be owned by root and have the
2950 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2951 install</literal> as root so that it can set up the Exim binary in this way. However, in
2952 some special situations (for example, if a host is doing no local deliveries)
2953 it may be possible to run Exim without making the binary setuid root (see
2954 chapter <xref linkend="CHAPsecurity"/> for details).
2955 </para>
2956 <para>
2957 <indexterm role="concept">
2958 <primary>CONFIGURE_FILE</primary>
2959 </indexterm>
2960 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2961 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2962 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2963 by the installation script. If a run time configuration file already exists, it
2964 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2965 alternative files, no default is installed.
2966 </para>
2967 <para>
2968 <indexterm role="concept">
2969 <primary>system aliases file</primary>
2970 </indexterm>
2971 <indexterm role="concept">
2972 <primary><filename>/etc/aliases</filename></primary>
2973 </indexterm>
2974 One change is made to the default configuration file when it is installed: the
2975 default configuration contains a router that references a system aliases file.
2976 The path to this file is set to the value specified by
2977 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2978 If the system aliases file does not exist, the installation script creates it,
2979 and outputs a comment to the user.
2980 </para>
2981 <para>
2982 The created file contains no aliases, but it does contain comments about the
2983 aliases a site should normally have. Mail aliases have traditionally been
2984 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2985 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2986 Exim&#x2019;s configuration if necessary.
2987 </para>
2988 <para>
2989 The default configuration uses the local host&#x2019;s name as the only local domain,
2990 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
2991 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
2992 directories are supported, but no NIS or NIS+ support is configured. Domains
2993 other than the name of the local host are routed using the DNS, with delivery
2994 over SMTP.
2995 </para>
2996 <para>
2997 It is possible to install Exim for special purposes (such as building a binary
2998 distribution) in a private part of the file system. You can do this by a
2999 command such as
3000 </para>
3001 <literallayout class="monospaced">
3002 make DESTDIR=/some/directory/ install
3003 </literallayout>
3004 <para>
3005 This has the effect of pre-pending the specified directory to all the file
3006 paths, except the name of the system aliases file that appears in the default
3007 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3008 For backwards compatibility, ROOT is used if DESTDIR is not set,
3009 but this usage is deprecated.
3010 </para>
3011 <para revisionflag="changed">
3012 <indexterm role="concept">
3013 <primary>installing Exim</primary>
3014 <secondary>what is not installed</secondary>
3015 </indexterm>
3016 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3017 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3018 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3019 directory are copied, except for the info files when you have set
3020 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3021 </para>
3022 <para>
3023 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3024 to their names. The Exim binary itself, however, is handled differently. It is
3025 installed under a name that includes the version number and the compile number,
3026 for example <filename>exim-4.70-1</filename>. The script then arranges for a symbolic link
3027 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3028 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3029 from the directory (as seen by other processes).
3030 </para>
3031 <para>
3032 <indexterm role="concept">
3033 <primary>installing Exim</primary>
3034 <secondary>testing the script</secondary>
3035 </indexterm>
3036 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3037 real, you can pass the <option>-n</option> option to the installation script by this
3038 command:
3039 </para>
3040 <literallayout class="monospaced">
3041 make INSTALL_ARG=-n install
3042 </literallayout>
3043 <para>
3044 The contents of the variable INSTALL_ARG are passed to the installation
3045 script. You do not need to be root to run this test. Alternatively, you can run
3046 the installation script directly, but this must be from within the build
3047 directory. For example, from the top-level Exim directory you could use this
3048 command:
3049 </para>
3050 <literallayout class="monospaced">
3051 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3052 </literallayout>
3053 <para>
3054 <indexterm role="concept">
3055 <primary>installing Exim</primary>
3056 <secondary>install script options</secondary>
3057 </indexterm>
3058 There are two other options that can be supplied to the installation script.
3059 </para>
3060 <itemizedlist>
3061 <listitem>
3062 <para>
3063 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3064 to root, and the call to make it a setuid binary.
3065 </para>
3066 </listitem>
3067 <listitem>
3068 <para>
3069 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3070 installed binary.
3071 </para>
3072 </listitem>
3073 </itemizedlist>
3074 <para>
3075 INSTALL_ARG can be used to pass these options to the script. For example:
3076 </para>
3077 <literallayout class="monospaced">
3078 make INSTALL_ARG=-no_symlink install
3079 </literallayout>
3080 <para>
3081 The installation script can also be given arguments specifying which files are
3082 to be copied. For example, to install just the Exim binary, and nothing else,
3083 without creating the symbolic link, you could use:
3084 </para>
3085 <literallayout class="monospaced">
3086 make INSTALL_ARG='-no_symlink exim' install
3087 </literallayout>
3088 </section>
3089 <section id="SECTinsinfdoc">
3090 <title>Installing info documentation</title>
3091 <para>
3092 <indexterm role="concept">
3093 <primary>installing Exim</primary>
3094 <secondary><emphasis>info</emphasis> documentation</secondary>
3095 </indexterm>
3096 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3097 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3098 distribution. Instead it is available separately from the ftp site (see section
3099 <xref linkend="SECTavail"/>).
3100 </para>
3101 <para>
3102 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3103 source of the documentation is found in the source tree, running <literal>make
3104 install</literal> automatically builds the info files and installs them.
3105 </para>
3106 </section>
3107 <section id="SECID33">
3108 <title>Setting up the spool directory</title>
3109 <para>
3110 <indexterm role="concept">
3111 <primary>spool directory</primary>
3112 <secondary>creating</secondary>
3113 </indexterm>
3114 When it starts up, Exim tries to create its spool directory if it does not
3115 exist. The Exim uid and gid are used for the owner and group of the spool
3116 directory. Sub-directories are automatically created in the spool directory as
3117 necessary.
3118 </para>
3119 </section>
3120 <section id="SECID34">
3121 <title>Testing</title>
3122 <para>
3123 <indexterm role="concept">
3124 <primary>testing</primary>
3125 <secondary>installation</secondary>
3126 </indexterm>
3127 Having installed Exim, you can check that the run time configuration file is
3128 syntactically valid by running the following command, which assumes that the
3129 Exim binary directory is within your PATH environment variable:
3130 </para>
3131 <literallayout class="monospaced">
3132 exim -bV
3133 </literallayout>
3134 <para>
3135 If there are any errors in the configuration file, Exim outputs error messages.
3136 Otherwise it outputs the version number and build date,
3137 the DBM library that is being used, and information about which drivers and
3138 other optional code modules are included in the binary.
3139 Some simple routing tests can be done by using the address testing option. For
3140 example,
3141 </para>
3142 <literallayout>
3143 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3144 </literallayout>
3145 <para>
3146 should verify that it recognizes a local mailbox, and
3147 </para>
3148 <literallayout>
3149 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3150 </literallayout>
3151 <para>
3152 a remote one. Then try getting it to deliver mail, both locally and remotely.
3153 This can be done by passing messages directly to Exim, without going through a
3154 user agent. For example:
3155 </para>
3156 <literallayout class="monospaced">
3157 exim -v postmaster@your.domain.example
3158 From: user@your.domain.example
3159 To: postmaster@your.domain.example
3160 Subject: Testing Exim
3161
3162 This is a test message.
3163 ^D
3164 </literallayout>
3165 <para>
3166 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3167 In this case you should see copies of three log lines, one for the message&#x2019;s
3168 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3169 </para>
3170 <para>
3171 <indexterm role="concept">
3172 <primary>delivery</primary>
3173 <secondary>problems with</secondary>
3174 </indexterm>
3175 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3176 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3177 of information is running Exim with debugging turned on, by specifying the
3178 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3179 with debugging turned on by a command of the form
3180 </para>
3181 <literallayout>
3182 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3183 </literallayout>
3184 <para>
3185 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3186 produces rather a lot of output, but you can cut this down to specific areas.
3187 For example, if you use <option>-d-all+route</option> only the debugging information
3188 relevant to routing is included. (See the <option>-d</option> option in chapter
3189 <xref linkend="CHAPcommandline"/> for more details.)
3190 </para>
3191 <para>
3192 <indexterm role="concept">
3193 <primary><quote>sticky</quote> bit</primary>
3194 </indexterm>
3195 <indexterm role="concept">
3196 <primary>lock files</primary>
3197 </indexterm>
3198 One specific problem that has shown up on some sites is the inability to do
3199 local deliveries into a shared mailbox directory, because it does not have the
3200 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3201 writing to a mailbox file, and if it cannot create the lock file, the delivery
3202 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3203 directory, or by setting a specific group for local deliveries and allowing
3204 that group to create files in the directory (see the comments above the
3205 <command>local_delivery</command> transport in the default configuration file). Another
3206 approach is to configure Exim not to use lock files, but just to rely on
3207 <function>fcntl()</function> locking instead. However, you should do this only if all user
3208 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3209 see chapter <xref linkend="CHAPappendfile"/>.
3210 </para>
3211 <para>
3212 One thing that cannot be tested on a system that is already running an MTA is
3213 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3214 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3215 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3216 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3217 incoming SMTP mail.
3218 </para>
3219 <para>
3220 Testing a new version on a system that is already running Exim can most easily
3221 be done by building a binary with a different CONFIGURE_FILE setting. From
3222 within the run time configuration, all other file and directory names
3223 that Exim uses can be altered, in order to keep it entirely clear of the
3224 production version.
3225 </para>
3226 </section>
3227 <section id="SECID35">
3228 <title>Replacing another MTA with Exim</title>
3229 <para>
3230 <indexterm role="concept">
3231 <primary>replacing another MTA</primary>
3232 </indexterm>
3233 Building and installing Exim for the first time does not of itself put it in
3234 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3235 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3236 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3237 binary in order to get the user agents to pass messages to Exim. This is
3238 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3239 or <filename>/usr/lib/sendmail</filename>
3240 <indexterm role="concept">
3241 <primary>symbolic link</primary>
3242 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3243 </indexterm>
3244 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3245 privilege and executable status from the old MTA. It is then necessary to stop
3246 and restart the mailer daemon, if one is running.
3247 </para>
3248 <para>
3249 <indexterm role="concept">
3250 <primary>FreeBSD, MTA indirection</primary>
3251 </indexterm>
3252 <indexterm role="concept">
3253 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3254 </indexterm>
3255 Some operating systems have introduced alternative ways of switching MTAs. For
3256 example, if you are running FreeBSD, you need to edit the file
3257 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3258 described. A typical example of the contents of this file for running Exim is
3259 as follows:
3260 </para>
3261 <literallayout class="monospaced">
3262 sendmail            /usr/exim/bin/exim
3263 send-mail           /usr/exim/bin/exim
3264 mailq               /usr/exim/bin/exim -bp
3265 newaliases          /usr/bin/true
3266 </literallayout>
3267 <para>
3268 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3269 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3270 favourite user agent.
3271 </para>
3272 <para>
3273 You should consider what to tell your users about the change of MTA. Exim may
3274 have different capabilities to what was previously running, and there are
3275 various operational differences such as the text of messages produced by
3276 command line options and in bounce messages. If you allow your users to make
3277 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3278 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3279 </para>
3280 </section>
3281 <section id="SECID36">
3282 <title>Upgrading Exim</title>
3283 <para>
3284 <indexterm role="concept">
3285 <primary>upgrading Exim</primary>
3286 </indexterm>
3287 If you are already running Exim on your host, building and installing a new
3288 version automatically makes it available to MUAs, or any other programs that
3289 call the MTA directly. However, if you are running an Exim daemon, you do need
3290 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3291 new binary. You do not need to stop processing mail in order to install a new
3292 version of Exim. The install script does not modify an existing runtime
3293 configuration file.
3294 </para>
3295 </section>
3296 <section id="SECID37">
3297 <title>Stopping the Exim daemon on Solaris</title>
3298 <para>
3299 <indexterm role="concept">
3300 <primary>Solaris</primary>
3301 <secondary>stopping Exim on</secondary>
3302 </indexterm>
3303 The standard command for stopping the mailer daemon on Solaris is
3304 </para>
3305 <literallayout class="monospaced">
3306 /etc/init.d/sendmail stop
3307 </literallayout>
3308 <para>
3309 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3310 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3311 for the text <quote>sendmail</quote>; this is not present because the actual program name
3312 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3313 solution is to replace the line that finds the process id with something like
3314 </para>
3315 <literallayout class="monospaced">
3316 pid=`cat /var/spool/exim/exim-daemon.pid`
3317 </literallayout>
3318 <para>
3319 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3320 </para>
3321 <para>
3322 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3323 still be received from local processes, and if automatic delivery is configured
3324 (the normal case), deliveries will still occur.
3325 </para>
3326 </section>
3327 </chapter>
3328
3329 <chapter id="CHAPcommandline">
3330 <title>The Exim command line</title>
3331 <para>
3332 <indexterm role="concept" id="IIDclo1" class="startofrange">
3333 <primary>command line</primary>
3334 <secondary>options</secondary>
3335 </indexterm>
3336 <indexterm role="concept" id="IIDclo2" class="startofrange">
3337 <primary>options</primary>
3338 <secondary>command line</secondary>
3339 </indexterm>
3340 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3341 each starting with a hyphen character, followed by a number of arguments. The
3342 options are compatible with the main options of Sendmail, and there are also
3343 some additional options, some of which are compatible with Smail 3. Certain
3344 combinations of options do not make sense, and provoke an error if used.
3345 The form of the arguments depends on which options are set.
3346 </para>
3347 <section id="SECID38">
3348 <title>Setting options by program name</title>
3349 <para>
3350 <indexterm role="concept">
3351 <primary><emphasis>mailq</emphasis></primary>
3352 </indexterm>
3353 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3354 were present before any other options.
3355 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3356 standard output.
3357 This feature is for compatibility with some systems that contain a command of
3358 that name in one of the standard libraries, symbolically linked to
3359 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3360 </para>
3361 <para>
3362 <indexterm role="concept">
3363 <primary><emphasis>rsmtp</emphasis></primary>
3364 </indexterm>
3365 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3366 were present before any other options, for compatibility with Smail. The
3367 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3368 format.
3369 </para>
3370 <para>
3371 <indexterm role="concept">
3372 <primary><emphasis>rmail</emphasis></primary>
3373 </indexterm>
3374 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3375 <option>-oee</option> options were present before any other options, for compatibility with
3376 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3377 </para>
3378 <para>
3379 <indexterm role="concept">
3380 <primary><emphasis>runq</emphasis></primary>
3381 </indexterm>
3382 <indexterm role="concept">
3383 <primary>queue runner</primary>
3384 </indexterm>
3385 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3386 were present before any other options, for compatibility with Smail. The <option>-q</option>
3387 option causes a single queue runner process to be started.
3388 </para>
3389 <para>
3390 <indexterm role="concept">
3391 <primary><emphasis>newaliases</emphasis></primary>
3392 </indexterm>
3393 <indexterm role="concept">
3394 <primary>alias file</primary>
3395 <secondary>building</secondary>
3396 </indexterm>
3397 <indexterm role="concept">
3398 <primary>Sendmail compatibility</primary>
3399 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3400 </indexterm>
3401 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3402 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3403 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3404 the concept of a single alias file, but can be configured to run a given
3405 command if called with the <option>-bi</option> option.
3406 </para>
3407 </section>
3408 <section id="SECTtrustedadmin">
3409 <title>Trusted and admin users</title>
3410 <para>
3411 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3412 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3413 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3414 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3415 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3416 </para>
3417 <itemizedlist>
3418 <listitem>
3419 <para>
3420 <indexterm role="concept">
3421 <primary>trusted users</primary>
3422 <secondary>definition of</secondary>
3423 </indexterm>
3424 <indexterm role="concept">
3425 <primary>user</primary>
3426 <secondary>trusted definition of</secondary>
3427 </indexterm>
3428 The trusted users are root, the Exim user, any user listed in the
3429 <option>trusted_users</option> configuration option, and any user whose current group or any
3430 supplementary group is one of those listed in the <option>trusted_groups</option>
3431 configuration option. Note that the Exim group is not automatically trusted.
3432 </para>
3433 <para>
3434 <indexterm role="concept">
3435 <primary><quote>From</quote> line</primary>
3436 </indexterm>
3437 <indexterm role="concept">
3438 <primary>envelope sender</primary>
3439 </indexterm>
3440 Trusted users are always permitted to use the <option>-f</option> option or a leading
3441 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3442 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3443 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3444 users to set envelope senders.
3445 </para>
3446 <para>
3447 <indexterm role="concept">
3448 <primary><emphasis>From:</emphasis> header line</primary>
3449 </indexterm>
3450 <indexterm role="concept">
3451 <primary><emphasis>Sender:</emphasis> header line</primary>
3452 </indexterm>
3453 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3454 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3455 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3456 </para>
3457 <para>
3458 Trusted users may also specify a host name, host address, interface address,
3459 protocol name, ident value, and authentication data when submitting a message
3460 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3461 have the characteristics of messages received from a remote host. Untrusted
3462 users may in some circumstances use <option>-f</option>, but can never set the other values
3463 that are available to trusted users.
3464 </para>
3465 </listitem>
3466 <listitem>
3467 <para>
3468 <indexterm role="concept">
3469 <primary>user</primary>
3470 <secondary>admin definition of</secondary>
3471 </indexterm>
3472 <indexterm role="concept">
3473 <primary>admin user</primary>
3474 <secondary>definition of</secondary>
3475 </indexterm>
3476 The admin users are root, the Exim user, and any user that is a member of the
3477 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3478 The current group does not have to be one of these groups.
3479 </para>
3480 <para>
3481 Admin users are permitted to list the queue, and to carry out certain
3482 operations on messages, for example, to force delivery failures. It is also
3483 necessary to be an admin user in order to see the full information provided by
3484 the Exim monitor, and full debugging output.
3485 </para>
3486 <para>
3487 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3488 Exim to attempt delivery of messages on its queue is restricted to admin users.
3489 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3490 option false (that is, specifying <option>no_prod_requires_admin</option>).
3491 </para>
3492 <para>
3493 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3494 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3495 false.
3496 </para>
3497 </listitem>
3498 </itemizedlist>
3499 <para>
3500 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3501 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3502 getting root. There is further discussion of this issue at the start of chapter
3503 <xref linkend="CHAPconf"/>.
3504 </para>
3505 </section>
3506 <section id="SECID39">
3507 <title>Command line options</title>
3508 <para>
3509 Exim&#x2019;s command line options are described in alphabetical order below. If none
3510 of the options that specifies a specific action (such as starting the daemon or
3511 a queue runner, or testing an address, or receiving a message in a specific
3512 format, or listing the queue) are present, and there is at least one argument
3513 on the command line, <option>-bm</option> (accept a local message on the standard input,
3514 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3515 outputs a brief message about itself and exits.
3516 </para>
3517 <!-- === Start of command line options === -->
3518 <variablelist>
3519 <varlistentry>
3520 <term><option>--</option></term>
3521 <listitem>
3522 <para>
3523 <indexterm role="option">
3524 <primary>--</primary>
3525 </indexterm>
3526 <indexterm role="concept">
3527 <primary>options</primary>
3528 <secondary>command line; terminating</secondary>
3529 </indexterm>
3530 This is a pseudo-option whose only purpose is to terminate the options and
3531 therefore to cause subsequent command line items to be treated as arguments
3532 rather than options, even if they begin with hyphens.
3533 </para>
3534 </listitem></varlistentry>
3535 <varlistentry>
3536 <term><option>--help</option></term>
3537 <listitem>
3538 <para>
3539 <indexterm role="option">
3540 <primary><option>--help</option></primary>
3541 </indexterm>
3542 This option causes Exim to output a few sentences stating what it is.
3543 The same output is generated if the Exim binary is called with no options and
3544 no arguments.
3545 </para>
3546 </listitem></varlistentry>
3547 <varlistentry>
3548 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3549 <listitem>
3550 <para>
3551 <indexterm role="option">
3552 <primary><option>-B</option></primary>
3553 </indexterm>
3554 <indexterm role="concept">
3555 <primary>8-bit characters</primary>
3556 </indexterm>
3557 <indexterm role="concept">
3558 <primary>Sendmail compatibility</primary>
3559 <secondary>8-bit characters</secondary>
3560 </indexterm>
3561 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3562 clean; it ignores this option.
3563 </para>
3564 </listitem></varlistentry>
3565 <varlistentry>
3566 <term><option>-bd</option></term>
3567 <listitem>
3568 <para>
3569 <indexterm role="option">
3570 <primary><option>-bd</option></primary>
3571 </indexterm>
3572 <indexterm role="concept">
3573 <primary>daemon</primary>
3574 </indexterm>
3575 <indexterm role="concept">
3576 <primary>SMTP</primary>
3577 <secondary>listener</secondary>
3578 </indexterm>
3579 <indexterm role="concept">
3580 <primary>queue runner</primary>
3581 </indexterm>
3582 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3583 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3584 that the daemon should also initiate periodic queue runs.
3585 </para>
3586 <para>
3587 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3588 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3589 disconnect from the controlling terminal. When running this way, it can be
3590 stopped by pressing ctrl-C.
3591 </para>
3592 <para>
3593 By default, Exim listens for incoming connections to the standard SMTP port on
3594 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3595 ports, on multiple ports, and only on specific interfaces. Chapter
3596 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3597 </para>
3598 <para>
3599 When a listening daemon
3600 <indexterm role="concept">
3601 <primary>daemon</primary>
3602 <secondary>process id (pid)</secondary>
3603 </indexterm>
3604 <indexterm role="concept">
3605 <primary>pid (process id)</primary>
3606 <secondary>of daemon</secondary>
3607 </indexterm>
3608 is started without the use of <option>-oX</option> (that is, without overriding the normal
3609 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3610 in Exim&#x2019;s spool directory. This location can be overridden by setting
3611 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3612 running as root.
3613 </para>
3614 <para>
3615 When <option>-oX</option> is used on the command line to start a listening daemon, the
3616 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3617 used to specify a path on the command line if a pid file is required.
3618 </para>
3619 <para>
3620 The SIGHUP signal
3621 <indexterm role="concept">
3622 <primary>SIGHUP</primary>
3623 </indexterm>
3624 <indexterm role="concept">
3625 <primary>daemon</primary>
3626 <secondary>restarting</secondary>
3627 </indexterm>
3628 can be used to cause the daemon to re-execute itself. This should be done
3629 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3630 means of the <option>.include</option> facility, is changed, and also whenever a new version
3631 of Exim is installed. It is not necessary to do this when other files that are
3632 referenced from the configuration (for example, alias files) are changed,
3633 because these are reread each time they are used.
3634 </para>
3635 </listitem></varlistentry>
3636 <varlistentry>
3637 <term><option>-bdf</option></term>
3638 <listitem>
3639 <para>
3640 <indexterm role="option">
3641 <primary><option>-bdf</option></primary>
3642 </indexterm>
3643 This option has the same effect as <option>-bd</option> except that it never disconnects
3644 from the controlling terminal, even when no debugging is specified.
3645 </para>
3646 </listitem></varlistentry>
3647 <varlistentry>
3648 <term><option>-be</option></term>
3649 <listitem>
3650 <para>
3651 <indexterm role="option">
3652 <primary><option>-be</option></primary>
3653 </indexterm>
3654 <indexterm role="concept">
3655 <primary>testing</primary>
3656 <secondary>string expansion</secondary>
3657 </indexterm>
3658 <indexterm role="concept">
3659 <primary>expansion</primary>
3660 <secondary>testing</secondary>
3661 </indexterm>
3662 Run Exim in expansion testing mode. Exim discards its root privilege, to
3663 prevent ordinary users from using this mode to read otherwise inaccessible
3664 files. If no arguments are given, Exim runs interactively, prompting for lines
3665 of data. Otherwise, it processes each argument in turn.
3666 </para>
3667 <para>
3668 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3669 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3670 used without command line arguments. If successful, it uses the <function>readline()</function>
3671 function, which provides extensive line-editing facilities, for reading the
3672 test data. A line history is supported.
3673 </para>
3674 <para>
3675 Long expansion expressions can be split over several lines by using backslash
3676 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3677 continuation lines is ignored. Each argument or data line is passed through the
3678 string expansion mechanism, and the result is output. Variable values from the
3679 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3680 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3681 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3682 </para>
3683 <para>
3684 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3685 files or databases you are using, you must exit and restart Exim before trying
3686 the same lookup again. Otherwise, because each Exim process caches the results
3687 of lookups, you will just get the same result as before.
3688 </para>
3689 </listitem></varlistentry>
3690 <varlistentry>
3691 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3692 <listitem>
3693 <para>
3694 <indexterm role="option">
3695 <primary><option>-bem</option></primary>
3696 </indexterm>
3697 <indexterm role="concept">
3698 <primary>testing</primary>
3699 <secondary>string expansion</secondary>
3700 </indexterm>
3701 <indexterm role="concept">
3702 <primary>expansion</primary>
3703 <secondary>testing</secondary>
3704 </indexterm>
3705 This option operates like <option>-be</option> except that it must be followed by the name
3706 of a file. For example:
3707 </para>
3708 <literallayout class="monospaced">
3709 exim -bem /tmp/testmessage
3710 </literallayout>
3711 <para>
3712 The file is read as a message (as if receiving a locally-submitted non-SMTP
3713 message) before any of the test expansions are done. Thus, message-specific
3714 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3715 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3716 recipients are read from the headers in the normal way, and are shown in the
3717 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3718 line, because further arguments are taken as strings to expand (just like
3719 <option>-be</option>).
3720 </para>
3721 </listitem></varlistentry>
3722 <varlistentry>
3723 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3724 <listitem>
3725 <para>
3726 <indexterm role="option">
3727 <primary><option>-bF</option></primary>
3728 </indexterm>
3729 <indexterm role="concept">
3730 <primary>system filter</primary>
3731 <secondary>testing</secondary>
3732 </indexterm>
3733 <indexterm role="concept">
3734 <primary>testing</primary>
3735 <secondary>system filter</secondary>
3736 </indexterm>
3737 This option is the same as <option>-bf</option> except that it assumes that the filter being
3738 tested is a system filter. The additional commands that are available only in
3739 system filters are recognized.
3740 </para>
3741 </listitem></varlistentry>
3742 <varlistentry>
3743 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3744 <listitem>
3745 <para>
3746 <indexterm role="option">
3747 <primary><option>-bf</option></primary>
3748 </indexterm>
3749 <indexterm role="concept">
3750 <primary>filter</primary>
3751 <secondary>testing</secondary>
3752 </indexterm>
3753 <indexterm role="concept">
3754 <primary>testing</primary>
3755 <secondary>filter file</secondary>
3756 </indexterm>
3757 <indexterm role="concept">
3758 <primary>forward file</primary>
3759 <secondary>testing</secondary>
3760 </indexterm>
3761 <indexterm role="concept">
3762 <primary>testing</primary>
3763 <secondary>forward file</secondary>
3764 </indexterm>
3765 <indexterm role="concept">
3766 <primary>Sieve filter</primary>
3767 <secondary>testing</secondary>
3768 </indexterm>
3769 This option runs Exim in user filter testing mode; the file is the filter file
3770 to be tested, and a test message must be supplied on the standard input. If
3771 there are no message-dependent tests in the filter, an empty file can be
3772 supplied.
3773 </para>
3774 <para>
3775 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3776 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3777 filter and a user filter in the same run. For example:
3778 </para>
3779 <literallayout class="monospaced">
3780 exim -bF /system/filter -bf /user/filter &lt;/test/message
3781 </literallayout>
3782 <para>
3783 This is helpful when the system filter adds header lines or sets filter
3784 variables that are used by the user filter.
3785 </para>
3786 <para>
3787 If the test filter file does not begin with one of the special lines
3788 </para>
3789 <literallayout class="monospaced">
3790 # Exim filter
3791 # Sieve filter
3792 </literallayout>
3793 <para>
3794 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3795 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3796 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3797 redirection lists.
3798 </para>
3799 <para>
3800 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3801 detected, is a list of the actions that Exim would try to take if presented
3802 with the message for real. More details of filter testing are given in the
3803 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3804 </para>
3805 <para>
3806 When testing a filter file,
3807 <indexterm role="concept">
3808 <primary><quote>From</quote> line</primary>
3809 </indexterm>
3810 <indexterm role="concept">
3811 <primary>envelope sender</primary>
3812 </indexterm>
3813 <indexterm role="option">
3814 <primary><option>-f</option></primary>
3815 <secondary>for filter testing</secondary>
3816 </indexterm>
3817 the envelope sender can be set by the <option>-f</option> option,
3818 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3819 that would normally be taken from the envelope recipient address of the message
3820 can be set by means of additional command line options (see the next four
3821 options).
3822 </para>
3823 </listitem></varlistentry>
3824 <varlistentry>
3825 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3826 <listitem>
3827 <para>
3828 <indexterm role="option">
3829 <primary><option>-bfd</option></primary>
3830 </indexterm>
3831 <indexterm role="variable">
3832 <primary><varname>$qualify_domain</varname></primary>
3833 </indexterm>
3834 This sets the domain of the recipient address when a filter file is being
3835 tested by means of the <option>-bf</option> option. The default is the value of
3836 <varname>$qualify_domain</varname>.
3837 </para>
3838 </listitem></varlistentry>
3839 <varlistentry>
3840 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3841 <listitem>
3842 <para>
3843 <indexterm role="option">
3844 <primary><option>-bfl</option></primary>
3845 </indexterm>
3846 This sets the local part of the recipient address when a filter file is being
3847 tested by means of the <option>-bf</option> option. The default is the username of the
3848 process that calls Exim. A local part should be specified with any prefix or
3849 suffix stripped, because that is how it appears to the filter when a message is
3850 actually being delivered.
3851 </para>
3852 </listitem></varlistentry>
3853 <varlistentry>
3854 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3855 <listitem>
3856 <para>
3857 <indexterm role="option">
3858 <primary><option>-bfp</option></primary>
3859 </indexterm>
3860 This sets the prefix of the local part of the recipient address when a filter
3861 file is being tested by means of the <option>-bf</option> option. The default is an empty
3862 prefix.
3863 </para>
3864 </listitem></varlistentry>
3865 <varlistentry>
3866 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3867 <listitem>
3868 <para>
3869 <indexterm role="option">
3870 <primary><option>-bfs</option></primary>
3871 </indexterm>
3872 This sets the suffix of the local part of the recipient address when a filter
3873 file is being tested by means of the <option>-bf</option> option. The default is an empty
3874 suffix.
3875 </para>
3876 </listitem></varlistentry>
3877 <varlistentry>
3878 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3879 <listitem>
3880 <para>
3881 <indexterm role="option">
3882 <primary><option>-bh</option></primary>
3883 </indexterm>
3884 <indexterm role="concept">
3885 <primary>testing</primary>
3886 <secondary>incoming SMTP</secondary>
3887 </indexterm>
3888 <indexterm role="concept">
3889 <primary>SMTP</primary>
3890 <secondary>testing incoming</secondary>
3891 </indexterm>
3892 <indexterm role="concept">
3893 <primary>testing</primary>
3894 <secondary>relay control</secondary>
3895 </indexterm>
3896 <indexterm role="concept">
3897 <primary>relaying</primary>
3898 <secondary>testing configuration</secondary>
3899 </indexterm>
3900 <indexterm role="concept">
3901 <primary>policy control</primary>
3902 <secondary>testing</secondary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>debugging</primary>
3906 <secondary><option>-bh</option> option</secondary>
3907 </indexterm>
3908 This option runs a fake SMTP session as if from the given IP address, using the
3909 standard input and output. The IP address may include a port number at the end,
3910 after a full stop. For example:
3911 </para>
3912 <literallayout class="monospaced">
3913 exim -bh 10.9.8.7.1234
3914 exim -bh fe80::a00:20ff:fe86:a061.5678
3915 </literallayout>
3916 <para>
3917 When an IPv6 address is given, it is converted into canonical form. In the case
3918 of the second example above, the value of <varname>$sender_host_address</varname> after
3919 conversion to the canonical form is
3920 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3921 </para>
3922 <para>
3923 Comments as to what is going on are written to the standard error file. These
3924 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3925 This facility is provided for testing configuration options for incoming
3926 messages, to make sure they implement the required policy. For example, you can
3927 test your relay controls using <option>-bh</option>.
3928 </para>
3929 <para>
3930 <emphasis role="bold">Warning 1</emphasis>:
3931 <indexterm role="concept">
3932 <primary>RFC 1413</primary>
3933 </indexterm>
3934 You can test features of the configuration that rely on ident (RFC 1413)
3935 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3936 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3937 connection.
3938 </para>
3939 <para>
3940 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3941 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3942 occur, use <option>-bhc</option> instead.
3943 </para>
3944 <para>
3945 Messages supplied during the testing session are discarded, and nothing is
3946 written to any of the real log files. There may be pauses when DNS (and other)
3947 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3948 can be used to specify a specific IP interface and port if this is important,
3949 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3950 session were authenticated.
3951 </para>
3952 <para>
3953 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3954 output just states whether a given recipient address from a given host is
3955 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3956 </para>
3957 <para>
3958 Features such as authentication and encryption, where the client input is not
3959 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3960 specialized SMTP test program such as
3961 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3962 </para>
3963 </listitem></varlistentry>
3964 <varlistentry>
3965 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3966 <listitem>
3967 <para>
3968 <indexterm role="option">
3969 <primary><option>-bhc</option></primary>
3970 </indexterm>
3971 This option operates in the same way as <option>-bh</option>, except that address
3972 verification callouts are performed if required. This includes consulting and
3973 updating the callout cache database.
3974 </para>
3975 </listitem></varlistentry>
3976 <varlistentry>
3977 <term><option>-bi</option></term>
3978 <listitem>
3979 <para>
3980 <indexterm role="option">
3981 <primary><option>-bi</option></primary>
3982 </indexterm>
3983 <indexterm role="concept">
3984 <primary>alias file</primary>
3985 <secondary>building</secondary>
3986 </indexterm>
3987 <indexterm role="concept">
3988 <primary>building alias file</primary>
3989 </indexterm>
3990 <indexterm role="concept">
3991 <primary>Sendmail compatibility</primary>
3992 <secondary><option>-bi</option> option</secondary>
3993 </indexterm>
3994 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3995 Exim does not have the concept of a single alias file, and so it cannot mimic
3996 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3997 tend to appear in various scripts such as NIS make files, so the option must be
3998 recognized.
3999 </para>
4000 <para>
4001 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4002 configuration option is run, under the uid and gid of the caller of Exim. If
4003 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4004 The command set by <option>bi_command</option> may not contain arguments. The command can
4005 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4006 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4007 <option>-bi</option> is a no-op.
4008 </para>
4009 </listitem></varlistentry>
4010 <varlistentry>
4011 <term><option>-bm</option></term>
4012 <listitem>
4013 <para>
4014 <indexterm role="option">
4015 <primary><option>-bm</option></primary>
4016 </indexterm>
4017 <indexterm role="concept">
4018 <primary>local message reception</primary>
4019 </indexterm>
4020 This option runs an Exim receiving process that accepts an incoming,
4021 locally-generated message on the current input. The recipients are given as the
4022 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4023 argument can be a comma-separated list of RFC 2822 addresses. This is the
4024 default option for selecting the overall action of an Exim call; it is assumed
4025 if no other conflicting option is present.
4026 </para>
4027 <para>
4028 If any addresses in the message are unqualified (have no domain), they are
4029 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4030 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4031 suppressing this for special cases.
4032 </para>
4033 <para>
4034 Policy checks on the contents of local messages can be enforced by means of
4035 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4036 </para>
4037 <para>
4038 <indexterm role="concept">
4039 <primary>return code</primary>
4040 <secondary>for <option>-bm</option></secondary>
4041 </indexterm>
4042 The return code is zero if the message is successfully accepted. Otherwise, the
4043 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4044 </para>
4045 <para>
4046 The format
4047 <indexterm role="concept">
4048 <primary>message</primary>
4049 <secondary>format</secondary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>format</primary>
4053 <secondary>message</secondary>
4054 </indexterm>
4055 <indexterm role="concept">
4056 <primary><quote>From</quote> line</primary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>UUCP</primary>
4060 <secondary><quote>From</quote> line</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>Sendmail compatibility</primary>
4064 <secondary><quote>From</quote> line</secondary>
4065 </indexterm>
4066 of the message must be as defined in RFC 2822, except that, for
4067 compatibility with Sendmail and Smail, a line in one of the forms
4068 </para>
4069 <literallayout class="monospaced">
4070 From sender Fri Jan  5 12:55 GMT 1997
4071 From sender Fri, 5 Jan 97 12:55:01
4072 </literallayout>
4073 <para>
4074 (with the weekday optional, and possibly with additional text after the date)
4075 is permitted to appear at the start of the message. There appears to be no
4076 authoritative specification of the format of this line. Exim recognizes it by
4077 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4078 option, which can be changed if necessary.
4079 </para>
4080 <para>
4081 <indexterm role="option">
4082 <primary><option>-f</option></primary>
4083 <secondary>overriding <quote>From</quote> line</secondary>
4084 </indexterm>
4085 The specified sender is treated as if it were given as the argument to the
4086 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4087 preference to the address taken from the message. The caller of Exim must be a
4088 trusted user for the sender of a message to be set in this way.
4089 </para>
4090 </listitem></varlistentry>
4091 <varlistentry>
4092 <term><option>-bnq</option></term>
4093 <listitem>
4094 <para>
4095 <indexterm role="option">
4096 <primary><option>-bnq</option></primary>
4097 </indexterm>
4098 <indexterm role="concept">
4099 <primary>address qualification, suppressing</primary>
4100 </indexterm>
4101 By default, Exim automatically qualifies unqualified addresses (those
4102 without domains) that appear in messages that are submitted locally (that
4103 is, not over TCP/IP). This qualification applies both to addresses in
4104 envelopes, and addresses in header lines. Sender addresses are qualified using
4105 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4106 defaults to the value of <option>qualify_domain</option>).
4107 </para>
4108 <para>
4109 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4110 being used to re-submit messages that originally came from remote hosts after
4111 content scanning, you probably do not want to qualify unqualified addresses in
4112 header lines. (Such lines will be present only if you have not enabled a header
4113 syntax check in the appropriate ACL.)
4114 </para>
4115 <para>
4116 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4117 messages that originate on the local host. When this is used, unqualified
4118 addresses in the envelope provoke errors (causing message rejection) and
4119 unqualified addresses in header lines are left alone.
4120 </para>
4121 </listitem></varlistentry>
4122 <varlistentry>
4123 <term><option>-bP</option></term>
4124 <listitem>
4125 <para>
4126 <indexterm role="option">
4127 <primary><option>-bP</option></primary>
4128 </indexterm>
4129 <indexterm role="concept">
4130 <primary>configuration options</primary>
4131 <secondary>extracting</secondary>
4132 </indexterm>
4133 <indexterm role="concept">
4134 <primary>options</primary>
4135 <secondary>configuration &ndash; extracting</secondary>
4136 </indexterm>
4137 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4138 main configuration options to be written to the standard output. The values
4139 of one or more specific options can be requested by giving their names as
4140 arguments, for example:
4141 </para>
4142 <literallayout class="monospaced">
4143 exim -bP qualify_domain hold_domains
4144 </literallayout>
4145 <para>
4146 <indexterm role="concept">
4147 <primary>hiding configuration option values</primary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>configuration options</primary>
4151 <secondary>hiding value of</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>options</primary>
4155 <secondary>hiding value of</secondary>
4156 </indexterm>
4157 However, any option setting that is preceded by the word <quote>hide</quote> in the
4158 configuration file is not shown in full, except to an admin user. For other
4159 users, the output is as in this example:
4160 </para>
4161 <literallayout class="monospaced">
4162 mysql_servers = &lt;value not displayable&gt;
4163 </literallayout>
4164 <para>
4165 If <option>configure_file</option> is given as an argument, the name of the run time
4166 configuration file is output.
4167 If a list of configuration files was supplied, the value that is output here
4168 is the name of the file that was actually used.
4169 </para>
4170 <para>
4171 <indexterm role="concept">
4172 <primary>daemon</primary>
4173 <secondary>process id (pid)</secondary>
4174 </indexterm>
4175 <indexterm role="concept">
4176 <primary>pid (process id)</primary>
4177 <secondary>of daemon</secondary>
4178 </indexterm>
4179 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4180 directories where log files and daemon pid files are written are output,
4181 respectively. If these values are unset, log files are written in a
4182 sub-directory of the spool directory called <option>log</option>, and the pid file is
4183 written directly into the spool directory.
4184 </para>
4185 <para>
4186 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4187 </para>
4188 <literallayout class="monospaced">
4189 exim -bP +local_domains
4190 </literallayout>
4191 <para>
4192 it searches for a matching named list of any type (domain, host, address, or
4193 local part) and outputs what it finds.
4194 </para>
4195 <para>
4196 <indexterm role="concept">
4197 <primary>options</primary>
4198 <secondary>router &ndash; extracting</secondary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>options</primary>
4202 <secondary>transport &ndash; extracting</secondary>
4203 </indexterm>
4204 <indexterm role="concept">
4205 <primary>options</primary>
4206 <secondary>authenticator &ndash; extracting</secondary>
4207 </indexterm>
4208 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4209 followed by the name of an appropriate driver instance, the option settings for
4210 that driver are output. For example:
4211 </para>
4212 <literallayout class="monospaced">
4213 exim -bP transport local_delivery
4214 </literallayout>
4215 <para>
4216 The generic driver options are output first, followed by the driver&#x2019;s private
4217 options. A list of the names of drivers of a particular type can be obtained by
4218 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4219 <option>authenticator_list</option>, and a complete list of all drivers with their option
4220 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4221 <option>authenticators</option>.
4222 </para>
4223 <para revisionflag="changed">
4224 <indexterm role="concept">
4225 <primary>options</primary>
4226 <secondary>macro &ndash; extracting</secondary>
4227 </indexterm>
4228 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4229 are available, similarly to the drivers.  Because macros are sometimes used
4230 for storing passwords, this option is restricted.
4231 The output format is one item per line.
4232 </para>
4233 </listitem></varlistentry>
4234 <varlistentry>
4235 <term><option>-bp</option></term>
4236 <listitem>
4237 <para>
4238 <indexterm role="option">
4239 <primary><option>-bp</option></primary>
4240 </indexterm>
4241 <indexterm role="concept">
4242 <primary>queue</primary>
4243 <secondary>listing messages on</secondary>
4244 </indexterm>
4245 <indexterm role="concept">
4246 <primary>listing</primary>
4247 <secondary>messages on the queue</secondary>
4248 </indexterm>
4249 This option requests a listing of the contents of the mail queue on the
4250 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4251 just those messages are listed. By default, this option can be used only by an
4252 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4253 to allow any user to see the queue.
4254 </para>
4255 <para>
4256 Each message on the queue is displayed as in the following example:
4257 </para>
4258 <literallayout class="monospaced">
4259 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4260           red.king@looking-glass.fict.example
4261           &lt;other addresses&gt;
4262 </literallayout>
4263 <para>
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>size in queue listing</secondary>
4267 </indexterm>
4268 <indexterm role="concept">
4269 <primary>size</primary>
4270 <secondary>of message</secondary>
4271 </indexterm>
4272 The first line contains the length of time the message has been on the queue
4273 (in this case 25 minutes), the size of the message (2.9K), the unique local
4274 identifier for the message, and the message sender, as contained in the
4275 envelope. For bounce messages, the sender address is empty, and appears as
4276 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4277 the default sender address, the user&#x2019;s login name is shown in parentheses
4278 before the sender address.
4279 </para>
4280 <para>
4281 <indexterm role="concept">
4282 <primary>frozen messages</primary>
4283 <secondary>in queue listing</secondary>
4284 </indexterm>
4285 If the message is frozen (attempts to deliver it are suspended) then the text
4286 <quote>*** frozen ***</quote> is displayed at the end of this line.
4287 </para>
4288 <para>
4289 The recipients of the message (taken from the envelope, not the headers) are
4290 displayed on subsequent lines. Those addresses to which the message has already
4291 been delivered are marked with the letter D. If an original address gets
4292 expanded into several addresses via an alias or forward file, the original is
4293 displayed with a D only when deliveries for all of its child addresses are
4294 complete.
4295 </para>
4296 </listitem></varlistentry>
4297 <varlistentry>
4298 <term><option>-bpa</option></term>
4299 <listitem>
4300 <para>
4301 <indexterm role="option">
4302 <primary><option>-bpa</option></primary>
4303 </indexterm>
4304 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4305 that were generated from the original top level address(es) in each message by
4306 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4307 of just <quote>D</quote>.
4308 </para>
4309 </listitem></varlistentry>
4310 <varlistentry>
4311 <term><option>-bpc</option></term>
4312 <listitem>
4313 <para>
4314 <indexterm role="option">
4315 <primary><option>-bpc</option></primary>
4316 </indexterm>
4317 <indexterm role="concept">
4318 <primary>queue</primary>
4319 <secondary>count of messages on</secondary>
4320 </indexterm>
4321 This option counts the number of messages on the queue, and writes the total
4322 to the standard output. It is restricted to admin users, unless
4323 <option>queue_list_requires_admin</option> is set false.
4324 </para>
4325 </listitem></varlistentry>
4326 <varlistentry>
4327 <term><option>-bpr</option></term>
4328 <listitem>
4329 <para>
4330 <indexterm role="option">
4331 <primary><option>-bpr</option></primary>
4332 </indexterm>
4333 This option operates like <option>-bp</option>, but the output is not sorted into
4334 chronological order of message arrival. This can speed it up when there are
4335 lots of messages on the queue, and is particularly useful if the output is
4336 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4337 </para>
4338 </listitem></varlistentry>
4339 <varlistentry>
4340 <term><option>-bpra</option></term>
4341 <listitem>
4342 <para>
4343 <indexterm role="option">
4344 <primary><option>-bpra</option></primary>
4345 </indexterm>
4346 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4347 </para>
4348 </listitem></varlistentry>
4349 <varlistentry>
4350 <term><option>-bpru</option></term>
4351 <listitem>
4352 <para>
4353 <indexterm role="option">
4354 <primary><option>-bpru</option></primary>
4355 </indexterm>
4356 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4357 </para>
4358 </listitem></varlistentry>
4359 <varlistentry>
4360 <term><option>-bpu</option></term>
4361 <listitem>
4362 <para>
4363 <indexterm role="option">
4364 <primary><option>-bpu</option></primary>
4365 </indexterm>
4366 This option operates like <option>-bp</option> but shows only undelivered top-level
4367 addresses for each message displayed. Addresses generated by aliasing or
4368 forwarding are not shown, unless the message was deferred after processing by a
4369 router with the <option>one_time</option> option set.
4370 </para>
4371 </listitem></varlistentry>
4372 <varlistentry>
4373 <term><option>-brt</option></term>
4374 <listitem>
4375 <para>
4376 <indexterm role="option">
4377 <primary><option>-brt</option></primary>
4378 </indexterm>
4379 <indexterm role="concept">
4380 <primary>testing</primary>
4381 <secondary>retry configuration</secondary>
4382 </indexterm>
4383 <indexterm role="concept">
4384 <primary>retry</primary>
4385 <secondary>configuration testing</secondary>
4386 </indexterm>
4387 This option is for testing retry rules, and it must be followed by up to three
4388 arguments. It causes Exim to look for a retry rule that matches the values
4389 and to write it to the standard output. For example:
4390 </para>
4391 <literallayout class="monospaced">
4392 exim -brt bach.comp.mus.example
4393 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4394 </literallayout>
4395 <para>
4396 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4397 argument, which is required, can be a complete address in the form
4398 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4399 contains a dot, it is interpreted as an optional second domain name; if no
4400 retry rule is found for the first argument, the second is tried. This ties in
4401 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4402 rule is found that matches the host, one that matches the mail domain is
4403 sought. Finally, an argument that is the name of a specific delivery error, as
4404 used in setting up retry rules, can be given. For example:
4405 </para>
4406 <literallayout class="monospaced">
4407 exim -brt haydn.comp.mus.example quota_3d
4408 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4409 </literallayout>
4410 </listitem></varlistentry>
4411 <varlistentry>
4412 <term><option>-brw</option></term>
4413 <listitem>
4414 <para>
4415 <indexterm role="option">
4416 <primary><option>-brw</option></primary>
4417 </indexterm>
4418 <indexterm role="concept">
4419 <primary>testing</primary>
4420 <secondary>rewriting</secondary>
4421 </indexterm>
4422 <indexterm role="concept">
4423 <primary>rewriting</primary>
4424 <secondary>testing</secondary>
4425 </indexterm>
4426 This option is for testing address rewriting rules, and it must be followed by
4427 a single argument, consisting of either a local part without a domain, or a
4428 complete address with a fully qualified domain. Exim outputs how this address
4429 would be rewritten for each possible place it might appear. See chapter
4430 <xref linkend="CHAPrewrite"/> for further details.
4431 </para>
4432 </listitem></varlistentry>
4433 <varlistentry>
4434 <term><option>-bS</option></term>
4435 <listitem>
4436 <para>
4437 <indexterm role="option">
4438 <primary><option>-bS</option></primary>
4439 </indexterm>
4440 <indexterm role="concept">
4441 <primary>SMTP</primary>
4442 <secondary>batched incoming</secondary>
4443 </indexterm>
4444 <indexterm role="concept">
4445 <primary>batched SMTP input</primary>
4446 </indexterm>
4447 This option is used for batched SMTP input, which is an alternative interface
4448 for non-interactive local message submission. A number of messages can be
4449 submitted in a single run. However, despite its name, this is not really SMTP
4450 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4451 input, but generates no responses. If the caller is trusted, or
4452 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4453 believed; otherwise the sender is always the caller of Exim.
4454 </para>
4455 <para>
4456 The message itself is read from the standard input, in SMTP format (leading
4457 dots doubled), terminated by a line containing just a single dot. An error is
4458 provoked if the terminating dot is missing. A further message may then follow.
4459 </para>
4460 <para>
4461 As for other local message submissions, the contents of incoming batch SMTP
4462 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4463 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4464 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4465 </para>
4466 <para>
4467 Some other SMTP commands are recognized in the input. HELO and EHLO act
4468 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4469 QUIT quits, ignoring the rest of the standard input.
4470 </para>
4471 <para>
4472 <indexterm role="concept">
4473 <primary>return code</primary>
4474 <secondary>for <option>-bS</option></secondary>
4475 </indexterm>
4476 If any error is encountered, reports are written to the standard output and
4477 error streams, and Exim gives up immediately. The return code is 0 if no error
4478 was detected; it is 1 if one or more messages were accepted before the error
4479 was detected; otherwise it is 2.
4480 </para>
4481 <para>
4482 More details of input using batched SMTP are given in section
4483 <xref linkend="SECTincomingbatchedSMTP"/>.
4484 </para>
4485 </listitem></varlistentry>
4486 <varlistentry>
4487 <term><option>-bs</option></term>
4488 <listitem>
4489 <para>
4490 <indexterm role="option">
4491 <primary><option>-bs</option></primary>
4492 </indexterm>
4493 <indexterm role="concept">
4494 <primary>SMTP</primary>
4495 <secondary>local input</secondary>
4496 </indexterm>
4497 <indexterm role="concept">
4498 <primary>local SMTP input</primary>
4499 </indexterm>
4500 This option causes Exim to accept one or more messages by reading SMTP commands
4501 on the standard input, and producing SMTP replies on the standard output. SMTP
4502 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4503 Some user agents use this interface as a way of passing locally-generated
4504 messages to the MTA.
4505 </para>
4506 <para>
4507 In
4508 <indexterm role="concept">
4509 <primary>sender</primary>
4510 <secondary>source of</secondary>
4511 </indexterm>
4512 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4513 set, the senders of messages are taken from the SMTP MAIL commands.
4514 Otherwise the content of these commands is ignored and the sender is set up as
4515 the calling user. Unqualified addresses are automatically qualified using
4516 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4517 <option>-bnq</option> option is used.
4518 </para>
4519 <para>
4520 <indexterm role="concept">
4521 <primary>inetd</primary>
4522 </indexterm>
4523 The
4524 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4525 using a listening daemon. Exim can distinguish the two cases by checking
4526 whether the standard input is a TCP/IP socket. When Exim is called from
4527 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4528 above concerning senders and qualification do not apply. In this situation,
4529 Exim behaves in exactly the same way as it does when receiving a message via
4530 the listening daemon.
4531 </para>
4532 </listitem></varlistentry>
4533 <varlistentry>
4534 <term><option>-bt</option></term>
4535 <listitem>
4536 <para>
4537 <indexterm role="option">
4538 <primary><option>-bt</option></primary>
4539 </indexterm>
4540 <indexterm role="concept">
4541 <primary>testing</primary>
4542 <secondary>addresses</secondary>
4543 </indexterm>
4544 <indexterm role="concept">
4545 <primary>address</primary>
4546 <secondary>testing</secondary>
4547 </indexterm>
4548 This option runs Exim in address testing mode, in which each argument is taken
4549 as a recipient address to be tested for deliverability. The results are
4550 written to the standard output. If a test fails, and the caller is not an admin
4551 user, no details of the failure are output, because these might contain
4552 sensitive information such as usernames and passwords for database lookups.
4553 </para>
4554 <para>
4555 If no arguments are given, Exim runs in an interactive manner, prompting with a
4556 right angle bracket for addresses to be tested.
4557 </para>
4558 <para>
4559 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4560 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4561 security issues.
4562 </para>
4563 <para>
4564 Each address is handled as if it were the recipient address of a message
4565 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4566 written to the standard output. However, any router that has
4567 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4568 genuine routing tests if your first router passes everything to a scanner
4569 program.
4570 </para>
4571 <para>
4572 <indexterm role="concept">
4573 <primary>return code</primary>
4574 <secondary>for <option>-bt</option></secondary>
4575 </indexterm>
4576 The return code is 2 if any address failed outright; it is 1 if no address
4577 failed outright but at least one could not be resolved for some reason. Return
4578 code 0 is given only when all addresses succeed.
4579 </para>
4580 <para>
4581 <indexterm role="concept">
4582 <primary>duplicate addresses</primary>
4583 </indexterm>
4584 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4585 addresses after routing is complete, so that only one delivery takes place.
4586 This does not happen when testing with <option>-bt</option>; the full results of routing are
4587 always shown.
4588 </para>
4589 <para>
4590 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4591 routers in the configuration makes any tests on the sender address of a
4592 message,
4593 <indexterm role="option">
4594 <primary><option>-f</option></primary>
4595 <secondary>for address testing</secondary>
4596 </indexterm>
4597 you can use the <option>-f</option> option to set an appropriate sender when running
4598 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4599 default qualifying domain. However, if you have set up (for example) routers
4600 whose behaviour depends on the contents of an incoming message, you cannot test
4601 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4602 doing such tests.
4603 </para>
4604 </listitem></varlistentry>
4605 <varlistentry>
4606 <term><option>-bV</option></term>
4607 <listitem>
4608 <para>
4609 <indexterm role="option">
4610 <primary><option>-bV</option></primary>
4611 </indexterm>
4612 <indexterm role="concept">
4613 <primary>version number of Exim</primary>
4614 </indexterm>
4615 This option causes Exim to write the current version number, compilation
4616 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4617 It also lists the DBM library this is being used, the optional modules (such as
4618 specific lookup types), the drivers that are included in the binary, and the
4619 name of the run time configuration file that is in use.
4620 </para>
4621 <para>
4622 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4623 configuration file. However, this is a static check only. It cannot check
4624 values that are to be expanded. For example, although a misspelt ACL verb is
4625 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4626 alone to discover (for example) all the typos in the configuration; some
4627 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4628 dynamic testing facilities.
4629 </para>
4630 </listitem></varlistentry>
4631 <varlistentry>
4632 <term><option>-bv</option></term>
4633 <listitem>
4634 <para>
4635 <indexterm role="option">
4636 <primary><option>-bv</option></primary>
4637 </indexterm>
4638 <indexterm role="concept">
4639 <primary>verifying address</primary>
4640 <secondary>using <option>-bv</option></secondary>
4641 </indexterm>
4642 <indexterm role="concept">
4643 <primary>address</primary>
4644 <secondary>verification</secondary>
4645 </indexterm>
4646 This option runs Exim in address verification mode, in which each argument is
4647 taken as a recipient address to be verified by the routers. (This does
4648 not involve any verification callouts). During normal operation, verification
4649 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4650 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4651 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4652 </para>
4653 <para>
4654 If verification fails, and the caller is not an admin user, no details of the
4655 failure are output, because these might contain sensitive information such as
4656 usernames and passwords for database lookups.
4657 </para>
4658 <para>
4659 If no arguments are given, Exim runs in an interactive manner, prompting with a
4660 right angle bracket for addresses to be verified.
4661 </para>
4662 <para>
4663 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4664 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4665 security issues.
4666 </para>
4667 <para>
4668 Verification differs from address testing (the <option>-bt</option> option) in that routers
4669 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4670 router that has <option>fail_verify</option> set, verification fails. The address is
4671 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4672 address, <option>-bvs</option> should be used.
4673 </para>
4674 <para>
4675 If the <option>-v</option> option is not set, the output consists of a single line for each
4676 address, stating whether it was verified or not, and giving a reason in the
4677 latter case. Without <option>-v</option>, generating more than one address by redirection
4678 causes verification to end successfully, without considering the generated
4679 addresses. However, if just one address is generated, processing continues,
4680 and the generated address must verify successfully for the overall verification
4681 to succeed.
4682 </para>
4683 <para>
4684 When <option>-v</option> is set, more details are given of how the address has been handled,
4685 and in the case of address redirection, all the generated addresses are also
4686 considered. Verification may succeed for some and fail for others.
4687 </para>
4688 <para>
4689 The
4690 <indexterm role="concept">
4691 <primary>return code</primary>
4692 <secondary>for <option>-bv</option></secondary>
4693 </indexterm>
4694 return code is 2 if any address failed outright; it is 1 if no address
4695 failed outright but at least one could not be resolved for some reason. Return
4696 code 0 is given only when all addresses succeed.
4697 </para>
4698 <para>
4699 If any of the routers in the configuration makes any tests on the sender
4700 address of a message, you should use the <option>-f</option> option to set an appropriate
4701 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4702 calling user at the default qualifying domain.
4703 </para>
4704 </listitem></varlistentry>
4705 <varlistentry>
4706 <term><option>-bvs</option></term>
4707 <listitem>
4708 <para>
4709 <indexterm role="option">
4710 <primary><option>-bvs</option></primary>
4711 </indexterm>
4712 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4713 than a recipient address. This affects any rewriting and qualification that
4714 might happen.
4715 </para>
4716 </listitem></varlistentry>
4717 <varlistentry>
4718 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4719 <listitem>
4720 <para>
4721 <indexterm role="option">
4722 <primary><option>-C</option></primary>
4723 </indexterm>
4724 <indexterm role="concept">
4725 <primary>configuration file</primary>
4726 <secondary>alternate</secondary>
4727 </indexterm>
4728 <indexterm role="concept">
4729 <primary>CONFIGURE_FILE</primary>
4730 </indexterm>
4731 <indexterm role="concept">
4732 <primary>alternate configuration file</primary>
4733 </indexterm>
4734 This option causes Exim to find the run time configuration file from the given
4735 list instead of from the list specified by the CONFIGURE_FILE
4736 compile-time setting. Usually, the list will consist of just a single file
4737 name, but it can be a colon-separated list of names. In this case, the first
4738 file that exists is used. Failure to open an existing file stops Exim from
4739 proceeding any further along the list, and an error is generated.
4740 </para>
4741 <para>
4742 When this option is used by a caller other than root or the Exim user, and the
4743 list is different from the compiled-in list, Exim gives up its root privilege
4744 immediately, and runs with the real and effective uid and gid set to those of
4745 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4746 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4747 Exim is root.
4748 </para>
4749 <para>
4750 That is, the Exim user is no longer privileged in this regard. This build-time
4751 option is not set by default in the Exim source distribution tarbundle.
4752 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4753 the packagers might have enabled it.
4754 </para>
4755 <para>
4756 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4757 configuration using <option>-C</option> right through message reception and delivery, even
4758 if the caller is root. The reception works, but by that time, Exim is running
4759 as the Exim user, so when it re-executes to regain privilege for the delivery,
4760 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4761 and delivery using two separate commands (one to put a message on the queue,
4762 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4763 </para>
4764 <para>
4765 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4766 prefix string with which any file named in a <option>-C</option> command line option
4767 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4768 However, if the value of the <option>-C</option> option is identical to the value of
4769 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4770 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4771 unset, any file name can be used with <option>-C</option>.
4772 </para>
4773 <para>
4774 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4775 to a directory to which only root has access. This prevents someone who has
4776 broken into the Exim account from running a privileged Exim with an arbitrary
4777 configuration file.
4778 </para>
4779 <para>
4780 The <option>-C</option> facility is useful for ensuring that configuration files are
4781 syntactically correct, but cannot be used for test deliveries, unless the
4782 caller is privileged, or unless it is an exotic configuration that does not
4783 require privilege. No check is made on the owner or group of the files
4784 specified by this option.
4785 </para>
4786 </listitem></varlistentry>
4787 <varlistentry>
4788 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4789 <listitem>
4790 <para>
4791 <indexterm role="option">
4792 <primary><option>-D</option></primary>
4793 </indexterm>
4794 <indexterm role="concept">
4795 <primary>macro</primary>
4796 <secondary>setting on command line</secondary>
4797 </indexterm>
4798 This option can be used to override macro definitions in the configuration file
4799 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4800 unprivileged caller, it causes Exim to give up its root privilege.
4801 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4802 completely disabled, and its use causes an immediate error exit.
4803 </para>
4804 <para>
4805 The entire option (including equals sign if present) must all be within one
4806 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4807 string, in which case the equals sign is optional. These two commands are
4808 synonymous:
4809 </para>
4810 <literallayout class="monospaced">
4811 exim -DABC  ...
4812 exim -DABC= ...
4813 </literallayout>
4814 <para>
4815 To include spaces in a macro definition item, quotes must be used. If you use
4816 quotes, spaces are permitted around the macro name and the equals sign. For
4817 example:
4818 </para>
4819 <literallayout class="monospaced">
4820 exim '-D ABC = something' ...
4821 </literallayout>
4822 <para>
4823 <option>-D</option> may be repeated up to 10 times on a command line.
4824 </para>
4825 </listitem></varlistentry>
4826 <varlistentry>
4827 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4828 <listitem>
4829 <para>
4830 <indexterm role="option">
4831 <primary><option>-d</option></primary>
4832 </indexterm>
4833 <indexterm role="concept">
4834 <primary>debugging</primary>
4835 <secondary>list of selectors</secondary>
4836 </indexterm>
4837 <indexterm role="concept">
4838 <primary>debugging</primary>
4839 <secondary><option>-d</option> option</secondary>
4840 </indexterm>
4841 This option causes debugging information to be written to the standard
4842 error stream. It is restricted to admin users because debugging output may show
4843 database queries that contain password information. Also, the details of users&#x2019;
4844 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4845 writes an error message to the standard error stream and exits with a non-zero
4846 return code.
4847 </para>
4848 <para>
4849 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4850 standard debugging data is output. This can be reduced, or increased to include
4851 some more rarely needed information, by directly following <option>-d</option> with a string
4852 made up of names preceded by plus or minus characters. These add or remove sets
4853 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4854 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4855 no spaces are allowed in the debug setting. The available debugging categories
4856 are:
4857 </para>
4858 <literallayout>
4859 <literal>acl            </literal> ACL interpretation
4860 <literal>auth           </literal> authenticators
4861 <literal>deliver        </literal> general delivery logic
4862 <literal>dns            </literal> DNS lookups (see also resolver)
4863 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4864 <literal>exec           </literal> arguments for <function>execv()</function> calls
4865 <literal>expand         </literal> detailed debugging for string expansions
4866 <literal>filter         </literal> filter handling
4867 <literal>hints_lookup   </literal> hints data lookups
4868 <literal>host_lookup    </literal> all types of name-to-IP address handling
4869 <literal>ident          </literal> ident lookup
4870 <literal>interface      </literal> lists of local interfaces
4871 <literal>lists          </literal> matching things in lists
4872 <literal>load           </literal> system load checks
4873 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4874 <literal>lookup         </literal> general lookup code and all lookups
4875 <literal>memory         </literal> memory handling
4876 <literal>pid            </literal> add pid to debug output lines
4877 <literal>process_info   </literal> setting info for the process log
4878 <literal>queue_run      </literal> queue runs
4879 <literal>receive        </literal> general message reception logic
4880 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4881 <literal>retry          </literal> retry handling
4882 <literal>rewrite        </literal> address rewriting
4883 <literal>route          </literal> address routing
4884 <literal>timestamp      </literal> add timestamp to debug output lines
4885 <literal>tls            </literal> TLS logic
4886 <literal>transport      </literal> transports
4887 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4888 <literal>verify         </literal> address verification logic
4889 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4890 </literallayout>
4891 <para>
4892 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4893 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4894 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4895 is included, an awful lot of output that is very rarely of interest is
4896 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4897 turn everything off.
4898 </para>
4899 <para>
4900 <indexterm role="concept">
4901 <primary>resolver, debugging output</primary>
4902 </indexterm>
4903 <indexterm role="concept">
4904 <primary>DNS resolver, debugging output</primary>
4905 </indexterm>
4906 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4907 with DEBUG enabled. This is not the case in some operating systems. Also,
4908 unfortunately, debugging output from the DNS resolver is written to stdout
4909 rather than stderr.
4910 </para>
4911 <para>
4912 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4913 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4914 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4915 daemon, which then passes it on to any re-executed Exims. Exim also
4916 automatically adds the pid to debug lines when several remote deliveries are
4917 run in parallel.
4918 </para>
4919 <para>
4920 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4921 of all debug output lines. This can be useful when trying to track down delays
4922 in processing.
4923 </para>
4924 <para>
4925 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4926 any debugging is selected, or if <option>-v</option> is used.
4927 </para>
4928 </listitem></varlistentry>
4929 <varlistentry>
4930 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4931 <listitem>
4932 <para>
4933 <indexterm role="option">
4934 <primary><option>-dd</option></primary>
4935 </indexterm>
4936 This option behaves exactly like <option>-d</option> except when used on a command that
4937 starts a daemon process. In that case, debugging is turned off for the
4938 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4939 behaviour of the daemon without creating as much output as full debugging does.
4940 </para>
4941 </listitem></varlistentry>
4942 <varlistentry>
4943 <term><option>-dropcr</option></term>
4944 <listitem>
4945 <para>
4946 <indexterm role="option">
4947 <primary><option>-dropcr</option></primary>
4948 </indexterm>
4949 This is an obsolete option that is now a no-op. It used to affect the way Exim
4950 handled CR and LF characters in incoming messages. What happens now is
4951 described in section <xref linkend="SECTlineendings"/>.
4952 </para>
4953 </listitem></varlistentry>
4954 <varlistentry>
4955 <term><option>-E</option></term>
4956 <listitem>
4957 <para>
4958 <indexterm role="option">
4959 <primary><option>-E</option></primary>
4960 </indexterm>
4961 <indexterm role="concept">
4962 <primary>bounce message</primary>
4963 <secondary>generating</secondary>
4964 </indexterm>
4965 This option specifies that an incoming message is a locally-generated delivery
4966 failure report. It is used internally by Exim when handling delivery failures
4967 and is not intended for external use. Its only effect is to stop Exim
4968 generating certain messages to the postmaster, as otherwise message cascades
4969 could occur in some situations. As part of the same option, a message id may
4970 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4971 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4972 </para>
4973 </listitem></varlistentry>
4974 <varlistentry>
4975 <term><option>-e</option><emphasis>x</emphasis></term>
4976 <listitem>
4977 <para>
4978 <indexterm role="option">
4979 <primary><option>-e</option><emphasis>x</emphasis></primary>
4980 </indexterm>
4981 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4982 called by various programs without the leading <option>o</option> in the option. For
4983 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4984 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4985 </para>
4986 </listitem></varlistentry>
4987 <varlistentry>
4988 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
4989 <listitem>
4990 <para>
4991 <indexterm role="option">
4992 <primary><option>-F</option></primary>
4993 </indexterm>
4994 <indexterm role="concept">
4995 <primary>sender</primary>
4996 <secondary>name</secondary>
4997 </indexterm>
4998 <indexterm role="concept">
4999 <primary>name</primary>
5000 <secondary>of sender</secondary>
5001 </indexterm>
5002 This option sets the sender&#x2019;s full name for use when a locally-generated
5003 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5004 entry from the password data is used. As users are generally permitted to alter
5005 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5006 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5007 </para>
5008 </listitem></varlistentry>
5009 <varlistentry>
5010 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5011 <listitem>
5012 <para>
5013 <indexterm role="option">
5014 <primary><option>-f</option></primary>
5015 </indexterm>
5016 <indexterm role="concept">
5017 <primary>sender</primary>
5018 <secondary>address</secondary>
5019 </indexterm>
5020 <indexterm role="concept">
5021 <primary>address</primary>
5022 <secondary>sender</secondary>
5023 </indexterm>
5024 <indexterm role="concept">
5025 <primary>trusted users</primary>
5026 </indexterm>
5027 <indexterm role="concept">
5028 <primary>envelope sender</primary>
5029 </indexterm>
5030 <indexterm role="concept">
5031 <primary>user</primary>
5032 <secondary>trusted</secondary>
5033 </indexterm>
5034 This option sets the address of the envelope sender of a locally-generated
5035 message (also known as the return path). The option can normally be used only
5036 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5037 users to use it.
5038 </para>
5039 <para>
5040 Processes running as root or the Exim user are always trusted. Other
5041 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5042 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5043 of a local message is set to the caller&#x2019;s login name at the default qualify
5044 domain.
5045 </para>
5046 <para>
5047 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5048 can be specified by any user, trusted or not, to create a message that can
5049 never provoke a bounce. An empty sender can be specified either as an empty
5050 string, or as a pair of angle brackets with nothing between them, as in these
5051 examples of shell commands:
5052 </para>
5053 <literallayout class="monospaced">
5054 exim -f '&lt;&gt;' user@domain
5055 exim -f "" user@domain
5056 </literallayout>
5057 <para>
5058 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5059 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5060 <option>-bv</option> options.
5061 </para>
5062 <para>
5063 Allowing untrusted users to change the sender address does not of itself make
5064 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5065 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5066 though this can be overridden by setting <option>no_local_from_check</option>.
5067 </para>
5068 <para>
5069 White
5070 <indexterm role="concept">
5071 <primary><quote>From</quote> line</primary>
5072 </indexterm>
5073 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5074 given as two arguments or one combined argument). The sender of a
5075 locally-generated message can also be set (when permitted) by an initial
5076 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5077 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5078 </para>
5079 </listitem></varlistentry>
5080 <varlistentry>
5081 <term><option>-G</option></term>
5082 <listitem>
5083 <para>
5084 <indexterm role="option">
5085 <primary><option>-G</option></primary>
5086 </indexterm>
5087 <indexterm role="concept">
5088 <primary>Sendmail compatibility</primary>
5089 <secondary><option>-G</option> option ignored</secondary>
5090 </indexterm>
5091 This is a Sendmail option which is ignored by Exim.
5092 </para>
5093 </listitem></varlistentry>
5094 <varlistentry>
5095 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5096 <listitem>
5097 <para>
5098 <indexterm role="option">
5099 <primary><option>-h</option></primary>
5100 </indexterm>
5101 <indexterm role="concept">
5102 <primary>Sendmail compatibility</primary>
5103 <secondary><option>-h</option> option ignored</secondary>
5104 </indexterm>
5105 This option is accepted for compatibility with Sendmail, but has no effect. (In
5106 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5107 headers.)
5108 </para>
5109 </listitem></varlistentry>
5110 <varlistentry>
5111 <term><option>-i</option></term>
5112 <listitem>
5113 <para>
5114 <indexterm role="option">
5115 <primary><option>-i</option></primary>
5116 </indexterm>
5117 <indexterm role="concept">
5118 <primary>Solaris</primary>
5119 <secondary><emphasis>mail</emphasis> command</secondary>
5120 </indexterm>
5121 <indexterm role="concept">
5122 <primary>dot</primary>
5123 <secondary>in incoming non-SMTP message</secondary>
5124 </indexterm>
5125 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5126 line by itself should not terminate an incoming, non-SMTP message. I can find
5127 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5128 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5129 </para>
5130 </listitem></varlistentry>
5131 <varlistentry>
5132 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5133 <listitem>
5134 <para>
5135 <indexterm role="option">
5136 <primary><option>-M</option></primary>
5137 </indexterm>
5138 <indexterm role="concept">
5139 <primary>forcing delivery</primary>
5140 </indexterm>
5141 <indexterm role="concept">
5142 <primary>delivery</primary>
5143 <secondary>forcing attempt</secondary>
5144 </indexterm>
5145 <indexterm role="concept">
5146 <primary>frozen messages</primary>
5147 <secondary>forcing delivery</secondary>
5148 </indexterm>
5149 This option requests Exim to run a delivery attempt on each message in turn. If
5150 any of the messages are frozen, they are automatically thawed before the
5151 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5152 and <option>hold_domains</option> are ignored.
5153 </para>
5154 <para>
5155 Retry
5156 <indexterm role="concept">
5157 <primary>hints database</primary>
5158 <secondary>overriding retry hints</secondary>
5159 </indexterm>
5160 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5161 the normal retry time has not yet been reached. This option requires the caller
5162 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5163 which can be set false to relax this restriction (and also the same requirement
5164 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5165 </para>
5166 <para>
5167 The deliveries happen synchronously, that is, the original Exim process does
5168 not terminate until all the delivery attempts have finished. No output is
5169 produced unless there is a serious error. If you want to see what is happening,
5170 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5171 </para>
5172 </listitem></varlistentry>
5173 <varlistentry>
5174 <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>
5175 <listitem>
5176 <para>
5177 <indexterm role="option">
5178 <primary><option>-Mar</option></primary>
5179 </indexterm>
5180 <indexterm role="concept">
5181 <primary>message</primary>
5182 <secondary>adding recipients</secondary>
5183 </indexterm>
5184 <indexterm role="concept">
5185 <primary>recipient</primary>
5186 <secondary>adding</secondary>
5187 </indexterm>
5188 This option requests Exim to add the addresses to the list of recipients of the
5189 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5190 id, and the remaining ones must be email addresses. However, if the message is
5191 active (in the middle of a delivery attempt), it is not altered. This option
5192 can be used only by an admin user.
5193 </para>
5194 </listitem></varlistentry>
5195 <varlistentry>
5196 <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>
5197 <listitem>
5198 <para>
5199 <indexterm role="option">
5200 <primary><option>-MC</option></primary>
5201 </indexterm>
5202 <indexterm role="concept">
5203 <primary>SMTP</primary>
5204 <secondary>passed connection</secondary>
5205 </indexterm>
5206 <indexterm role="concept">
5207 <primary>SMTP</primary>
5208 <secondary>multiple deliveries</secondary>
5209 </indexterm>
5210 <indexterm role="concept">
5211 <primary>multiple SMTP deliveries</primary>
5212 </indexterm>
5213 This option is not intended for use by external callers. It is used internally
5214 by Exim to invoke another instance of itself to deliver a waiting message using
5215 an existing SMTP connection, which is passed as the standard input. Details are
5216 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5217 must be root or the Exim user in order to use it.
5218 </para>
5219 </listitem></varlistentry>
5220 <varlistentry>
5221 <term><option>-MCA</option></term>
5222 <listitem>
5223 <para>
5224 <indexterm role="option">
5225 <primary><option>-MCA</option></primary>
5226 </indexterm>
5227 This option is not intended for use by external callers. It is used internally
5228 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5229 connection to the remote host has been authenticated.
5230 </para>
5231 </listitem></varlistentry>
5232 <varlistentry>
5233 <term><option>-MCP</option></term>
5234 <listitem>
5235 <para>
5236 <indexterm role="option">
5237 <primary><option>-MCP</option></primary>
5238 </indexterm>
5239 This option is not intended for use by external callers. It is used internally
5240 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5241 which Exim is connected supports pipelining.
5242 </para>
5243 </listitem></varlistentry>
5244 <varlistentry>
5245 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5246 <listitem>
5247 <para>
5248 <indexterm role="option">
5249 <primary><option>-MCQ</option></primary>
5250 </indexterm>
5251 This option is not intended for use by external callers. It is used internally
5252 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5253 started by a queue runner. It passes on the process id of the queue runner,
5254 together with the file descriptor number of an open pipe. Closure of the pipe
5255 signals the final completion of the sequence of processes that are passing
5256 messages through the same SMTP connection.
5257 </para>
5258 </listitem></varlistentry>
5259 <varlistentry>
5260 <term><option>-MCS</option></term>
5261 <listitem>
5262 <para>
5263 <indexterm role="option">
5264 <primary><option>-MCS</option></primary>
5265 </indexterm>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5268 SMTP SIZE option should be used on messages delivered down the existing
5269 connection.
5270 </para>
5271 </listitem></varlistentry>
5272 <varlistentry>
5273 <term><option>-MCT</option></term>
5274 <listitem>
5275 <para>
5276 <indexterm role="option">
5277 <primary><option>-MCT</option></primary>
5278 </indexterm>
5279 This option is not intended for use by external callers. It is used internally
5280 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5281 host to which Exim is connected supports TLS encryption.
5282 </para>
5283 </listitem></varlistentry>
5284 <varlistentry>
5285 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5286 <listitem>
5287 <para>
5288 <indexterm role="option">
5289 <primary><option>-Mc</option></primary>
5290 </indexterm>
5291 <indexterm role="concept">
5292 <primary>hints database</primary>
5293 <secondary>not overridden by <option>-Mc</option></secondary>
5294 </indexterm>
5295 <indexterm role="concept">
5296 <primary>delivery</primary>
5297 <secondary>manually started &ndash; not forced</secondary>
5298 </indexterm>
5299 This option requests Exim to run a delivery attempt on each message in turn,
5300 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5301 that are found. This option is not very useful to external callers. It is
5302 provided mainly for internal use by Exim when it needs to re-invoke itself in
5303 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5304 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5305 respects retry times and other options such as <option>hold_domains</option> that are
5306 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5307 If you want to run a specific delivery as if in a queue run, you should use
5308 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5309 and other deliveries is made in one or two places.
5310 </para>
5311 </listitem></varlistentry>
5312 <varlistentry>
5313 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5314 <listitem>
5315 <para>
5316 <indexterm role="option">
5317 <primary><option>-Mes</option></primary>
5318 </indexterm>
5319 <indexterm role="concept">
5320 <primary>message</primary>
5321 <secondary>changing sender</secondary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>sender</primary>
5325 <secondary>changing</secondary>
5326 </indexterm>
5327 This option requests Exim to change the sender address in the message to the
5328 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5329 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5330 be a message id, and the second one an email address. However, if the message
5331 is active (in the middle of a delivery attempt), its status is not altered.
5332 This option can be used only by an admin user.
5333 </para>
5334 </listitem></varlistentry>
5335 <varlistentry>
5336 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5337 <listitem>
5338 <para>
5339 <indexterm role="option">
5340 <primary><option>-Mf</option></primary>
5341 </indexterm>
5342 <indexterm role="concept">
5343 <primary>freezing messages</primary>
5344 </indexterm>
5345 <indexterm role="concept">
5346 <primary>message</primary>
5347 <secondary>manually freezing</secondary>
5348 </indexterm>
5349 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5350 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5351 either manually or as a result of the <option>auto_thaw</option> configuration option.
5352 However, if any of the messages are active (in the middle of a delivery
5353 attempt), their status is not altered. This option can be used only by an admin
5354 user.
5355 </para>
5356 </listitem></varlistentry>
5357 <varlistentry>
5358 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5359 <listitem>
5360 <para>
5361 <indexterm role="option">
5362 <primary><option>-Mg</option></primary>
5363 </indexterm>
5364 <indexterm role="concept">
5365 <primary>giving up on messages</primary>
5366 </indexterm>
5367 <indexterm role="concept">
5368 <primary>message</primary>
5369 <secondary>abandoning delivery attempts</secondary>
5370 </indexterm>
5371 <indexterm role="concept">
5372 <primary>delivery</primary>
5373 <secondary>abandoning further attempts</secondary>
5374 </indexterm>
5375 This option requests Exim to give up trying to deliver the listed messages,
5376 including any that are frozen. However, if any of the messages are active,
5377 their status is not altered. For non-bounce messages, a delivery error message
5378 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5379 Bounce messages are just discarded. This option can be used only by an admin
5380 user.
5381 </para>
5382 </listitem></varlistentry>
5383 <varlistentry>
5384 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5385 <listitem>
5386 <para>
5387 <indexterm role="option">
5388 <primary><option>-Mmad</option></primary>
5389 </indexterm>
5390 <indexterm role="concept">
5391 <primary>delivery</primary>
5392 <secondary>cancelling all</secondary>
5393 </indexterm>
5394 This option requests Exim to mark all the recipient addresses in the messages
5395 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5396 message is active (in the middle of a delivery attempt), its status is not
5397 altered. This option can be used only by an admin user.
5398 </para>
5399 </listitem></varlistentry>
5400 <varlistentry>
5401 <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>
5402 <listitem>
5403 <para>
5404 <indexterm role="option">
5405 <primary><option>-Mmd</option></primary>
5406 </indexterm>
5407 <indexterm role="concept">
5408 <primary>delivery</primary>
5409 <secondary>cancelling by address</secondary>
5410 </indexterm>
5411 <indexterm role="concept">
5412 <primary>recipient</primary>
5413 <secondary>removing</secondary>
5414 </indexterm>
5415 <indexterm role="concept">
5416 <primary>removing recipients</primary>
5417 </indexterm>
5418 This option requests Exim to mark the given addresses as already delivered
5419 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5420 the remaining ones must be email addresses. These are matched to recipient
5421 addresses in the message in a case-sensitive manner. If the message is active
5422 (in the middle of a delivery attempt), its status is not altered. This option
5423 can be used only by an admin user.
5424 </para>
5425 </listitem></varlistentry>
5426 <varlistentry>
5427 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5428 <listitem>
5429 <para>
5430 <indexterm role="option">
5431 <primary><option>-Mrm</option></primary>
5432 </indexterm>
5433 <indexterm role="concept">
5434 <primary>removing messages</primary>
5435 </indexterm>
5436 <indexterm role="concept">
5437 <primary>abandoning mail</primary>
5438 </indexterm>
5439 <indexterm role="concept">
5440 <primary>message</primary>
5441 <secondary>manually discarding</secondary>
5442 </indexterm>
5443 This option requests Exim to remove the given messages from the queue. No
5444 bounce messages are sent; each message is simply forgotten. However, if any of
5445 the messages are active, their status is not altered. This option can be used
5446 only by an admin user or by the user who originally caused the message to be
5447 placed on the queue.
5448 </para>
5449 </listitem></varlistentry>
5450 <varlistentry>
5451 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5452 <listitem>
5453 <para>
5454 <indexterm role="option">
5455 <primary><option>-Mset</option></primary>
5456 </indexterm>
5457 <indexterm role="concept">
5458 <primary>testing</primary>
5459 <secondary>string expansion</secondary>
5460 </indexterm>
5461 <indexterm role="concept">
5462 <primary>expansion</primary>
5463 <secondary>testing</secondary>
5464 </indexterm>
5465 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5466 string expansions). Exim loads the given message from its spool before doing
5467 the test expansions, thus setting message-specific variables such as
5468 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5469 available. This feature is provided to make it easier to test expansions that
5470 make use of these variables. However, this option can be used only by an admin
5471 user. See also <option>-bem</option>.
5472 </para>
5473 </listitem></varlistentry>
5474 <varlistentry>
5475 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5476 <listitem>
5477 <para>
5478 <indexterm role="option">
5479 <primary><option>-Mt</option></primary>
5480 </indexterm>
5481 <indexterm role="concept">
5482 <primary>thawing messages</primary>
5483 </indexterm>
5484 <indexterm role="concept">
5485 <primary>unfreezing messages</primary>
5486 </indexterm>
5487 <indexterm role="concept">
5488 <primary>frozen messages</primary>
5489 <secondary>thawing</secondary>
5490 </indexterm>
5491 <indexterm role="concept">
5492 <primary>message</primary>
5493 <secondary>thawing frozen</secondary>
5494 </indexterm>
5495 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5496 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5497 messages are active, their status is not altered. This option can be used only
5498 by an admin user.
5499 </para>
5500 </listitem></varlistentry>
5501 <varlistentry>
5502 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5503 <listitem>
5504 <para>
5505 <indexterm role="option">
5506 <primary><option>-Mvb</option></primary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>listing</primary>
5510 <secondary>message body</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>message</primary>
5514 <secondary>listing body of</secondary>
5515 </indexterm>
5516 This option causes the contents of the message body (-D) spool file to be
5517 written to the standard output. This option can be used only by an admin user.
5518 </para>
5519 </listitem></varlistentry>
5520 <varlistentry>
5521 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5522 <listitem>
5523 <para>
5524 <indexterm role="option">
5525 <primary><option>-Mvc</option></primary>
5526 </indexterm>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>listing in RFC 2822 format</secondary>
5530 </indexterm>
5531 <indexterm role="concept">
5532 <primary>listing</primary>
5533 <secondary>message in RFC 2922 format</secondary>
5534 </indexterm>
5535 This option causes a copy of the complete message (header lines plus body) to
5536 be written to the standard output in RFC 2822 format. This option can be used
5537 only by an admin user.
5538 </para>
5539 </listitem></varlistentry>
5540 <varlistentry>
5541 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5542 <listitem>
5543 <para>
5544 <indexterm role="option">
5545 <primary><option>-Mvh</option></primary>
5546 </indexterm>
5547 <indexterm role="concept">
5548 <primary>listing</primary>
5549 <secondary>message headers</secondary>
5550 </indexterm>
5551 <indexterm role="concept">
5552 <primary>header lines</primary>
5553 <secondary>listing</secondary>
5554 </indexterm>
5555 <indexterm role="concept">
5556 <primary>message</primary>
5557 <secondary>listing header lines</secondary>
5558 </indexterm>
5559 This option causes the contents of the message headers (-H) spool file to be
5560 written to the standard output. This option can be used only by an admin user.
5561 </para>
5562 </listitem></varlistentry>
5563 <varlistentry>
5564 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5565 <listitem>
5566 <para>
5567 <indexterm role="option">
5568 <primary><option>-Mvl</option></primary>
5569 </indexterm>
5570 <indexterm role="concept">
5571 <primary>listing</primary>
5572 <secondary>message log</secondary>
5573 </indexterm>
5574 <indexterm role="concept">
5575 <primary>message</primary>
5576 <secondary>listing message log</secondary>
5577 </indexterm>
5578 This option causes the contents of the message log spool file to be written to
5579 the standard output. This option can be used only by an admin user.
5580 </para>
5581 </listitem></varlistentry>
5582 <varlistentry>
5583 <term><option>-m</option></term>
5584 <listitem>
5585 <para>
5586 <indexterm role="option">
5587 <primary><option>-m</option></primary>
5588 </indexterm>
5589 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5590 treats it that way too.
5591 </para>
5592 </listitem></varlistentry>
5593 <varlistentry>
5594 <term><option>-N</option></term>
5595 <listitem>
5596 <para>
5597 <indexterm role="option">
5598 <primary><option>-N</option></primary>
5599 </indexterm>
5600 <indexterm role="concept">
5601 <primary>debugging</primary>
5602 <secondary><option>-N</option> option</secondary>
5603 </indexterm>
5604 <indexterm role="concept">
5605 <primary>debugging</primary>
5606 <secondary>suppressing delivery</secondary>
5607 </indexterm>
5608 This is a debugging option that inhibits delivery of a message at the transport
5609 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5610 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5611 had successfully done so. However, it does not make any updates to the retry
5612 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5613 than <quote>=&gt;</quote>.
5614 </para>
5615 <para>
5616 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5617 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5618 words, an ordinary user can use it only when supplying an incoming message to
5619 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5620 address may be deferred because of a configuration problem on a transport, or a
5621 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5622 the message, and applies to any subsequent delivery attempts that may happen
5623 for that message.
5624 </para>
5625 </listitem></varlistentry>
5626 <varlistentry>
5627 <term><option>-n</option></term>
5628 <listitem>
5629 <para>
5630 <indexterm role="option">
5631 <primary><option>-n</option></primary>
5632 </indexterm>
5633 <indexterm role="concept">
5634 <primary>Sendmail compatibility</primary>
5635 <secondary><option>-n</option> option ignored</secondary>
5636 </indexterm>
5637 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5638 by Exim.
5639 </para>
5640 </listitem></varlistentry>
5641 <varlistentry>
5642 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5643 <listitem>
5644 <para>
5645 <indexterm role="option">
5646 <primary><option>-O</option></primary>
5647 </indexterm>
5648 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5649 Exim.
5650 </para>
5651 </listitem></varlistentry>
5652 <varlistentry>
5653 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5654 <listitem>
5655 <para>
5656 <indexterm role="option">
5657 <primary><option>-oA</option></primary>
5658 </indexterm>
5659 <indexterm role="concept">
5660 <primary>Sendmail compatibility</primary>
5661 <secondary><option>-oA</option> option</secondary>
5662 </indexterm>
5663 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5664 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5665 description above.
5666 </para>
5667 </listitem></varlistentry>
5668 <varlistentry>
5669 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5670 <listitem>
5671 <para>
5672 <indexterm role="option">
5673 <primary><option>-oB</option></primary>
5674 </indexterm>
5675 <indexterm role="concept">
5676 <primary>SMTP</primary>
5677 <secondary>passed connection</secondary>
5678 </indexterm>
5679 <indexterm role="concept">
5680 <primary>SMTP</primary>
5681 <secondary>multiple deliveries</secondary>
5682 </indexterm>
5683 <indexterm role="concept">
5684 <primary>multiple SMTP deliveries</primary>
5685 </indexterm>
5686 This is a debugging option which limits the maximum number of messages that can
5687 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5688 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5689 </para>
5690 </listitem></varlistentry>
5691 <varlistentry>
5692 <term><option>-odb</option></term>
5693 <listitem>
5694 <para>
5695 <indexterm role="option">
5696 <primary><option>-odb</option></primary>
5697 </indexterm>
5698 <indexterm role="concept">
5699 <primary>background delivery</primary>
5700 </indexterm>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>in the background</secondary>
5704 </indexterm>
5705 This option applies to all modes in which Exim accepts incoming messages,
5706 including the listening daemon. It requests <quote>background</quote> delivery of such
5707 messages, which means that the accepting process automatically starts a
5708 delivery process for each message received, but does not wait for the delivery
5709 processes to finish.
5710 </para>
5711 <para>
5712 When all the messages have been received, the reception process exits,
5713 leaving the delivery processes to finish in their own time. The standard output
5714 and error streams are closed at the start of each delivery process.
5715 This is the default action if none of the <option>-od</option> options are present.
5716 </para>
5717 <para>
5718 If one of the queueing options in the configuration file
5719 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5720 overrides it if <option>queue_only_override</option> is set true, which is the default
5721 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5722 </para>
5723 </listitem></varlistentry>
5724 <varlistentry>
5725 <term><option>-odf</option></term>
5726 <listitem>
5727 <para>
5728 <indexterm role="option">
5729 <primary><option>-odf</option></primary>
5730 </indexterm>
5731 <indexterm role="concept">
5732 <primary>foreground delivery</primary>
5733 </indexterm>
5734 <indexterm role="concept">
5735 <primary>delivery</primary>
5736 <secondary>in the foreground</secondary>
5737 </indexterm>
5738 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5739 accepted a locally-generated message. (For the daemon it is exactly the same as
5740 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5741 and Exim waits for it to complete before proceeding.
5742 </para>
5743 <para>
5744 The original Exim reception process does not finish until the delivery
5745 process for the final message has ended. The standard error stream is left open
5746 during deliveries.
5747 </para>
5748 <para>
5749 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5750 false and one of the queueing options in the configuration file is in effect.
5751 </para>
5752 <para>
5753 If there is a temporary delivery error during foreground delivery, the
5754 message is left on the queue for later delivery, and the original reception
5755 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5756 restricted configuration that never queues messages.
5757 </para>
5758 </listitem></varlistentry>
5759 <varlistentry>
5760 <term><option>-odi</option></term>
5761 <listitem>
5762 <para>
5763 <indexterm role="option">
5764 <primary><option>-odi</option></primary>
5765 </indexterm>
5766 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5767 Sendmail.
5768 </para>
5769 </listitem></varlistentry>
5770 <varlistentry>
5771 <term><option>-odq</option></term>
5772 <listitem>
5773 <para>
5774 <indexterm role="option">
5775 <primary><option>-odq</option></primary>
5776 </indexterm>
5777 <indexterm role="concept">
5778 <primary>non-immediate delivery</primary>
5779 </indexterm>
5780 <indexterm role="concept">
5781 <primary>delivery</primary>
5782 <secondary>suppressing immediate</secondary>
5783 </indexterm>
5784 <indexterm role="concept">
5785 <primary>queueing incoming messages</primary>
5786 </indexterm>
5787 This option applies to all modes in which Exim accepts incoming messages,
5788 including the listening daemon. It specifies that the accepting process should
5789 not automatically start a delivery process for each message received. Messages
5790 are placed on the queue, and remain there until a subsequent queue runner
5791 process encounters them. There are several configuration options (such as
5792 <option>queue_only</option>) that can be used to queue incoming messages under certain
5793 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5794 forces queueing.
5795 </para>
5796 </listitem></varlistentry>
5797 <varlistentry>
5798 <term><option>-odqs</option></term>
5799 <listitem>
5800 <para>
5801 <indexterm role="option">
5802 <primary><option>-odqs</option></primary>
5803 </indexterm>
5804 <indexterm role="concept">
5805 <primary>SMTP</primary>
5806 <secondary>delaying delivery</secondary>
5807 </indexterm>
5808 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5809 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5810 <option>queue_only_override</option> is false and one of the queueing options in the
5811 configuration file is in effect.
5812 </para>
5813 <para>
5814 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5815 message, in the background by default, but in the foreground if <option>-odi</option> is
5816 also present. The recipient addresses are routed, and local deliveries are done
5817 in the normal way. However, if any SMTP deliveries are required, they are not
5818 done at this time, so the message remains on the queue until a subsequent queue
5819 runner process encounters it. Because routing was done, Exim knows which
5820 messages are waiting for which hosts, and so a number of messages for the same
5821 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5822 configuration option has the same effect for specific domains. See also the
5823 <option>-qq</option> option.
5824 </para>
5825 </listitem></varlistentry>
5826 <varlistentry>
5827 <term><option>-oee</option></term>
5828 <listitem>
5829 <para>
5830 <indexterm role="option">
5831 <primary><option>-oee</option></primary>
5832 </indexterm>
5833 <indexterm role="concept">
5834 <primary>error</primary>
5835 <secondary>reporting</secondary>
5836 </indexterm>
5837 If an error is detected while a non-SMTP message is being received (for
5838 example, a malformed address), the error is reported to the sender in a mail
5839 message.
5840 </para>
5841 <para>
5842 <indexterm role="concept">
5843 <primary>return code</primary>
5844 <secondary>for <option>-oee</option></secondary>
5845 </indexterm>
5846 Provided
5847 this error message is successfully sent, the Exim receiving process
5848 exits with a return code of zero. If not, the return code is 2 if the problem
5849 is that the original message has no recipients, or 1 any other error. This is
5850 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5851 </para>
5852 </listitem></varlistentry>
5853 <varlistentry>
5854 <term><option>-oem</option></term>
5855 <listitem>
5856 <para>
5857 <indexterm role="option">
5858 <primary><option>-oem</option></primary>
5859 </indexterm>
5860 <indexterm role="concept">
5861 <primary>error</primary>
5862 <secondary>reporting</secondary>
5863 </indexterm>
5864 <indexterm role="concept">
5865 <primary>return code</primary>
5866 <secondary>for <option>-oem</option></secondary>
5867 </indexterm>
5868 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5869 return code, whether or not the error message was successfully sent.
5870 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5871 </para>
5872 </listitem></varlistentry>
5873 <varlistentry>
5874 <term><option>-oep</option></term>
5875 <listitem>
5876 <para>
5877 <indexterm role="option">
5878 <primary><option>-oep</option></primary>
5879 </indexterm>
5880 <indexterm role="concept">
5881 <primary>error</primary>
5882 <secondary>reporting</secondary>
5883 </indexterm>
5884 If an error is detected while a non-SMTP message is being received, the
5885 error is reported by writing a message to the standard error file (stderr).
5886 <indexterm role="concept">
5887 <primary>return code</primary>
5888 <secondary>for <option>-oep</option></secondary>
5889 </indexterm>
5890 The return code is 1 for all errors.
5891 </para>
5892 </listitem></varlistentry>
5893 <varlistentry>
5894 <term><option>-oeq</option></term>
5895 <listitem>
5896 <para>
5897 <indexterm role="option">
5898 <primary><option>-oeq</option></primary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>error</primary>
5902 <secondary>reporting</secondary>
5903 </indexterm>
5904 This option is supported for compatibility with Sendmail, but has the same
5905 effect as <option>-oep</option>.
5906 </para>
5907 </listitem></varlistentry>
5908 <varlistentry>
5909 <term><option>-oew</option></term>
5910 <listitem>
5911 <para>
5912 <indexterm role="option">
5913 <primary><option>-oew</option></primary>
5914 </indexterm>
5915 <indexterm role="concept">
5916 <primary>error</primary>
5917 <secondary>reporting</secondary>
5918 </indexterm>
5919 This option is supported for compatibility with Sendmail, but has the same
5920 effect as <option>-oem</option>.
5921 </para>
5922 </listitem></varlistentry>
5923 <varlistentry>
5924 <term><option>-oi</option></term>
5925 <listitem>
5926 <para>
5927 <indexterm role="option">
5928 <primary><option>-oi</option></primary>
5929 </indexterm>
5930 <indexterm role="concept">
5931 <primary>dot</primary>
5932 <secondary>in incoming non-SMTP message</secondary>
5933 </indexterm>
5934 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5935 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5936 single dot does terminate, though Exim does no special processing for other
5937 lines that start with a dot. This option is set by default if Exim is called as
5938 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5939 </para>
5940 </listitem></varlistentry>
5941 <varlistentry>
5942 <term><option>-oitrue</option></term>
5943 <listitem>
5944 <para>
5945 <indexterm role="option">
5946 <primary><option>-oitrue</option></primary>
5947 </indexterm>
5948 This option is treated as synonymous with <option>-oi</option>.
5949 </para>
5950 </listitem></varlistentry>
5951 <varlistentry>
5952 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5953 <listitem>
5954 <para>
5955 <indexterm role="option">
5956 <primary><option>-oMa</option></primary>
5957 </indexterm>
5958 <indexterm role="concept">
5959 <primary>sender</primary>
5960 <secondary>host address, specifying for local message</secondary>
5961 </indexterm>
5962 A number of options starting with <option>-oM</option> can be used to set values associated
5963 with remote hosts on locally-submitted messages (that is, messages not received
5964 over TCP/IP). These options can be used by any caller in conjunction with the
5965 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5966 other circumstances, they are ignored unless the caller is trusted.
5967 </para>
5968 <para>
5969 The <option>-oMa</option> option sets the sender host address. This may include a port
5970 number at the end, after a full stop (period). For example:
5971 </para>
5972 <literallayout class="monospaced">
5973 exim -bs -oMa 10.9.8.7.1234
5974 </literallayout>
5975 <para>
5976 An alternative syntax is to enclose the IP address in square brackets,
5977 followed by a colon and the port number:
5978 </para>
5979 <literallayout class="monospaced">
5980 exim -bs -oMa [10.9.8.7]:1234
5981 </literallayout>
5982 <para>
5983 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5984 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5985 are present on the command line, the sender host IP address is taken from
5986 whichever one is last.
5987 </para>
5988 </listitem></varlistentry>
5989 <varlistentry>
5990 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5991 <listitem>
5992 <para>
5993 <indexterm role="option">
5994 <primary><option>-oMaa</option></primary>
5995 </indexterm>
5996 <indexterm role="concept">
5997 <primary>authentication</primary>
5998 <secondary>name, specifying for local message</secondary>
5999 </indexterm>
6000 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6001 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6002 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6003 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6004 authenticated SMTP session without actually using the SMTP AUTH command.
6005 </para>
6006 </listitem></varlistentry>
6007 <varlistentry>
6008 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6009 <listitem>
6010 <para>
6011 <indexterm role="option">
6012 <primary><option>-oMai</option></primary>
6013 </indexterm>
6014 <indexterm role="concept">
6015 <primary>authentication</primary>
6016 <secondary>id, specifying for local message</secondary>
6017 </indexterm>
6018 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6019 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6020 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6021 where there is no default) for messages from local sources. See chapter
6022 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6023 </para>
6024 </listitem></varlistentry>
6025 <varlistentry>
6026 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6027 <listitem>
6028 <para>
6029 <indexterm role="option">
6030 <primary><option>-oMas</option></primary>
6031 </indexterm>
6032 <indexterm role="concept">
6033 <primary>authentication</primary>
6034 <secondary>sender, specifying for local message</secondary>
6035 </indexterm>
6036 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6037 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6038 overrides the sender address that is created from the caller&#x2019;s login id for
6039 messages from local sources, except when <option>-bh</option> is used, when there is no
6040 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6041 specified on a MAIL command overrides this value. See chapter
6042 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6043 </para>
6044 </listitem></varlistentry>
6045 <varlistentry>
6046 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6047 <listitem>
6048 <para>
6049 <indexterm role="option">
6050 <primary><option>-oMi</option></primary>
6051 </indexterm>
6052 <indexterm role="concept">
6053 <primary>interface</primary>
6054 <secondary>address, specifying for local message</secondary>
6055 </indexterm>
6056 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6057 option sets the IP interface address value. A port number may be included,
6058 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6059 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6060 </para>
6061 </listitem></varlistentry>
6062 <varlistentry>
6063 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6064 <listitem>
6065 <para>
6066 <indexterm role="option">
6067 <primary><option>-oMr</option></primary>
6068 </indexterm>
6069 <indexterm role="concept">
6070 <primary>protocol, specifying for local message</primary>
6071 </indexterm>
6072 <indexterm role="variable">
6073 <primary><varname>$received_protocol</varname></primary>
6074 </indexterm>
6075 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6076 option sets the received protocol value that is stored in
6077 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6078 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6079 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6080 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6081 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6082 be set by <option>-oMr</option>.
6083 </para>
6084 </listitem></varlistentry>
6085 <varlistentry>
6086 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6087 <listitem>
6088 <para>
6089 <indexterm role="option">
6090 <primary><option>-oMs</option></primary>
6091 </indexterm>
6092 <indexterm role="concept">
6093 <primary>sender</primary>
6094 <secondary>host name, specifying for local message</secondary>
6095 </indexterm>
6096 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6097 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6098 present, Exim does not attempt to look up a host name from an IP address; it
6099 uses the name it is given.
6100 </para>
6101 </listitem></varlistentry>
6102 <varlistentry>
6103 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6104 <listitem>
6105 <para>
6106 <indexterm role="option">
6107 <primary><option>-oMt</option></primary>
6108 </indexterm>
6109 <indexterm role="concept">
6110 <primary>sender</primary>
6111 <secondary>ident string, specifying for local message</secondary>
6112 </indexterm>
6113 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6114 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6115 local callers is the login id of the calling process, except when <option>-bh</option> is
6116 used, when there is no default.
6117 </para>
6118 </listitem></varlistentry>
6119 <varlistentry>
6120 <term><option>-om</option></term>
6121 <listitem>
6122 <para>
6123 <indexterm role="option">
6124 <primary><option>-om</option></primary>
6125 </indexterm>
6126 <indexterm role="concept">
6127 <primary>Sendmail compatibility</primary>
6128 <secondary><option>-om</option> option ignored</secondary>
6129 </indexterm>
6130 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6131 message should receive a copy of the message if the sender appears in an alias
6132 expansion. Exim always does this, so the option does nothing.
6133 </para>
6134 </listitem></varlistentry>
6135 <varlistentry>
6136 <term><option>-oo</option></term>
6137 <listitem>
6138 <para>
6139 <indexterm role="option">
6140 <primary><option>-oo</option></primary>
6141 </indexterm>
6142 <indexterm role="concept">
6143 <primary>Sendmail compatibility</primary>
6144 <secondary><option>-oo</option> option ignored</secondary>
6145 </indexterm>
6146 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6147 whatever that means.
6148 </para>
6149 </listitem></varlistentry>
6150 <varlistentry>
6151 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6152 <listitem>
6153 <para>
6154 <indexterm role="option">
6155 <primary><option>-oP</option></primary>
6156 </indexterm>
6157 <indexterm role="concept">
6158 <primary>pid (process id)</primary>
6159 <secondary>of daemon</secondary>
6160 </indexterm>
6161 <indexterm role="concept">
6162 <primary>daemon</primary>
6163 <secondary>process id (pid)</secondary>
6164 </indexterm>
6165 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6166 value. The option specifies the file to which the process id of the daemon is
6167 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6168 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6169 because in those cases, the normal pid file is not used.
6170 </para>
6171 </listitem></varlistentry>
6172 <varlistentry>
6173 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6174 <listitem>
6175 <para>
6176 <indexterm role="option">
6177 <primary><option>-or</option></primary>
6178 </indexterm>
6179 <indexterm role="concept">
6180 <primary>timeout</primary>
6181 <secondary>for non-SMTP input</secondary>
6182 </indexterm>
6183 This option sets a timeout value for incoming non-SMTP messages. If it is not
6184 set, Exim will wait forever for the standard input. The value can also be set
6185 by the <option>receive_timeout</option> option. The format used for specifying times is
6186 described in section <xref linkend="SECTtimeformat"/>.
6187 </para>
6188 </listitem></varlistentry>
6189 <varlistentry>
6190 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6191 <listitem>
6192 <para>
6193 <indexterm role="option">
6194 <primary><option>-os</option></primary>
6195 </indexterm>
6196 <indexterm role="concept">
6197 <primary>timeout</primary>
6198 <secondary>for SMTP input</secondary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>SMTP</primary>
6202 <secondary>input timeout</secondary>
6203 </indexterm>
6204 This option sets a timeout value for incoming SMTP messages. The timeout
6205 applies to each SMTP command and block of data. The value can also be set by
6206 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6207 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6208 </para>
6209 </listitem></varlistentry>
6210 <varlistentry>
6211 <term><option>-ov</option></term>
6212 <listitem>
6213 <para>
6214 <indexterm role="option">
6215 <primary><option>-ov</option></primary>
6216 </indexterm>
6217 This option has exactly the same effect as <option>-v</option>.
6218 </para>
6219 </listitem></varlistentry>
6220 <varlistentry>
6221 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6222 <listitem>
6223 <para>
6224 <indexterm role="option">
6225 <primary><option>-oX</option></primary>
6226 </indexterm>
6227 <indexterm role="concept">
6228 <primary>TCP/IP</primary>
6229 <secondary>setting listening ports</secondary>
6230 </indexterm>
6231 <indexterm role="concept">
6232 <primary>TCP/IP</primary>
6233 <secondary>setting listening interfaces</secondary>
6234 </indexterm>
6235 <indexterm role="concept">
6236 <primary>port</primary>
6237 <secondary>receiving TCP/IP</secondary>
6238 </indexterm>
6239 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6240 is also given. It controls which ports and interfaces the daemon uses. Details
6241 of the syntax, and how it interacts with configuration file options, are given
6242 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6243 file is written unless <option>-oP</option> is also present to specify a pid file name.
6244 </para>
6245 </listitem></varlistentry>
6246 <varlistentry>
6247 <term><option>-pd</option></term>
6248 <listitem>
6249 <para>
6250 <indexterm role="option">
6251 <primary><option>-pd</option></primary>
6252 </indexterm>
6253 <indexterm role="concept">
6254 <primary>Perl</primary>
6255 <secondary>starting the interpreter</secondary>
6256 </indexterm>
6257 This option applies when an embedded Perl interpreter is linked with Exim (see
6258 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6259 option, forcing the starting of the interpreter to be delayed until it is
6260 needed.
6261 </para>
6262 </listitem></varlistentry>
6263 <varlistentry>
6264 <term><option>-ps</option></term>
6265 <listitem>
6266 <para>
6267 <indexterm role="option">
6268 <primary><option>-ps</option></primary>
6269 </indexterm>
6270 <indexterm role="concept">
6271 <primary>Perl</primary>
6272 <secondary>starting the interpreter</secondary>
6273 </indexterm>
6274 This option applies when an embedded Perl interpreter is linked with Exim (see
6275 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6276 option, forcing the starting of the interpreter to occur as soon as Exim is
6277 started.
6278 </para>
6279 </listitem></varlistentry>
6280 <varlistentry>
6281 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6282 <listitem>
6283 <para>
6284 <indexterm role="option">
6285 <primary><option>-p</option></primary>
6286 </indexterm>
6287 For compatibility with Sendmail, this option is equivalent to
6288 </para>
6289 <literallayout>
6290 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6291 </literallayout>
6292 <para>
6293 It sets the incoming protocol and host name (for trusted callers). The
6294 host name and its colon can be omitted when only the protocol is to be set.
6295 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6296 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6297 or <literal>s</literal> using this option (but that does not seem a real limitation).
6298 </para>
6299 </listitem></varlistentry>
6300 <varlistentry>
6301 <term><option>-q</option></term>
6302 <listitem>
6303 <para>
6304 <indexterm role="option">
6305 <primary><option>-q</option></primary>
6306 </indexterm>
6307 <indexterm role="concept">
6308 <primary>queue runner</primary>
6309 <secondary>starting manually</secondary>
6310 </indexterm>
6311 This option is normally restricted to admin users. However, there is a
6312 configuration option called <option>prod_requires_admin</option> which can be set false to
6313 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6314 and <option>-S</option> options).
6315 </para>
6316 <para>
6317 <indexterm role="concept">
6318 <primary>queue runner</primary>
6319 <secondary>description of operation</secondary>
6320 </indexterm>
6321 The <option>-q</option> option starts one queue runner process. This scans the queue of
6322 waiting messages, and runs a delivery process for each one in turn. It waits
6323 for each delivery process to finish before starting the next one. A delivery
6324 process may not actually do any deliveries if the retry times for the addresses
6325 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6326 </para>
6327 <para>
6328 If
6329 <indexterm role="concept">
6330 <primary>SMTP</primary>
6331 <secondary>passed connection</secondary>
6332 </indexterm>
6333 <indexterm role="concept">
6334 <primary>SMTP</primary>
6335 <secondary>multiple deliveries</secondary>
6336 </indexterm>
6337 <indexterm role="concept">
6338 <primary>multiple SMTP deliveries</primary>
6339 </indexterm>
6340 the delivery process spawns other processes to deliver other messages down
6341 passed SMTP connections, the queue runner waits for these to finish before
6342 proceeding.
6343 </para>
6344 <para>
6345 When all the queued messages have been considered, the original queue runner
6346 process terminates. In other words, a single pass is made over the waiting
6347 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6348 this to be repeated periodically.
6349 </para>
6350 <para>
6351 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6352 random, but it is likely to be different each time, which is all that matters.
6353 If one particular message screws up a remote MTA, other messages to the same
6354 MTA have a chance of getting through if they get tried first.
6355 </para>
6356 <para>
6357 It is possible to cause the messages to be processed in lexical message id
6358 order, which is essentially the order in which they arrived, by setting the
6359 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6360 </para>
6361 </listitem></varlistentry>
6362 <varlistentry>
6363 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6364 <listitem>
6365 <para>
6366 The <option>-q</option> option may be followed by one or more flag letters that change its
6367 behaviour. They are all optional, but if more than one is present, they must
6368 appear in the correct order. Each flag is described in a separate item below.
6369 </para>
6370 </listitem></varlistentry>
6371 <varlistentry>
6372 <term><option>-qq...</option></term>
6373 <listitem>
6374 <para>
6375 <indexterm role="option">
6376 <primary><option>-qq</option></primary>
6377 </indexterm>
6378 <indexterm role="concept">
6379 <primary>queue</primary>
6380 <secondary>double scanning</secondary>
6381 </indexterm>
6382 <indexterm role="concept">
6383 <primary>queue</primary>
6384 <secondary>routing</secondary>
6385 </indexterm>
6386 <indexterm role="concept">
6387 <primary>routing</primary>
6388 <secondary>whole queue before delivery</secondary>
6389 </indexterm>
6390 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6391 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6392 every domain. Addresses are routed, local deliveries happen, but no remote
6393 transports are run.
6394 </para>
6395 <para>
6396 <indexterm role="concept">
6397 <primary>hints database</primary>
6398 <secondary>remembering routing</secondary>
6399 </indexterm>
6400 The hints database that remembers which messages are waiting for specific hosts
6401 is updated, as if delivery to those hosts had been deferred. After this is
6402 complete, a second, normal queue scan happens, with routing and delivery taking
6403 place as normal. Messages that are routed to the same host should mostly be
6404 delivered down a single SMTP
6405 <indexterm role="concept">
6406 <primary>SMTP</primary>
6407 <secondary>passed connection</secondary>
6408 </indexterm>
6409 <indexterm role="concept">
6410 <primary>SMTP</primary>
6411 <secondary>multiple deliveries</secondary>
6412 </indexterm>
6413 <indexterm role="concept">
6414 <primary>multiple SMTP deliveries</primary>
6415 </indexterm>
6416 connection because of the hints that were set up during the first queue scan.
6417 This option may be useful for hosts that are connected to the Internet
6418 intermittently.
6419 </para>
6420 </listitem></varlistentry>
6421 <varlistentry>
6422 <term><option>-q[q]i...</option></term>
6423 <listitem>
6424 <para>
6425 <indexterm role="option">
6426 <primary><option>-qi</option></primary>
6427 </indexterm>
6428 <indexterm role="concept">
6429 <primary>queue</primary>
6430 <secondary>initial delivery</secondary>
6431 </indexterm>
6432 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6433 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6434 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6435 <option>-odq</option> and want a queue runner just to process the new messages.
6436 </para>
6437 </listitem></varlistentry>
6438 <varlistentry>
6439 <term><option>-q[q][i]f...</option></term>
6440 <listitem>
6441 <para>
6442 <indexterm role="option">
6443 <primary><option>-qf</option></primary>
6444 </indexterm>
6445 <indexterm role="concept">
6446 <primary>queue</primary>
6447 <secondary>forcing delivery</secondary>
6448 </indexterm>
6449 <indexterm role="concept">
6450 <primary>delivery</primary>
6451 <secondary>forcing in queue run</secondary>
6452 </indexterm>
6453 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6454 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6455 their retry times are tried.
6456 </para>
6457 </listitem></varlistentry>
6458 <varlistentry>
6459 <term><option>-q[q][i]ff...</option></term>
6460 <listitem>
6461 <para>
6462 <indexterm role="option">
6463 <primary><option>-qff</option></primary>
6464 </indexterm>
6465 <indexterm role="concept">
6466 <primary>frozen messages</primary>
6467 <secondary>forcing delivery</secondary>
6468 </indexterm>
6469 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6470 frozen or not.
6471 </para>
6472 </listitem></varlistentry>
6473 <varlistentry>
6474 <term><option>-q[q][i][f[f]]l</option></term>
6475 <listitem>
6476 <para>
6477 <indexterm role="option">
6478 <primary><option>-ql</option></primary>
6479 </indexterm>
6480 <indexterm role="concept">
6481 <primary>queue</primary>
6482 <secondary>local deliveries only</secondary>
6483 </indexterm>
6484 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6485 be done. If a message requires any remote deliveries, it remains on the queue
6486 for later delivery.
6487 </para>
6488 </listitem></varlistentry>
6489 <varlistentry>
6490 <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>
6491 <listitem>
6492 <para>
6493 <indexterm role="concept">
6494 <primary>queue</primary>
6495 <secondary>delivering specific messages</secondary>
6496 </indexterm>
6497 When scanning the queue, Exim can be made to skip over messages whose ids are
6498 lexically less than a given value by following the <option>-q</option> option with a
6499 starting message id. For example:
6500 </para>
6501 <literallayout class="monospaced">
6502 exim -q 0t5C6f-0000c8-00
6503 </literallayout>
6504 <para>
6505 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6506 second message id is given, messages whose ids are lexically greater than it
6507 are also skipped. If the same id is given twice, for example,
6508 </para>
6509 <literallayout class="monospaced">
6510 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6511 </literallayout>
6512 <para>
6513 just one delivery process is started, for that message. This differs from
6514 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6515 that it counts as a delivery from a queue run. Note that the selection
6516 mechanism does not affect the order in which the messages are scanned. There
6517 are also other ways of selecting specific sets of messages for delivery in a
6518 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6519 </para>
6520 </listitem></varlistentry>
6521 <varlistentry>
6522 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6523 <listitem>
6524 <para>
6525 <indexterm role="concept">
6526 <primary>queue runner</primary>
6527 <secondary>starting periodically</secondary>
6528 </indexterm>
6529 <indexterm role="concept">
6530 <primary>periodic queue running</primary>
6531 </indexterm>
6532 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6533 starting a queue runner process at intervals specified by the given time value
6534 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6535 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6536 single daemon process handles both functions. A common way of starting up a
6537 combined daemon at system boot time is to use a command such as
6538 </para>
6539 <literallayout class="monospaced">
6540 /usr/exim/bin/exim -bd -q30m
6541 </literallayout>
6542 <para>
6543 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6544 process every 30 minutes.
6545 </para>
6546 <para>
6547 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6548 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6549 </para>
6550 </listitem></varlistentry>
6551 <varlistentry>
6552 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6553 <listitem>
6554 <para>
6555 <indexterm role="option">
6556 <primary><option>-qR</option></primary>
6557 </indexterm>
6558 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6559 compatibility.
6560 </para>
6561 </listitem></varlistentry>
6562 <varlistentry>
6563 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6564 <listitem>
6565 <para>
6566 <indexterm role="option">
6567 <primary><option>-qS</option></primary>
6568 </indexterm>
6569 This option is synonymous with <option>-S</option>.
6570 </para>
6571 </listitem></varlistentry>
6572 <varlistentry>
6573 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6574 <listitem>
6575 <para>
6576 <indexterm role="option">
6577 <primary><option>-R</option></primary>
6578 </indexterm>
6579 <indexterm role="concept">
6580 <primary>queue runner</primary>
6581 <secondary>for specific recipients</secondary>
6582 </indexterm>
6583 <indexterm role="concept">
6584 <primary>delivery</primary>
6585 <secondary>to given domain</secondary>
6586 </indexterm>
6587 <indexterm role="concept">
6588 <primary>domain</primary>
6589 <secondary>delivery to</secondary>
6590 </indexterm>
6591 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6592 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6593 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6594 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6595 </para>
6596 <para>
6597 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6598 perform a single queue run, except that, when scanning the messages on the
6599 queue, Exim processes only those that have at least one undelivered recipient
6600 address containing the given string, which is checked in a case-independent
6601 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6602 regular expression; otherwise it is a literal string.
6603 </para>
6604 <para>
6605 If you want to do periodic queue runs for messages with specific recipients,
6606 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6607 </para>
6608 <literallayout class="monospaced">
6609 exim -q25m -R @special.domain.example
6610 </literallayout>
6611 <para>
6612 This example does a queue run for messages with recipients in the given domain
6613 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6614 applied to each queue run.
6615 </para>
6616 <para>
6617 Once a message is selected for delivery by this mechanism, all its addresses
6618 are processed. For the first selected message, Exim overrides any retry
6619 information and forces a delivery attempt for each undelivered address. This
6620 means that if delivery of any address in the first message is successful, any
6621 existing retry information is deleted, and so delivery attempts for that
6622 address in subsequently selected messages (which are processed without forcing)
6623 will run. However, if delivery of any address does not succeed, the retry
6624 information is updated, and in subsequently selected messages, the failing
6625 address will be skipped.
6626 </para>
6627 <para>
6628 <indexterm role="concept">
6629 <primary>frozen messages</primary>
6630 <secondary>forcing delivery</secondary>
6631 </indexterm>
6632 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6633 all selected messages, not just the first; frozen messages are included when
6634 <emphasis>ff</emphasis> is present.
6635 </para>
6636 <para>
6637 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6638 to a given domain after a host has been down for some time. When the SMTP
6639 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6640 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6641 an arbitrary command instead.
6642 </para>
6643 </listitem></varlistentry>
6644 <varlistentry>
6645 <term><option>-r</option></term>
6646 <listitem>
6647 <para>
6648 <indexterm role="option">
6649 <primary><option>-r</option></primary>
6650 </indexterm>
6651 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6652 </para>
6653 </listitem></varlistentry>
6654 <varlistentry>
6655 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6656 <listitem>
6657 <para>
6658 <indexterm role="option">
6659 <primary><option>-S</option></primary>
6660 </indexterm>
6661 <indexterm role="concept">
6662 <primary>delivery</primary>
6663 <secondary>from given sender</secondary>
6664 </indexterm>
6665 <indexterm role="concept">
6666 <primary>queue runner</primary>
6667 <secondary>for specific senders</secondary>
6668 </indexterm>
6669 This option acts like <option>-R</option> except that it checks the string against each
6670 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6671 conditions must be met for a message to be selected. If either of the options
6672 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6673 </para>
6674 </listitem></varlistentry>
6675 <varlistentry>
6676 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6677 <listitem>
6678 <para>
6679 <indexterm role="option">
6680 <primary><option>-Tqt</option></primary>
6681 </indexterm>
6682 This an option that is exclusively for use by the Exim testing suite. It is not
6683 recognized when Exim is run normally. It allows for the setting up of explicit
6684 <quote>queue times</quote> so that various warning/retry features can be tested.
6685 </para>
6686 </listitem></varlistentry>
6687 <varlistentry>
6688 <term><option>-t</option></term>
6689 <listitem>
6690 <para>
6691 <indexterm role="option">
6692 <primary><option>-t</option></primary>
6693 </indexterm>
6694 <indexterm role="concept">
6695 <primary>recipient</primary>
6696 <secondary>extracting from header lines</secondary>
6697 </indexterm>
6698 <indexterm role="concept">
6699 <primary><emphasis>Bcc:</emphasis> header line</primary>
6700 </indexterm>
6701 <indexterm role="concept">
6702 <primary><emphasis>Cc:</emphasis> header line</primary>
6703 </indexterm>
6704 <indexterm role="concept">
6705 <primary><emphasis>To:</emphasis> header line</primary>
6706 </indexterm>
6707 When Exim is receiving a locally-generated, non-SMTP message on its standard
6708 input, the <option>-t</option> option causes the recipients of the message to be obtained
6709 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6710 from the command arguments. The addresses are extracted before any rewriting
6711 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6712 </para>
6713 <para>
6714 <indexterm role="concept">
6715 <primary>Sendmail compatibility</primary>
6716 <secondary><option>-t</option> option</secondary>
6717 </indexterm>
6718 If the command has any arguments, they specify addresses to which the message
6719 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6720 the recipients list obtained from the headers. This is compatible with Smail 3
6721 and in accordance with the documented behaviour of several versions of
6722 Sendmail, as described in man pages on a number of operating systems (e.g.
6723 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6724 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6725 Sendmail book documents it that way. Exim can be made to add argument addresses
6726 instead of subtracting them by setting the option
6727 <option>extract_addresses_remove_arguments</option> false.
6728 </para>
6729 <para>
6730 <indexterm role="concept">
6731 <primary><option>Resent-</option> header lines</primary>
6732 <secondary>with <option>-t</option></secondary>
6733 </indexterm>
6734 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6735 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6736 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6737 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6738 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6739 </para>
6740 <para>
6741 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6742 message is resent several times). The RFC also specifies that they should be
6743 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6744 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6745 nor indeed exactly what constitutes a <quote>set</quote>.
6746 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6747 are often added at the end of the header, and if a message is resent more than
6748 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6749 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6750 </para>
6751 </listitem></varlistentry>
6752 <varlistentry>
6753 <term><option>-ti</option></term>
6754 <listitem>
6755 <para>
6756 <indexterm role="option">
6757 <primary><option>-ti</option></primary>
6758 </indexterm>
6759 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6760 compatibility with Sendmail.
6761 </para>
6762 </listitem></varlistentry>
6763 <varlistentry>
6764 <term><option>-tls-on-connect</option></term>
6765 <listitem>
6766 <para>
6767 <indexterm role="option">
6768 <primary><option>-tls-on-connect</option></primary>
6769 </indexterm>
6770 <indexterm role="concept">
6771 <primary>TLS</primary>
6772 <secondary>use without STARTTLS</secondary>
6773 </indexterm>
6774 <indexterm role="concept">
6775 <primary>TLS</primary>
6776 <secondary>automatic start</secondary>
6777 </indexterm>
6778 This option is available when Exim is compiled with TLS support. It forces all
6779 incoming SMTP connections to behave as if the incoming port is listed in the
6780 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6781 <xref linkend="CHAPTLS"/> for further details.
6782 </para>
6783 </listitem></varlistentry>
6784 <varlistentry>
6785 <term><option>-U</option></term>
6786 <listitem>
6787 <para>
6788 <indexterm role="option">
6789 <primary><option>-U</option></primary>
6790 </indexterm>
6791 <indexterm role="concept">
6792 <primary>Sendmail compatibility</primary>
6793 <secondary><option>-U</option> option ignored</secondary>
6794 </indexterm>
6795 Sendmail uses this option for <quote>initial message submission</quote>, and its
6796 documentation states that in future releases, it may complain about
6797 syntactically invalid messages rather than fixing them when this flag is not
6798 set. Exim ignores this option.
6799 </para>
6800 </listitem></varlistentry>
6801 <varlistentry>
6802 <term><option>-v</option></term>
6803 <listitem>
6804 <para>
6805 <indexterm role="option">
6806 <primary><option>-v</option></primary>
6807 </indexterm>
6808 This option causes Exim to write information to the standard error stream,
6809 describing what it is doing. In particular, it shows the log lines for
6810 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6811 dialogue is shown. Some of the log lines shown may not actually be written to
6812 the log if the setting of <option>log_selector</option> discards them. Any relevant
6813 selectors are shown with each log line. If none are shown, the logging is
6814 unconditional.
6815 </para>
6816 </listitem></varlistentry>
6817 <varlistentry>
6818 <term><option>-x</option></term>
6819 <listitem>
6820 <para>
6821 <indexterm role="option">
6822 <primary><option>-x</option></primary>
6823 </indexterm>
6824 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6825 National Language Support extended characters in the body of the mail item</quote>).
6826 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6827 this option.
6828 </para>
6829 </listitem></varlistentry>
6830 </variablelist>
6831 <para>
6832 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6833 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6834 </para>
6835 <!-- === End of command line options === -->
6836 </section>
6837 </chapter>
6838
6839 <chapter id="CHAPconf">
6840 <title>The Exim run time configuration file</title>
6841 <titleabbrev>The runtime configuration file</titleabbrev>
6842 <para>
6843 <indexterm role="concept">
6844 <primary>run time configuration</primary>
6845 </indexterm>
6846 <indexterm role="concept">
6847 <primary>configuration file</primary>
6848 <secondary>general description</secondary>
6849 </indexterm>
6850 <indexterm role="concept">
6851 <primary>CONFIGURE_FILE</primary>
6852 </indexterm>
6853 <indexterm role="concept">
6854 <primary>configuration file</primary>
6855 <secondary>errors in</secondary>
6856 </indexterm>
6857 <indexterm role="concept">
6858 <primary>error</primary>
6859 <secondary>in configuration file</secondary>
6860 </indexterm>
6861 <indexterm role="concept">
6862 <primary>return code</primary>
6863 <secondary>for bad configuration</secondary>
6864 </indexterm>
6865 Exim uses a single run time configuration file that is read whenever an Exim
6866 binary is executed. Note that in normal operation, this happens frequently,
6867 because Exim is designed to operate in a distributed manner, without central
6868 control.
6869 </para>
6870 <para>
6871 If a syntax error is detected while reading the configuration file, Exim
6872 writes a message on the standard error, and exits with a non-zero return code.
6873 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6874 errors can be detected at this time. The values of any expanded options are
6875 not checked until the expansion happens, even when the expansion does not
6876 actually alter the string.
6877 </para>
6878 <para>
6879 The name of the configuration file is compiled into the binary for security
6880 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6881 most configurations, this specifies a single file. However, it is permitted to
6882 give a colon-separated list of file names, in which case Exim uses the first
6883 existing file in the list.
6884 </para>
6885 <para>
6886 <indexterm role="concept">
6887 <primary>EXIM_USER</primary>
6888 </indexterm>
6889 <indexterm role="concept">
6890 <primary>EXIM_GROUP</primary>
6891 </indexterm>
6892 <indexterm role="concept">
6893 <primary>CONFIGURE_OWNER</primary>
6894 </indexterm>
6895 <indexterm role="concept">
6896 <primary>CONFIGURE_GROUP</primary>
6897 </indexterm>
6898 <indexterm role="concept">
6899 <primary>configuration file</primary>
6900 <secondary>ownership</secondary>
6901 </indexterm>
6902 <indexterm role="concept">
6903 <primary>ownership</primary>
6904 <secondary>configuration file</secondary>
6905 </indexterm>
6906 The run time configuration file must be owned by root or by the user that is
6907 specified at compile time by the EXIM_USER option, or by the user that is
6908 specified at compile time by the CONFIGURE_OWNER option (if set). The
6909 configuration file must not be world-writeable or group-writeable, unless its
6910 group is the one specified at compile time by the EXIM_GROUP option or by the
6911 CONFIGURE_GROUP option.
6912 </para>
6913 <para>
6914 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6915 to root, anybody who is able to edit the run time configuration file has an
6916 easy way to run commands as root. If you make your mail administrators members
6917 of the Exim group, but do not trust them with root, make sure that the run time
6918 configuration is not group writeable.
6919 </para>
6920 <para>
6921 A default configuration file, which will work correctly in simple situations,
6922 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6923 defines just one file name, the installation process copies the default
6924 configuration to a new file of that name if it did not previously exist. If
6925 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6926 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6927 configuration.
6928 </para>
6929 <section id="SECID40">
6930 <title>Using a different configuration file</title>
6931 <para>
6932 <indexterm role="concept">
6933 <primary>configuration file</primary>
6934 <secondary>alternate</secondary>
6935 </indexterm>
6936 A one-off alternate configuration can be specified by the <option>-C</option> command line
6937 option, which may specify a single file or a list of files. However, when
6938 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6939 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6940 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6941 configuration files before installing them. No owner or group checks are done
6942 on a configuration file specified by <option>-C</option>.
6943 </para>
6944 <para>
6945 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6946 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6947 if you do this, you also lock out the possibility of testing a
6948 configuration using <option>-C</option> right through message reception and delivery, even
6949 if the caller is root. The reception works, but by that time, Exim is running
6950 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6951 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6952 delivery using two separate commands (one to put a message on the queue, using
6953 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6954 </para>
6955 <para>
6956 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6957 prefix string with which any file named in a <option>-C</option> command line option must
6958 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6959 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6960 name can be used with <option>-C</option>.
6961 </para>
6962 <para>
6963 One-off changes to a configuration can be specified by the <option>-D</option> command line
6964 option, which defines and overrides values for macros used inside the
6965 configuration file. However, like <option>-C</option>, the use of this option by a
6966 non-privileged user causes Exim to discard its root privilege.
6967 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6968 completely disabled, and its use causes an immediate error exit.
6969 </para>
6970 <para>
6971 Some sites may wish to use the same Exim binary on different machines that
6972 share a file system, but to use different configuration files on each machine.
6973 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6974 looks for a file whose name is the configuration file name followed by a dot
6975 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6976 file does not exist, the standard name is tried. This processing occurs for
6977 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6978 </para>
6979 <para>
6980 In some esoteric situations different versions of Exim may be run under
6981 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6982 help with this. See the comments in <filename>src/EDITME</filename> for details.
6983 </para>
6984 </section>
6985 <section id="SECTconffilfor">
6986 <title>Configuration file format</title>
6987 <para>
6988 <indexterm role="concept">
6989 <primary>configuration file</primary>
6990 <secondary>format of</secondary>
6991 </indexterm>
6992 <indexterm role="concept">
6993 <primary>format</primary>
6994 <secondary>configuration file</secondary>
6995 </indexterm>
6996 Exim&#x2019;s configuration file is divided into a number of different parts. General
6997 option settings must always appear at the start of the file. The other parts
6998 are all optional, and may appear in any order. Each part other than the first
6999 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7000 optional parts are:
7001 </para>
7002 <itemizedlist>
7003 <listitem>
7004 <para>
7005 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7006 <xref linkend="CHAPACL"/>).
7007 </para>
7008 </listitem>
7009 <listitem>
7010 <para>
7011 <indexterm role="concept">
7012 <primary>AUTH</primary>
7013 <secondary>configuration</secondary>
7014 </indexterm>
7015 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7016 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7017 </para>
7018 </listitem>
7019 <listitem>
7020 <para>
7021 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7022 addresses and determine how the message is to be delivered (see chapters
7023 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7024 </para>
7025 </listitem>
7026 <listitem>
7027 <para>
7028 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7029 define mechanisms for copying messages to destinations (see chapters
7030 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7031 </para>
7032 </listitem>
7033 <listitem>
7034 <para>
7035 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7036 If there is no retry section, or if it is empty (that is, no retry rules are
7037 defined), Exim will not retry deliveries. In this situation, temporary errors
7038 are treated the same as permanent errors. Retry rules are discussed in chapter
7039 <xref linkend="CHAPretry"/>.
7040 </para>
7041 </listitem>
7042 <listitem>
7043 <para>
7044 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7045 when new addresses are generated during delivery. Rewriting is discussed in
7046 chapter <xref linkend="CHAPrewrite"/>.
7047 </para>
7048 </listitem>
7049 <listitem>
7050 <para>
7051 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7052 want to use this feature, you must set
7053 </para>
7054 <literallayout class="monospaced">
7055 LOCAL_SCAN_HAS_OPTIONS=yes
7056 </literallayout>
7057 <para>
7058 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7059 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7060 </para>
7061 </listitem>
7062 </itemizedlist>
7063 <para>
7064 <indexterm role="concept">
7065 <primary>configuration file</primary>
7066 <secondary>leading white space in</secondary>
7067 </indexterm>
7068 <indexterm role="concept">
7069 <primary>configuration file</primary>
7070 <secondary>trailing white space in</secondary>
7071 </indexterm>
7072 <indexterm role="concept">
7073 <primary>white space</primary>
7074 <secondary>in configuration file</secondary>
7075 </indexterm>
7076 Leading and trailing white space in configuration lines is always ignored.
7077 </para>
7078 <para>
7079 Blank lines in the file, and lines starting with a # character (ignoring
7080 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7081 # character other than at the beginning of a line is not treated specially,
7082 and does not introduce a comment.
7083 </para>
7084 <para>
7085 Any non-comment line can be continued by ending it with a backslash. Note that
7086 the general rule for white space means that trailing white space after the
7087 backslash and leading white space at the start of continuation
7088 lines is ignored. Comment lines beginning with # (but not empty lines) may
7089 appear in the middle of a sequence of continuation lines.
7090 </para>
7091 <para>
7092 A convenient way to create a configuration file is to start from the
7093 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7094 change settings as required.
7095 </para>
7096 <para>
7097 The ACLs, retry rules, and rewriting rules have their own syntax which is
7098 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7099 respectively. The other parts of the configuration file have some syntactic
7100 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7101 onwards. Before that, the inclusion, macro, and conditional facilities are
7102 described.
7103 </para>
7104 </section>
7105 <section id="SECID41">
7106 <title>File inclusions in the configuration file</title>
7107 <para>
7108 <indexterm role="concept">
7109 <primary>inclusions in configuration file</primary>
7110 </indexterm>
7111 <indexterm role="concept">
7112 <primary>configuration file</primary>
7113 <secondary>including other files</secondary>
7114 </indexterm>
7115 <indexterm role="concept">
7116 <primary><literal>.include</literal> in configuration file</primary>
7117 </indexterm>
7118 <indexterm role="concept">
7119 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7120 </indexterm>
7121 You can include other files inside Exim&#x2019;s run time configuration file by
7122 using this syntax:
7123 </para>
7124 <literallayout>
7125 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7126 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7127 </literallayout>
7128 <para>
7129 on a line by itself. Double quotes round the file name are optional. If you use
7130 the first form, a configuration error occurs if the file does not exist; the
7131 second form does nothing for non-existent files. In all cases, an absolute file
7132 name is required.
7133 </para>
7134 <para>
7135 Includes may be nested to any depth, but remember that Exim reads its
7136 configuration file often, so it is a good idea to keep them to a minimum.
7137 If you change the contents of an included file, you must HUP the daemon,
7138 because an included file is read only when the configuration itself is read.
7139 </para>
7140 <para>
7141 The processing of inclusions happens early, at a physical line level, so, like
7142 comment lines, an inclusion can be used in the middle of an option setting,
7143 for example:
7144 </para>
7145 <literallayout class="monospaced">
7146 hosts_lookup = a.b.c \
7147                .include /some/file
7148 </literallayout>
7149 <para>
7150 Include processing happens after macro processing (see below). Its effect is to
7151 process the lines of the included file as if they occurred inline where the
7152 inclusion appears.
7153 </para>
7154 </section>
7155 <section id="SECTmacrodefs">
7156 <title>Macros in the configuration file</title>
7157 <para>
7158 <indexterm role="concept">
7159 <primary>macro</primary>
7160 <secondary>description of</secondary>
7161 </indexterm>
7162 <indexterm role="concept">
7163 <primary>configuration file</primary>
7164 <secondary>macros</secondary>
7165 </indexterm>
7166 If a line in the main part of the configuration (that is, before the first
7167 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7168 definition, and must be of the form
7169 </para>
7170 <literallayout>
7171 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7172 </literallayout>
7173 <para>
7174 The name must consist of letters, digits, and underscores, and need not all be
7175 in upper case, though that is recommended. The rest of the line, including any
7176 continuations, is the replacement text, and has leading and trailing white
7177 space removed. Quotes are not removed. The replacement text can never end with
7178 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7179 </para>
7180 <para>
7181 Macros may also be defined between router, transport, authenticator, or ACL
7182 definitions. They may not, however, be defined within an individual driver or
7183 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7184 </para>
7185 </section>
7186 <section id="SECID42">
7187 <title>Macro substitution</title>
7188 <para>
7189 Once a macro is defined, all subsequent lines in the file (and any included
7190 files) are scanned for the macro name; if there are several macros, the line is
7191 scanned for each in turn, in the order in which the macros are defined. The
7192 replacement text is not re-scanned for the current macro, though it is scanned
7193 for subsequently defined macros. For this reason, a macro name may not contain
7194 the name of a previously defined macro as a substring. You could, for example,
7195 define
7196 </para>
7197 <literallayout>
7198 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7199 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7200 </literallayout>
7201 <para>
7202 but putting the definitions in the opposite order would provoke a configuration
7203 error. Macro expansion is applied to individual physical lines from the file,
7204 before checking for line continuation or file inclusion (see above). If a line
7205 consists solely of a macro name, and the expansion of the macro is empty, the
7206 line is ignored. A macro at the start of a line may turn the line into a
7207 comment line or a <literal>.include</literal> line.
7208 </para>
7209 </section>
7210 <section id="SECID43">
7211 <title>Redefining macros</title>
7212 <para>
7213 Once defined, the value of a macro can be redefined later in the configuration
7214 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7215 <emphasis>=</emphasis>. For example:
7216 </para>
7217 <literallayout class="monospaced">
7218 MAC =  initial value
7219 ...
7220 MAC == updated value
7221 </literallayout>
7222 <para>
7223 Redefinition does not alter the order in which the macros are applied to the
7224 subsequent lines of the configuration file. It is still the same order in which
7225 the macros were originally defined. All that changes is the macro&#x2019;s value.
7226 Redefinition makes it possible to accumulate values. For example:
7227 </para>
7228 <literallayout class="monospaced">
7229 MAC =  initial value
7230 ...
7231 MAC == MAC and something added
7232 </literallayout>
7233 <para>
7234 This can be helpful in situations where the configuration file is built
7235 from a number of other files.
7236 </para>
7237 </section>
7238 <section id="SECID44">
7239 <title>Overriding macro values</title>
7240 <para>
7241 The values set for macros in the configuration file can be overridden by the
7242 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7243 used, unless called by root or the Exim user. A definition on the command line
7244 using the <option>-D</option> option causes all definitions and redefinitions within the
7245 file to be ignored.
7246 </para>
7247 </section>
7248 <section id="SECID45">
7249 <title>Example of macro usage</title>
7250 <para>
7251 As an example of macro usage, consider a configuration where aliases are looked
7252 up in a MySQL database. It helps to keep the file less cluttered if long
7253 strings such as SQL statements are defined separately as macros, for example:
7254 </para>
7255 <literallayout class="monospaced">
7256 ALIAS_QUERY = select mailbox from user where \
7257               login='${quote_mysql:$local_part}';
7258 </literallayout>
7259 <para>
7260 This can then be used in a <command>redirect</command> router setting like this:
7261 </para>
7262 <literallayout class="monospaced">
7263 data = ${lookup mysql{ALIAS_QUERY}}
7264 </literallayout>
7265 <para>
7266 In earlier versions of Exim macros were sometimes used for domain, host, or
7267 address lists. In Exim 4 these are handled better by named lists &ndash; see
7268 section <xref linkend="SECTnamedlists"/>.
7269 </para>
7270 </section>
7271 <section id="SECID46">
7272 <title>Conditional skips in the configuration file</title>
7273 <para>
7274 <indexterm role="concept">
7275 <primary>configuration file</primary>
7276 <secondary>conditional skips</secondary>
7277 </indexterm>
7278 <indexterm role="concept">
7279 <primary><literal>.ifdef</literal></primary>
7280 </indexterm>
7281 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7282 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7283 portions of the configuration file. The processing happens whenever the file is
7284 read (that is, when an Exim binary starts to run).
7285 </para>
7286 <para>
7287 The implementation is very simple. Instances of the first four directives must
7288 be followed by text that includes the names of one or macros. The condition
7289 that is tested is whether or not any macro substitution has taken place in the
7290 line. Thus:
7291 </para>
7292 <literallayout class="monospaced">
7293 .ifdef AAA
7294 message_size_limit = 50M
7295 .else
7296 message_size_limit = 100M
7297 .endif
7298 </literallayout>
7299 <para>
7300 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7301 otherwise. If there is more than one macro named on the line, the condition
7302 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7303 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7304 </para>
7305 <para>
7306 Although you can use a macro expansion to generate one of these directives,
7307 it is not very useful, because the condition <quote>there was a macro substitution
7308 in this line</quote> will always be true.
7309 </para>
7310 <para>
7311 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7312 to clarify complicated nestings.
7313 </para>
7314 </section>
7315 <section id="SECTcos">
7316 <title>Common option syntax</title>
7317 <para>
7318 <indexterm role="concept">
7319 <primary>common option syntax</primary>
7320 </indexterm>
7321 <indexterm role="concept">
7322 <primary>syntax of common options</primary>
7323 </indexterm>
7324 <indexterm role="concept">
7325 <primary>configuration file</primary>
7326 <secondary>common option syntax</secondary>
7327 </indexterm>
7328 For the main set of options, driver options, and <function>local_scan()</function> options,
7329 each setting is on a line by itself, and starts with a name consisting of
7330 lower-case letters and underscores. Many options require a data value, and in
7331 these cases the name must be followed by an equals sign (with optional white
7332 space) and then the value. For example:
7333 </para>
7334 <literallayout class="monospaced">
7335 qualify_domain = mydomain.example.com
7336 </literallayout>
7337 <para>
7338 <indexterm role="concept">
7339 <primary>hiding configuration option values</primary>
7340 </indexterm>
7341 <indexterm role="concept">
7342 <primary>configuration options</primary>
7343 <secondary>hiding value of</secondary>
7344 </indexterm>
7345 <indexterm role="concept">
7346 <primary>options</primary>
7347 <secondary>hiding value of</secondary>
7348 </indexterm>
7349 Some option settings may contain sensitive data, for example, passwords for
7350 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7351 line option to read these values, you can precede the option settings with the
7352 word <quote>hide</quote>. For example:
7353 </para>
7354 <literallayout class="monospaced">
7355 hide mysql_servers = localhost/users/admin/secret-password
7356 </literallayout>
7357 <para>
7358 For non-admin users, such options are displayed like this:
7359 </para>
7360 <literallayout class="monospaced">
7361 mysql_servers = &lt;value not displayable&gt;
7362 </literallayout>
7363 <para>
7364 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7365 all instances of the same driver.
7366 </para>
7367 <para>
7368 The following sections describe the syntax used for the different data types
7369 that are found in option settings.
7370 </para>
7371 </section>
7372 <section id="SECID47">
7373 <title>Boolean options</title>
7374 <para>
7375 <indexterm role="concept">
7376 <primary>format</primary>
7377 <secondary>boolean</secondary>
7378 </indexterm>
7379 <indexterm role="concept">
7380 <primary>boolean configuration values</primary>
7381 </indexterm>
7382 <indexterm role="option">
7383 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7384 </indexterm>
7385 <indexterm role="option">
7386 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7387 </indexterm>
7388 Options whose type is given as boolean are on/off switches. There are two
7389 different ways of specifying such options: with and without a data value. If
7390 the option name is specified on its own without data, the switch is turned on;
7391 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7392 boolean options may be followed by an equals sign and one of the words
7393 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7394 the following two settings have exactly the same effect:
7395 </para>
7396 <literallayout class="monospaced">
7397 queue_only
7398 queue_only = true
7399 </literallayout>
7400 <para>
7401 The following two lines also have the same (opposite) effect:
7402 </para>
7403 <literallayout class="monospaced">
7404 no_queue_only
7405 queue_only = false
7406 </literallayout>
7407 <para>
7408 You can use whichever syntax you prefer.
7409 </para>
7410 </section>
7411 <section id="SECID48">
7412 <title>Integer values</title>
7413 <para>
7414 <indexterm role="concept">
7415 <primary>integer configuration values</primary>
7416 </indexterm>
7417 <indexterm role="concept">
7418 <primary>format</primary>
7419 <secondary>integer</secondary>
7420 </indexterm>
7421 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7422 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7423 number is assumed. Otherwise, it is treated as an octal number unless it starts
7424 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7425 hexadecimal number.
7426 </para>
7427 <para>
7428 If an integer value is followed by the letter K, it is multiplied by 1024; if
7429 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7430 of integer option settings are output, values which are an exact multiple of
7431 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7432 and M. The printing style is independent of the actual input format that was
7433 used.
7434 </para>
7435 </section>
7436 <section id="SECID49">
7437 <title>Octal integer values</title>
7438 <para>
7439 <indexterm role="concept">
7440 <primary>integer format</primary>
7441 </indexterm>
7442 <indexterm role="concept">
7443 <primary>format</primary>
7444 <secondary>octal integer</secondary>
7445 </indexterm>
7446 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7447 interpreted as an octal number, whether or not it starts with the digit zero.
7448 Such options are always output in octal.
7449 </para>
7450 </section>
7451 <section id="SECID50">
7452 <title>Fixed point numbers</title>
7453 <para>
7454 <indexterm role="concept">
7455 <primary>fixed point configuration values</primary>
7456 </indexterm>
7457 <indexterm role="concept">
7458 <primary>format</primary>
7459 <secondary>fixed point</secondary>
7460 </indexterm>
7461 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7462 integer, optionally followed by a decimal point and up to three further digits.
7463 </para>
7464 </section>
7465 <section id="SECTtimeformat">
7466 <title>Time intervals</title>
7467 <para>
7468 <indexterm role="concept">
7469 <primary>time interval</primary>
7470 <secondary>specifying in configuration</secondary>
7471 </indexterm>
7472 <indexterm role="concept">
7473 <primary>format</primary>
7474 <secondary>time interval</secondary>
7475 </indexterm>
7476 A time interval is specified as a sequence of numbers, each followed by one of
7477 the following letters, with no intervening white space:
7478 </para>
7479 <informaltable frame="none">
7480 <tgroup cols="2" colsep="0" rowsep="0">
7481 <colspec colwidth="30pt" align="left"/>
7482 <colspec colwidth="254pt" align="left"/>
7483 <tbody>
7484 <row>
7485 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7486 <entry>seconds</entry>
7487 </row>
7488 <row>
7489 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7490 <entry>minutes</entry>
7491 </row>
7492 <row>
7493 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7494 <entry>hours</entry>
7495 </row>
7496 <row>
7497 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7498 <entry>days</entry>
7499 </row>
7500 <row>
7501 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7502 <entry>weeks</entry>
7503 </row>
7504 </tbody>
7505 </tgroup>
7506 </informaltable>
7507 <para>
7508 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7509 intervals are output in the same format. Exim does not restrict the values; it
7510 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7511 </para>
7512 </section>
7513 <section id="SECTstrings">
7514 <title>String values</title>
7515 <para>
7516 <indexterm role="concept">
7517 <primary>string</primary>
7518 <secondary>format of configuration values</secondary>
7519 </indexterm>
7520 <indexterm role="concept">
7521 <primary>format</primary>
7522 <secondary>string</secondary>
7523 </indexterm>
7524 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7525 or without double-quotes. If it does not start with a double-quote, the value
7526 consists of the remainder of the line plus any continuation lines, starting at
7527 the first character after any leading white space, with trailing white space
7528 removed, and with no interpretation of the characters in the string. Because
7529 Exim removes comment lines (those beginning with #) at an early stage, they can
7530 appear in the middle of a multi-line string. The following two settings are
7531 therefore equivalent:
7532 </para>
7533 <literallayout class="monospaced">
7534 trusted_users = uucp:mail
7535 trusted_users = uucp:\
7536                 # This comment line is ignored
7537                 mail
7538 </literallayout>
7539 <para>
7540 <indexterm role="concept">
7541 <primary>string</primary>
7542 <secondary>quoted</secondary>
7543 </indexterm>
7544 <indexterm role="concept">
7545 <primary>escape characters in quoted strings</primary>
7546 </indexterm>
7547 If a string does start with a double-quote, it must end with a closing
7548 double-quote, and any backslash characters other than those used for line
7549 continuation are interpreted as escape characters, as follows:
7550 </para>
7551 <informaltable frame="none">
7552 <tgroup cols="2" colsep="0" rowsep="0">
7553 <colspec colwidth="100pt" align="left"/>
7554 <colspec colwidth="254pt" align="left"/>
7555 <tbody>
7556 <row>
7557 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7558 <entry>single backslash</entry>
7559 </row>
7560 <row>
7561 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7562 <entry>newline</entry>
7563 </row>
7564 <row>
7565 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7566 <entry>carriage return</entry>
7567 </row>
7568 <row>
7569 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7570 <entry>tab</entry>
7571 </row>
7572 <row>
7573 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7574 <entry>up to 3 octal digits specify one character</entry>
7575 </row>
7576 <row>
7577 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7578 <entry>up to 2 hexadecimal digits specify one character</entry>
7579 </row>
7580 </tbody>
7581 </tgroup>
7582 </informaltable>
7583 <para>
7584 If a backslash is followed by some other character, including a double-quote
7585 character, that character replaces the pair.
7586 </para>
7587 <para>
7588 Quoting is necessary only if you want to make use of the backslash escapes to
7589 insert special characters, or if you need to specify a value with leading or
7590 trailing spaces. These cases are rare, so quoting is almost never needed in
7591 current versions of Exim. In versions of Exim before 3.14, quoting was required
7592 in order to continue lines, so you may come across older configuration files
7593 and examples that apparently quote unnecessarily.
7594 </para>
7595 </section>
7596 <section id="SECID51">
7597 <title>Expanded strings</title>
7598 <para>
7599 <indexterm role="concept">
7600 <primary>expansion</primary>
7601 <secondary>definition of</secondary>
7602 </indexterm>
7603 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7604 by which means various parts of the string may be changed according to the
7605 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7606 is as just described; in particular, the handling of backslashes in quoted
7607 strings is done as part of the input process, before expansion takes place.
7608 However, backslash is also an escape character for the expander, so any
7609 backslashes that are required for that reason must be doubled if they are
7610 within a quoted configuration string.
7611 </para>
7612 </section>
7613 <section id="SECID52">
7614 <title>User and group names</title>
7615 <para>
7616 <indexterm role="concept">
7617 <primary>user name</primary>
7618 <secondary>format of</secondary>
7619 </indexterm>
7620 <indexterm role="concept">
7621 <primary>format</primary>
7622 <secondary>user name</secondary>
7623 </indexterm>
7624 <indexterm role="concept">
7625 <primary>groups</primary>
7626 <secondary>name format</secondary>
7627 </indexterm>
7628 <indexterm role="concept">
7629 <primary>format</primary>
7630 <secondary>group name</secondary>
7631 </indexterm>
7632 User and group names are specified as strings, using the syntax described
7633 above, but the strings are interpreted specially. A user or group name must
7634 either consist entirely of digits, or be a name that can be looked up using the
7635 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7636 </para>
7637 </section>
7638 <section id="SECTlistconstruct">
7639 <title>List construction</title>
7640 <para>
7641 <indexterm role="concept">
7642 <primary>list</primary>
7643 <secondary>syntax of in configuration</secondary>
7644 </indexterm>
7645 <indexterm role="concept">
7646 <primary>format</primary>
7647 <secondary>list item in configuration</secondary>
7648 </indexterm>
7649 <indexterm role="concept">
7650 <primary>string</primary>
7651 <secondary>list, definition of</secondary>
7652 </indexterm>
7653 The data for some configuration options is a list of items, with colon as the
7654 default separator. Many of these options are shown with type <quote>string list</quote> in
7655 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7656 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7657 are all the same; however, those other than <quote>string list</quote> are subject to
7658 particular kinds of interpretation, as described in chapter
7659 <xref linkend="CHAPdomhosaddlists"/>.
7660 </para>
7661 <para>
7662 In all these cases, the entire list is treated as a single string as far as the
7663 input syntax is concerned. The <option>trusted_users</option> setting in section
7664 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7665 in a list, it must be entered as two colons. Leading and trailing white space
7666 on each item in a list is ignored. This makes it possible to include items that
7667 start with a colon, and in particular, certain forms of IPv6 address. For
7668 example, the list
7669 </para>
7670 <literallayout class="monospaced">
7671 local_interfaces = 127.0.0.1 : ::::1
7672 </literallayout>
7673 <para>
7674 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7675 </para>
7676 <para>
7677 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7678 list items, it is not ignored when parsing the list. The space after the first
7679 colon in the example above is necessary. If it were not there, the list would
7680 be interpreted as the two items 127.0.0.1:: and 1.
7681 </para>
7682 </section>
7683 <section id="SECID53">
7684 <title>Changing list separators</title>
7685 <para>
7686 <indexterm role="concept">
7687 <primary>list separator</primary>
7688 <secondary>changing</secondary>
7689 </indexterm>
7690 <indexterm role="concept">
7691 <primary>IPv6</primary>
7692 <secondary>addresses in lists</secondary>
7693 </indexterm>
7694 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7695 introduced to allow the separator character to be changed. If a list begins
7696 with a left angle bracket, followed by any punctuation character, that
7697 character is used instead of colon as the list separator. For example, the list
7698 above can be rewritten to use a semicolon separator like this:
7699 </para>
7700 <literallayout class="monospaced">
7701 local_interfaces = &lt;; 127.0.0.1 ; ::1
7702 </literallayout>
7703 <para>
7704 This facility applies to all lists, with the exception of the list in
7705 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7706 confined to circumstances where they really are needed.
7707 </para>
7708 <para>
7709 <indexterm role="concept">
7710 <primary>list separator</primary>
7711 <secondary>newline as</secondary>
7712 </indexterm>
7713 <indexterm role="concept">
7714 <primary>newline</primary>
7715 <secondary>as list separator</secondary>
7716 </indexterm>
7717 It is also possible to use newline and other control characters (those with
7718 code values less than 32, plus DEL) as separators in lists. Such separators
7719 must be provided literally at the time the list is processed. For options that
7720 are string-expanded, you can write the separator using a normal escape
7721 sequence. This will be processed by the expander before the string is
7722 interpreted as a list. For example, if a newline-separated list of domains is
7723 generated by a lookup, you can process it directly by a line such as this:
7724 </para>
7725 <literallayout class="monospaced">
7726 domains = &lt;\n ${lookup mysql{.....}}
7727 </literallayout>
7728 <para>
7729 This avoids having to change the list separator in such data. You are unlikely
7730 to want to use a control character as a separator in an option that is not
7731 expanded, because the value is literal text. However, it can be done by giving
7732 the value in quotes. For example:
7733 </para>
7734 <literallayout class="monospaced">
7735 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7736 </literallayout>
7737 <para>
7738 Unlike printing character separators, which can be included in list items by
7739 doubling, it is not possible to include a control character as data when it is
7740 set as the separator. Two such characters in succession are interpreted as
7741 enclosing an empty list item.
7742 </para>
7743 </section>
7744 <section id="SECTempitelis">
7745 <title>Empty items in lists</title>
7746 <para>
7747 <indexterm role="concept">
7748 <primary>list</primary>
7749 <secondary>empty item in</secondary>
7750 </indexterm>
7751 An empty item at the end of a list is always ignored. In other words, trailing
7752 separator characters are ignored. Thus, the list in
7753 </para>
7754 <literallayout class="monospaced">
7755 senders = user@domain :
7756 </literallayout>
7757 <para>
7758 contains only a single item. If you want to include an empty string as one item
7759 in a list, it must not be the last item. For example, this list contains three
7760 items, the second of which is empty:
7761 </para>
7762 <literallayout class="monospaced">
7763 senders = user1@domain : : user2@domain
7764 </literallayout>
7765 <para>
7766 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7767 are interpreted as representing a single colon data character (and the list
7768 would then contain just one item). If you want to specify a list that contains
7769 just one, empty item, you can do it as in this example:
7770 </para>
7771 <literallayout class="monospaced">
7772 senders = :
7773 </literallayout>
7774 <para>
7775 In this case, the first item is empty, and the second is discarded because it
7776 is at the end of the list.
7777 </para>
7778 </section>
7779 <section id="SECTfordricon">
7780 <title>Format of driver configurations</title>
7781 <para>
7782 <indexterm role="concept">
7783 <primary>drivers</primary>
7784 <secondary>configuration format</secondary>
7785 </indexterm>
7786 There are separate parts in the configuration for defining routers, transports,
7787 and authenticators. In each part, you are defining a number of driver
7788 instances, each with its own set of options. Each driver instance is defined by
7789 a sequence of lines like this:
7790 </para>
7791 <literallayout>
7792 &lt;<emphasis>instance name</emphasis>&gt;:
7793   &lt;<emphasis>option</emphasis>&gt;
7794   ...
7795   &lt;<emphasis>option</emphasis>&gt;
7796 </literallayout>
7797 <para>
7798 In the following example, the instance name is <command>localuser</command>, and it is
7799 followed by three options settings:
7800 </para>
7801 <literallayout class="monospaced">
7802 localuser:
7803   driver = accept
7804   check_local_user
7805   transport = local_delivery
7806 </literallayout>
7807 <para>
7808 For each driver instance, you specify which Exim code module it uses &ndash; by the
7809 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7810 settings. For example, in the case of transports, if you want a transport to
7811 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7812 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7813 described in detail in its own separate chapter later in this manual.
7814 </para>
7815 <para>
7816 You can have several routers, transports, or authenticators that are based on
7817 the same underlying driver (each must have a different instance name).
7818 </para>
7819 <para>
7820 The order in which routers are defined is important, because addresses are
7821 passed to individual routers one by one, in order. The order in which
7822 transports are defined does not matter at all. The order in which
7823 authenticators are defined is used only when Exim, as a client, is searching
7824 them to find one that matches an authentication mechanism offered by the
7825 server.
7826 </para>
7827 <para>
7828 <indexterm role="concept">
7829 <primary>generic options</primary>
7830 </indexterm>
7831 <indexterm role="concept">
7832 <primary>options</primary>
7833 <secondary>generic &ndash; definition of</secondary>
7834 </indexterm>
7835 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7836 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7837 same type (that is, all routers, all transports or all authenticators). The
7838 <option>driver</option> option is a generic option that must appear in every definition.
7839 <indexterm role="concept">
7840 <primary>private options</primary>
7841 </indexterm>
7842 The private options are special for each driver, and none need appear, because
7843 they all have default values.
7844 </para>
7845 <para>
7846 The options may appear in any order, except that the <option>driver</option> option must
7847 precede any private options, since these depend on the particular driver. For
7848 this reason, it is recommended that <option>driver</option> always be the first option.
7849 </para>
7850 <para>
7851 Driver instance names, which are used for reference in log entries and
7852 elsewhere, can be any sequence of letters, digits, and underscores (starting
7853 with a letter) and must be unique among drivers of the same type. A router and
7854 a transport (for example) can each have the same name, but no two router
7855 instances can have the same name. The name of a driver instance should not be
7856 confused with the name of the underlying driver module. For example, the
7857 configuration lines:
7858 </para>
7859 <literallayout class="monospaced">
7860 remote_smtp:
7861   driver = smtp
7862 </literallayout>
7863 <para>
7864 create an instance of the <command>smtp</command> transport driver whose name is
7865 <command>remote_smtp</command>. The same driver code can be used more than once, with
7866 different instance names and different option settings each time. A second
7867 instance of the <command>smtp</command> transport, with different options, might be defined
7868 thus:
7869 </para>
7870 <literallayout class="monospaced">
7871 special_smtp:
7872   driver = smtp
7873   port = 1234
7874   command_timeout = 10s
7875 </literallayout>
7876 <para>
7877 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7878 these transport instances from routers, and these names would appear in log
7879 lines.
7880 </para>
7881 <para>
7882 Comment lines may be present in the middle of driver specifications. The full
7883 list of option settings for any particular driver instance, including all the
7884 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7885 option.
7886 </para>
7887 </section>
7888 </chapter>
7889
7890 <chapter id="CHAPdefconfil">
7891 <title>The default configuration file</title>
7892 <para>
7893 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7894 <primary>configuration file</primary>
7895 <secondary>default <quote>walk through</quote></secondary>
7896 </indexterm>
7897 <indexterm role="concept">
7898 <primary>default</primary>
7899 <secondary>configuration file <quote>walk through</quote></secondary>
7900 </indexterm>
7901 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7902 is sufficient for a host with simple mail requirements. As an introduction to
7903 the way Exim is configured, this chapter <quote>walks through</quote> the default
7904 configuration, giving brief explanations of the settings. Detailed descriptions
7905 of the options are given in subsequent chapters. The default configuration file
7906 itself contains extensive comments about ways you might want to modify the
7907 initial settings. However, note that there are many options that are not
7908 mentioned at all in the default configuration.
7909 </para>
7910 <section id="SECTdefconfmain">
7911 <title>Main configuration settings</title>
7912 <para>
7913 The main (global) configuration option settings must always come first in the
7914 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7915 the line
7916 </para>
7917 <literallayout class="monospaced">
7918 # primary_hostname =
7919 </literallayout>
7920 <para>
7921 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7922 to know the official, fully qualified name of your host, and this is where you
7923 can specify it. However, in most cases you do not need to set this option. When
7924 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7925 </para>
7926 <para>
7927 The first three non-comment configuration lines are as follows:
7928 </para>
7929 <literallayout class="monospaced">
7930 domainlist local_domains = @
7931 domainlist relay_to_domains =
7932 hostlist   relay_from_hosts = 127.0.0.1
7933 </literallayout>
7934 <para>
7935 These are not, in fact, option settings. They are definitions of two named
7936 domain lists and one named host list. Exim allows you to give names to lists of
7937 domains, hosts, and email addresses, in order to make it easier to manage the
7938 configuration file (see section <xref linkend="SECTnamedlists"/>).
7939 </para>
7940 <para>
7941 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7942 later in the configuration to identify domains that are to be delivered
7943 on the local host.
7944 </para>
7945 <para>
7946 <indexterm role="concept">
7947 <primary>@ in a domain list</primary>
7948 </indexterm>
7949 There is just one item in this list, the string <quote>@</quote>. This is a special form
7950 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7951 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7952 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7953 the same configuration file can be used on different hosts.
7954 </para>
7955 <para>
7956 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7957 list itself is empty. Later in the configuration we will come to the part that
7958 controls mail relaying through the local host; it allows relaying to any
7959 domains in this list. By default, therefore, no relaying on the basis of a mail
7960 domain is permitted.
7961 </para>
7962 <para>
7963 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7964 used later in the configuration to permit relaying from any host or IP address
7965 that matches the list. The default contains just the IP address of the IPv4
7966 loopback interface, which means that processes on the local host are able to
7967 submit mail for relaying by sending it over TCP/IP to that interface. No other
7968 hosts are permitted to submit messages for relaying.
7969 </para>
7970 <para>
7971 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7972 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7973 and hosts that will be used in the controls that are specified later.
7974 </para>
7975 <para>
7976 The next two configuration lines are genuine option settings:
7977 </para>
7978 <literallayout class="monospaced">
7979 acl_smtp_rcpt = acl_check_rcpt
7980 acl_smtp_data = acl_check_data
7981 </literallayout>
7982 <para>
7983 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7984 during an incoming SMTP session for every recipient of a message (every RCPT
7985 command), and after the contents of the message have been received,
7986 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7987 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7988 section of the configuration. The RCPT ACL controls which recipients are
7989 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7990 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7991 contents of a message to be checked.
7992 </para>
7993 <para>
7994 Two commented-out option settings are next:
7995 </para>
7996 <literallayout class="monospaced">
7997 # av_scanner = clamd:/tmp/clamd
7998 # spamd_address = 127.0.0.1 783
7999 </literallayout>
8000 <para>
8001 These are example settings that can be used when Exim is compiled with the
8002 content-scanning extension. The first specifies the interface to the virus
8003 scanner, and the second specifies the interface to SpamAssassin. Further
8004 details are given in chapter <xref linkend="CHAPexiscan"/>.
8005 </para>
8006 <para>
8007 Three more commented-out option settings follow:
8008 </para>
8009 <literallayout class="monospaced">
8010 # tls_advertise_hosts = *
8011 # tls_certificate = /etc/ssl/exim.crt
8012 # tls_privatekey = /etc/ssl/exim.pem
8013 </literallayout>
8014 <para>
8015 These are example settings that can be used when Exim is compiled with
8016 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8017 first one specifies the list of clients that are allowed to use TLS when
8018 connecting to this server; in this case the wildcard means all clients. The
8019 other options specify where Exim should find its TLS certificate and private
8020 key, which together prove the server&#x2019;s identity to any clients that connect.
8021 More details are given in chapter <xref linkend="CHAPTLS"/>.
8022 </para>
8023 <para>
8024 Another two commented-out option settings follow:
8025 </para>
8026 <literallayout class="monospaced">
8027 # daemon_smtp_ports = 25 : 465 : 587
8028 # tls_on_connect_ports = 465
8029 </literallayout>
8030 <para>
8031 <indexterm role="concept">
8032 <primary>port</primary>
8033 <secondary>465 and 587</secondary>
8034 </indexterm>
8035 <indexterm role="concept">
8036 <primary>port</primary>
8037 <secondary>for message submission</secondary>
8038 </indexterm>
8039 <indexterm role="concept">
8040 <primary>message</primary>
8041 <secondary>submission, ports for</secondary>
8042 </indexterm>
8043 <indexterm role="concept">
8044 <primary>ssmtp protocol</primary>
8045 </indexterm>
8046 <indexterm role="concept">
8047 <primary>smtps protocol</primary>
8048 </indexterm>
8049 <indexterm role="concept">
8050 <primary>SMTP</primary>
8051 <secondary>ssmtp protocol</secondary>
8052 </indexterm>
8053 <indexterm role="concept">
8054 <primary>SMTP</primary>
8055 <secondary>smtps protocol</secondary>
8056 </indexterm>
8057 These options provide better support for roaming users who wish to use this
8058 server for message submission. They are not much use unless you have turned on
8059 TLS (as described in the previous paragraph) and authentication (about which
8060 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8061 on end-user networks, so RFC 4409 specifies that message submission should use
8062 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8063 configured to use port 587 correctly, so these settings also enable the
8064 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8065 <xref linkend="SECTsupobssmt"/>).
8066 </para>
8067 <para>
8068 Two more commented-out options settings follow:
8069 </para>
8070 <literallayout class="monospaced">
8071 # qualify_domain =
8072 # qualify_recipient =
8073 </literallayout>
8074 <para>
8075 The first of these specifies a domain that Exim uses when it constructs a
8076 complete email address from a local login name. This is often needed when Exim
8077 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8078 the value of <option>primary_hostname</option> is used. If you set both of these options,
8079 you can have different qualification domains for sender and recipient
8080 addresses. If you set only the first one, its value is used in both cases.
8081 </para>
8082 <para>
8083 <indexterm role="concept">
8084 <primary>domain literal</primary>
8085 <secondary>recognizing format</secondary>
8086 </indexterm>
8087 The following line must be uncommented if you want Exim to recognize
8088 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8089 (an IP address within square brackets) instead of a named domain.
8090 </para>
8091 <literallayout class="monospaced">
8092 # allow_domain_literals
8093 </literallayout>
8094 <para>
8095 The RFCs still require this form, but many people think that in the modern
8096 Internet it makes little sense to permit mail to be sent to specific hosts by
8097 quoting their IP addresses. This ancient format has been used by people who
8098 try to abuse hosts by using them for unwanted relaying. However, some
8099 people believe there are circumstances (for example, messages addressed to
8100 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8101 </para>
8102 <para>
8103 The next configuration line is a kind of trigger guard:
8104 </para>
8105 <literallayout class="monospaced">
8106 never_users = root
8107 </literallayout>
8108 <para>
8109 It specifies that no delivery must ever be run as the root user. The normal
8110 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8111 setting is a guard against slips in the configuration.
8112 The list of users specified by <option>never_users</option> is not, however, the complete
8113 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8114 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8115 contents of <option>never_users</option> are added to this list. By default
8116 FIXED_NEVER_USERS also specifies root.
8117 </para>
8118 <para>
8119 When a remote host connects to Exim in order to send mail, the only information
8120 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8121 line,
8122 </para>
8123 <literallayout class="monospaced">
8124 host_lookup = *
8125 </literallayout>
8126 <para>
8127 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8128 in order to get a host name. This improves the quality of the logging
8129 information, but if you feel it is too expensive, you can remove it entirely,
8130 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8131 Note that it is not always possible to find a host name from an IP address,
8132 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8133 unreachable.
8134 </para>
8135 <para>
8136 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8137 1413 (hence their names):
8138 </para>
8139 <literallayout class="monospaced">
8140 rfc1413_hosts = *
8141 rfc1413_query_timeout = 5s
8142 </literallayout>
8143 <para>
8144 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8145 You can limit the hosts to which these calls are made, or change the timeout
8146 that is used. If you set the timeout to zero, all ident calls are disabled.
8147 Although they are cheap and can provide useful information for tracing problem
8148 messages, some hosts and firewalls have problems with ident calls. This can
8149 result in a timeout instead of an immediate refused connection, leading to
8150 delays on starting up an incoming SMTP session.
8151 </para>
8152 <para>
8153 When Exim receives messages over SMTP connections, it expects all addresses to
8154 be fully qualified with a domain, as required by the SMTP definition. However,
8155 if you are running a server to which simple clients submit messages, you may
8156 find that they send unqualified addresses. The two commented-out options:
8157 </para>
8158 <literallayout class="monospaced">
8159 # sender_unqualified_hosts =
8160 # recipient_unqualified_hosts =
8161 </literallayout>
8162 <para>
8163 show how you can specify hosts that are permitted to send unqualified sender
8164 and recipient addresses, respectively.
8165 </para>
8166 <para>
8167 The <option>percent_hack_domains</option> option is also commented out:
8168 </para>
8169 <literallayout class="monospaced">
8170 # percent_hack_domains =
8171 </literallayout>
8172 <para>
8173 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8174 This is an almost obsolete form of explicit email routing. If you do not know
8175 anything about it, you can safely ignore this topic.
8176 </para>
8177 <para>
8178 The last two settings in the main part of the default configuration are
8179 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8180 message is frozen, Exim no longer continues to try to deliver it. Freezing
8181 occurs when a bounce message encounters a permanent failure because the sender
8182 address of the original message that caused the bounce is invalid, so the
8183 bounce cannot be delivered. This is probably the most common case, but there
8184 are also other conditions that cause freezing, and frozen messages are not
8185 always bounce messages.
8186 </para>
8187 <literallayout class="monospaced">
8188 ignore_bounce_errors_after = 2d
8189 timeout_frozen_after = 7d
8190 </literallayout>
8191 <para>
8192 The first of these options specifies that failing bounce messages are to be
8193 discarded after 2 days on the queue. The second specifies that any frozen
8194 message (whether a bounce message or not) is to be timed out (and discarded)
8195 after a week. In this configuration, the first setting ensures that no failing
8196 bounce message ever lasts a week.
8197 </para>
8198 </section>
8199 <section id="SECID54">
8200 <title>ACL configuration</title>
8201 <para>
8202 <indexterm role="concept">
8203 <primary>default</primary>
8204 <secondary>ACLs</secondary>
8205 </indexterm>
8206 <indexterm role="concept">
8207 <primary>access control lists (ACLs)</primary>
8208 <secondary>default configuration</secondary>
8209 </indexterm>
8210 In the default configuration, the ACL section follows the main configuration.
8211 It starts with the line
8212 </para>
8213 <literallayout class="monospaced">
8214 begin acl
8215 </literallayout>
8216 <para>
8217 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8218 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8219 and <option>acl_smtp_data</option> above.
8220 </para>
8221 <para>
8222 <indexterm role="concept">
8223 <primary>RCPT</primary>
8224 <secondary>ACL for</secondary>
8225 </indexterm>
8226 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8227 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8228 are considered in order, until the recipient address is either accepted or
8229 rejected. The RCPT command is then accepted or rejected, according to the
8230 result of the ACL processing.
8231 </para>
8232 <literallayout class="monospaced">
8233 acl_check_rcpt:
8234 </literallayout>
8235 <para>
8236 This line, consisting of a name terminated by a colon, marks the start of the
8237 ACL, and names it.
8238 </para>
8239 <literallayout class="monospaced">
8240 accept  hosts = :
8241 </literallayout>
8242 <para>
8243 This ACL statement accepts the recipient if the sending host matches the list.
8244 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8245 names or IP addresses. The presence of the colon puts an empty item in the
8246 list; Exim matches this only if the incoming message did not come from a remote
8247 host, because in that case, the remote hostname is empty. The colon is
8248 important. Without it, the list itself is empty, and can never match anything.
8249 </para>
8250 <para>
8251 What this statement is doing is to accept unconditionally all recipients in
8252 messages that are submitted by SMTP from local processes using the standard
8253 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8254 manner.
8255 </para>
8256 <literallayout class="monospaced">
8257 deny    message       = Restricted characters in address
8258         domains       = +local_domains
8259         local_parts   = ^[.] : ^.*[@%!/|]
8260
8261 deny    message       = Restricted characters in address
8262         domains       = !+local_domains
8263         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8264 </literallayout>
8265 <para>
8266 These statements are concerned with local parts that contain any of the
8267 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8268 Although these characters are entirely legal in local parts (in the case of
8269 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8270 in Internet mail addresses.
8271 </para>
8272 <para>
8273 The first three have in the past been associated with explicitly routed
8274 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8275 option). Addresses containing these characters are regularly tried by spammers
8276 in an attempt to bypass relaying restrictions, and also by open relay testing
8277 programs. Unless you really need them it is safest to reject these characters
8278 at this early stage. This configuration is heavy-handed in rejecting these
8279 characters for all messages it accepts from remote hosts. This is a deliberate
8280 policy of being as safe as possible.
8281 </para>
8282 <para>
8283 The first rule above is stricter, and is applied to messages that are addressed
8284 to one of the local domains handled by this host. This is implemented by the
8285 first condition, which restricts it to domains that are listed in the
8286 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8287 reference to a named list. In this configuration, there is just one domain in
8288 <emphasis>local_domains</emphasis>, but in general there may be many.
8289 </para>
8290 <para>
8291 The second condition on the first statement uses two regular expressions to
8292 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8293 or <quote>|</quote>. If you have local accounts that include these characters, you will
8294 have to modify this rule.
8295 </para>
8296 <para>
8297 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8298 allows them because they have been encountered in practice. (Consider the
8299 common convention of local parts constructed as
8300 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8301 the author of Exim, who has no second initial.) However, a local part starting
8302 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8303 file name (for example, for a mailing list). This is also true for local parts
8304 that contain slashes. A pipe symbol can also be troublesome if the local part
8305 is incorporated unthinkingly into a shell command line.
8306 </para>
8307 <para>
8308 The second rule above applies to all other domains, and is less strict. This
8309 allows your own users to send outgoing messages to sites that use slashes
8310 and vertical bars in their local parts. It blocks local parts that begin
8311 with a dot, slash, or vertical bar, but allows these characters within the
8312 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8313 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8314 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8315 </para>
8316 <literallayout class="monospaced">
8317 accept  local_parts   = postmaster
8318         domains       = +local_domains
8319 </literallayout>
8320 <para>
8321 This statement, which has two conditions, accepts an incoming address if the
8322 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8323 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8324 reference to a named list. In this configuration, there is just one domain in
8325 <emphasis>local_domains</emphasis>, but in general there may be many.
8326 </para>
8327 <para>
8328 The presence of this statement means that mail to postmaster is never blocked
8329 by any of the subsequent tests. This can be helpful while sorting out problems
8330 in cases where the subsequent tests are incorrectly denying access.
8331 </para>
8332 <literallayout class="monospaced">
8333 require verify        = sender
8334 </literallayout>
8335 <para>
8336 This statement requires the sender address to be verified before any subsequent
8337 ACL statement can be used. If verification fails, the incoming recipient
8338 address is refused. Verification consists of trying to route the address, to
8339 see if a bounce message could be delivered to it. In the case of remote
8340 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8341 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8342 discusses the details of address verification.
8343 </para>
8344 <literallayout class="monospaced">
8345 accept  hosts         = +relay_from_hosts
8346         control       = submission
8347 </literallayout>
8348 <para>
8349 This statement accepts the address if the message is coming from one of the
8350 hosts that are defined as being allowed to relay through this host. Recipient
8351 verification is omitted here, because in many cases the clients are dumb MUAs
8352 that do not cope well with SMTP error responses. For the same reason, the
8353 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8354 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8355 messages that are deficient in some way, for example, because they lack a
8356 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8357 probably add recipient verification here, and disable submission mode.
8358 </para>
8359 <literallayout class="monospaced">
8360 accept  authenticated = *
8361         control       = submission
8362 </literallayout>
8363 <para>
8364 This statement accepts the address if the client host has authenticated itself.
8365 Submission mode is again specified, on the grounds that such messages are most
8366 likely to come from MUAs. The default configuration does not define any
8367 authenticators, though it does include some nearly complete commented-out
8368 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8369 fact authenticate until you complete the authenticator definitions.
8370 </para>
8371 <literallayout class="monospaced">
8372 require message = relay not permitted
8373         domains = +local_domains : +relay_domains
8374 </literallayout>
8375 <para>
8376 This statement rejects the address if its domain is neither a local domain nor
8377 one of the domains for which this host is a relay.
8378 </para>
8379 <literallayout class="monospaced">
8380 require verify = recipient
8381 </literallayout>
8382 <para>
8383 This statement requires the recipient address to be verified; if verification
8384 fails, the address is rejected.
8385 </para>
8386 <literallayout class="monospaced">
8387 # deny    message     = rejected because $sender_host_address \
8388 #                       is in a black list at $dnslist_domain\n\
8389 #                       $dnslist_text
8390 #         dnslists    = black.list.example
8391 #
8392 # warn    dnslists    = black.list.example
8393 #         add_header  = X-Warning: $sender_host_address is in \
8394 #                       a black list at $dnslist_domain
8395 #         log_message = found in $dnslist_domain
8396 </literallayout>
8397 <para>
8398 These commented-out lines are examples of how you could configure Exim to check
8399 sending hosts against a DNS black list. The first statement rejects messages
8400 from blacklisted hosts, whereas the second just inserts a warning header
8401 line.
8402 </para>
8403 <literallayout class="monospaced">
8404 # require verify = csa
8405 </literallayout>
8406 <para>
8407 This commented-out line is an example of how you could turn on client SMTP
8408 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8409 records.
8410 </para>
8411 <literallayout class="monospaced">
8412 accept
8413 </literallayout>
8414 <para>
8415 The final statement in the first ACL unconditionally accepts any recipient
8416 address that has successfully passed all the previous tests.
8417 </para>
8418 <literallayout class="monospaced">
8419 acl_check_data:
8420 </literallayout>
8421 <para>
8422 This line marks the start of the second ACL, and names it. Most of the contents
8423 of this ACL are commented out:
8424 </para>
8425 <literallayout class="monospaced">
8426 # deny    malware   = *
8427 #         message   = This message contains a virus \
8428 #                     ($malware_name).
8429 </literallayout>
8430 <para>
8431 These lines are examples of how to arrange for messages to be scanned for
8432 viruses when Exim has been compiled with the content-scanning extension, and a
8433 suitable virus scanner is installed. If the message is found to contain a
8434 virus, it is rejected with the given custom error message.
8435 </para>
8436 <literallayout class="monospaced">
8437 # warn    spam      = nobody
8438 #         message   = X-Spam_score: $spam_score\n\
8439 #                     X-Spam_score_int: $spam_score_int\n\
8440 #                     X-Spam_bar: $spam_bar\n\
8441 #                     X-Spam_report: $spam_report
8442 </literallayout>
8443 <para>
8444 These lines are an example of how to arrange for messages to be scanned by
8445 SpamAssassin when Exim has been compiled with the content-scanning extension,
8446 and SpamAssassin has been installed. The SpamAssassin check is run with
8447 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8448 series of extra header line. In this case, the message is not rejected,
8449 whatever the spam score.
8450 </para>
8451 <literallayout class="monospaced">
8452 accept
8453 </literallayout>
8454 <para>
8455 This final line in the DATA ACL accepts the message unconditionally.
8456 </para>
8457 </section>
8458 <section id="SECID55">
8459 <title>Router configuration</title>
8460 <para>
8461 <indexterm role="concept">
8462 <primary>default</primary>
8463 <secondary>routers</secondary>
8464 </indexterm>
8465 <indexterm role="concept">
8466 <primary>routers</primary>
8467 <secondary>default</secondary>
8468 </indexterm>
8469 The router configuration comes next in the default configuration, introduced
8470 by the line
8471 </para>
8472 <literallayout class="monospaced">
8473 begin routers
8474 </literallayout>
8475 <para>
8476 Routers are the modules in Exim that make decisions about where to send
8477 messages. An address is passed to each router in turn, until it is either
8478 accepted, or failed. This means that the order in which you define the routers
8479 matters. Each router is fully described in its own chapter later in this
8480 manual. Here we give only brief overviews.
8481 </para>
8482 <literallayout class="monospaced">
8483 # domain_literal:
8484 #   driver = ipliteral
8485 #   domains = !+local_domains
8486 #   transport = remote_smtp
8487 </literallayout>
8488 <para>
8489 <indexterm role="concept">
8490 <primary>domain literal</primary>
8491 <secondary>default router</secondary>
8492 </indexterm>
8493 This router is commented out because the majority of sites do not want to
8494 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8495 you uncomment this router, you also need to uncomment the setting of
8496 <option>allow_domain_literals</option> in the main part of the configuration.
8497 </para>
8498 <literallayout class="monospaced">
8499 dnslookup:
8500   driver = dnslookup
8501   domains = ! +local_domains
8502   transport = remote_smtp
8503   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8504   no_more
8505 </literallayout>
8506 <para>
8507 The first uncommented router handles addresses that do not involve any local
8508 domains. This is specified by the line
8509 </para>
8510 <literallayout class="monospaced">
8511 domains = ! +local_domains
8512 </literallayout>
8513 <para>
8514 The <option>domains</option> option lists the domains to which this router applies, but the
8515 exclamation mark is a negation sign, so the router is used only for domains
8516 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8517 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8518 indicates that it is referring to a named list. Addresses in other domains are
8519 passed on to the following routers.
8520 </para>
8521 <para>
8522 The name of the router driver is <command>dnslookup</command>,
8523 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8524 the name of this router instance is the same as the name of the driver. The
8525 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8526 one of the driver modules that is in the Exim binary.
8527 </para>
8528 <para>
8529 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8530 DNS in order to obtain a list of hosts to which the address is routed. If the
8531 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8532 specified by the <option>transport</option> option. If the router does not find the domain
8533 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8534 the address fails and is bounced.
8535 </para>
8536 <para>
8537 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8538 be entirely ignored. This option is present because a number of cases have been
8539 encountered where MX records in the DNS point to host names
8540 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8541 Completely ignoring these IP addresses causes Exim to fail to route the
8542 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8543 continue to try to deliver the message periodically until the address timed
8544 out.
8545 </para>
8546 <literallayout class="monospaced">
8547 system_aliases:
8548   driver = redirect
8549   allow_fail
8550   allow_defer
8551   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8552 # user = exim
8553   file_transport = address_file
8554   pipe_transport = address_pipe
8555 </literallayout>
8556 <para>
8557 Control reaches this and subsequent routers only for addresses in the local
8558 domains. This router checks to see whether the local part is defined as an
8559 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8560 data that it looks up from that file. If no data is found for the local part,
8561 the value of the <option>data</option> option is empty, causing the address to be passed to
8562 the next router.
8563 </para>
8564 <para>
8565 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8566 often used. That is why it is referenced by from the default configuration
8567 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8568 <filename>Local/Makefile</filename> before building Exim.
8569 </para>
8570 <literallayout class="monospaced">
8571 userforward:
8572   driver = redirect
8573   check_local_user
8574 # local_part_suffix = +* : -*
8575 # local_part_suffix_optional
8576   file = $home/.forward
8577 # allow_filter
8578   no_verify
8579   no_expn
8580   check_ancestor
8581   file_transport = address_file
8582   pipe_transport = address_pipe
8583   reply_transport = address_reply
8584 </literallayout>
8585 <para>
8586 This is the most complicated router in the default configuration. It is another
8587 redirection router, but this time it is looking for forwarding data set up by
8588 individual users. The <option>check_local_user</option> setting specifies a check that the
8589 local part of the address is the login name of a local user. If it is not, the
8590 router is skipped. The two commented options that follow <option>check_local_user</option>,
8591 namely:
8592 </para>
8593 <literallayout class="monospaced">
8594 # local_part_suffix = +* : -*
8595 # local_part_suffix_optional
8596 </literallayout>
8597 <para>
8598 <indexterm role="variable">
8599 <primary><varname>$local_part_suffix</varname></primary>
8600 </indexterm>
8601 show how you can specify the recognition of local part suffixes. If the first
8602 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8603 by any sequence of characters, is removed from the local part and placed in the
8604 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8605 presence of a suffix in the local part is optional. When a suffix is present,
8606 the check for a local login uses the local part with the suffix removed.
8607 </para>
8608 <para>
8609 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8610 home directory is consulted. If it does not exist, or is empty, the router
8611 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8612 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8613 </para>
8614 <para>
8615 <indexterm role="concept">
8616 <primary>Sieve filter</primary>
8617 <secondary>enabling in default router</secondary>
8618 </indexterm>
8619 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8620 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8621 is commented out by default), the contents of the file are interpreted as a set
8622 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8623 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8624 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8625 </para>
8626 <para>
8627 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8628 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8629 There are two reasons for doing this:
8630 </para>
8631 <orderedlist numeration="arabic">
8632 <listitem>
8633 <para>
8634 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8635 checking an address for validity; it makes sense not to waste resources doing
8636 unnecessary work.
8637 </para>
8638 </listitem>
8639 <listitem>
8640 <para>
8641 More importantly, when Exim is verifying addresses or handling an EXPN
8642 command during an SMTP session, it is running as the Exim user, not as root.
8643 The group is the Exim group, and no additional groups are set up.
8644 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8645 this time.
8646 </para>
8647 </listitem>
8648 </orderedlist>
8649 <para>
8650 The setting of <option>check_ancestor</option> prevents the router from generating a new
8651 address that is the same as any previous address that was redirected. (This
8652 works round a problem concerning a bad interaction between aliasing and
8653 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8654 </para>
8655 <para>
8656 The final three option settings specify the transports that are to be used when
8657 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8658 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8659 </para>
8660 <literallayout class="monospaced">
8661 a.nother@elsewhere.example, /home/spqr/archive
8662 </literallayout>
8663 <para>
8664 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8665 transport.
8666 </para>
8667 <literallayout class="monospaced">
8668 localuser:
8669   driver = accept
8670   check_local_user
8671 # local_part_suffix = +* : -*
8672 # local_part_suffix_optional
8673   transport = local_delivery
8674 </literallayout>
8675 <para>
8676 The final router sets up delivery into local mailboxes, provided that the local
8677 part is the name of a local login, by accepting the address and assigning it to
8678 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8679 routers, so the address is bounced. The commented suffix settings fulfil the
8680 same purpose as they do for the <command>userforward</command> router.
8681 </para>
8682 </section>
8683 <section id="SECID56">
8684 <title>Transport configuration</title>
8685 <para>
8686 <indexterm role="concept">
8687 <primary>default</primary>
8688 <secondary>transports</secondary>
8689 </indexterm>
8690 <indexterm role="concept">
8691 <primary>transports</primary>
8692 <secondary>default</secondary>
8693 </indexterm>
8694 Transports define mechanisms for actually delivering messages. They operate
8695 only when referenced from routers, so the order in which they are defined does
8696 not matter. The transports section of the configuration starts with
8697 </para>
8698 <literallayout class="monospaced">
8699 begin transports
8700 </literallayout>
8701 <para>
8702 One remote transport and four local transports are defined.
8703 </para>
8704 <literallayout class="monospaced">
8705 remote_smtp:
8706   driver = smtp
8707 </literallayout>
8708 <para>
8709 This transport is used for delivering messages over SMTP connections. All its
8710 options are defaulted. The list of remote hosts comes from the router.
8711 </para>
8712 <literallayout class="monospaced">
8713 local_delivery:
8714   driver = appendfile
8715   file = /var/mail/$local_part
8716   delivery_date_add
8717   envelope_to_add
8718   return_path_add
8719 # group = mail
8720 # mode = 0660
8721 </literallayout>
8722 <para>
8723 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8724 traditional BSD mailbox format. By default it runs under the uid and gid of the
8725 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8726 directory. Some systems use the alternative approach of running mail deliveries
8727 under a particular group instead of using the sticky bit. The commented options
8728 show how this can be done.
8729 </para>
8730 <para>
8731 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8732 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8733 similarly-named options above.
8734 </para>
8735 <literallayout class="monospaced">
8736 address_pipe:
8737   driver = pipe
8738   return_output
8739 </literallayout>
8740 <para>
8741 This transport is used for handling deliveries to pipes that are generated by
8742 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8743 option specifies that any output generated by the pipe is to be returned to the
8744 sender.
8745 </para>
8746 <literallayout class="monospaced">
8747 address_file:
8748   driver = appendfile
8749   delivery_date_add
8750   envelope_to_add
8751   return_path_add
8752 </literallayout>
8753 <para>
8754 This transport is used for handling deliveries to files that are generated by
8755 redirection. The name of the file is not specified in this instance of
8756 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8757 </para>
8758 <literallayout class="monospaced">
8759 address_reply:
8760   driver = autoreply
8761 </literallayout>
8762 <para>
8763 This transport is used for handling automatic replies generated by users&#x2019;
8764 filter files.
8765 </para>
8766 </section>
8767 <section id="SECID57">
8768 <title>Default retry rule</title>
8769 <para>
8770 <indexterm role="concept">
8771 <primary>retry</primary>
8772 <secondary>default rule</secondary>
8773 </indexterm>
8774 <indexterm role="concept">
8775 <primary>default</primary>
8776 <secondary>retry rule</secondary>
8777 </indexterm>
8778 The retry section of the configuration file contains rules which affect the way
8779 Exim retries deliveries that cannot be completed at the first attempt. It is
8780 introduced by the line
8781 </para>
8782 <literallayout class="monospaced">
8783 begin retry
8784 </literallayout>
8785 <para>
8786 In the default configuration, there is just one rule, which applies to all
8787 errors:
8788 </para>
8789 <literallayout class="monospaced">
8790 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8791 </literallayout>
8792 <para>
8793 This causes any temporarily failing address to be retried every 15 minutes for
8794 2 hours, then at intervals starting at one hour and increasing by a factor of
8795 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8796 is not delivered after 4 days of temporary failure, it is bounced.
8797 </para>
8798 <para>
8799 If the retry section is removed from the configuration, or is empty (that is,
8800 if no retry rules are defined), Exim will not retry deliveries. This turns
8801 temporary errors into permanent errors.
8802 </para>
8803 </section>
8804 <section id="SECID58">
8805 <title>Rewriting configuration</title>
8806 <para>
8807 The rewriting section of the configuration, introduced by
8808 </para>
8809 <literallayout class="monospaced">
8810 begin rewrite
8811 </literallayout>
8812 <para>
8813 contains rules for rewriting addresses in messages as they arrive. There are no
8814 rewriting rules in the default configuration file.
8815 </para>
8816 </section>
8817 <section id="SECTdefconfauth">
8818 <title>Authenticators configuration</title>
8819 <para>
8820 <indexterm role="concept">
8821 <primary>AUTH</primary>
8822 <secondary>configuration</secondary>
8823 </indexterm>
8824 The authenticators section of the configuration, introduced by
8825 </para>
8826 <literallayout class="monospaced">
8827 begin authenticators
8828 </literallayout>
8829 <para>
8830 defines mechanisms for the use of the SMTP AUTH command. The default
8831 configuration file contains two commented-out example authenticators
8832 which support plaintext username/password authentication using the
8833 standard PLAIN mechanism and the traditional but non-standard LOGIN
8834 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8835 to support most MUA software.
8836 </para>
8837 <para>
8838 The example PLAIN authenticator looks like this:
8839 </para>
8840 <literallayout class="monospaced">
8841 #PLAIN:
8842 #  driver                  = plaintext
8843 #  server_set_id           = $auth2
8844 #  server_prompts          = :
8845 #  server_condition        = Authentication is not yet configured
8846 #  server_advertise_condition = ${if def:tls_cipher }
8847 </literallayout>
8848 <para>
8849 And the example LOGIN authenticator looks like this:
8850 </para>
8851 <literallayout class="monospaced">
8852 #LOGIN:
8853 #  driver                  = plaintext
8854 #  server_set_id           = $auth1
8855 #  server_prompts          = &lt;| Username: | Password:
8856 #  server_condition        = Authentication is not yet configured
8857 #  server_advertise_condition = ${if def:tls_cipher }
8858 </literallayout>
8859 <para>
8860 The <option>server_set_id</option> option makes Exim remember the authenticated username
8861 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8862 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8863 that it implements the details of the specific authentication mechanism,
8864 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8865 when Exim offers authentication to clients; in the examples, this is only
8866 when TLS or SSL has been started, so to enable the authenticators you also
8867 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8868 </para>
8869 <para>
8870 The <option>server_condition</option> setting defines how to verify that the username and
8871 password are correct. In the examples it just produces an error message.
8872 To make the authenticators work, you can use a string expansion
8873 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8874 </para>
8875 <para revisionflag="changed">
8876 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8877 usercode and password are in different positions.  <xref linkend="CHAPplaintext"/>
8878 covers both.
8879 </para>
8880 <para>
8881 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8882 </para>
8883 </section>
8884 </chapter>
8885
8886 <chapter id="CHAPregexp">
8887 <title>Regular expressions</title>
8888 <para>
8889 <indexterm role="concept">
8890 <primary>regular expressions</primary>
8891 <secondary>library</secondary>
8892 </indexterm>
8893 <indexterm role="concept">
8894 <primary>PCRE</primary>
8895 </indexterm>
8896 Exim supports the use of regular expressions in many of its options. It
8897 uses the PCRE regular expression library; this provides regular expression
8898 matching that is compatible with Perl 5. The syntax and semantics of
8899 regular expressions is discussed in many Perl reference books, and also in
8900 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8901 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8902 </para>
8903 <para revisionflag="changed">
8904 The documentation for the syntax and semantics of the regular expressions that
8905 are supported by PCRE is included in the PCRE distribution, and no further
8906 description is included here. The PCRE functions are called from Exim using
8907 the default option settings (that is, with no PCRE options set), except that
8908 the PCRE_CASELESS option is set when the matching is required to be
8909 case-insensitive.
8910 </para>
8911 <para>
8912 In most cases, when a regular expression is required in an Exim configuration,
8913 it has to start with a circumflex, in order to distinguish it from plain text
8914 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8915 second item in the colon-separated list is a regular expression.
8916 </para>
8917 <literallayout class="monospaced">
8918 domains = a.b.c : ^\\d{3} : *.y.z : ...
8919 </literallayout>
8920 <para>
8921 The doubling of the backslash is required because of string expansion that
8922 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8923 of this issue, and a way of avoiding the need for doubling backslashes. The
8924 regular expression that is eventually used in this example contains just one
8925 backslash. The circumflex is included in the regular expression, and has the
8926 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8927 matched.
8928 </para>
8929 <para>
8930 There are, however, two cases where a circumflex is not required for the
8931 recognition of a regular expression: these are the <option>match</option> condition in a
8932 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8933 these cases, the relevant string is always treated as a regular expression; if
8934 it does not start with a circumflex, the expression is not anchored, and can
8935 match anywhere in the subject string.
8936 </para>
8937 <para>
8938 In all cases, if you want a regular expression to match at the end of a string,
8939 you must code the $ metacharacter to indicate this. For example:
8940 </para>
8941 <literallayout class="monospaced">
8942 domains = ^\\d{3}\\.example
8943 </literallayout>
8944 <para>
8945 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8946 You need to use:
8947 </para>
8948 <literallayout class="monospaced">
8949 domains = ^\\d{3}\\.example\$
8950 </literallayout>
8951 <para>
8952 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8953 $ is needed because string expansion also interprets dollar characters.
8954 </para>
8955 </chapter>
8956
8957 <chapter id="CHAPfdlookup">
8958 <title>File and database lookups</title>
8959 <para>
8960 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8961 <primary>file</primary>
8962 <secondary>lookups</secondary>
8963 </indexterm>
8964 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8965 <primary>database</primary>
8966 <secondary>lookups</secondary>
8967 </indexterm>
8968 <indexterm role="concept">
8969 <primary>lookup</primary>
8970 <secondary>description of</secondary>
8971 </indexterm>
8972 Exim can be configured to look up data in files or databases as it processes
8973 messages. Two different kinds of syntax are used:
8974 </para>
8975 <orderedlist numeration="arabic">
8976 <listitem>
8977 <para>
8978 A string that is to be expanded may contain explicit lookup requests. These
8979 cause parts of the string to be replaced by data that is obtained from the
8980 lookup. Lookups of this type are conditional expansion items. Different results
8981 can be defined for the cases of lookup success and failure. See chapter
8982 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8983 </para>
8984 </listitem>
8985 <listitem>
8986 <para>
8987 Lists of domains, hosts, and email addresses can contain lookup requests as a
8988 way of avoiding excessively long linear lists. In this case, the data that is
8989 returned by the lookup is often (but not always) discarded; whether the lookup
8990 succeeds or fails is what really counts. These kinds of list are described in
8991 chapter <xref linkend="CHAPdomhosaddlists"/>.
8992 </para>
8993 </listitem>
8994 </orderedlist>
8995 <para>
8996 String expansions, lists, and lookups interact with each other in such a way
8997 that there is no order in which to describe any one of them that does not
8998 involve references to the others. Each of these three chapters makes more sense
8999 if you have read the other two first. If you are reading this for the first
9000 time, be aware that some of it will make a lot more sense after you have read
9001 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9002 </para>
9003 <section id="SECID60">
9004 <title>Examples of different lookup syntax</title>
9005 <para>
9006 It is easy to confuse the two different kinds of lookup, especially as the
9007 lists that may contain the second kind are always expanded before being
9008 processed as lists. Therefore, they may also contain lookups of the first kind.
9009 Be careful to distinguish between the following two examples:
9010 </para>
9011 <literallayout class="monospaced">
9012 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9013 domains = lsearch;/some/file
9014 </literallayout>
9015 <para>
9016 The first uses a string expansion, the result of which must be a domain list.
9017 No strings have been specified for a successful or a failing lookup; the
9018 defaults in this case are the looked-up data and an empty string, respectively.
9019 The expansion takes place before the string is processed as a list, and the
9020 file that is searched could contain lines like this:
9021 </para>
9022 <literallayout class="monospaced">
9023 192.168.3.4: domain1:domain2:...
9024 192.168.1.9: domain3:domain4:...
9025 </literallayout>
9026 <para>
9027 When the lookup succeeds, the result of the expansion is a list of domains (and
9028 possibly other types of item that are allowed in domain lists).
9029 </para>
9030 <para>
9031 In the second example, the lookup is a single item in a domain list. It causes
9032 Exim to use a lookup to see if the domain that is being processed can be found
9033 in the file. The file could contains lines like this:
9034 </para>
9035 <literallayout class="monospaced">
9036 domain1:
9037 domain2:
9038 </literallayout>
9039 <para>
9040 Any data that follows the keys is not relevant when checking that the domain
9041 matches the list item.
9042 </para>
9043 <para>
9044 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9045 Consider a file containing lines like this:
9046 </para>
9047 <literallayout class="monospaced">
9048 192.168.5.6: lsearch;/another/file
9049 </literallayout>
9050 <para>
9051 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9052 first <option>domains</option> setting above generates the second setting, which therefore
9053 causes a second lookup to occur.
9054 </para>
9055 <para>
9056 The rest of this chapter describes the different lookup types that are
9057 available. Any of them can be used in any part of the configuration where a
9058 lookup is permitted.
9059 </para>
9060 </section>
9061 <section id="SECID61">
9062 <title>Lookup types</title>
9063 <para>
9064 <indexterm role="concept">
9065 <primary>lookup</primary>
9066 <secondary>types of</secondary>
9067 </indexterm>
9068 <indexterm role="concept">
9069 <primary>single-key lookup</primary>
9070 <secondary>definition of</secondary>
9071 </indexterm>
9072 Two different types of data lookup are implemented:
9073 </para>
9074 <itemizedlist>
9075 <listitem>
9076 <para>
9077 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9078 and a single key to search for. The key must be a non-empty string for the
9079 lookup to succeed. The lookup type determines how the file is searched.
9080 </para>
9081 </listitem>
9082 <listitem>
9083 <para>
9084 <indexterm role="concept">
9085 <primary>query-style lookup</primary>
9086 <secondary>definition of</secondary>
9087 </indexterm>
9088 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9089 key value is assumed by Exim for query-style lookups. You can use whichever
9090 Exim variables you need to construct the database query.
9091 </para>
9092 </listitem>
9093 </itemizedlist>
9094 <para>
9095 The code for each lookup type is in a separate source file that is included in
9096 the binary of Exim only if the corresponding compile-time option is set. The
9097 default settings in <filename>src/EDITME</filename> are:
9098 </para>
9099 <literallayout class="monospaced">
9100 LOOKUP_DBM=yes
9101 LOOKUP_LSEARCH=yes
9102 </literallayout>
9103 <para>
9104 which means that only linear searching and DBM lookups are included by default.
9105 For some types of lookup (e.g. SQL databases), you need to install appropriate
9106 libraries and header files before building Exim.
9107 </para>
9108 </section>
9109 <section id="SECTsinglekeylookups">
9110 <title>Single-key lookup types</title>
9111 <para>
9112 <indexterm role="concept">
9113 <primary>lookup</primary>
9114 <secondary>single-key types</secondary>
9115 </indexterm>
9116 <indexterm role="concept">
9117 <primary>single-key lookup</primary>
9118 <secondary>list of types</secondary>
9119 </indexterm>
9120 The following single-key lookup types are implemented:
9121 </para>
9122 <itemizedlist>
9123 <listitem>
9124 <para>
9125 <indexterm role="concept">
9126 <primary>cdb</primary>
9127 <secondary>description of</secondary>
9128 </indexterm>
9129 <indexterm role="concept">
9130 <primary>lookup</primary>
9131 <secondary>cdb</secondary>
9132 </indexterm>
9133 <indexterm role="concept">
9134 <primary>binary zero</primary>
9135 <secondary>in lookup key</secondary>
9136 </indexterm>
9137 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9138 string without a terminating binary zero. The cdb format is designed for
9139 indexed files that are read frequently and never updated, except by total
9140 re-creation. As such, it is particularly suitable for large files containing
9141 aliases or other indexed data referenced by an MTA. Information about cdb can
9142 be found in several places:
9143 </para>
9144 <literallayout>
9145 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9146 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9147 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9148 </literallayout>
9149 <para>
9150 A cdb distribution is not needed in order to build Exim with cdb support,
9151 because the code for reading cdb files is included directly in Exim itself.
9152 However, no means of building or testing cdb files is provided with Exim, so
9153 you need to obtain a cdb distribution in order to do this.
9154 </para>
9155 </listitem>
9156 <listitem>
9157 <para>
9158 <indexterm role="concept">
9159 <primary>DBM</primary>
9160 <secondary>lookup type</secondary>
9161 </indexterm>
9162 <indexterm role="concept">
9163 <primary>lookup</primary>
9164 <secondary>dbm</secondary>
9165 </indexterm>
9166 <indexterm role="concept">
9167 <primary>binary zero</primary>
9168 <secondary>in lookup key</secondary>
9169 </indexterm>
9170 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9171 DBM file by looking up the record with the given key. A terminating binary
9172 zero is included in the key that is passed to the DBM library. See section
9173 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9174 </para>
9175 <para>
9176 <indexterm role="concept">
9177 <primary>Berkeley DB library</primary>
9178 <secondary>file format</secondary>
9179 </indexterm>
9180 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9181 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9182 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9183 the DB_UNKNOWN option. This enables it to handle any of the types of database
9184 that the library supports, and can be useful for accessing DBM files created by
9185 other applications. (For earlier DB versions, DB_HASH is always used.)
9186 </para>
9187 </listitem>
9188 <listitem>
9189 <para>
9190 <indexterm role="concept">
9191 <primary>lookup</primary>
9192 <secondary>dbmnz</secondary>
9193 </indexterm>
9194 <indexterm role="concept">
9195 <primary>lookup</primary>
9196 <secondary>dbm &ndash; terminating zero</secondary>
9197 </indexterm>
9198 <indexterm role="concept">
9199 <primary>binary zero</primary>
9200 <secondary>in lookup key</secondary>
9201 </indexterm>
9202 <indexterm role="concept">
9203 <primary>Courier</primary>
9204 </indexterm>
9205 <indexterm role="concept">
9206 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9207 </indexterm>
9208 <indexterm role="concept">
9209 <primary>dmbnz lookup type</primary>
9210 </indexterm>
9211 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9212 is not included in the key that is passed to the DBM library. You may need this
9213 if you want to look up data in files that are created by or shared with some
9214 other application that does not use terminating zeros. For example, you need to
9215 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9216 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9217 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9218 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9219 </para>
9220 </listitem>
9221 <listitem>
9222 <para>
9223 <indexterm role="concept">
9224 <primary>lookup</primary>
9225 <secondary>dsearch</secondary>
9226 </indexterm>
9227 <indexterm role="concept">
9228 <primary>dsearch lookup type</primary>
9229 </indexterm>
9230 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9231 whose name is the key by calling the <function>lstat()</function> function. The key may not
9232 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9233 the lookup is the name of the entry, which may be a file, directory,
9234 symbolic link, or any other kind of directory entry. An example of how this
9235 lookup can be used to support virtual domains is given in section
9236 <xref linkend="SECTvirtualdomains"/>.
9237 </para>
9238 </listitem>
9239 <listitem>
9240 <para>
9241 <indexterm role="concept">
9242 <primary>lookup</primary>
9243 <secondary>iplsearch</secondary>
9244 </indexterm>
9245 <indexterm role="concept">
9246 <primary>iplsearch lookup type</primary>
9247 </indexterm>
9248 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9249 terminated by a colon or white space or the end of the line. The keys in the
9250 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9251 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9252 being interpreted as a key terminator. For example:
9253 </para>
9254 <literallayout class="monospaced">
9255 1.2.3.4:           data for 1.2.3.4
9256 192.168.0.0/16:    data for 192.168.0.0/16
9257 "abcd::cdab":      data for abcd::cdab
9258 "abcd:abcd::/32"   data for abcd:abcd::/32
9259 </literallayout>
9260 <para>
9261 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9262 file is searched linearly, using the CIDR masks where present, until a matching
9263 key is found. The first key that matches is used; there is no attempt to find a
9264 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9265 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9266 </para>
9267 <para>
9268 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9269 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9270 lookup types support only literal keys.
9271 </para>
9272 <para>
9273 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9274 the implicit key is the host&#x2019;s IP address rather than its name (see section
9275 <xref linkend="SECThoslispatsikey"/>).
9276 </para>
9277 </listitem>
9278 <listitem>
9279 <para>
9280 <indexterm role="concept">
9281 <primary>linear search</primary>
9282 </indexterm>
9283 <indexterm role="concept">
9284 <primary>lookup</primary>
9285 <secondary>lsearch</secondary>
9286 </indexterm>
9287 <indexterm role="concept">
9288 <primary>lsearch lookup type</primary>
9289 </indexterm>
9290 <indexterm role="concept">
9291 <primary>case sensitivity</primary>
9292 <secondary>in lsearch lookup</secondary>
9293 </indexterm>
9294 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9295 line beginning with the search key, terminated by a colon or white space or the
9296 end of the line. The search is case-insensitive; that is, upper and lower case
9297 letters are treated as the same. The first occurrence of the key that is found
9298 in the file is used.
9299 </para>
9300 <para>
9301 White space between the key and the colon is permitted. The remainder of the
9302 line, with leading and trailing white space removed, is the data. This can be
9303 continued onto subsequent lines by starting them with any amount of white
9304 space, but only a single space character is included in the data at such a
9305 junction. If the data begins with a colon, the key must be terminated by a
9306 colon, for example:
9307 </para>
9308 <literallayout class="monospaced">
9309 baduser:  :fail:
9310 </literallayout>
9311 <para>
9312 Empty lines and lines beginning with # are ignored, even if they occur in the
9313 middle of an item. This is the traditional textual format of alias files. Note
9314 that the keys in an <command>lsearch</command> file are literal strings. There is no
9315 wildcarding of any kind.
9316 </para>
9317 <para>
9318 <indexterm role="concept">
9319 <primary>lookup</primary>
9320 <secondary>lsearch &ndash; colons in keys</secondary>
9321 </indexterm>
9322 <indexterm role="concept">
9323 <primary>white space</primary>
9324 <secondary>in lsearch key</secondary>
9325 </indexterm>
9326 In most <command>lsearch</command> files, keys are not required to contain colons or #
9327 characters, or white space. However, if you need this feature, it is available.
9328 If a key begins with a doublequote character, it is terminated only by a
9329 matching quote (or end of line), and the normal escaping rules apply to its
9330 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9331 quoted keys (exactly as for unquoted keys). There is no special handling of
9332 quotes for the data part of an <command>lsearch</command> line.
9333 </para>
9334 </listitem>
9335 <listitem>
9336 <para>
9337 <indexterm role="concept">
9338 <primary>NIS lookup type</primary>
9339 </indexterm>
9340 <indexterm role="concept">
9341 <primary>lookup</primary>
9342 <secondary>NIS</secondary>
9343 </indexterm>
9344 <indexterm role="concept">
9345 <primary>binary zero</primary>
9346 <secondary>in lookup key</secondary>
9347 </indexterm>
9348 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9349 the given key, without a terminating binary zero. There is a variant called
9350 <command>nis0</command> which does include the terminating binary zero in the key. This is
9351 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9352 aliases; the full map names must be used.
9353 </para>
9354 </listitem>
9355 <listitem>
9356 <para>
9357 <indexterm role="concept">
9358 <primary>wildlsearch lookup type</primary>
9359 </indexterm>
9360 <indexterm role="concept">
9361 <primary>lookup</primary>
9362 <secondary>wildlsearch</secondary>
9363 </indexterm>
9364 <indexterm role="concept">
9365 <primary>nwildlsearch lookup type</primary>
9366 </indexterm>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>nwildlsearch</secondary>
9370 </indexterm>
9371 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9372 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9373 the file may be wildcarded. The difference between these two lookup types is
9374 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9375 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9376 </para>
9377 <para>
9378 <indexterm role="concept">
9379 <primary>case sensitivity</primary>
9380 <secondary>in (n)wildlsearch lookup</secondary>
9381 </indexterm>
9382 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9383 file that are regular expressions can be made case-sensitive by the use of
9384 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9385 </para>
9386 <orderedlist numeration="arabic">
9387 <listitem>
9388 <para>
9389 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9390 </para>
9391 <literallayout class="monospaced">
9392     *.a.b.c       data for anything.a.b.c
9393     *fish         data for anythingfish
9394 </literallayout>
9395 </listitem>
9396 <listitem>
9397 <para>
9398 The string may begin with a circumflex to indicate a regular expression. For
9399 example, for <command>wildlsearch</command>:
9400 </para>
9401 <literallayout class="monospaced">
9402     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9403 </literallayout>
9404 <para>
9405 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9406 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9407 string-expanded, the equivalent entry is:
9408 </para>
9409 <literallayout class="monospaced">
9410     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9411 </literallayout>
9412 <para>
9413 The case-insensitive flag is set at the start of compiling the regular
9414 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9415 For example, to make the entire pattern case-sensitive:
9416 </para>
9417 <literallayout class="monospaced">
9418     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9419 </literallayout>
9420 <para>
9421 If the regular expression contains white space or colon characters, you must
9422 either quote it (see <command>lsearch</command> above), or represent these characters in other
9423 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9424 colon. This may be easier than quoting, because if you quote, you have to
9425 escape all the backslashes inside the quotes.
9426 </para>
9427 <para>
9428 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9429 match for later use, because the results of all lookups are cached. If a lookup
9430 is repeated, the result is taken from the cache, and no actual pattern matching
9431 takes place. The values of all the numeric variables are unset after a
9432 <command>(n)wildlsearch</command> match.
9433 </para>
9434 </listitem>
9435 <listitem>
9436 <para>
9437 Although I cannot see it being of much use, the general matching function that
9438 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9439 lookup name terminated by a semicolon, and followed by lookup data. For
9440 example:
9441 </para>
9442 <literallayout class="monospaced">
9443     cdb;/some/file  data for keys that match the file
9444 </literallayout>
9445 <para>
9446 The data that is obtained from the nested lookup is discarded.
9447 </para>
9448 </listitem>
9449 </orderedlist>
9450 <para>
9451 Keys that do not match any of these patterns are interpreted literally. The
9452 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9453 be followed by optional colons.
9454 </para>
9455 <para>
9456 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9457 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9458 lookup types support only literal keys.
9459 </para>
9460 </listitem>
9461 </itemizedlist>
9462 </section>
9463 <section id="SECID62">
9464 <title>Query-style lookup types</title>
9465 <para>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>query-style types</secondary>
9469 </indexterm>
9470 <indexterm role="concept">
9471 <primary>query-style lookup</primary>
9472 <secondary>list of types</secondary>
9473 </indexterm>
9474 The supported query-style lookup types are listed below. Further details about
9475 many of them are given in later sections.
9476 </para>
9477 <itemizedlist>
9478 <listitem>
9479 <para>
9480 <indexterm role="concept">
9481 <primary>DNS</primary>
9482 <secondary>as a lookup type</secondary>
9483 </indexterm>
9484 <indexterm role="concept">
9485 <primary>lookup</primary>
9486 <secondary>DNS</secondary>
9487 </indexterm>
9488 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9489 are given in the supplied query. The resulting data is the contents of the
9490 records. See section <xref linkend="SECTdnsdb"/>.
9491 </para>
9492 </listitem>
9493 <listitem>
9494 <para>
9495 <indexterm role="concept">
9496 <primary>InterBase lookup type</primary>
9497 </indexterm>
9498 <indexterm role="concept">
9499 <primary>lookup</primary>
9500 <secondary>InterBase</secondary>
9501 </indexterm>
9502 <command>ibase</command>: This does a lookup in an InterBase database.
9503 </para>
9504 </listitem>
9505 <listitem>
9506 <para>
9507 <indexterm role="concept">
9508 <primary>LDAP</primary>
9509 <secondary>lookup type</secondary>
9510 </indexterm>
9511 <indexterm role="concept">
9512 <primary>lookup</primary>
9513 <secondary>LDAP</secondary>
9514 </indexterm>
9515 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9516 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9517 that permits values from multiple entries to be returned. A third variant
9518 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9519 any attribute values. See section <xref linkend="SECTldap"/>.
9520 </para>
9521 </listitem>
9522 <listitem>
9523 <para>
9524 <indexterm role="concept">
9525 <primary>MySQL</primary>
9526 <secondary>lookup type</secondary>
9527 </indexterm>
9528 <indexterm role="concept">
9529 <primary>lookup</primary>
9530 <secondary>MySQL</secondary>
9531 </indexterm>
9532 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9533 MySQL database. See section <xref linkend="SECTsql"/>.
9534 </para>
9535 </listitem>
9536 <listitem>
9537 <para>
9538 <indexterm role="concept">
9539 <primary>NIS+ lookup type</primary>
9540 </indexterm>
9541 <indexterm role="concept">
9542 <primary>lookup</primary>
9543 <secondary>NIS+</secondary>
9544 </indexterm>
9545 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9546 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9547 </para>
9548 </listitem>
9549 <listitem>
9550 <para>
9551 <indexterm role="concept">
9552 <primary>Oracle</primary>
9553 <secondary>lookup type</secondary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary>lookup</primary>
9557 <secondary>Oracle</secondary>
9558 </indexterm>
9559 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9560 Oracle database. See section <xref linkend="SECTsql"/>.
9561 </para>
9562 </listitem>
9563 <listitem>
9564 <para>
9565 <indexterm role="concept">
9566 <primary>lookup</primary>
9567 <secondary>passwd</secondary>
9568 </indexterm>
9569 <indexterm role="concept">
9570 <primary>passwd lookup type</primary>
9571 </indexterm>
9572 <indexterm role="concept">
9573 <primary><filename>/etc/passwd</filename></primary>
9574 </indexterm>
9575 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9576 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9577 success, the result string is the same as you would get from an <command>lsearch</command>
9578 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9579 password value. For example:
9580 </para>
9581 <literallayout class="monospaced">
9582 *:42:42:King Rat:/home/kr:/bin/bash
9583 </literallayout>
9584 </listitem>
9585 <listitem>
9586 <para>
9587 <indexterm role="concept">
9588 <primary>PostgreSQL lookup type</primary>
9589 </indexterm>
9590 <indexterm role="concept">
9591 <primary>lookup</primary>
9592 <secondary>PostgreSQL</secondary>
9593 </indexterm>
9594 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9595 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9596 </para>
9597 </listitem>
9598 <listitem>
9599 <para>
9600 <indexterm role="concept">
9601 <primary>sqlite lookup type</primary>
9602 </indexterm>
9603 <indexterm role="concept">
9604 <primary>lookup</primary>
9605 <secondary>sqlite</secondary>
9606 </indexterm>
9607 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9608 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9609 </para>
9610 </listitem>
9611 <listitem>
9612 <para>
9613 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9614 not likely to be useful in normal operation.
9615 </para>
9616 </listitem>
9617 <listitem>
9618 <para>
9619 <indexterm role="concept">
9620 <primary>whoson lookup type</primary>
9621 </indexterm>
9622 <indexterm role="concept">
9623 <primary>lookup</primary>
9624 <secondary>whoson</secondary>
9625 </indexterm>
9626 <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
9627 allows a server to check whether a particular (dynamically allocated) IP
9628 address is currently allocated to a known (trusted) user and, optionally, to
9629 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9630 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9631 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9632 <quote>POP before SMTP</quote> checking using ACL statements such as
9633 </para>
9634 <literallayout class="monospaced">
9635 require condition = \
9636   ${lookup whoson {$sender_host_address}{yes}{no}}
9637 </literallayout>
9638 <para>
9639 The query consists of a single IP address. The value returned is the name of
9640 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9641 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9642 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9643 </para>
9644 </listitem>
9645 </itemizedlist>
9646 </section>
9647 <section id="SECID63">
9648 <title>Temporary errors in lookups</title>
9649 <para>
9650 <indexterm role="concept">
9651 <primary>lookup</primary>
9652 <secondary>temporary error in</secondary>
9653 </indexterm>
9654 Lookup functions can return temporary error codes if the lookup cannot be
9655 completed. For example, an SQL or LDAP database might be unavailable. For this
9656 reason, it is not advisable to use a lookup that might do this for critical
9657 options such as a list of local domains.
9658 </para>
9659 <para>
9660 When a lookup cannot be completed in a router or transport, delivery
9661 of the message (to the relevant address) is deferred, as for any other
9662 temporary error. In other circumstances Exim may assume the lookup has failed,
9663 or may give up altogether.
9664 </para>
9665 </section>
9666 <section id="SECTdefaultvaluelookups">
9667 <title>Default values in single-key lookups</title>
9668 <para>
9669 <indexterm role="concept">
9670 <primary>wildcard lookups</primary>
9671 </indexterm>
9672 <indexterm role="concept">
9673 <primary>lookup</primary>
9674 <secondary>default values</secondary>
9675 </indexterm>
9676 <indexterm role="concept">
9677 <primary>lookup</primary>
9678 <secondary>wildcard</secondary>
9679 </indexterm>
9680 <indexterm role="concept">
9681 <primary>lookup</primary>
9682 <secondary>* added to type</secondary>
9683 </indexterm>
9684 <indexterm role="concept">
9685 <primary>default</primary>
9686 <secondary>in single-key lookups</secondary>
9687 </indexterm>
9688 In this context, a <quote>default value</quote> is a value specified by the administrator
9689 that is to be used if a lookup fails.
9690 </para>
9691 <para>
9692 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9693 lookups, the facilities of the query language must be used. An attempt to
9694 specify a default for a query-style lookup provokes an error.
9695 </para>
9696 <para>
9697 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9698 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9699 provide a default value. See also the section on partial matching below.
9700 </para>
9701 <para>
9702 <indexterm role="concept">
9703 <primary>*@ with single-key lookup</primary>
9704 </indexterm>
9705 <indexterm role="concept">
9706 <primary>lookup</primary>
9707 <secondary>*@ added to type</secondary>
9708 </indexterm>
9709 <indexterm role="concept">
9710 <primary>alias file</primary>
9711 <secondary>per-domain default</secondary>
9712 </indexterm>
9713 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9714 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9715 character, a second lookup is done with everything before the last @ replaced
9716 by *. This makes it possible to provide per-domain defaults in alias files
9717 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9718 take place because there is no @ in the key), <quote>*</quote> is looked up.
9719 For example, a <command>redirect</command> router might contain:
9720 </para>
9721 <literallayout class="monospaced">
9722 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9723 </literallayout>
9724 <para>
9725 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9726 looks up these keys, in this order:
9727 </para>
9728 <literallayout class="monospaced">
9729 jane@eyre.example
9730 *@eyre.example
9731 *
9732 </literallayout>
9733 <para>
9734 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9735 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9736 complete scan is done for each key, and only if it is not found at all does
9737 Exim move on to try the next key.
9738 </para>
9739 </section>
9740 <section id="SECTpartiallookup">
9741 <title>Partial matching in single-key lookups</title>
9742 <para>
9743 <indexterm role="concept">
9744 <primary>partial matching</primary>
9745 </indexterm>
9746 <indexterm role="concept">
9747 <primary>wildcard lookups</primary>
9748 </indexterm>
9749 <indexterm role="concept">
9750 <primary>lookup</primary>
9751 <secondary>partial matching</secondary>
9752 </indexterm>
9753 <indexterm role="concept">
9754 <primary>lookup</primary>
9755 <secondary>wildcard</secondary>
9756 </indexterm>
9757 <indexterm role="concept">
9758 <primary>asterisk</primary>
9759 <secondary>in search type</secondary>
9760 </indexterm>
9761 The normal operation of a single-key lookup is to search the file for an exact
9762 match with the given key. However, in a number of situations where domains are
9763 being looked up, it is useful to be able to do partial matching. In this case,
9764 information in the file that has a key starting with <quote>*.</quote> is matched by any
9765 domain that ends with the components that follow the full stop. For example, if
9766 a key in a DBM file is
9767 </para>
9768 <literallayout class="monospaced">
9769 *.dates.fict.example
9770 </literallayout>
9771 <para>
9772 then when partial matching is enabled this is matched by (amongst others)
9773 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9774 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9775 file.
9776 </para>
9777 <para>
9778 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9779 also not available for any lookup items in address lists (see section
9780 <xref linkend="SECTaddresslist"/>).
9781 </para>
9782 <para>
9783 Partial matching is implemented by doing a series of separate lookups using
9784 keys constructed by modifying the original subject key. This means that it can
9785 be used with any of the single-key lookup types, provided that
9786 partial matching keys
9787 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9788 Keys in the file that do not begin with the prefix are matched only by
9789 unmodified subject keys when partial matching is in use.
9790 </para>
9791 <para>
9792 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9793 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9794 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9795 is added at the start of the subject key, and it is looked up again. If that
9796 fails, further lookups are tried with dot-separated components removed from the
9797 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9798 remains.
9799 </para>
9800 <para>
9801 A minimum number of two non-* components are required. This can be adjusted
9802 by including a number before the hyphen in the search type. For example,
9803 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9804 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9805 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9806 up when the minimum number of non-* components is two:
9807 </para>
9808 <literallayout class="monospaced">
9809 2250.dates.fict.example
9810 *.2250.dates.fict.example
9811 *.dates.fict.example
9812 *.fict.example
9813 </literallayout>
9814 <para>
9815 As soon as one key in the sequence is successfully looked up, the lookup
9816 finishes.
9817 </para>
9818 <para>
9819 <indexterm role="concept">
9820 <primary>lookup</primary>
9821 <secondary>partial matching &ndash; changing prefix</secondary>
9822 </indexterm>
9823 <indexterm role="concept">
9824 <primary>prefix</primary>
9825 <secondary>for partial matching</secondary>
9826 </indexterm>
9827 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9828 changed. The motivation for this feature is to allow Exim to operate with file
9829 formats that are used by other MTAs. A different prefix can be supplied in
9830 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9831 </para>
9832 <literallayout class="monospaced">
9833 domains = partial(.)lsearch;/some/file
9834 </literallayout>
9835 <para>
9836 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9837 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9838 components is unchanged). The prefix may consist of any punctuation characters
9839 other than a closing parenthesis. It may be empty, for example:
9840 </para>
9841 <literallayout class="monospaced">
9842 domains = partial1()cdb;/some/file
9843 </literallayout>
9844 <para>
9845 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9846 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9847 </para>
9848 <para>
9849 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9850 just one non-wild component has failed, and the original key is shortened right
9851 down to the null string) depends on the prefix:
9852 </para>
9853 <itemizedlist>
9854 <listitem>
9855 <para>
9856 If the prefix has zero length, the whole lookup fails.
9857 </para>
9858 </listitem>
9859 <listitem>
9860 <para>
9861 If the prefix has length 1, a lookup for just the prefix is done. For
9862 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9863 </para>
9864 </listitem>
9865 <listitem>
9866 <para>
9867 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9868 remainder is looked up. With the default prefix, therefore, the final lookup is
9869 for <quote>*</quote> on its own.
9870 </para>
9871 </listitem>
9872 <listitem>
9873 <para>
9874 Otherwise, the whole prefix is looked up.
9875 </para>
9876 </listitem>
9877 </itemizedlist>
9878 <para>
9879 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9880 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9881 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9882 specified, adding <quote>*</quote> to the search type has no effect with the default
9883 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9884 lookups. However, there might be a use for lookup types such as
9885 <quote>partial0(.)lsearch*</quote>.
9886 </para>
9887 <para>
9888 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9889 in domain lists and the like. Partial matching works only in terms of
9890 dot-separated components; a key such as <literal>*fict.example</literal>
9891 in a database file is useless, because the asterisk in a partial matching
9892 subject key is always followed by a dot.
9893 </para>
9894 </section>
9895 <section id="SECID64">
9896 <title>Lookup caching</title>
9897 <para>
9898 <indexterm role="concept">
9899 <primary>lookup</primary>
9900 <secondary>caching</secondary>
9901 </indexterm>
9902 <indexterm role="concept">
9903 <primary>caching</primary>
9904 <secondary>lookup data</secondary>
9905 </indexterm>
9906 Exim caches all lookup results in order to avoid needless repetition of
9907 lookups. However, because (apart from the daemon) Exim operates as a collection
9908 of independent, short-lived processes, this caching applies only within a
9909 single Exim process. There is no inter-process lookup caching facility.
9910 </para>
9911 <para>
9912 For single-key lookups, Exim keeps the relevant files open in case there is
9913 another lookup that needs them. In some types of configuration this can lead to
9914 many files being kept open for messages with many recipients. To avoid hitting
9915 the operating system limit on the number of simultaneously open files, Exim
9916 closes the least recently used file when it needs to open more files than its
9917 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9918 </para>
9919 <para>
9920 The single-key lookup files are closed and the lookup caches are flushed at
9921 strategic points during delivery &ndash; for example, after all routing is
9922 complete.
9923 </para>
9924 </section>
9925 <section id="SECID65">
9926 <title>Quoting lookup data</title>
9927 <para>
9928 <indexterm role="concept">
9929 <primary>lookup</primary>
9930 <secondary>quoting</secondary>
9931 </indexterm>
9932 <indexterm role="concept">
9933 <primary>quoting</primary>
9934 <secondary>in lookups</secondary>
9935 </indexterm>
9936 When data from an incoming message is included in a query-style lookup, there
9937 is the possibility of special characters in the data messing up the syntax of
9938 the query. For example, a NIS+ query that contains
9939 </para>
9940 <literallayout class="monospaced">
9941 [name=$local_part]
9942 </literallayout>
9943 <para>
9944 will be broken if the local part happens to contain a closing square bracket.
9945 For NIS+, data can be enclosed in double quotes like this:
9946 </para>
9947 <literallayout class="monospaced">
9948 [name="$local_part"]
9949 </literallayout>
9950 <para>
9951 but this still leaves the problem of a double quote in the data. The rule for
9952 NIS+ is that double quotes must be doubled. Other lookup types have different
9953 rules, and to cope with the differing requirements, an expansion operator
9954 of the following form is provided:
9955 </para>
9956 <literallayout class="monospaced">
9957 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9958 </literallayout>
9959 <para>
9960 For example, the safest way to write the NIS+ query is
9961 </para>
9962 <literallayout class="monospaced">
9963 [name="${quote_nisplus:$local_part}"]
9964 </literallayout>
9965 <para>
9966 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9967 operator can be used for all lookup types, but has no effect for single-key
9968 lookups, since no quoting is ever needed in their key strings.
9969 </para>
9970 </section>
9971 <section id="SECTdnsdb">
9972 <title>More about dnsdb</title>
9973 <para>
9974 <indexterm role="concept">
9975 <primary>dnsdb lookup</primary>
9976 </indexterm>
9977 <indexterm role="concept">
9978 <primary>lookup</primary>
9979 <secondary>dnsdb</secondary>
9980 </indexterm>
9981 <indexterm role="concept">
9982 <primary>DNS</primary>
9983 <secondary>as a lookup type</secondary>
9984 </indexterm>
9985 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9986 of a record type and a domain name, separated by an equals sign. For example,
9987 an expansion string could contain:
9988 </para>
9989 <literallayout class="monospaced">
9990 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9991 </literallayout>
9992 <para>
9993 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9994 is used on its own as the result. If the lookup does not succeed, the
9995 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
9996 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9997 </para>
9998 <para>
9999 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10000 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10001 configured). If no type is given, TXT is assumed. When the type is PTR,
10002 the data can be an IP address, written as normal; inversion and the addition of
10003 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10004 </para>
10005 <literallayout class="monospaced">
10006 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10007 </literallayout>
10008 <para>
10009 If the data for a PTR record is not a syntactically valid IP address, it is not
10010 altered and nothing is added.
10011 </para>
10012 <para>
10013 <indexterm role="concept">
10014 <primary>MX record</primary>
10015 <secondary>in <command>dnsdb</command> lookup</secondary>
10016 </indexterm>
10017 <indexterm role="concept">
10018 <primary>SRV record</primary>
10019 <secondary>in <command>dnsdb</command> lookup</secondary>
10020 </indexterm>
10021 For an MX lookup, both the preference value and the host name are returned for
10022 each record, separated by a space. For an SRV lookup, the priority, weight,
10023 port, and host name are returned for each record, separated by spaces.
10024 </para>
10025 <para>
10026 For any record type, if multiple records are found (or, for A6 lookups, if a
10027 single record leads to multiple addresses), the data is returned as a
10028 concatenation, with newline as the default separator. The order, of course,
10029 depends on the DNS resolver. You can specify a different separator character
10030 between multiple records by putting a right angle-bracket followed immediately
10031 by the new separator at the start of the query. For example:
10032 </para>
10033 <literallayout class="monospaced">
10034 ${lookup dnsdb{&gt;: a=host1.example}}
10035 </literallayout>
10036 <para>
10037 It is permitted to specify a space as the separator character. Further
10038 white space is ignored.
10039 </para>
10040 </section>
10041 <section id="SECID66">
10042 <title>Pseudo dnsdb record types</title>
10043 <para>
10044 <indexterm role="concept">
10045 <primary>MX record</primary>
10046 <secondary>in <command>dnsdb</command> lookup</secondary>
10047 </indexterm>
10048 By default, both the preference value and the host name are returned for
10049 each MX record, separated by a space. If you want only host names, you can use
10050 the pseudo-type MXH:
10051 </para>
10052 <literallayout class="monospaced">
10053 ${lookup dnsdb{mxh=a.b.example}}
10054 </literallayout>
10055 <para>
10056 In this case, the preference values are omitted, and just the host names are
10057 returned.
10058 </para>
10059 <para>
10060 <indexterm role="concept">
10061 <primary>name server for enclosing domain</primary>
10062 </indexterm>
10063 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10064 records on the given domain, but if none are found, it removes the first
10065 component of the domain name, and tries again. This process continues until NS
10066 records are found or there are no more components left (or there is a DNS
10067 error). In other words, it may return the name servers for a top-level domain,
10068 but it never returns the root name servers. If there are no NS records for the
10069 top-level domain, the lookup fails. Consider these examples:
10070 </para>
10071 <literallayout class="monospaced">
10072 ${lookup dnsdb{zns=xxx.quercite.com}}
10073 ${lookup dnsdb{zns=xxx.edu}}
10074 </literallayout>
10075 <para>
10076 Assuming that in each case there are no NS records for the full domain name,
10077 the first returns the name servers for <option>quercite.com</option>, and the second returns
10078 the name servers for <option>edu</option>.
10079 </para>
10080 <para>
10081 You should be careful about how you use this lookup because, unless the
10082 top-level domain does not exist, the lookup always returns some host names. The
10083 sort of use to which this might be put is for seeing if the name servers for a
10084 given domain are on a blacklist. You can probably assume that the name servers
10085 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10086 such a list.
10087 </para>
10088 <para>
10089 <indexterm role="concept">
10090 <primary>CSA</primary>
10091 <secondary>in <command>dnsdb</command> lookup</secondary>
10092 </indexterm>
10093 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10094 records according to the CSA rules, which are described in section
10095 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10096 not sufficient because of the extra parent domain search behaviour of CSA. The
10097 result of a successful lookup such as:
10098 </para>
10099 <literallayout class="monospaced">
10100 ${lookup dnsdb {csa=$sender_helo_name}}
10101 </literallayout>
10102 <para>
10103 has two space-separated fields: an authorization code and a target host name.
10104 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10105 authorization required but absent, or <quote>?</quote> for unknown.
10106 </para>
10107 </section>
10108 <section id="SECID67">
10109 <title>Multiple dnsdb lookups</title>
10110 <para>
10111 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10112 However, you can specify a list of domains or IP addresses in a single
10113 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10114 the default separator, but with the ability to change this. For example:
10115 </para>
10116 <literallayout class="monospaced">
10117 ${lookup dnsdb{one.domain.com:two.domain.com}}
10118 ${lookup dnsdb{a=one.host.com:two.host.com}}
10119 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10120 </literallayout>
10121 <para>
10122 In order to retain backwards compatibility, there is one special case: if
10123 the lookup type is PTR and no change of separator is specified, Exim looks
10124 to see if the rest of the string is precisely one IPv6 address. In this
10125 case, it does not treat it as a list.
10126 </para>
10127 <para>
10128 The data from each lookup is concatenated, with newline separators by default,
10129 in the same way that multiple DNS records for a single item are handled. A
10130 different separator can be specified, as described above.
10131 </para>
10132 <para>
10133 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10134 temporary DNS error for any of them, the behaviour is controlled by
10135 an optional keyword followed by a comma that may appear before the record
10136 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10137 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10138 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10139 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10140 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10141 error causes the whole lookup to defer only if none of the other lookups
10142 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10143 </para>
10144 <literallayout class="monospaced">
10145 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10146 ${lookup dnsdb{a=one.host.com:two.host.com}}
10147 </literallayout>
10148 <para>
10149 Thus, in the default case, as long as at least one of the DNS lookups
10150 yields some data, the lookup succeeds.
10151 </para>
10152 </section>
10153 <section id="SECTldap">
10154 <title>More about LDAP</title>
10155 <para>
10156 <indexterm role="concept">
10157 <primary>LDAP</primary>
10158 <secondary>lookup, more about</secondary>
10159 </indexterm>
10160 <indexterm role="concept">
10161 <primary>lookup</primary>
10162 <secondary>LDAP</secondary>
10163 </indexterm>
10164 <indexterm role="concept">
10165 <primary>Solaris</primary>
10166 <secondary>LDAP</secondary>
10167 </indexterm>
10168 The original LDAP implementation came from the University of Michigan; this has
10169 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10170 implementation comes from Netscape, and Solaris 7 and subsequent releases
10171 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10172 the lookup function level, their error handling is different. For this reason
10173 it is necessary to set a compile-time variable when building Exim with LDAP, to
10174 indicate which LDAP library is in use. One of the following should appear in
10175 your <filename>Local/Makefile</filename>:
10176 </para>
10177 <literallayout class="monospaced">
10178 LDAP_LIB_TYPE=UMICHIGAN
10179 LDAP_LIB_TYPE=OPENLDAP1
10180 LDAP_LIB_TYPE=OPENLDAP2
10181 LDAP_LIB_TYPE=NETSCAPE
10182 LDAP_LIB_TYPE=SOLARIS
10183 </literallayout>
10184 <para>
10185 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10186 same interface as the University of Michigan version.
10187 </para>
10188 <para>
10189 There are three LDAP lookup types in Exim. These behave slightly differently in
10190 the way they handle the results of a query:
10191 </para>
10192 <itemizedlist>
10193 <listitem>
10194 <para>
10195 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10196 gives an error.
10197 </para>
10198 </listitem>
10199 <listitem>
10200 <para>
10201 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10202 Distinguished Name that is returned rather than any attribute values.
10203 </para>
10204 </listitem>
10205 <listitem>
10206 <para>
10207 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10208 from all of them are returned.
10209 </para>
10210 </listitem>
10211 </itemizedlist>
10212 <para>
10213 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10214 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10215 the data returned by a successful lookup is described in the next section.
10216 First we explain how LDAP queries are coded.
10217 </para>
10218 </section>
10219 <section id="SECTforldaque">
10220 <title>Format of LDAP queries</title>
10221 <para>
10222 <indexterm role="concept">
10223 <primary>LDAP</primary>
10224 <secondary>query format</secondary>
10225 </indexterm>
10226 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10227 the configuration of a <command>redirect</command> router one might have this setting:
10228 </para>
10229 <literallayout class="monospaced">
10230 data = ${lookup ldap \
10231   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10232   c=UK?mailbox?base?}}
10233 </literallayout>
10234 <para>
10235 <indexterm role="concept">
10236 <primary>LDAP</primary>
10237 <secondary>with TLS</secondary>
10238 </indexterm>
10239 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10240 secure (encrypted) LDAP connections. The second of these ensures that an
10241 encrypted TLS connection is used.
10242 </para>
10243 </section>
10244 <section id="SECID68">
10245 <title>LDAP quoting</title>
10246 <para>
10247 <indexterm role="concept">
10248 <primary>LDAP</primary>
10249 <secondary>quoting</secondary>
10250 </indexterm>
10251 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10252 and the second because the LDAP query is represented as a URL. Furthermore,
10253 within an LDAP query, two different kinds of quoting are required. For this
10254 reason, there are two different LDAP-specific quoting operators.
10255 </para>
10256 <para>
10257 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10258 filter specifications. Conceptually, it first does the following conversions on
10259 the string:
10260 </para>
10261 <literallayout class="monospaced">
10262 *   =&gt;   \2A
10263 (   =&gt;   \28
10264 )   =&gt;   \29
10265 \   =&gt;   \5C
10266 </literallayout>
10267 <para>
10268 in accordance with RFC 2254. The resulting string is then quoted according
10269 to the rules for URLs, that is, all non-alphanumeric characters except
10270 </para>
10271 <literallayout class="monospaced">
10272 ! $ ' - . _ ( ) * +
10273 </literallayout>
10274 <para>
10275 are converted to their hex values, preceded by a percent sign. For example:
10276 </para>
10277 <literallayout class="monospaced">
10278 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10279 </literallayout>
10280 <para>
10281 yields
10282 </para>
10283 <literallayout class="monospaced">
10284 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10285 </literallayout>
10286 <para>
10287 Removing the URL quoting, this is (with a leading and a trailing space):
10288 </para>
10289 <literallayout class="monospaced">
10290 a\28bc\29\2A, a&lt;yz&gt;;
10291 </literallayout>
10292 <para>
10293 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10294 base DN specifications in queries. Conceptually, it first converts the string
10295 by inserting a backslash in front of any of the following characters:
10296 </para>
10297 <literallayout class="monospaced">
10298 , + " \ &lt; &gt; ;
10299 </literallayout>
10300 <para>
10301 It also inserts a backslash before any leading spaces or # characters, and
10302 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10303 is then quoted according to the rules for URLs. For example:
10304 </para>
10305 <literallayout class="monospaced">
10306 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10307 </literallayout>
10308 <para>
10309 yields
10310 </para>
10311 <literallayout class="monospaced">
10312 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10313 </literallayout>
10314 <para>
10315 Removing the URL quoting, this is (with a trailing space):
10316 </para>
10317 <literallayout class="monospaced">
10318 \ a(bc)*\, a\&lt;yz\&gt;\;\
10319 </literallayout>
10320 <para>
10321 There are some further comments about quoting in the section on LDAP
10322 authentication below.
10323 </para>
10324 </section>
10325 <section id="SECID69">
10326 <title>LDAP connections</title>
10327 <para>
10328 <indexterm role="concept">
10329 <primary>LDAP</primary>
10330 <secondary>connections</secondary>
10331 </indexterm>
10332 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10333 is in use, via a Unix domain socket. The example given above does not specify
10334 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10335 by starting it with
10336 </para>
10337 <literallayout class="monospaced">
10338 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10339 </literallayout>
10340 <para>
10341 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10342 used. When no server is specified in a query, a list of default servers is
10343 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10344 colon-separated list of servers which are tried in turn until one successfully
10345 handles a query, or there is a serious error. Successful handling either
10346 returns the requested data, or indicates that it does not exist. Serious errors
10347 are syntactical, or multiple values when only a single value is expected.
10348 Errors which cause the next server to be tried are connection failures, bind
10349 failures, and timeouts.
10350 </para>
10351 <para>
10352 For each server name in the list, a port number can be given. The standard way
10353 of specifying a host and port is to use a colon separator (RFC 1738). Because
10354 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10355 doubled. For example
10356 </para>
10357 <literallayout class="monospaced">
10358 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10359 </literallayout>
10360 <para>
10361 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10362 to the LDAP library with no server name, and the library&#x2019;s default (normally
10363 the local host) is used.
10364 </para>
10365 <para>
10366 If you are using the OpenLDAP library, you can connect to an LDAP server using
10367 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10368 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10369 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10370 not available.
10371 </para>
10372 <para>
10373 For this type of connection, instead of a host name for the server, a pathname
10374 for the socket is required, and the port number is not relevant. The pathname
10375 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10376 the query. In the former case, you can have settings such as
10377 </para>
10378 <literallayout class="monospaced">
10379 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10380 </literallayout>
10381 <para>
10382 When the pathname is given in the query, you have to escape the slashes as
10383 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10384 </para>
10385 <literallayout class="monospaced">
10386 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10387 </literallayout>
10388 <para>
10389 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10390 a pathname, it uses the Unix domain socket code, even if the query actually
10391 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10392 socket connection. This behaviour means that you can use a setting of
10393 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10394 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10395 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10396 backup host.
10397 </para>
10398 <para>
10399 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10400 specified, an error is diagnosed. However, if there are more items in
10401 <option>ldap_default_servers</option>, they are tried. In other words:
10402 </para>
10403 <itemizedlist>
10404 <listitem>
10405 <para>
10406 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10407 interface.
10408 </para>
10409 </listitem>
10410 <listitem>
10411 <para>
10412 Using <literal>ldapi</literal> with a host name causes an error.
10413 </para>
10414 </listitem>
10415 </itemizedlist>
10416 <para>
10417 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10418 <option>ldap_default_servers</option>, does whatever the library does by default.
10419 </para>
10420 </section>
10421 <section id="SECID70">
10422 <title>LDAP authentication and control information</title>
10423 <para>
10424 <indexterm role="concept">
10425 <primary>LDAP</primary>
10426 <secondary>authentication</secondary>
10427 </indexterm>
10428 The LDAP URL syntax provides no way of passing authentication and other control
10429 information to the server. To make this possible, the URL in an LDAP query may
10430 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10431 spaces. If a value contains spaces it must be enclosed in double quotes, and
10432 when double quotes are used, backslash is interpreted in the usual way inside
10433 them. The following names are recognized:
10434 </para>
10435 <literallayout>
10436 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10437 <literal>NETTIME    </literal>  set a timeout for a network operation
10438 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10439 <literal>PASS       </literal>  set the password, likewise
10440 <literal>REFERRALS  </literal>  set the referrals parameter
10441 <literal>SIZE       </literal>  set the limit for the number of entries returned
10442 <literal>TIME       </literal>  set the maximum waiting time for a query
10443 </literallayout>
10444 <para>
10445 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10446 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10447 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10448 library from trying to follow referrals issued by the LDAP server.
10449 </para>
10450 <para>
10451 The name CONNECT is an obsolete name for NETTIME, retained for
10452 backwards compatibility. This timeout (specified as a number of seconds) is
10453 enforced from the client end for operations that can be carried out over a
10454 network. Specifically, it applies to network connections and calls to the
10455 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10456 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10457 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10458 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10459 Netscape SDK; for OpenLDAP no action is taken.
10460 </para>
10461 <para>
10462 The TIME parameter (also a number of seconds) is passed to the server to
10463 set a server-side limit on the time taken to complete a search.
10464 </para>
10465 <para>
10466 Here is an example of an LDAP query in an Exim lookup that uses some of these
10467 values. This is a single line, folded to fit on the page:
10468 </para>
10469 <literallayout class="monospaced">
10470 ${lookup ldap
10471   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10472   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10473   {$value}fail}
10474 </literallayout>
10475 <para>
10476 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10477 any of the auxiliary data. Exim configuration settings that include lookups
10478 which contain password information should be preceded by <quote>hide</quote> to prevent
10479 non-admin users from using the <option>-bP</option> option to see their values.
10480 </para>
10481 <para>
10482 The auxiliary data items may be given in any order. The default is no
10483 connection timeout (the system timeout is used), no user or password, no limit
10484 on the number of entries returned, and no time limit on queries.
10485 </para>
10486 <para>
10487 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10488 removes any URL quoting that it may contain before passing it LDAP. Apparently
10489 some libraries do this for themselves, but some do not. Removing the URL
10490 quoting has two advantages:
10491 </para>
10492 <itemizedlist>
10493 <listitem>
10494 <para>
10495 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10496 DNs as with DNs inside actual queries.
10497 </para>
10498 </listitem>
10499 <listitem>
10500 <para>
10501 It permits spaces inside USER= DNs.
10502 </para>
10503 </listitem>
10504 </itemizedlist>
10505 <para>
10506 For example, a setting such as
10507 </para>
10508 <literallayout class="monospaced">
10509 USER=cn=${quote_ldap_dn:$1}
10510 </literallayout>
10511 <para>
10512 should work even if <varname>$1</varname> contains spaces.
10513 </para>
10514 <para>
10515 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10516 expansion operator, rather than the LDAP quote operators. The only reason this
10517 field needs quoting is to ensure that it conforms to the Exim syntax, which
10518 does not allow unquoted spaces. For example:
10519 </para>
10520 <literallayout class="monospaced">
10521 PASS=${quote:$3}
10522 </literallayout>
10523 <para>
10524 The LDAP authentication mechanism can be used to check passwords as part of
10525 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10526 <xref linkend="CHAPexpand"/>.
10527 </para>
10528 </section>
10529 <section id="SECID71">
10530 <title>Format of data returned by LDAP</title>
10531 <para>
10532 <indexterm role="concept">
10533 <primary>LDAP</primary>
10534 <secondary>returned data formats</secondary>
10535 </indexterm>
10536 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10537 as a sequence of values, for example
10538 </para>
10539 <literallayout class="monospaced">
10540 cn=manager, o=University of Cambridge, c=UK
10541 </literallayout>
10542 <para>
10543 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10544 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10545 the result between the data from different entries. It is possible for multiple
10546 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10547 you know that whatever values are returned all came from a single entry in the
10548 directory.
10549 </para>
10550 <para>
10551 In the common case where you specify a single attribute in your LDAP query, the
10552 result is not quoted, and does not contain the attribute name. If the attribute
10553 has multiple values, they are separated by commas.
10554 </para>
10555 <para>
10556 If you specify multiple attributes, the result contains space-separated, quoted
10557 strings, each preceded by the attribute name and an equals sign. Within the
10558 quotes, the quote character, backslash, and newline are escaped with
10559 backslashes, and commas are used to separate multiple values for the attribute.
10560 Apart from the escaping, the string within quotes takes the same form as the
10561 output when a single attribute is requested. Specifying no attributes is the
10562 same as specifying all of an entry&#x2019;s attributes.
10563 </para>
10564 <para>
10565 Here are some examples of the output format. The first line of each pair is an
10566 LDAP query, and the second is the data that is returned. The attribute called
10567 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10568 </para>
10569 <literallayout class="monospaced">
10570 ldap:///o=base?attr1?sub?(uid=fred)
10571 value1.1, value1.2
10572
10573 ldap:///o=base?attr2?sub?(uid=fred)
10574 value two
10575
10576 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10577 attr1="value1.1, value1.2" attr2="value two"
10578
10579 ldap:///o=base??sub?(uid=fred)
10580 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10581 </literallayout>
10582 <para>
10583 The <option>extract</option> operator in string expansions can be used to pick out
10584 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10585 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10586 results of LDAP lookups.
10587 </para>
10588 </section>
10589 <section id="SECTnisplus">
10590 <title>More about NIS+</title>
10591 <para>
10592 <indexterm role="concept">
10593 <primary>NIS+ lookup type</primary>
10594 </indexterm>
10595 <indexterm role="concept">
10596 <primary>lookup</primary>
10597 <secondary>NIS+</secondary>
10598 </indexterm>
10599 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10600 and field name. If this is given, the result of a successful query is the
10601 contents of the named field; otherwise the result consists of a concatenation
10602 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10603 values containing spaces are quoted. For example, the query
10604 </para>
10605 <literallayout class="monospaced">
10606 [name=mg1456],passwd.org_dir
10607 </literallayout>
10608 <para>
10609 might return the string
10610 </para>
10611 <literallayout class="monospaced">
10612 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10613 home=/home/mg1456 shell=/bin/bash shadow=""
10614 </literallayout>
10615 <para>
10616 (split over two lines here to fit on the page), whereas
10617 </para>
10618 <literallayout class="monospaced">
10619 [name=mg1456],passwd.org_dir:gcos
10620 </literallayout>
10621 <para>
10622 would just return
10623 </para>
10624 <literallayout class="monospaced">
10625 Martin Guerre
10626 </literallayout>
10627 <para>
10628 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10629 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10630 operator is to double any quote characters within the text.
10631 </para>
10632 </section>
10633 <section id="SECTsql">
10634 <title>SQL lookups</title>
10635 <para>
10636 <indexterm role="concept">
10637 <primary>SQL lookup types</primary>
10638 </indexterm>
10639 <indexterm role="concept">
10640 <primary>MySQL</primary>
10641 <secondary>lookup type</secondary>
10642 </indexterm>
10643 <indexterm role="concept">
10644 <primary>PostgreSQL lookup type</primary>
10645 </indexterm>
10646 <indexterm role="concept">
10647 <primary>lookup</primary>
10648 <secondary>MySQL</secondary>
10649 </indexterm>
10650 <indexterm role="concept">
10651 <primary>lookup</primary>
10652 <secondary>PostgreSQL</secondary>
10653 </indexterm>
10654 <indexterm role="concept">
10655 <primary>Oracle</primary>
10656 <secondary>lookup type</secondary>
10657 </indexterm>
10658 <indexterm role="concept">
10659 <primary>lookup</primary>
10660 <secondary>Oracle</secondary>
10661 </indexterm>
10662 <indexterm role="concept">
10663 <primary>InterBase lookup type</primary>
10664 </indexterm>
10665 <indexterm role="concept">
10666 <primary>lookup</primary>
10667 <secondary>InterBase</secondary>
10668 </indexterm>
10669 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10670 databases. Queries for these databases contain SQL statements, so an example
10671 might be
10672 </para>
10673 <literallayout class="monospaced">
10674 ${lookup mysql{select mailbox from users where id='userx'}\
10675   {$value}fail}
10676 </literallayout>
10677 <para>
10678 If the result of the query contains more than one field, the data for each
10679 field in the row is returned, preceded by its name, so the result of
10680 </para>
10681 <literallayout class="monospaced">
10682 ${lookup pgsql{select home,name from users where id='userx'}\
10683   {$value}}
10684 </literallayout>
10685 <para>
10686 might be
10687 </para>
10688 <literallayout class="monospaced">
10689 home=/home/userx name="Mister X"
10690 </literallayout>
10691 <para>
10692 Empty values and values containing spaces are double quoted, with embedded
10693 quotes escaped by a backslash. If the result of the query contains just one
10694 field, the value is passed back verbatim, without a field name, for example:
10695 </para>
10696 <literallayout class="monospaced">
10697 Mister X
10698 </literallayout>
10699 <para>
10700 If the result of the query yields more than one row, it is all concatenated,
10701 with a newline between the data for each row.
10702 </para>
10703 </section>
10704 <section id="SECID72">
10705 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10706 <para>
10707 <indexterm role="concept">
10708 <primary>MySQL</primary>
10709 <secondary>lookup type</secondary>
10710 </indexterm>
10711 <indexterm role="concept">
10712 <primary>PostgreSQL lookup type</primary>
10713 </indexterm>
10714 <indexterm role="concept">
10715 <primary>lookup</primary>
10716 <secondary>MySQL</secondary>
10717 </indexterm>
10718 <indexterm role="concept">
10719 <primary>lookup</primary>
10720 <secondary>PostgreSQL</secondary>
10721 </indexterm>
10722 <indexterm role="concept">
10723 <primary>Oracle</primary>
10724 <secondary>lookup type</secondary>
10725 </indexterm>
10726 <indexterm role="concept">
10727 <primary>lookup</primary>
10728 <secondary>Oracle</secondary>
10729 </indexterm>
10730 <indexterm role="concept">
10731 <primary>InterBase lookup type</primary>
10732 </indexterm>
10733 <indexterm role="concept">
10734 <primary>lookup</primary>
10735 <secondary>InterBase</secondary>
10736 </indexterm>
10737 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10738 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10739 option (as appropriate) must be set to a colon-separated list of server
10740 information.
10741 (For MySQL and PostgreSQL only, the global option need not be set if all
10742 queries contain their own server information &ndash; see section
10743 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10744 items: host name, database name, user name, and password. In the case of
10745 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10746 name field is not used and should be empty. For example:
10747 </para>
10748 <literallayout class="monospaced">
10749 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10750 </literallayout>
10751 <para>
10752 Because password data is sensitive, you should always precede the setting with
10753 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10754 option. Here is an example where two MySQL servers are listed:
10755 </para>
10756 <literallayout class="monospaced">
10757 hide mysql_servers = localhost/users/root/secret:\
10758                      otherhost/users/root/othersecret
10759 </literallayout>
10760 <para>
10761 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10762 because this is a colon-separated list, the colon has to be doubled. For each
10763 query, these parameter groups are tried in order until a connection is made and
10764 a query is successfully processed. The result of a query may be that no data is
10765 found, but that is still a successful query. In other words, the list of
10766 servers provides a backup facility, not a list of different places to look.
10767 </para>
10768 <para>
10769 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10770 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10771 respectively, and the characters single-quote, double-quote, and backslash
10772 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10773 addition, escapes the percent and underscore characters. This cannot be done
10774 for MySQL because these escapes are not recognized in contexts where these
10775 characters are not special.
10776 </para>
10777 </section>
10778 <section id="SECTspeserque">
10779 <title>Specifying the server in the query</title>
10780 <para>
10781 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10782 it is possible to specify a list of servers with an individual query. This is
10783 done by starting the query with
10784 </para>
10785 <literallayout>
10786 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10787 </literallayout>
10788 <para>
10789 Each item in the list may take one of two forms:
10790 </para>
10791 <orderedlist numeration="arabic">
10792 <listitem>
10793 <para>
10794 If it contains no slashes it is assumed to be just a host name. The appropriate
10795 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10796 of the same name, and the remaining parameters (database, user, password) are
10797 taken from there.
10798 </para>
10799 </listitem>
10800 <listitem>
10801 <para>
10802 If it contains any slashes, it is taken as a complete parameter set.
10803 </para>
10804 </listitem>
10805 </orderedlist>
10806 <para>
10807 The list of servers is used in exactly the same way as the global list.
10808 Once a connection to a server has happened and a query has been
10809 successfully executed, processing of the lookup ceases.
10810 </para>
10811 <para>
10812 This feature is intended for use in master/slave situations where updates
10813 are occurring and you want to update the master rather than a slave. If the
10814 master is in the list as a backup for reading, you might have a global setting
10815 like this:
10816 </para>
10817 <literallayout class="monospaced">
10818 mysql_servers = slave1/db/name/pw:\
10819                 slave2/db/name/pw:\
10820                 master/db/name/pw
10821 </literallayout>
10822 <para>
10823 In an updating lookup, you could then write:
10824 </para>
10825 <literallayout class="monospaced">
10826 ${lookup mysql{servers=master; UPDATE ...} }
10827 </literallayout>
10828 <para>
10829 That query would then be sent only to the master server. If, on the other hand,
10830 the master is not to be used for reading, and so is not present in the global
10831 option, you can still update it by a query of this form:
10832 </para>
10833 <literallayout class="monospaced">
10834 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10835 </literallayout>
10836 </section>
10837 <section id="SECID73">
10838 <title>Special MySQL features</title>
10839 <para>
10840 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10841 causes a connection to the server on the local host by means of a Unix domain
10842 socket. An alternate socket can be specified in parentheses. The full syntax of
10843 each item in <option>mysql_servers</option> is:
10844 </para>
10845 <literallayout>
10846 &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;
10847 </literallayout>
10848 <para>
10849 Any of the three sub-parts of the first field can be omitted. For normal use on
10850 the local host it can be left blank or set to just <quote>localhost</quote>.
10851 </para>
10852 <para>
10853 No database need be supplied &ndash; but if it is absent here, it must be given in
10854 the queries.
10855 </para>
10856 <para>
10857 If a MySQL query is issued that does not request any data (an insert, update,
10858 or delete command), the result of the lookup is the number of rows affected.
10859 </para>
10860 <para>
10861 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10862 anything (for example, setting a field to the value it already has), the result
10863 is zero because no rows are affected.
10864 </para>
10865 </section>
10866 <section id="SECID74">
10867 <title>Special PostgreSQL features</title>
10868 <para>
10869 PostgreSQL lookups can also use Unix domain socket connections to the database.
10870 This is usually faster and costs less CPU time than a TCP/IP connection.
10871 However it can be used only if the mail server runs on the same machine as the
10872 database server. A configuration line for PostgreSQL via Unix domain sockets
10873 looks like this:
10874 </para>
10875 <literallayout class="monospaced">
10876 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10877 </literallayout>
10878 <para>
10879 In other words, instead of supplying a host name, a path to the socket is
10880 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10881 visually confused with the delimiters for the other server parameters.
10882 </para>
10883 <para>
10884 If a PostgreSQL query is issued that does not request any data (an insert,
10885 update, or delete command), the result of the lookup is the number of rows
10886 affected.
10887 </para>
10888 </section>
10889 <section id="SECTsqlite">
10890 <title>More about SQLite</title>
10891 <para>
10892 <indexterm role="concept">
10893 <primary>lookup</primary>
10894 <secondary>SQLite</secondary>
10895 </indexterm>
10896 <indexterm role="concept">
10897 <primary>sqlite lookup type</primary>
10898 </indexterm>
10899 SQLite is different to the other SQL lookups because a file name is required in
10900 addition to the SQL query. An SQLite database is a single file, and there is no
10901 daemon as in the other SQL databases. The interface to Exim requires the name
10902 of the file, as an absolute path, to be given at the start of the query. It is
10903 separated from the query by white space. This means that the path name cannot
10904 contain white space. Here is a lookup expansion example:
10905 </para>
10906 <literallayout class="monospaced">
10907 ${lookup sqlite {/some/thing/sqlitedb \
10908   select name from aliases where id='userx';}}
10909 </literallayout>
10910 <para>
10911 In a list, the syntax is similar. For example:
10912 </para>
10913 <literallayout class="monospaced">
10914 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10915    select * from relays where ip='$sender_host_address';
10916 </literallayout>
10917 <para>
10918 The only character affected by the <option>quote_sqlite</option> operator is a single
10919 quote, which it doubles.
10920 </para>
10921 <para>
10922 The SQLite library handles multiple simultaneous accesses to the database
10923 internally. Multiple readers are permitted, but only one process can
10924 update at once. Attempts to access the database while it is being updated
10925 are rejected after a timeout period, during which the SQLite library
10926 waits for the lock to be released. In Exim, the default timeout is set
10927 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10928 option.
10929 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10930 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10931 </para>
10932 </section>
10933 </chapter>
10934
10935 <chapter id="CHAPdomhosaddlists">
10936 <title>Domain, host, address, and local part lists</title>
10937 <titleabbrev>Domain, host, and address lists</titleabbrev>
10938 <para>
10939 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10940 <primary>lists of domains; hosts; etc.</primary>
10941 </indexterm>
10942 A number of Exim configuration options contain lists of domains, hosts,
10943 email addresses, or local parts. For example, the <option>hold_domains</option> option
10944 contains a list of domains whose delivery is currently suspended. These lists
10945 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10946 arguments to expansion conditions such as <option>match_domain</option>.
10947 </para>
10948 <para>
10949 Each item in one of these lists is a pattern to be matched against a domain,
10950 host, email address, or local part, respectively. In the sections below, the
10951 different types of pattern for each case are described, but first we cover some
10952 general facilities that apply to all four kinds of list.
10953 </para>
10954 <section id="SECID75">
10955 <title>Expansion of lists</title>
10956 <para>
10957 <indexterm role="concept">
10958 <primary>expansion</primary>
10959 <secondary>of lists</secondary>
10960 </indexterm>
10961 Each list is expanded as a single string before it is used. The result of
10962 expansion must be a list, possibly containing empty items, which is split up
10963 into separate items for matching. By default, colon is the separator character,
10964 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10965 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10966 discusses the way to specify empty list items.
10967 </para>
10968 <para>
10969 If the string expansion is forced to fail, Exim behaves as if the item it is
10970 testing (domain, host, address, or local part) is not in the list. Other
10971 expansion failures cause temporary errors.
10972 </para>
10973 <para>
10974 If an item in a list is a regular expression, backslashes, dollars and possibly
10975 other special characters in the expression must be protected against
10976 misinterpretation by the string expander. The easiest way to do this is to use
10977 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10978 expression should not be expanded. For example, in an ACL you might have:
10979 </para>
10980 <literallayout class="monospaced">
10981 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10982                ${lookup{$domain}lsearch{/badsenders/bydomain}}
10983 </literallayout>
10984 <para>
10985 The first item is a regular expression that is protected from expansion by
10986 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10987 senders based on the receiving domain.
10988 </para>
10989 </section>
10990 <section id="SECID76">
10991 <title>Negated items in lists</title>
10992 <para>
10993 <indexterm role="concept">
10994 <primary>list</primary>
10995 <secondary>negation</secondary>
10996 </indexterm>
10997 <indexterm role="concept">
10998 <primary>negation</primary>
10999 <secondary>in lists</secondary>
11000 </indexterm>
11001 Items in a list may be positive or negative. Negative items are indicated by a
11002 leading exclamation mark, which may be followed by optional white space. A list
11003 defines a set of items (domains, etc). When Exim processes one of these lists,
11004 it is trying to find out whether a domain, host, address, or local part
11005 (respectively) is in the set that is defined by the list. It works like this:
11006 </para>
11007 <para>
11008 The list is scanned from left to right. If a positive item is matched, the
11009 subject that is being checked is in the set; if a negative item is matched, the
11010 subject is not in the set. If the end of the list is reached without the
11011 subject having matched any of the patterns, it is in the set if the last item
11012 was a negative one, but not if it was a positive one. For example, the list in
11013 </para>
11014 <literallayout class="monospaced">
11015 domainlist relay_domains = !a.b.c : *.b.c
11016 </literallayout>
11017 <para>
11018 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11019 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11020 list is positive. However, if the setting were
11021 </para>
11022 <literallayout class="monospaced">
11023 domainlist relay_domains = !a.b.c
11024 </literallayout>
11025 <para>
11026 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11027 list is negative. In other words, a list that ends with a negative item behaves
11028 as if it had an extra item <literal>:*</literal> on the end.
11029 </para>
11030 <para>
11031 Another way of thinking about positive and negative items in lists is to read
11032 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11033 item.
11034 </para>
11035 </section>
11036 <section id="SECTfilnamlis">
11037 <title>File names in lists</title>
11038 <para>
11039 <indexterm role="concept">
11040 <primary>list</primary>
11041 <secondary>file name in</secondary>
11042 </indexterm>
11043 If an item in a domain, host, address, or local part list is an absolute file
11044 name (beginning with a slash character), each line of the file is read and
11045 processed as if it were an independent item in the list, except that further
11046 file names are not allowed,
11047 and no expansion of the data from the file takes place.
11048 Empty lines in the file are ignored, and the file may also contain comment
11049 lines:
11050 </para>
11051 <itemizedlist>
11052 <listitem>
11053 <para>
11054 For domain and host lists, if a # character appears anywhere in a line of the
11055 file, it and all following characters are ignored.
11056 </para>
11057 </listitem>
11058 <listitem>
11059 <para>
11060 Because local parts may legitimately contain # characters, a comment in an
11061 address list or local part list file is recognized only if # is preceded by
11062 white space or the start of the line. For example:
11063 </para>
11064 <literallayout class="monospaced">
11065 not#comment@x.y.z   # but this is a comment
11066 </literallayout>
11067 </listitem>
11068 </itemizedlist>
11069 <para>
11070 Putting a file name in a list has the same effect as inserting each line of the
11071 file as an item in the list (blank lines and comments excepted). However, there
11072 is one important difference: the file is read each time the list is processed,
11073 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11074 </para>
11075 <para>
11076 If a file name is preceded by an exclamation mark, the sense of any match
11077 within the file is inverted. For example, if
11078 </para>
11079 <literallayout class="monospaced">
11080 hold_domains = !/etc/nohold-domains
11081 </literallayout>
11082 <para>
11083 and the file contains the lines
11084 </para>
11085 <literallayout class="monospaced">
11086 !a.b.c
11087 *.b.c
11088 </literallayout>
11089 <para>
11090 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11091 any domain matching <literal>*.b.c</literal> is not.
11092 </para>
11093 </section>
11094 <section id="SECID77">
11095 <title>An lsearch file is not an out-of-line list</title>
11096 <para>
11097 As will be described in the sections that follow, lookups can be used in lists
11098 to provide indexed methods of checking list membership. There has been some
11099 confusion about the way <command>lsearch</command> lookups work in lists. Because
11100 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11101 sometimes thought that it is allowed to contain wild cards and other kinds of
11102 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11103 always fixed strings, just as for any other single-key lookup type.
11104 </para>
11105 <para>
11106 If you want to use a file to contain wild-card patterns that form part of a
11107 list, just give the file name on its own, without a search type, as described
11108 in the previous section. You could also use the <command>wildlsearch</command> or
11109 <command>nwildlsearch</command>, but there is no advantage in doing this.
11110 </para>
11111 </section>
11112 <section id="SECTnamedlists">
11113 <title>Named lists</title>
11114 <para>
11115 <indexterm role="concept">
11116 <primary>named lists</primary>
11117 </indexterm>
11118 <indexterm role="concept">
11119 <primary>list</primary>
11120 <secondary>named</secondary>
11121 </indexterm>
11122 A list of domains, hosts, email addresses, or local parts can be given a name
11123 which is then used to refer to the list elsewhere in the configuration. This is
11124 particularly convenient if the same list is required in several different
11125 places. It also allows lists to be given meaningful names, which can improve
11126 the readability of the configuration. For example, it is conventional to define
11127 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11128 locally on a host, using a configuration line such as
11129 </para>
11130 <literallayout class="monospaced">
11131 domainlist local_domains = localhost:my.dom.example
11132 </literallayout>
11133 <para>
11134 Named lists are referenced by giving their name preceded by a plus sign, so,
11135 for example, a router that is intended to handle local domains would be
11136 configured with the line
11137 </para>
11138 <literallayout class="monospaced">
11139 domains = +local_domains
11140 </literallayout>
11141 <para>
11142 The first router in a configuration is often one that handles all domains
11143 except the local ones, using a configuration with a negated item like this:
11144 </para>
11145 <literallayout class="monospaced">
11146 dnslookup:
11147   driver = dnslookup
11148   domains = ! +local_domains
11149   transport = remote_smtp
11150   no_more
11151 </literallayout>
11152 <para>
11153 The four kinds of named list are created by configuration lines starting with
11154 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11155 respectively. Then there follows the name that you are defining, followed by an
11156 equals sign and the list itself. For example:
11157 </para>
11158 <literallayout class="monospaced">
11159 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11160 addresslist bad_senders = cdb;/etc/badsenders
11161 </literallayout>
11162 <para>
11163 A named list may refer to other named lists:
11164 </para>
11165 <literallayout class="monospaced">
11166 domainlist  dom1 = first.example : second.example
11167 domainlist  dom2 = +dom1 : third.example
11168 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11169 </literallayout>
11170 <para>
11171 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11172 effect may not be what you intended, because the negation does not propagate
11173 out to the higher level. For example, consider:
11174 </para>
11175 <literallayout class="monospaced">
11176 domainlist  dom1 = !a.b
11177 domainlist  dom2 = +dom1 : *.b
11178 </literallayout>
11179 <para>
11180 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11181 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11182 means it matches the second list as well. The effect is not the same as
11183 </para>
11184 <literallayout class="monospaced">
11185 domainlist  dom2 = !a.b : *.b
11186 </literallayout>
11187 <para>
11188 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11189 referenced lists if you can.
11190 </para>
11191 <para>
11192 Named lists may have a performance advantage. When Exim is routing an
11193 address or checking an incoming message, it caches the result of tests on named
11194 lists. So, if you have a setting such as
11195 </para>
11196 <literallayout class="monospaced">
11197 domains = +local_domains
11198 </literallayout>
11199 <para>
11200 on several of your routers
11201 or in several ACL statements,
11202 the actual test is done only for the first one. However, the caching works only
11203 if there are no expansions within the list itself or any sublists that it
11204 references. In other words, caching happens only for lists that are known to be
11205 the same each time they are referenced.
11206 </para>
11207 <para>
11208 By default, there may be up to 16 named lists of each type. This limit can be
11209 extended by changing a compile-time variable. The use of domain and host lists
11210 is recommended for concepts such as local domains, relay domains, and relay
11211 hosts. The default configuration is set up like this.
11212 </para>
11213 </section>
11214 <section id="SECID78">
11215 <title>Named lists compared with macros</title>
11216 <para>
11217 <indexterm role="concept">
11218 <primary>list</primary>
11219 <secondary>named compared with macro</secondary>
11220 </indexterm>
11221 <indexterm role="concept">
11222 <primary>macro</primary>
11223 <secondary>compared with named list</secondary>
11224 </indexterm>
11225 At first sight, named lists might seem to be no different from macros in the
11226 configuration file. However, macros are just textual substitutions. If you
11227 write
11228 </para>
11229 <literallayout class="monospaced">
11230 ALIST = host1 : host2
11231 auth_advertise_hosts = !ALIST
11232 </literallayout>
11233 <para>
11234 it probably won&#x2019;t do what you want, because that is exactly the same as
11235 </para>
11236 <literallayout class="monospaced">
11237 auth_advertise_hosts = !host1 : host2
11238 </literallayout>
11239 <para>
11240 Notice that the second host name is not negated. However, if you use a host
11241 list, and write
11242 </para>
11243 <literallayout class="monospaced">
11244 hostlist alist = host1 : host2
11245 auth_advertise_hosts = ! +alist
11246 </literallayout>
11247 <para>
11248 the negation applies to the whole list, and so that is equivalent to
11249 </para>
11250 <literallayout class="monospaced">
11251 auth_advertise_hosts = !host1 : !host2
11252 </literallayout>
11253 </section>
11254 <section id="SECID79">
11255 <title>Named list caching</title>
11256 <para>
11257 <indexterm role="concept">
11258 <primary>list</primary>
11259 <secondary>caching of named</secondary>
11260 </indexterm>
11261 <indexterm role="concept">
11262 <primary>caching</primary>
11263 <secondary>named lists</secondary>
11264 </indexterm>
11265 While processing a message, Exim caches the result of checking a named list if
11266 it is sure that the list is the same each time. In practice, this means that
11267 the cache operates only if the list contains no $ characters, which guarantees
11268 that it will not change when it is expanded. Sometimes, however, you may have
11269 an expanded list that you know will be the same each time within a given
11270 message. For example:
11271 </para>
11272 <literallayout class="monospaced">
11273 domainlist special_domains = \
11274            ${lookup{$sender_host_address}cdb{/some/file}}
11275 </literallayout>
11276 <para>
11277 This provides a list of domains that depends only on the sending host&#x2019;s IP
11278 address. If this domain list is referenced a number of times (for example,
11279 in several ACL lines, or in several routers) the result of the check is not
11280 cached by default, because Exim does not know that it is going to be the
11281 same list each time.
11282 </para>
11283 <para>
11284 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11285 cache the result anyway. For example:
11286 </para>
11287 <literallayout class="monospaced">
11288 domainlist_cache special_domains = ${lookup{...
11289 </literallayout>
11290 <para>
11291 If you do this, you should be absolutely sure that caching is going to do
11292 the right thing in all cases. When in doubt, leave it out.
11293 </para>
11294 </section>
11295 <section id="SECTdomainlist">
11296 <title>Domain lists</title>
11297 <para>
11298 <indexterm role="concept">
11299 <primary>domain list</primary>
11300 <secondary>patterns for</secondary>
11301 </indexterm>
11302 <indexterm role="concept">
11303 <primary>list</primary>
11304 <secondary>domain list</secondary>
11305 </indexterm>
11306 Domain lists contain patterns that are to be matched against a mail domain.
11307 The following types of item may appear in domain lists:
11308 </para>
11309 <itemizedlist>
11310 <listitem>
11311 <para>
11312 <indexterm role="concept">
11313 <primary>primary host name</primary>
11314 </indexterm>
11315 <indexterm role="concept">
11316 <primary>host name</primary>
11317 <secondary>matched in domain list</secondary>
11318 </indexterm>
11319 <indexterm role="option">
11320 <primary><option>primary_hostname</option></primary>
11321 </indexterm>
11322 <indexterm role="concept">
11323 <primary>domain list</primary>
11324 <secondary>matching primary host name</secondary>
11325 </indexterm>
11326 <indexterm role="concept">
11327 <primary>@ in a domain list</primary>
11328 </indexterm>
11329 If a pattern consists of a single @ character, it matches the local host name,
11330 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11331 possible to use the same configuration file on several different hosts that
11332 differ only in their names.
11333 </para>
11334 </listitem>
11335 <listitem>
11336 <para>
11337 <indexterm role="concept">
11338 <primary>@[] in a domain list</primary>
11339 </indexterm>
11340 <indexterm role="concept">
11341 <primary>domain list</primary>
11342 <secondary>matching local IP interfaces</secondary>
11343 </indexterm>
11344 <indexterm role="concept">
11345 <primary>domain literal</primary>
11346 </indexterm>
11347 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11348 in square brackets (as in an email address that contains a domain literal), but
11349 only if that IP address is recognized as local for email routing purposes. The
11350 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11351 control which of a host&#x2019;s several IP addresses are treated as local.
11352 In today&#x2019;s Internet, the use of domain literals is controversial.
11353 </para>
11354 </listitem>
11355 <listitem>
11356 <para>
11357 <indexterm role="concept">
11358 <primary>@mx_any</primary>
11359 </indexterm>
11360 <indexterm role="concept">
11361 <primary>@mx_primary</primary>
11362 </indexterm>
11363 <indexterm role="concept">
11364 <primary>@mx_secondary</primary>
11365 </indexterm>
11366 <indexterm role="concept">
11367 <primary>domain list</primary>
11368 <secondary>matching MX pointers to local host</secondary>
11369 </indexterm>
11370 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11371 has an MX record pointing to the local host or to any host that is listed in
11372 <indexterm role="option">
11373 <primary><option>hosts_treat_as_local</option></primary>
11374 </indexterm>
11375 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11376 are similar, except that the first matches only when a primary MX target is the
11377 local host, and the second only when no primary MX target is the local host,
11378 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11379 preference value &ndash; there may of course be more than one of them.
11380 </para>
11381 <para>
11382 The MX lookup that takes place when matching a pattern of this type is
11383 performed with the resolver options for widening names turned off. Thus, for
11384 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11385 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11386 options of the <command>dnslookup</command> router for a discussion of domain widening.
11387 </para>
11388 <para>
11389 Sometimes you may want to ignore certain IP addresses when using one of these
11390 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11391 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11392 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11393 on a router). For example:
11394 </para>
11395 <literallayout class="monospaced">
11396 domains = @mx_any/ignore=127.0.0.1
11397 </literallayout>
11398 <para>
11399 This example matches any domain that has an MX record pointing to one of
11400 the local host&#x2019;s IP addresses other than 127.0.0.1.
11401 </para>
11402 <para>
11403 The list of IP addresses is in fact processed by the same code that processes
11404 host lists, so it may contain CIDR-coded network specifications and it may also
11405 contain negative items.
11406 </para>
11407 <para>
11408 Because the list of IP addresses is a sublist within a domain list, you have to
11409 be careful about delimiters if there is more than one address. Like any other
11410 list, the default delimiter can be changed. Thus, you might have:
11411 </para>
11412 <literallayout class="monospaced">
11413 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11414           an.other.domain : ...
11415 </literallayout>
11416 <para>
11417 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11418 involved, it is easiest to change the delimiter for the main list as well:
11419 </para>
11420 <literallayout class="monospaced">
11421 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11422           an.other.domain ? ...
11423 </literallayout>
11424 </listitem>
11425 <listitem>
11426 <para>
11427 <indexterm role="concept">
11428 <primary>asterisk</primary>
11429 <secondary>in domain list</secondary>
11430 </indexterm>
11431 <indexterm role="concept">
11432 <primary>domain list</primary>
11433 <secondary>asterisk in</secondary>
11434 </indexterm>
11435 <indexterm role="concept">
11436 <primary>domain list</primary>
11437 <secondary>matching <quote>ends with</quote></secondary>
11438 </indexterm>
11439 If a pattern starts with an asterisk, the remaining characters of the pattern
11440 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11441 domain lists differs from its use in partial matching lookups. In a domain
11442 list, the character following the asterisk need not be a dot, whereas partial
11443 matching works only in terms of dot-separated components. For example, a domain
11444 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11445 <emphasis>cipher.key.ex</emphasis>.
11446 </para>
11447 </listitem>
11448 <listitem>
11449 <para>
11450 <indexterm role="concept">
11451 <primary>regular expressions</primary>
11452 <secondary>in domain list</secondary>
11453 </indexterm>
11454 <indexterm role="concept">
11455 <primary>domain list</primary>
11456 <secondary>matching regular expression</secondary>
11457 </indexterm>
11458 If a pattern starts with a circumflex character, it is treated as a regular
11459 expression, and matched against the domain using a regular expression matching
11460 function. The circumflex is treated as part of the regular expression.
11461 Email domains are case-independent, so this regular expression match is by
11462 default case-independent, but you can make it case-dependent by starting it
11463 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11464 are given in chapter <xref linkend="CHAPregexp"/>.
11465 </para>
11466 <para>
11467 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11468 must escape any backslash and dollar characters in the regular expression, or
11469 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11470 it is not to be expanded (unless you really do want to build a regular
11471 expression by expansion, of course).
11472 </para>
11473 </listitem>
11474 <listitem>
11475 <para>
11476 <indexterm role="concept">
11477 <primary>lookup</primary>
11478 <secondary>in domain list</secondary>
11479 </indexterm>
11480 <indexterm role="concept">
11481 <primary>domain list</primary>
11482 <secondary>matching by lookup</secondary>
11483 </indexterm>
11484 If a pattern starts with the name of a single-key lookup type followed by a
11485 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11486 must be a file name in a suitable format for the lookup type. For example, for
11487 <quote>cdb;</quote> it must be an absolute path:
11488 </para>
11489 <literallayout class="monospaced">
11490 domains = cdb;/etc/mail/local_domains.cdb
11491 </literallayout>
11492 <para>
11493 The appropriate type of lookup is done on the file using the domain name as the
11494 key. In most cases, the data that is looked up is not used; Exim is interested
11495 only in whether or not the key is present in the file. However, when a lookup
11496 is used for the <option>domains</option> option on a router
11497 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11498 <varname>$domain_data</varname> variable and can be referred to in other router options or
11499 other statements in the same ACL.
11500 </para>
11501 </listitem>
11502 <listitem>
11503 <para>
11504 Any of the single-key lookup type names may be preceded by
11505 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11506 </para>
11507 <literallayout class="monospaced">
11508 domains = partial-dbm;/partial/domains
11509 </literallayout>
11510 <para>
11511 This causes partial matching logic to be invoked; a description of how this
11512 works is given in section <xref linkend="SECTpartiallookup"/>.
11513 </para>
11514 </listitem>
11515 <listitem>
11516 <para>
11517 <indexterm role="concept">
11518 <primary>asterisk</primary>
11519 <secondary>in lookup type</secondary>
11520 </indexterm>
11521 Any of the single-key lookup types may be followed by an asterisk. This causes
11522 a default lookup for a key consisting of a single asterisk to be done if the
11523 original lookup fails. This is not a useful feature when using a domain list to
11524 select particular domains (because any domain would match), but it might have
11525 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11526 expansion variable.
11527 </para>
11528 </listitem>
11529 <listitem>
11530 <para>
11531 If the pattern starts with the name of a query-style lookup type followed by a
11532 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11533 pattern must be an appropriate query for the lookup type, as described in
11534 chapter <xref linkend="CHAPfdlookup"/>. For example:
11535 </para>
11536 <literallayout class="monospaced">
11537 hold_domains = mysql;select domain from holdlist \
11538   where domain = '$domain';
11539 </literallayout>
11540 <para>
11541 In most cases, the data that is looked up is not used (so for an SQL query, for
11542 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11543 whether or not the query succeeds. However, when a lookup is used for the
11544 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11545 variable and can be referred to in other options.
11546 </para>
11547 </listitem>
11548 <listitem>
11549 <para>
11550 <indexterm role="concept">
11551 <primary>domain list</primary>
11552 <secondary>matching literal domain name</secondary>
11553 </indexterm>
11554 If none of the above cases apply, a caseless textual comparison is made
11555 between the pattern and the domain.
11556 </para>
11557 </listitem>
11558 </itemizedlist>
11559 <para>
11560 Here is an example that uses several different kinds of pattern:
11561 </para>
11562 <literallayout class="monospaced">
11563 domainlist funny_domains = \
11564   @ : \
11565   lib.unseen.edu : \
11566   *.foundation.fict.example : \
11567   \N^[1-2]\d{3}\.fict\.example$\N : \
11568   partial-dbm;/opt/data/penguin/book : \
11569   nis;domains.byname : \
11570   nisplus;[name=$domain,status=local],domains.org_dir
11571 </literallayout>
11572 <para>
11573 There are obvious processing trade-offs among the various matching modes. Using
11574 an asterisk is faster than a regular expression, and listing a few names
11575 explicitly probably is too. The use of a file or database lookup is expensive,
11576 but may be the only option if hundreds of names are required. Because the
11577 patterns are tested in order, it makes sense to put the most commonly matched
11578 patterns earlier.
11579 </para>
11580 </section>
11581 <section id="SECThostlist">
11582 <title>Host lists</title>
11583 <para>
11584 <indexterm role="concept">
11585 <primary>host list</primary>
11586 <secondary>patterns in</secondary>
11587 </indexterm>
11588 <indexterm role="concept">
11589 <primary>list</primary>
11590 <secondary>host list</secondary>
11591 </indexterm>
11592 Host lists are used to control what remote hosts are allowed to do. For
11593 example, some hosts may be allowed to use the local host as a relay, and some
11594 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11595 two different ways, by name or by IP address. In a host list, some types of
11596 pattern are matched to a host name, and some are matched to an IP address.
11597 You need to be particularly careful with this when single-key lookups are
11598 involved, to ensure that the right value is being used as the key.
11599 </para>
11600 </section>
11601 <section id="SECID80">
11602 <title>Special host list patterns</title>
11603 <para>
11604 <indexterm role="concept">
11605 <primary>empty item in hosts list</primary>
11606 </indexterm>
11607 <indexterm role="concept">
11608 <primary>host list</primary>
11609 <secondary>empty string in</secondary>
11610 </indexterm>
11611 If a host list item is the empty string, it matches only when no remote host is
11612 involved. This is the case when a message is being received from a local
11613 process using SMTP on the standard input, that is, when a TCP/IP connection is
11614 not used.
11615 </para>
11616 <para>
11617 <indexterm role="concept">
11618 <primary>asterisk</primary>
11619 <secondary>in host list</secondary>
11620 </indexterm>
11621 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11622 the IP address nor the name is actually inspected.
11623 </para>
11624 </section>
11625 <section id="SECThoslispatip">
11626 <title>Host list patterns that match by IP address</title>
11627 <para>
11628 <indexterm role="concept">
11629 <primary>host list</primary>
11630 <secondary>matching IP addresses</secondary>
11631 </indexterm>
11632 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11633 the incoming address actually appears in the IPv6 host as
11634 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11635 list, it is converted into a traditional IPv4 address first. (Not all operating
11636 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11637 concerns.)
11638 </para>
11639 <para>
11640 The following types of pattern in a host list check the remote host by
11641 inspecting its IP address:
11642 </para>
11643 <itemizedlist>
11644 <listitem>
11645 <para>
11646 If the pattern is a plain domain name (not a regular expression, not starting
11647 with *, not a lookup of any kind), Exim calls the operating system function
11648 to find the associated IP address(es). Exim uses the newer
11649 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11650 This typically causes a forward DNS lookup of the name. The result is compared
11651 with the IP address of the subject host.
11652 </para>
11653 <para>
11654 If there is a temporary problem (such as a DNS timeout) with the host name
11655 lookup, a temporary error occurs. For example, if the list is being used in an
11656 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11657 temporary SMTP error code. If no IP address can be found for the host name,
11658 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11659 </para>
11660 </listitem>
11661 <listitem>
11662 <para>
11663 <indexterm role="concept">
11664 <primary>@ in a host list</primary>
11665 </indexterm>
11666 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11667 domain name, as just described.
11668 </para>
11669 </listitem>
11670 <listitem>
11671 <para>
11672 If the pattern is an IP address, it is matched against the IP address of the
11673 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11674 IPv6 addresses can be given in colon-separated format, but the colons have to
11675 be doubled so as not to be taken as item separators when the default list
11676 separator is used. IPv6 addresses are recognized even when Exim is compiled
11677 without IPv6 support. This means that if they appear in a host list on an
11678 IPv4-only host, Exim will not treat them as host names. They are just addresses
11679 that can never match a client host.
11680 </para>
11681 </listitem>
11682 <listitem>
11683 <para>
11684 <indexterm role="concept">
11685 <primary>@[] in a host list</primary>
11686 </indexterm>
11687 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11688 the local host. For example, if the local host is an IPv4 host with one
11689 interface address 10.45.23.56, these two ACL statements have the same effect:
11690 </para>
11691 <literallayout class="monospaced">
11692 accept hosts = 127.0.0.1 : 10.45.23.56
11693 accept hosts = @[]
11694 </literallayout>
11695 </listitem>
11696 <listitem>
11697 <para>
11698 <indexterm role="concept">
11699 <primary>CIDR notation</primary>
11700 </indexterm>
11701 If the pattern is an IP address followed by a slash and a mask length (for
11702 example 10.11.42.0/24), it is matched against the IP address of the subject
11703 host under the given mask. This allows, an entire network of hosts to be
11704 included (or excluded) by a single item. The mask uses CIDR notation; it
11705 specifies the number of address bits that must match, starting from the most
11706 significant end of the address.
11707 </para>
11708 <para>
11709 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11710 of a range of addresses. It is the number of bits in the network portion of the
11711 address. The above example specifies a 24-bit netmask, so it matches all 256
11712 addresses in the 10.11.42.0 network. An item such as
11713 </para>
11714 <literallayout class="monospaced">
11715 192.168.23.236/31
11716 </literallayout>
11717 <para>
11718 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11719 32 for an IPv4 address is the same as no mask at all; just a single address
11720 matches.
11721 </para>
11722 <para>
11723 Here is another example which shows an IPv4 and an IPv6 network:
11724 </para>
11725 <literallayout class="monospaced">
11726 recipient_unqualified_hosts = 192.168.0.0/16: \
11727                               3ffe::ffff::836f::::/48
11728 </literallayout>
11729 <para>
11730 The doubling of list separator characters applies only when these items
11731 appear inline in a host list. It is not required when indirecting via a file.
11732 For example:
11733 </para>
11734 <literallayout class="monospaced">
11735 recipient_unqualified_hosts = /opt/exim/unqualnets
11736 </literallayout>
11737 <para>
11738 could make use of a file containing
11739 </para>
11740 <literallayout class="monospaced">
11741 172.16.0.0/12
11742 3ffe:ffff:836f::/48
11743 </literallayout>
11744 <para>
11745 to have exactly the same effect as the previous example. When listing IPv6
11746 addresses inline, it is usually more convenient to use the facility for
11747 changing separator characters. This list contains the same two networks:
11748 </para>
11749 <literallayout class="monospaced">
11750 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11751                                  3ffe:ffff:836f::/48
11752 </literallayout>
11753 <para>
11754 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11755 list.
11756 </para>
11757 </listitem>
11758 </itemizedlist>
11759 </section>
11760 <section id="SECThoslispatsikey">
11761 <title>Host list patterns for single-key lookups by host address</title>
11762 <para>
11763 <indexterm role="concept">
11764 <primary>host list</primary>
11765 <secondary>lookup of IP address</secondary>
11766 </indexterm>
11767 When a host is to be identified by a single-key lookup of its complete IP
11768 address, the pattern takes this form:
11769 </para>
11770 <literallayout>
11771 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11772 </literallayout>
11773 <para>
11774 For example:
11775 </para>
11776 <literallayout class="monospaced">
11777 hosts_lookup = net-cdb;/hosts-by-ip.db
11778 </literallayout>
11779 <para>
11780 The text form of the IP address of the subject host is used as the lookup key.
11781 IPv6 addresses are converted to an unabbreviated form, using lower case
11782 letters, with dots as separators because colon is the key terminator in
11783 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11784 quoting the keys, but this is a facility that was added later.] The data
11785 returned by the lookup is not used.
11786 </para>
11787 <para>
11788 <indexterm role="concept">
11789 <primary>IP address</primary>
11790 <secondary>masking</secondary>
11791 </indexterm>
11792 <indexterm role="concept">
11793 <primary>host list</primary>
11794 <secondary>masked IP address</secondary>
11795 </indexterm>
11796 Single-key lookups can also be performed using masked IP addresses, using
11797 patterns of this form:
11798 </para>
11799 <literallayout>
11800 <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>
11801 </literallayout>
11802 <para>
11803 For example:
11804 </para>
11805 <literallayout class="monospaced">
11806 net24-dbm;/networks.db
11807 </literallayout>
11808 <para>
11809 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11810 length. A textual string is constructed from the masked value, followed by the
11811 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11812 is 192.168.34.6, the key that is looked up for the above example is
11813 <quote>192.168.34.0/24</quote>.
11814 </para>
11815 <para>
11816 When an IPv6 address is converted to a string, dots are normally used instead
11817 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11818 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11819 to quote keys was made available in <command>lsearch</command> files. However, the more
11820 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11821 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11822 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11823 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11824 addresses are always used.
11825 </para>
11826 <para>
11827 Ideally, it would be nice to tidy up this anomalous situation by changing to
11828 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11829 However, this would be an incompatible change that might break some existing
11830 configurations.
11831 </para>
11832 <para>
11833 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11834 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11835 the former case the key strings include the mask value, whereas in the latter
11836 case the IP address is used on its own.
11837 </para>
11838 </section>
11839 <section id="SECThoslispatnam">
11840 <title>Host list patterns that match by host name</title>
11841 <para>
11842 <indexterm role="concept">
11843 <primary>host</primary>
11844 <secondary>lookup failures</secondary>
11845 </indexterm>
11846 <indexterm role="concept">
11847 <primary>unknown host name</primary>
11848 </indexterm>
11849 <indexterm role="concept">
11850 <primary>host list</primary>
11851 <secondary>matching host name</secondary>
11852 </indexterm>
11853 There are several types of pattern that require Exim to know the name of the
11854 remote host. These are either wildcard patterns or lookups by name. (If a
11855 complete hostname is given without any wildcarding, it is used to find an IP
11856 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11857 above.)
11858 </para>
11859 <para>
11860 If the remote host name is not already known when Exim encounters one of these
11861 patterns, it has to be found from the IP address.
11862 Although many sites on the Internet are conscientious about maintaining reverse
11863 DNS data for their hosts, there are also many that do not do this.
11864 Consequently, a name cannot always be found, and this may lead to unwanted
11865 effects. Take care when configuring host lists with wildcarded name patterns.
11866 Consider what will happen if a name cannot be found.
11867 </para>
11868 <para>
11869 Because of the problems of determining host names from IP addresses, matching
11870 against host names is not as common as matching against IP addresses.
11871 </para>
11872 <para>
11873 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11874 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11875 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11876 are done can be changed by setting the <option>host_lookup_order</option> option. For
11877 security, once Exim has found one or more names, it looks up the IP addresses
11878 for these names and compares them with the IP address that it started with.
11879 Only those names whose IP addresses match are accepted. Any other names are
11880 discarded. If no names are left, Exim behaves as if the host name cannot be
11881 found. In the most common case there is only one name and one IP address.
11882 </para>
11883 <para>
11884 There are some options that control what happens if a host name cannot be
11885 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11886 </para>
11887 <para>
11888 <indexterm role="concept">
11889 <primary>host</primary>
11890 <secondary>alias for</secondary>
11891 </indexterm>
11892 <indexterm role="concept">
11893 <primary>alias for host</primary>
11894 </indexterm>
11895 As a result of aliasing, hosts may have more than one name. When processing any
11896 of the following types of pattern, all the host&#x2019;s names are checked:
11897 </para>
11898 <itemizedlist>
11899 <listitem>
11900 <para>
11901 <indexterm role="concept">
11902 <primary>asterisk</primary>
11903 <secondary>in host list</secondary>
11904 </indexterm>
11905 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11906 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11907 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11908 requirement. Other kinds of wildcarding require the use of a regular
11909 expression.
11910 </para>
11911 </listitem>
11912 <listitem>
11913 <para>
11914 <indexterm role="concept">
11915 <primary>regular expressions</primary>
11916 <secondary>in host list</secondary>
11917 </indexterm>
11918 <indexterm role="concept">
11919 <primary>host list</primary>
11920 <secondary>regular expression in</secondary>
11921 </indexterm>
11922 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11923 matched against the host name. Host names are case-independent, so this regular
11924 expression match is by default case-independent, but you can make it
11925 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
11926 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
11927 example,
11928 </para>
11929 <literallayout class="monospaced">
11930 ^(a|b)\.c\.d$
11931 </literallayout>
11932 <para>
11933 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11934 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11935 that backslash and dollar characters are not misinterpreted as part of the
11936 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11937 part of the string as non-expandable. For example:
11938 </para>
11939 <literallayout class="monospaced">
11940 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11941 </literallayout>
11942 <para>
11943 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11944 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11945 example. Without it, a match at the start of the host name is all that is
11946 required.
11947 </para>
11948 </listitem>
11949 </itemizedlist>
11950 </section>
11951 <section id="SECTbehipnot">
11952 <title>Behaviour when an IP address or name cannot be found</title>
11953 <para>
11954 <indexterm role="concept">
11955 <primary>host</primary>
11956 <secondary>lookup failures, permanent</secondary>
11957 </indexterm>
11958 While processing a host list, Exim may need to look up an IP address from a
11959 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11960 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11961 behaviour when it fails to find the information it is seeking is the same.
11962 </para>
11963 <para>
11964 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11965 apply to temporary DNS errors, whose handling is described in the next section.
11966 </para>
11967 <para>
11968 <indexterm role="concept">
11969 <primary><literal>+include_unknown</literal></primary>
11970 </indexterm>
11971 <indexterm role="concept">
11972 <primary><literal>+ignore_unknown</literal></primary>
11973 </indexterm>
11974 By default, Exim behaves as if the host does not match the list. This may not
11975 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
11976 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11977 top level &ndash; they are not recognized in an indirected file).
11978 </para>
11979 <itemizedlist>
11980 <listitem>
11981 <para>
11982 If any item that follows <literal>+include_unknown</literal> requires information that
11983 cannot found, Exim behaves as if the host does match the list. For example,
11984 </para>
11985 <literallayout class="monospaced">
11986 host_reject_connection = +include_unknown:*.enemy.ex
11987 </literallayout>
11988 <para>
11989 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11990 any hosts whose name it cannot find.
11991 </para>
11992 </listitem>
11993 <listitem>
11994 <para>
11995 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11996 be found, Exim ignores that item and proceeds to the rest of the list. For
11997 example:
11998 </para>
11999 <literallayout class="monospaced">
12000 accept hosts = +ignore_unknown : friend.example : \
12001                192.168.4.5
12002 </literallayout>
12003 <para>
12004 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12005 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12006 name can be found for 192.168.4.5, it is rejected.
12007 </para>
12008 </listitem>
12009 </itemizedlist>
12010 <para>
12011 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12012 list. The effect of each one lasts until the next, or until the end of the
12013 list.
12014 </para>
12015 </section>
12016 <section id="SECTtemdnserr">
12017 <title>Temporary DNS errors when looking up host information</title>
12018 <para>
12019 <indexterm role="concept">
12020 <primary>host</primary>
12021 <secondary>lookup failures, temporary</secondary>
12022 </indexterm>
12023 <indexterm role="concept">
12024 <primary><literal>+include_defer</literal></primary>
12025 </indexterm>
12026 <indexterm role="concept">
12027 <primary><literal>+ignore_defer</literal></primary>
12028 </indexterm>
12029 A temporary DNS lookup failure normally causes a defer action (except when
12030 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12031 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12032 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12033 section. These options should be used with care, probably only in non-critical
12034 host lists such as whitelists.
12035 </para>
12036 </section>
12037 <section id="SECThoslispatnamsk">
12038 <title>Host list patterns for single-key lookups by host name</title>
12039 <para>
12040 <indexterm role="concept">
12041 <primary>unknown host name</primary>
12042 </indexterm>
12043 <indexterm role="concept">
12044 <primary>host list</primary>
12045 <secondary>matching host name</secondary>
12046 </indexterm>
12047 If a pattern is of the form
12048 </para>
12049 <literallayout>
12050 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12051 </literallayout>
12052 <para>
12053 for example
12054 </para>
12055 <literallayout class="monospaced">
12056 dbm;/host/accept/list
12057 </literallayout>
12058 <para>
12059 a single-key lookup is performed, using the host name as its key. If the
12060 lookup succeeds, the host matches the item. The actual data that is looked up
12061 is not used.
12062 </para>
12063 <para>
12064 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12065 keys in the file, not IP addresses. If you want to do lookups based on IP
12066 addresses, you must precede the search type with <quote>net-</quote> (see section
12067 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12068 two items in the same list, one doing an address lookup and one doing a name
12069 lookup, both using the same file.
12070 </para>
12071 </section>
12072 <section id="SECID81">
12073 <title>Host list patterns for query-style lookups</title>
12074 <para>
12075 If a pattern is of the form
12076 </para>
12077 <literallayout>
12078 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12079 </literallayout>
12080 <para>
12081 the query is obeyed, and if it succeeds, the host matches the item. The actual
12082 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12083 <varname>$sender_host_name</varname> can be used in the query. For example:
12084 </para>
12085 <literallayout class="monospaced">
12086 hosts_lookup = pgsql;\
12087   select ip from hostlist where ip='$sender_host_address'
12088 </literallayout>
12089 <para>
12090 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12091 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12092 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12093 operator.
12094 </para>
12095 <para>
12096 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12097 looks up the host name if has not already done so. (See section
12098 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12099 </para>
12100 <para>
12101 Historical note: prior to release 4.30, Exim would always attempt to find a
12102 host name before running the query, unless the search type was preceded by
12103 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12104 still recognized for query-style lookups, but its presence or absence has no
12105 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12106 See section <xref linkend="SECThoslispatsikey"/>.)
12107 </para>
12108 </section>
12109 <section id="SECTmixwilhos">
12110 <title>Mixing wildcarded host names and addresses in host lists</title>
12111 <para>
12112 <indexterm role="concept">
12113 <primary>host list</primary>
12114 <secondary>mixing names and addresses in</secondary>
12115 </indexterm>
12116 If you have name lookups or wildcarded host names and IP addresses in the same
12117 host list, you should normally put the IP addresses first. For example, in an
12118 ACL you could have:
12119 </para>
12120 <literallayout class="monospaced">
12121 accept hosts = 10.9.8.7 : *.friend.example
12122 </literallayout>
12123 <para>
12124 The reason for this lies in the left-to-right way that Exim processes lists.
12125 It can test IP addresses without doing any DNS lookups, but when it reaches an
12126 item that requires a host name, it fails if it cannot find a host name to
12127 compare with the pattern. If the above list is given in the opposite order, the
12128 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12129 IP address is 10.9.8.7.
12130 </para>
12131 <para>
12132 If you really do want to do the name check first, and still recognize the IP
12133 address, you can rewrite the ACL like this:
12134 </para>
12135 <literallayout class="monospaced">
12136 accept hosts = *.friend.example
12137 accept hosts = 10.9.8.7
12138 </literallayout>
12139 <para>
12140 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12141 <xref linkend="CHAPACL"/> for details of ACLs.
12142 </para>
12143 </section>
12144 <section id="SECTaddresslist">
12145 <title>Address lists</title>
12146 <para>
12147 <indexterm role="concept">
12148 <primary>list</primary>
12149 <secondary>address list</secondary>
12150 </indexterm>
12151 <indexterm role="concept">
12152 <primary>address list</primary>
12153 <secondary>empty item</secondary>
12154 </indexterm>
12155 <indexterm role="concept">
12156 <primary>address list</primary>
12157 <secondary>patterns</secondary>
12158 </indexterm>
12159 Address lists contain patterns that are matched against mail addresses. There
12160 is one special case to be considered: the sender address of a bounce message is
12161 always empty. You can test for this by providing an empty item in an address
12162 list. For example, you can set up a router to process bounce messages by
12163 using this option setting:
12164 </para>
12165 <literallayout class="monospaced">
12166 senders = :
12167 </literallayout>
12168 <para>
12169 The presence of the colon creates an empty item. If you do not provide any
12170 data, the list is empty and matches nothing. The empty sender can also be
12171 detected by a regular expression that matches an empty string,
12172 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12173 </para>
12174 <para>
12175 Non-empty items in an address list can be straightforward email addresses. For
12176 example:
12177 </para>
12178 <literallayout class="monospaced">
12179 senders = jbc@askone.example : hs@anacreon.example
12180 </literallayout>
12181 <para>
12182 A certain amount of wildcarding is permitted. If a pattern contains an @
12183 character, but is not a regular expression and does not begin with a
12184 semicolon-terminated lookup type (described below), the local part of the
12185 subject address is compared with the local part of the pattern, which may start
12186 with an asterisk. If the local parts match, the domain is checked in exactly
12187 the same way as for a pattern in a domain list. For example, the domain can be
12188 wildcarded, refer to a named list, or be a lookup:
12189 </para>
12190 <literallayout class="monospaced">
12191 deny senders = *@*.spamming.site:\
12192                *@+hostile_domains:\
12193                bozo@partial-lsearch;/list/of/dodgy/sites:\
12194                *@dbm;/bad/domains.db
12195 </literallayout>
12196 <para>
12197 <indexterm role="concept">
12198 <primary>local part</primary>
12199 <secondary>starting with !</secondary>
12200 </indexterm>
12201 <indexterm role="concept">
12202 <primary>address list</primary>
12203 <secondary>local part starting with !</secondary>
12204 </indexterm>
12205 If a local part that begins with an exclamation mark is required, it has to be
12206 specified using a regular expression, because otherwise the exclamation mark is
12207 treated as a sign of negation, as is standard in lists.
12208 </para>
12209 <para>
12210 If a non-empty pattern that is not a regular expression or a lookup does not
12211 contain an @ character, it is matched against the domain part of the subject
12212 address. The only two formats that are recognized this way are a literal
12213 domain, or a domain pattern that starts with *. In both these cases, the effect
12214 is the same as if <literal>*@</literal> preceded the pattern. For example:
12215 </para>
12216 <literallayout class="monospaced">
12217 deny senders = enemy.domain : *.enemy.domain
12218 </literallayout>
12219 <para>
12220 The following kinds of more complicated address list pattern can match any
12221 address, including the empty address that is characteristic of bounce message
12222 senders:
12223 </para>
12224 <itemizedlist>
12225 <listitem>
12226 <para>
12227 <indexterm role="concept">
12228 <primary>regular expressions</primary>
12229 <secondary>in address list</secondary>
12230 </indexterm>
12231 <indexterm role="concept">
12232 <primary>address list</primary>
12233 <secondary>regular expression in</secondary>
12234 </indexterm>
12235 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12236 done against the complete address, with the pattern as the regular expression.
12237 You must take care that backslash and dollar characters are not misinterpreted
12238 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12239 to mark that part of the string as non-expandable. For example:
12240 </para>
12241 <literallayout class="monospaced">
12242 deny senders = \N^.*this.*@example\.com$\N : \
12243                \N^\d{8}.+@spamhaus.example$\N : ...
12244 </literallayout>
12245 <para>
12246 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12247 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12248 </para>
12249 </listitem>
12250 <listitem>
12251 <para>
12252 <indexterm role="concept">
12253 <primary>address list</primary>
12254 <secondary>lookup for complete address</secondary>
12255 </indexterm>
12256 Complete addresses can be looked up by using a pattern that starts with a
12257 lookup type terminated by a semicolon, followed by the data for the lookup. For
12258 example:
12259 </para>
12260 <literallayout class="monospaced">
12261 deny senders = cdb;/etc/blocked.senders : \
12262   mysql;select address from blocked where \
12263   address='${quote_mysql:$sender_address}'
12264 </literallayout>
12265 <para>
12266 Both query-style and single-key lookup types can be used. For a single-key
12267 lookup type, Exim uses the complete address as the key. However, empty keys are
12268 not supported for single-key lookups, so a match against the empty address
12269 always fails. This restriction does not apply to query-style lookups.
12270 </para>
12271 <para>
12272 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12273 cannot be used, and is ignored if specified, with an entry being written to the
12274 panic log.
12275 <indexterm role="concept">
12276 <primary>*@ with single-key lookup</primary>
12277 </indexterm>
12278 However, you can configure lookup defaults, as described in section
12279 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12280 default. For example, with this lookup:
12281 </para>
12282 <literallayout class="monospaced">
12283 accept senders = lsearch*@;/some/file
12284 </literallayout>
12285 <para>
12286 the file could contains lines like this:
12287 </para>
12288 <literallayout class="monospaced">
12289 user1@domain1.example
12290 *@domain2.example
12291 </literallayout>
12292 <para>
12293 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12294 that are tried is:
12295 </para>
12296 <literallayout class="monospaced">
12297 nimrod@jaeger.example
12298 *@jaeger.example
12299 *
12300 </literallayout>
12301 <para>
12302 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12303 would mean that every address matches, thus rendering the test useless.
12304 </para>
12305 <para>
12306 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12307 </para>
12308 <literallayout class="monospaced">
12309 deny recipients = dbm*@;/some/file
12310 deny recipients = *@dbm;/some/file
12311 </literallayout>
12312 <para>
12313 The first does a whole address lookup, with defaulting, as just described,
12314 because it starts with a lookup type. The second matches the local part and
12315 domain independently, as described in a bullet point below.
12316 </para>
12317 </listitem>
12318 </itemizedlist>
12319 <para>
12320 The following kinds of address list pattern can match only non-empty addresses.
12321 If the subject address is empty, a match against any of these pattern types
12322 always fails.
12323 </para>
12324 <itemizedlist>
12325 <listitem>
12326 <para>
12327 <indexterm role="concept">
12328 <primary>@@ with single-key lookup</primary>
12329 </indexterm>
12330 <indexterm role="concept">
12331 <primary>address list</primary>
12332 <secondary>@@ lookup type</secondary>
12333 </indexterm>
12334 <indexterm role="concept">
12335 <primary>address list</primary>
12336 <secondary>split local part and domain</secondary>
12337 </indexterm>
12338 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12339 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12340 split into a local part and a domain. The domain is looked up in the file. If
12341 it is not found, there is no match. If it is found, the data that is looked up
12342 from the file is treated as a colon-separated list of local part patterns, each
12343 of which is matched against the subject local part in turn.
12344 </para>
12345 <para>
12346 <indexterm role="concept">
12347 <primary>asterisk</primary>
12348 <secondary>in address list</secondary>
12349 </indexterm>
12350 The lookup may be a partial one, and/or one involving a search for a default
12351 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12352 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12353 even be further lookups. They may also be independently negated. For example,
12354 with
12355 </para>
12356 <literallayout class="monospaced">
12357 deny senders = @@dbm;/etc/reject-by-domain
12358 </literallayout>
12359 <para>
12360 the data from which the DBM file is built could contain lines like
12361 </para>
12362 <literallayout class="monospaced">
12363 baddomain.com:  !postmaster : *
12364 </literallayout>
12365 <para>
12366 to reject all senders except <option>postmaster</option> from that domain.
12367 </para>
12368 <para>
12369 <indexterm role="concept">
12370 <primary>local part</primary>
12371 <secondary>starting with !</secondary>
12372 </indexterm>
12373 If a local part that actually begins with an exclamation mark is required, it
12374 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12375 may be split over several lines by indenting the second and subsequent lines,
12376 but the separating colon must still be included at line breaks. White space
12377 surrounding the colons is ignored. For example:
12378 </para>
12379 <literallayout class="monospaced">
12380 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12381 spammer3 : spammer4
12382 </literallayout>
12383 <para>
12384 As in all colon-separated lists in Exim, a colon can be included in an item by
12385 doubling.
12386 </para>
12387 <para>
12388 If the last item in the list starts with a right angle-bracket, the remainder
12389 of the item is taken as a new key to look up in order to obtain a continuation
12390 list of local parts. The new key can be any sequence of characters. Thus one
12391 might have entries like
12392 </para>
12393 <literallayout class="monospaced">
12394 aol.com: spammer1 : spammer 2 : &gt;*
12395 xyz.com: spammer3 : &gt;*
12396 *:       ^\d{8}$
12397 </literallayout>
12398 <para>
12399 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12400 local parts for all domains, in addition to the specific local parts listed for
12401 each domain. Of course, using this feature costs another lookup each time a
12402 chain is followed, but the effort needed to maintain the data is reduced.
12403 </para>
12404 <para>
12405 <indexterm role="concept">
12406 <primary>loop</primary>
12407 <secondary>in lookups</secondary>
12408 </indexterm>
12409 It is possible to construct loops using this facility, and in order to catch
12410 them, the chains may be no more than fifty items long.
12411 </para>
12412 </listitem>
12413 <listitem>
12414 <para>
12415 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12416 lookup, but in this case, the chaining facility is not available. The lookup
12417 can only return a single list of local parts.
12418 </para>
12419 </listitem>
12420 </itemizedlist>
12421 <para>
12422 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12423 in these two examples:
12424 </para>
12425 <literallayout class="monospaced">
12426 senders = +my_list
12427 senders = *@+my_list
12428 </literallayout>
12429 <para>
12430 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12431 example it is a named domain list.
12432 </para>
12433 </section>
12434 <section id="SECTcasletadd">
12435 <title>Case of letters in address lists</title>
12436 <para>
12437 <indexterm role="concept">
12438 <primary>case of local parts</primary>
12439 </indexterm>
12440 <indexterm role="concept">
12441 <primary>address list</primary>
12442 <secondary>case forcing</secondary>
12443 </indexterm>
12444 <indexterm role="concept">
12445 <primary>case forcing in address lists</primary>
12446 </indexterm>
12447 Domains in email addresses are always handled caselessly, but for local parts
12448 case may be significant on some systems (see <option>caseful_local_part</option> for how
12449 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12450 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12451 blocking lists should be done in a case-independent manner. Since most address
12452 lists in Exim are used for this kind of control, Exim attempts to do this by
12453 default.
12454 </para>
12455 <para>
12456 The domain portion of an address is always lowercased before matching it to an
12457 address list. The local part is lowercased by default, and any string
12458 comparisons that take place are done caselessly. This means that the data in
12459 the address list itself, in files included as plain file names, and in any file
12460 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12461 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12462 works caselessly) must be in lower case, because these lookups are not
12463 case-independent.
12464 </para>
12465 <para>
12466 <indexterm role="concept">
12467 <primary><literal>+caseful</literal></primary>
12468 </indexterm>
12469 To allow for the possibility of caseful address list matching, if an item in
12470 an address list is the string <quote>+caseful</quote>, the original case of the local
12471 part is restored for any comparisons that follow, and string comparisons are no
12472 longer case-independent. This does not affect the domain, which remains in
12473 lower case. However, although independent matches on the domain alone are still
12474 performed caselessly, regular expressions that match against an entire address
12475 become case-sensitive after <quote>+caseful</quote> has been seen.
12476 </para>
12477 </section>
12478 <section id="SECTlocparlis">
12479 <title>Local part lists</title>
12480 <para>
12481 <indexterm role="concept">
12482 <primary>list</primary>
12483 <secondary>local part list</secondary>
12484 </indexterm>
12485 <indexterm role="concept">
12486 <primary>local part</primary>
12487 <secondary>list</secondary>
12488 </indexterm>
12489 Case-sensitivity in local part lists is handled in the same way as for address
12490 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12491 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12492 set false, the subject is lowercased and the matching is initially
12493 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12494 matching in the local part list, but not elsewhere in the router. If
12495 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12496 option is case-sensitive from the start.
12497 </para>
12498 <para>
12499 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12500 comments are handled in the same way as address lists &ndash; they are recognized
12501 only if the # is preceded by white space or the start of the line.
12502 Otherwise, local part lists are matched in the same way as domain lists, except
12503 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12504 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12505 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12506 types.
12507 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12508 </para>
12509 </section>
12510 </chapter>
12511
12512 <chapter id="CHAPexpand">
12513 <title>String expansions</title>
12514 <para>
12515 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12516 <primary>expansion</primary>
12517 <secondary>of strings</secondary>
12518 </indexterm>
12519 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12520 them are expanded every time they are used; others are expanded only once.
12521 </para>
12522 <para>
12523 When a string is being expanded it is copied verbatim from left to right except
12524 when a dollar or backslash character is encountered. A dollar specifies the
12525 start of a portion of the string that is interpreted and replaced as described
12526 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12527 escape character, as described in the following section.
12528 </para>
12529 <section id="SECTlittext">
12530 <title>Literal text in expanded strings</title>
12531 <para>
12532 <indexterm role="concept">
12533 <primary>expansion</primary>
12534 <secondary>including literal text</secondary>
12535 </indexterm>
12536 An uninterpreted dollar can be included in an expanded string by putting a
12537 backslash in front of it. A backslash can be used to prevent any special
12538 character being treated specially in an expansion, including backslash itself.
12539 If the string appears in quotes in the configuration file, two backslashes are
12540 required because the quotes themselves cause interpretation of backslashes when
12541 the string is read in (see section <xref linkend="SECTstrings"/>).
12542 </para>
12543 <para>
12544 <indexterm role="concept">
12545 <primary>expansion</primary>
12546 <secondary>non-expandable substrings</secondary>
12547 </indexterm>
12548 A portion of the string can specified as non-expandable by placing it between
12549 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12550 expressions, which often contain backslashes and dollar signs. For example:
12551 </para>
12552 <literallayout class="monospaced">
12553 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12554 </literallayout>
12555 <para>
12556 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12557 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12558 string.
12559 </para>
12560 </section>
12561 <section id="SECID82">
12562 <title>Character escape sequences in expanded strings</title>
12563 <para>
12564 <indexterm role="concept">
12565 <primary>expansion</primary>
12566 <secondary>escape sequences</secondary>
12567 </indexterm>
12568 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12569 expanded string is recognized as an escape sequence for the character newline,
12570 carriage return, or tab, respectively. A backslash followed by up to three
12571 octal digits is recognized as an octal encoding for a single character, and a
12572 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12573 encoding.
12574 </para>
12575 <para>
12576 These escape sequences are also recognized in quoted strings when they are read
12577 in. Their interpretation in expansions as well is useful for unquoted strings,
12578 and for other cases such as looked-up strings that are then expanded.
12579 </para>
12580 </section>
12581 <section id="SECID83">
12582 <title>Testing string expansions</title>
12583 <para>
12584 <indexterm role="concept">
12585 <primary>expansion</primary>
12586 <secondary>testing</secondary>
12587 </indexterm>
12588 <indexterm role="concept">
12589 <primary>testing</primary>
12590 <secondary>string expansion</secondary>
12591 </indexterm>
12592 <indexterm role="option">
12593 <primary><option>-be</option></primary>
12594 </indexterm>
12595 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12596 takes the command arguments, or lines from the standard input if there are no
12597 arguments, runs them through the string expansion code, and writes the results
12598 to the standard output. Variables based on configuration values are set up, but
12599 since no message is being processed, variables such as <varname>$local_part</varname> have no
12600 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12601 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12602 and <option>nhash</option>.
12603 </para>
12604 <para>
12605 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12606 instead runs under the uid and gid it was called with, to prevent users from
12607 using <option>-be</option> for reading files to which they do not have access.
12608 </para>
12609 <para>
12610 <indexterm role="option">
12611 <primary><option>-bem</option></primary>
12612 </indexterm>
12613 If you want to test expansions that include variables whose values are taken
12614 from a message, there are two other options that can be used. The <option>-bem</option>
12615 option is like <option>-be</option> except that it is followed by a file name. The file is
12616 read as a message before doing the test expansions. For example:
12617 </para>
12618 <literallayout class="monospaced">
12619 exim -bem /tmp/test.message '$h_subject:'
12620 </literallayout>
12621 <para>
12622 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12623 Exim message identifier. For example:
12624 </para>
12625 <literallayout class="monospaced">
12626 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12627 </literallayout>
12628 <para>
12629 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12630 is therefore restricted to admin users.
12631 </para>
12632 </section>
12633 <section id="SECTforexpfai">
12634 <title>Forced expansion failure</title>
12635 <para>
12636 <indexterm role="concept">
12637 <primary>expansion</primary>
12638 <secondary>forced failure</secondary>
12639 </indexterm>
12640 A number of expansions that are described in the following section have
12641 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12642 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12643 used depends on some condition that is evaluated as part of the expansion. If,
12644 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12645 the entire string expansion fails in a way that can be detected by the code
12646 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12647 its consequences depend on the circumstances. In some cases it is no different
12648 from any other expansion failure, but in others a different action may be
12649 taken. Such variations are mentioned in the documentation of the option that is
12650 being expanded.
12651 </para>
12652 </section>
12653 <section id="SECTexpansionitems">
12654 <title>Expansion items</title>
12655 <para>
12656 The following items are recognized in expanded strings. White space may be used
12657 between sub-items that are keywords or substrings enclosed in braces inside an
12658 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12659 white space is significant.
12660 </para>
12661 <variablelist>
12662 <varlistentry>
12663 <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>
12664 <listitem>
12665 <para>
12666 <indexterm role="concept">
12667 <primary>expansion</primary>
12668 <secondary>variables</secondary>
12669 </indexterm>
12670 Substitute the contents of the named variable, for example:
12671 </para>
12672 <literallayout class="monospaced">
12673 $local_part
12674 ${domain}
12675 </literallayout>
12676 <para>
12677 The second form can be used to separate the name from subsequent alphanumeric
12678 characters. This form (using braces) is available only for variables; it does
12679 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12680 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12681 given, the expansion fails.
12682 </para>
12683 </listitem></varlistentry>
12684 <varlistentry>
12685 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12686 <listitem>
12687 <para>
12688 <indexterm role="concept">
12689 <primary>expansion</primary>
12690 <secondary>operators</secondary>
12691 </indexterm>
12692 The string is first itself expanded, and then the operation specified by
12693 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12694 </para>
12695 <literallayout class="monospaced">
12696 ${lc:$local_part}
12697 </literallayout>
12698 <para>
12699 The string starts with the first character after the colon, which may be
12700 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12701 below. The operator notation is used for simple expansion items that have just
12702 one argument, because it reduces the number of braces and therefore makes the
12703 string easier to understand.
12704 </para>
12705 </listitem></varlistentry>
12706 <varlistentry>
12707 <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>
12708 <listitem>
12709 <para>
12710 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12711 expansion item below.
12712 </para>
12713 </listitem></varlistentry>
12714 <varlistentry>
12715 <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>
12716 <listitem>
12717 <para>
12718 <indexterm role="concept">
12719 <primary><option>dlfunc</option></primary>
12720 </indexterm>
12721 This expansion dynamically loads and then calls a locally-written C function.
12722 This functionality is available only if Exim is compiled with
12723 </para>
12724 <literallayout class="monospaced">
12725 EXPAND_DLFUNC=yes
12726 </literallayout>
12727 <para>
12728 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12729 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12730 (but of course Exim does start new processes frequently).
12731 </para>
12732 <para>
12733 There may be from zero to eight arguments to the function. When compiling
12734 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12735 included. The Exim variables and functions that are defined by that API
12736 are also available for dynamically loaded functions. The function itself
12737 must have the following type:
12738 </para>
12739 <literallayout class="monospaced">
12740 int dlfunction(uschar **yield, int argc, uschar *argv[])
12741 </literallayout>
12742 <para>
12743 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12744 function should return one of the following values:
12745 </para>
12746 <para>
12747 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12748 into the expanded string that is being built.
12749 </para>
12750 <para>
12751 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12752 from <emphasis>yield</emphasis>, if it is set.
12753 </para>
12754 <para>
12755 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12756 taken from <emphasis>yield</emphasis> if it is set.
12757 </para>
12758 <para>
12759 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12760 </para>
12761 <para>
12762 When compiling a function that is to be used in this way with gcc,
12763 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12764 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12765 </para>
12766 </listitem></varlistentry>
12767 <varlistentry>
12768 <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>
12769 <listitem>
12770 <para>
12771 <indexterm role="concept">
12772 <primary>expansion</primary>
12773 <secondary>extracting substrings by key</secondary>
12774 </indexterm>
12775 <indexterm role="concept">
12776 <primary><option>extract</option></primary>
12777 <secondary>substrings by key</secondary>
12778 </indexterm>
12779 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12780 white space is removed from the key (but not from any of the strings). The key
12781 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12782 form:
12783 </para>
12784 <literallayout>
12785 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12786 </literallayout>
12787 <para>
12788 <indexterm role="variable">
12789 <primary><varname>$value</varname></primary>
12790 </indexterm>
12791 where the equals signs and spaces (but not both) are optional. If any of the
12792 values contain white space, they must be enclosed in double quotes, and any
12793 values that are enclosed in double quotes are subject to escape processing as
12794 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12795 for the value that corresponds to the key. The search is case-insensitive. If
12796 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12797 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12798 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12799 is restored to any previous value it might have had.
12800 </para>
12801 <para>
12802 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12803 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12804 extracted is used. Thus, for example, these two expansions are identical, and
12805 yield <quote>2001</quote>:
12806 </para>
12807 <literallayout class="monospaced">
12808 ${extract{gid}{uid=1984 gid=2001}}
12809 ${extract{gid}{uid=1984 gid=2001}{$value}}
12810 </literallayout>
12811 <para>
12812 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12813 appear, for example:
12814 </para>
12815 <literallayout class="monospaced">
12816 ${extract{Z}{A=... B=...}{$value} fail }
12817 </literallayout>
12818 <para>
12819 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12820 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12821 </para>
12822 </listitem></varlistentry>
12823 <varlistentry>
12824 <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>
12825 <listitem>
12826 <para>
12827 <indexterm role="concept">
12828 <primary>expansion</primary>
12829 <secondary>extracting substrings by number</secondary>
12830 </indexterm>
12831 <indexterm role="concept">
12832 <primary><option>extract</option></primary>
12833 <secondary>substrings by number</secondary>
12834 </indexterm>
12835 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12836 apart from leading and trailing white space, which is ignored.
12837 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12838 behaves in the same way, except that, instead of extracting a named field, it
12839 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12840 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12841 &lt;<emphasis>string3</emphasis>&gt; as before.
12842 </para>
12843 <para>
12844 The fields in the string are separated by any one of the characters in the
12845 separator string. These may include space or tab characters.
12846 The first field is numbered one. If the number is negative, the fields are
12847 counted from the end of the string, with the rightmost one numbered -1. If the
12848 number given is zero, the entire string is returned. If the modulus of the
12849 number is greater than the number of fields in the string, the result is the
12850 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12851 provided. For example:
12852 </para>
12853 <literallayout class="monospaced">
12854 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12855 </literallayout>
12856 <para>
12857 yields <quote>42</quote>, and
12858 </para>
12859 <literallayout class="monospaced">
12860 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12861 </literallayout>
12862 <para>
12863 yields <quote>99</quote>. Two successive separators mean that the field between them is
12864 empty (for example, the fifth field above).
12865 </para>
12866 </listitem></varlistentry>
12867 <varlistentry>
12868 <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>
12869 <listitem>
12870 <para>
12871 <indexterm role="concept">
12872 <primary>list</primary>
12873 <secondary>selecting by condition</secondary>
12874 </indexterm>
12875 <indexterm role="concept">
12876 <primary>expansion</primary>
12877 <secondary>selecting from list by condition</secondary>
12878 </indexterm>
12879 <indexterm role="variable">
12880 <primary><varname>$item</varname></primary>
12881 </indexterm>
12882 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
12883 default, but the separator can be changed in the usual way. For each item
12884 in this list, its value is place in <varname>$item</varname>, and then the condition is
12885 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12886 item in a new list; if the condition is false, the item is discarded. The
12887 separator used for the output list is the same as the one used for the
12888 input, but a separator setting is not included in the output. For example:
12889 </para>
12890 <literallayout class="monospaced">
12891 ${filter{a:b:c}{!eq{$item}{b}}
12892 </literallayout>
12893 <para>
12894 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12895 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12896 </para>
12897 </listitem></varlistentry>
12898 <varlistentry>
12899 <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>
12900 <listitem>
12901 <para>
12902 <indexterm role="concept">
12903 <primary>hash function</primary>
12904 <secondary>textual</secondary>
12905 </indexterm>
12906 <indexterm role="concept">
12907 <primary>expansion</primary>
12908 <secondary>textual hash</secondary>
12909 </indexterm>
12910 This is a textual hashing function, and was the first to be implemented in
12911 early versions of Exim. In current releases, there are other hashing functions
12912 (numeric, MD5, and SHA-1), which are described below.
12913 </para>
12914 <para>
12915 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12916 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12917 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12918 use the simpler operator notation that avoids some of the braces:
12919 </para>
12920 <literallayout class="monospaced">
12921 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12922 </literallayout>
12923 <para>
12924 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12925 or equal to the length of the string, the expansion item returns the string.
12926 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12927 function to the string. The new string consists of characters taken from the
12928 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12929 </para>
12930 <literallayout class="monospaced">
12931 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12932 </literallayout>
12933 <para>
12934 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12935 letters appear. For example:
12936 </para>
12937 <literallayout>
12938 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12939 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12940 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12941 </literallayout>
12942 </listitem></varlistentry>
12943 <varlistentry>
12944 <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>
12945 <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>
12946 <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>
12947 <listitem>
12948 <para>
12949 <indexterm role="concept">
12950 <primary>expansion</primary>
12951 <secondary>header insertion</secondary>
12952 </indexterm>
12953 <indexterm role="variable">
12954 <primary><varname>$header_</varname></primary>
12955 </indexterm>
12956 <indexterm role="variable">
12957 <primary><varname>$bheader_</varname></primary>
12958 </indexterm>
12959 <indexterm role="variable">
12960 <primary><varname>$rheader_</varname></primary>
12961 </indexterm>
12962 <indexterm role="concept">
12963 <primary>header lines</primary>
12964 <secondary>in expansion strings</secondary>
12965 </indexterm>
12966 <indexterm role="concept">
12967 <primary>header lines</primary>
12968 <secondary>character sets</secondary>
12969 </indexterm>
12970 <indexterm role="concept">
12971 <primary>header lines</primary>
12972 <secondary>decoding</secondary>
12973 </indexterm>
12974 Substitute the contents of the named message header line, for example
12975 </para>
12976 <literallayout class="monospaced">
12977 $header_reply-to:
12978 </literallayout>
12979 <para>
12980 The newline that terminates a header line is not included in the expansion, but
12981 internal newlines (caused by splitting the header line over several physical
12982 lines) may be present.
12983 </para>
12984 <para>
12985 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12986 the data in the header line is interpreted.
12987 </para>
12988 <itemizedlist>
12989 <listitem>
12990 <para>
12991 <indexterm role="concept">
12992 <primary>white space</primary>
12993 <secondary>in header lines</secondary>
12994 </indexterm>
12995 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12996 processing at all, and without the removal of leading and trailing white space.
12997 </para>
12998 </listitem>
12999 <listitem>
13000 <para>
13001 <indexterm role="concept">
13002 <primary>base64 encoding</primary>
13003 <secondary>in header lines</secondary>
13004 </indexterm>
13005 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13006 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13007 character set translation. If decoding of what looks superficially like a MIME
13008 <quote>word</quote> fails, the raw string is returned. If decoding
13009 <indexterm role="concept">
13010 <primary>binary zero</primary>
13011 <secondary>in header line</secondary>
13012 </indexterm>
13013 produces a binary zero character, it is replaced by a question mark &ndash; this is
13014 what Exim does for binary zeros that are actually received in header lines.
13015 </para>
13016 </listitem>
13017 <listitem>
13018 <para>
13019 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13020 standard character set. This is an attempt to produce the same string as would
13021 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13022 returned. Translation is attempted only on operating systems that support the
13023 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13024 a system Makefile or in <filename>Local/Makefile</filename>.
13025 </para>
13026 </listitem>
13027 </itemizedlist>
13028 <para>
13029 In a filter file, the target character set for <option>header</option> can be specified by a
13030 command of the following form:
13031 </para>
13032 <literallayout class="monospaced">
13033 headers charset "UTF-8"
13034 </literallayout>
13035 <para>
13036 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13037 subsequently obeyed filter commands. In the absence of this command, the target
13038 character set in a filter is taken from the setting of the <option>headers_charset</option>
13039 option in the runtime configuration. The value of this option defaults to the
13040 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13041 ISO-8859-1.
13042 </para>
13043 <para>
13044 Header names follow the syntax of RFC 2822, which states that they may contain
13045 any printing characters except space and colon. Consequently, curly brackets
13046 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13047 if they were variables. Attempting to do so causes a syntax error.
13048 </para>
13049 <para>
13050 Only header lines that are common to all copies of a message are visible to
13051 this mechanism. These are the original header lines that are received with the
13052 message, and any that are added by an ACL statement or by a system
13053 filter. Header lines that are added to a particular copy of a message by a
13054 router or transport are not accessible.
13055 </para>
13056 <para>
13057 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13058 before the DATA ACL, because the header structure is not set up until the
13059 message is received. Header lines that are added in a RCPT ACL (for example)
13060 are saved until the message&#x2019;s incoming header lines are available, at which
13061 point they are added. When a DATA ACL is running, however, header lines added
13062 by earlier ACLs are visible.
13063 </para>
13064 <para>
13065 Upper case and lower case letters are synonymous in header names. If the
13066 following character is white space, the terminating colon may be omitted, but
13067 this is not recommended, because you may then forget it when it is needed. When
13068 white space terminates the header name, it is included in the expanded string.
13069 If the message does not contain the given header, the expansion item is
13070 replaced by an empty string. (See the <option>def</option> condition in section
13071 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13072 </para>
13073 <para>
13074 If there is more than one header with the same name, they are all concatenated
13075 to form the substitution string, up to a maximum length of 64K. Unless
13076 <option>rheader</option> is being used, leading and trailing white space is removed from
13077 each header before concatenation, and a completely empty header is ignored. A
13078 newline character is then inserted between non-empty headers, but there is no
13079 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13080 those headers that contain lists of addresses, a comma is also inserted at the
13081 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13082 </para>
13083 </listitem></varlistentry>
13084 <varlistentry>
13085 <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>
13086 <listitem>
13087 <para>
13088 <indexterm role="concept">
13089 <primary>expansion</primary>
13090 <secondary>hmac hashing</secondary>
13091 </indexterm>
13092 <indexterm role="concept">
13093 <primary><option>hmac</option></primary>
13094 </indexterm>
13095 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13096 shared secret and some text into a message authentication code, as specified in
13097 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13098 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13099 cryptographic hash, allowing for authentication that is not possible with MD5
13100 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13101 present. For example:
13102 </para>
13103 <literallayout class="monospaced">
13104 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13105 </literallayout>
13106 <para>
13107 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13108 produces:
13109 </para>
13110 <literallayout class="monospaced">
13111 dd97e3ba5d1a61b5006108f8c8252953
13112 </literallayout>
13113 <para>
13114 As an example of how this might be used, you might put in the main part of
13115 an Exim configuration:
13116 </para>
13117 <literallayout class="monospaced">
13118 SPAMSCAN_SECRET=cohgheeLei2thahw
13119 </literallayout>
13120 <para>
13121 In a router or a transport you could then have:
13122 </para>
13123 <literallayout class="monospaced">
13124 headers_add = \
13125   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13126   ${hmac{md5}{SPAMSCAN_SECRET}\
13127   {${primary_hostname},${message_exim_id},$h_message-id:}}
13128 </literallayout>
13129 <para>
13130 Then given a message, you can check where it was scanned by looking at the
13131 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13132 this header line is authentic by recomputing the authentication code from the
13133 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13134 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13135 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13136 </para>
13137 </listitem></varlistentry>
13138 <varlistentry>
13139 <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>
13140 <listitem>
13141 <para>
13142 <indexterm role="concept">
13143 <primary>expansion</primary>
13144 <secondary>conditional</secondary>
13145 </indexterm>
13146 <indexterm role="concept">
13147 <primary><option>if</option>, expansion item</primary>
13148 </indexterm>
13149 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13150 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13151 in section <xref linkend="SECTexpcond"/> below. For example:
13152 </para>
13153 <literallayout class="monospaced">
13154 ${if eq {$local_part}{postmaster} {yes}{no} }
13155 </literallayout>
13156 <para>
13157 The second string need not be present; if it is not and the condition is not
13158 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13159 be present instead of the second string (without any curly brackets). In this
13160 case, the expansion is forced to fail if the condition is not true (see section
13161 <xref linkend="SECTforexpfai"/>).
13162 </para>
13163 <para>
13164 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13165 is true, and the empty string if the condition is false. This makes it less
13166 cumbersome to write custom ACL and router conditions. For example, instead of
13167 </para>
13168 <literallayout class="monospaced">
13169 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13170 </literallayout>
13171 <para>
13172 you can use
13173 </para>
13174 <literallayout class="monospaced">
13175 condition = ${if &gt;{$acl_m4}{3}}
13176 </literallayout>
13177 </listitem></varlistentry>
13178 <varlistentry>
13179 <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>
13180 <listitem>
13181 <para>
13182 <indexterm role="concept">
13183 <primary>expansion</primary>
13184 <secondary>string truncation</secondary>
13185 </indexterm>
13186 <indexterm role="concept">
13187 <primary><option>length</option> expansion item</primary>
13188 </indexterm>
13189 The <option>length</option> item is used to extract the initial portion of a string. Both
13190 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13191 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13192 change when expanded, you can use the simpler operator notation that avoids
13193 some of the braces:
13194 </para>
13195 <literallayout class="monospaced">
13196 ${length_&lt;n&gt;:&lt;string&gt;}
13197 </literallayout>
13198 <para>
13199 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13200 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13201 <option>strlen</option>, which gives the length of a string.
13202 </para>
13203 </listitem></varlistentry>
13204 <varlistentry>
13205 <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>
13206 <listitem>
13207 <para>
13208 This is the first of one of two different types of lookup item, which are both
13209 described in the next item.
13210 </para>
13211 </listitem></varlistentry>
13212 <varlistentry>
13213 <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>
13214 <listitem>
13215 <para>
13216 <indexterm role="concept">
13217 <primary>expansion</primary>
13218 <secondary>lookup in</secondary>
13219 </indexterm>
13220 <indexterm role="concept">
13221 <primary>file</primary>
13222 <secondary>lookups</secondary>
13223 </indexterm>
13224 <indexterm role="concept">
13225 <primary>lookup</primary>
13226 <secondary>in expanded string</secondary>
13227 </indexterm>
13228 The two forms of lookup item specify data lookups in files and databases, as
13229 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13230 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13231 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13232 </para>
13233 <para>
13234 If there is any white space in a lookup item which is part of a filter command,
13235 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13236 other place where white space is significant, the lookup item must be enclosed
13237 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13238 out by the system administrator.
13239 </para>
13240 <para>
13241 <indexterm role="variable">
13242 <primary><varname>$value</varname></primary>
13243 </indexterm>
13244 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13245 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13246 lookup. Afterwards it reverts to the value it had previously (at the outer
13247 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13248 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13249 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13250 lookup, thus providing a mechanism for looking up a default value when the
13251 original lookup fails.
13252 </para>
13253 <para>
13254 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13255 data for the outer lookup while the parameters of the second lookup are
13256 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13257 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13258 appear, and in this case, if the lookup fails, the entire expansion is forced
13259 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13260 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13261 successful lookup, and nothing in the case of failure.
13262 </para>
13263 <para>
13264 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13265 search type in order to do partial matching, and * or *@ may follow a search
13266 type to request default lookups if the key does not match (see sections
13267 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13268 </para>
13269 <para>
13270 <indexterm role="concept">
13271 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13272 <secondary>in lookup expansion</secondary>
13273 </indexterm>
13274 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13275 and non-wild parts of the key during the expansion of the replacement text.
13276 They return to their previous values at the end of the lookup item.
13277 </para>
13278 <para>
13279 This example looks up the postmaster alias in the conventional alias file:
13280 </para>
13281 <literallayout class="monospaced">
13282 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13283 </literallayout>
13284 <para>
13285 This example uses NIS+ to look up the full name of the user corresponding to
13286 the local part of an address, forcing the expansion to fail if it is not found:
13287 </para>
13288 <literallayout class="monospaced">
13289 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13290   {$value}fail}
13291 </literallayout>
13292 </listitem></varlistentry>
13293 <varlistentry>
13294 <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>
13295 <listitem>
13296 <para>
13297 <indexterm role="concept">
13298 <primary>expansion</primary>
13299 <secondary>list creation</secondary>
13300 </indexterm>
13301 <indexterm role="variable">
13302 <primary><varname>$item</varname></primary>
13303 </indexterm>
13304 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13305 default, but the separator can be changed in the usual way. For each item
13306 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13307 expanded and added to the output as an item in a new list. The separator used
13308 for the output list is the same as the one used for the input, but a separator
13309 setting is not included in the output. For example:
13310 </para>
13311 <literallayout class="monospaced">
13312 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13313 </literallayout>
13314 <para>
13315 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13316 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13317 and <emphasis role="bold">reduce</emphasis> expansion items.
13318 </para>
13319 </listitem></varlistentry>
13320 <varlistentry>
13321 <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>
13322 <listitem>
13323 <para>
13324 <indexterm role="concept">
13325 <primary>expansion</primary>
13326 <secondary>numeric hash</secondary>
13327 </indexterm>
13328 <indexterm role="concept">
13329 <primary>hash function</primary>
13330 <secondary>numeric</secondary>
13331 </indexterm>
13332 The three strings are expanded; the first two must yield numbers. Call them
13333 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13334 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13335 can use the simpler operator notation that avoids some of the braces:
13336 </para>
13337 <literallayout class="monospaced">
13338 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13339 </literallayout>
13340 <para>
13341 The second number is optional (in both notations). If there is only one number,
13342 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13343 processed by a div/mod hash function that returns two numbers, separated by a
13344 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13345 example,
13346 </para>
13347 <literallayout class="monospaced">
13348 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13349 </literallayout>
13350 <para>
13351 returns the string <quote>6/33</quote>.
13352 </para>
13353 </listitem></varlistentry>
13354 <varlistentry>
13355 <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>
13356 <listitem>
13357 <para>
13358 <indexterm role="concept">
13359 <primary>Perl</primary>
13360 <secondary>use in expanded string</secondary>
13361 </indexterm>
13362 <indexterm role="concept">
13363 <primary>expansion</primary>
13364 <secondary>calling Perl from</secondary>
13365 </indexterm>
13366 This item is available only if Exim has been built to include an embedded Perl
13367 interpreter. The subroutine name and the arguments are first separately
13368 expanded, and then the Perl subroutine is called with those arguments. No
13369 additional arguments need be given; the maximum number permitted, including the
13370 name of the subroutine, is nine.
13371 </para>
13372 <para>
13373 The return value of the subroutine is inserted into the expanded string, unless
13374 the return value is <option>undef</option>. In that case, the expansion fails in the same
13375 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13376 Whatever you return is evaluated in a scalar context. For example, if you
13377 return the name of a Perl vector, the return value is the size of the vector,
13378 not its contents.
13379 </para>
13380 <para>
13381 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13382 with the error message that was passed to <option>die</option>. More details of the embedded
13383 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13384 </para>
13385 <para>
13386 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13387 out the use of this expansion item in filter files.
13388 </para>
13389 </listitem></varlistentry>
13390 <varlistentry>
13391 <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>
13392 <listitem>
13393 <para>
13394 <indexterm role="concept">
13395 <primary><option>prvs</option> expansion item</primary>
13396 </indexterm>
13397 The first argument is a complete email address and the second is secret
13398 keystring. The third argument, specifying a key number, is optional. If absent,
13399 it defaults to 0. The result of the expansion is a prvs-signed email address,
13400 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13401 as part of a bounce address tag validation (BATV) scheme. For more discussion
13402 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13403 </para>
13404 </listitem></varlistentry>
13405 <varlistentry>
13406 <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>
13407 <listitem>
13408 <para>
13409 <indexterm role="concept">
13410 <primary><option>prvscheck</option> expansion item</primary>
13411 </indexterm>
13412 This expansion item is the complement of the <option>prvs</option> item. It is used for
13413 checking prvs-signed addresses. If the expansion of the first argument does not
13414 yield a syntactically valid prvs-signed address, the whole item expands to the
13415 empty string. When the first argument does expand to a syntactically valid
13416 prvs-signed address, the second argument is expanded, with the prvs-decoded
13417 version of the address and the key number extracted from the address in the
13418 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13419 </para>
13420 <para>
13421 These two variables can be used in the expansion of the second argument to
13422 retrieve the secret. The validity of the prvs-signed address is then checked
13423 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13424 which is empty for failure or <quote>1</quote> for success.
13425 </para>
13426 <para>
13427 The third argument is optional; if it is missing, it defaults to an empty
13428 string. This argument is now expanded. If the result is an empty string, the
13429 result of the expansion is the decoded version of the address. This is the case
13430 whether or not the signature was valid. Otherwise, the result of the expansion
13431 is the expansion of the third argument.
13432 </para>
13433 <para>
13434 All three variables can be used in the expansion of the third argument.
13435 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13436 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13437 </para>
13438 </listitem></varlistentry>
13439 <varlistentry>
13440 <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>
13441 <listitem>
13442 <para>
13443 <indexterm role="concept">
13444 <primary>expansion</primary>
13445 <secondary>inserting an entire file</secondary>
13446 </indexterm>
13447 <indexterm role="concept">
13448 <primary>file</primary>
13449 <secondary>inserting into expansion</secondary>
13450 </indexterm>
13451 <indexterm role="concept">
13452 <primary><option>readfile</option> expansion item</primary>
13453 </indexterm>
13454 The file name and end-of-line string are first expanded separately. The file is
13455 then read, and its contents replace the entire item. All newline characters in
13456 the file are replaced by the end-of-line string if it is present. Otherwise,
13457 newlines are left in the string.
13458 String expansion is not applied to the contents of the file. If you want this,
13459 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13460 the string expansion fails.
13461 </para>
13462 <para>
13463 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13464 locks out the use of this expansion item in filter files.
13465 </para>
13466 </listitem></varlistentry>
13467 <varlistentry>
13468 <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>
13469 <listitem>
13470 <para>
13471 <indexterm role="concept">
13472 <primary>expansion</primary>
13473 <secondary>inserting from a socket</secondary>
13474 </indexterm>
13475 <indexterm role="concept">
13476 <primary>socket, use of in expansion</primary>
13477 </indexterm>
13478 <indexterm role="concept">
13479 <primary><option>readsocket</option> expansion item</primary>
13480 </indexterm>
13481 This item inserts data from a Unix domain or Internet socket into the expanded
13482 string. The minimal way of using it uses just two arguments, as in these
13483 examples:
13484 </para>
13485 <literallayout class="monospaced">
13486 ${readsocket{/socket/name}{request string}}
13487 ${readsocket{inet:some.host:1234}{request string}}
13488 </literallayout>
13489 <para>
13490 For a Unix domain socket, the first substring must be the path to the socket.
13491 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13492 a host name or IP address, followed by a colon and a port, which can be a
13493 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13494 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13495 example:
13496 </para>
13497 <literallayout class="monospaced">
13498 ${readsocket{inet:[::1]:1234}{request string}}
13499 </literallayout>
13500 <para>
13501 Only a single host name may be given, but if looking it up yields more than
13502 one IP address, they are each tried in turn until a connection is made. For
13503 both kinds of socket, Exim makes a connection, writes the request string
13504 (unless it is an empty string) and reads from the socket until an end-of-file
13505 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13506 extend what can be done. Firstly, you can vary the timeout. For example:
13507 </para>
13508 <literallayout class="monospaced">
13509 ${readsocket{/socket/name}{request string}{3s}}
13510 </literallayout>
13511 <para>
13512 A fourth argument allows you to change any newlines that are in the data
13513 that is read, in the same way as for <option>readfile</option> (see above). This example
13514 turns them into spaces:
13515 </para>
13516 <literallayout class="monospaced">
13517 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13518 </literallayout>
13519 <para>
13520 As with all expansions, the substrings are expanded before the processing
13521 happens. Errors in these sub-expansions cause the expansion to fail. In
13522 addition, the following errors can occur:
13523 </para>
13524 <itemizedlist>
13525 <listitem>
13526 <para>
13527 Failure to create a socket file descriptor;
13528 </para>
13529 </listitem>
13530 <listitem>
13531 <para>
13532 Failure to connect the socket;
13533 </para>
13534 </listitem>
13535 <listitem>
13536 <para>
13537 Failure to write the request string;
13538 </para>
13539 </listitem>
13540 <listitem>
13541 <para>
13542 Timeout on reading from the socket.
13543 </para>
13544 </listitem>
13545 </itemizedlist>
13546 <para>
13547 By default, any of these errors causes the expansion to fail. However, if
13548 you supply a fifth substring, it is expanded and used when any of the above
13549 errors occurs. For example:
13550 </para>
13551 <literallayout class="monospaced">
13552 ${readsocket{/socket/name}{request string}{3s}{\n}\
13553   {socket failure}}
13554 </literallayout>
13555 <para>
13556 You can test for the existence of a Unix domain socket by wrapping this
13557 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13558 and the actual opening of the socket, so it is safer to use the fifth argument
13559 if you want to be absolutely sure of avoiding an expansion error for a
13560 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13561 </para>
13562 <para>
13563 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13564 locks out the use of this expansion item in filter files.
13565 </para>
13566 </listitem></varlistentry>
13567 <varlistentry>
13568 <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>
13569 <listitem>
13570 <para>
13571 <indexterm role="concept">
13572 <primary>expansion</primary>
13573 <secondary>reducing a list to a scalar</secondary>
13574 </indexterm>
13575 <indexterm role="concept">
13576 <primary>list</primary>
13577 <secondary>reducing to a scalar</secondary>
13578 </indexterm>
13579 <indexterm role="variable">
13580 <primary><varname>$value</varname></primary>
13581 </indexterm>
13582 <indexterm role="variable">
13583 <primary><varname>$item</varname></primary>
13584 </indexterm>
13585 This operation reduces a list to a single, scalar string. After expansion,
13586 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13587 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13588 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13589 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13590 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13591 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13592 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13593 number of ways. For example, to add up a list of numbers:
13594 </para>
13595 <literallayout class="monospaced">
13596 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13597 </literallayout>
13598 <para>
13599 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13600 can be found:
13601 </para>
13602 <literallayout class="monospaced">
13603 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13604 </literallayout>
13605 <para>
13606 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13607 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13608 expansion items.
13609 </para>
13610 </listitem></varlistentry>
13611 <varlistentry>
13612 <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>
13613 <listitem>
13614 <para>
13615 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13616 expansion item above.
13617 </para>
13618 </listitem></varlistentry>
13619 <varlistentry>
13620 <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>
13621 <listitem>
13622 <para>
13623 <indexterm role="concept">
13624 <primary>expansion</primary>
13625 <secondary>running a command</secondary>
13626 </indexterm>
13627 <indexterm role="concept">
13628 <primary><option>run</option> expansion item</primary>
13629 </indexterm>
13630 The command and its arguments are first expanded separately, and then the
13631 command is run in a separate process, but under the same uid and gid. As in
13632 other command executions from Exim, a shell is not used by default. If you want
13633 a shell, you must explicitly code it.
13634 </para>
13635 <para>
13636 The standard input for the command exists, but is empty. The standard output
13637 and standard error are set to the same file descriptor.
13638 <indexterm role="concept">
13639 <primary>return code</primary>
13640 <secondary>from <option>run</option> expansion</secondary>
13641 </indexterm>
13642 <indexterm role="variable">
13643 <primary><varname>$value</varname></primary>
13644 </indexterm>
13645 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13646 and replaces the entire item; during this expansion, the standard output/error
13647 from the command is in the variable <varname>$value</varname>. If the command fails,
13648 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13649 expansion, the standard output/error from the command is in the variable
13650 <varname>$value</varname>.
13651 </para>
13652 <para>
13653 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13654 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13655 command does not succeed. If both strings are omitted, the result is contents
13656 of the standard output/error on success, and nothing on failure.
13657 </para>
13658 <para>
13659 <indexterm role="variable">
13660 <primary><varname>$runrc</varname></primary>
13661 </indexterm>
13662 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13663 remains set afterwards, so in a filter file you can do things like this:
13664 </para>
13665 <literallayout class="monospaced">
13666 if "${run{x y z}{}}$runrc" is 1 then ...
13667   elif $runrc is 2 then ...
13668   ...
13669 endif
13670 </literallayout>
13671 <para>
13672 If execution of the command fails (for example, the command does not exist),
13673 the return code is 127 &ndash; the same code that shells use for non-existent
13674 commands.
13675 </para>
13676 <para>
13677 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13678 option values are expanded, except for those preconditions whose order of
13679 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13680 by the expansion of one option, and use it in another.
13681 </para>
13682 <para>
13683 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13684 out the use of this expansion item in filter files.
13685 </para>
13686 </listitem></varlistentry>
13687 <varlistentry>
13688 <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>
13689 <listitem>
13690 <para>
13691 <indexterm role="concept">
13692 <primary>expansion</primary>
13693 <secondary>string substitution</secondary>
13694 </indexterm>
13695 <indexterm role="concept">
13696 <primary><option>sg</option> expansion item</primary>
13697 </indexterm>
13698 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13699 option; hence its name. However, unlike the Perl equivalent, Exim does not
13700 modify the subject string; instead it returns the modified string for insertion
13701 into the overall expansion. The item takes three arguments: the subject string,
13702 a regular expression, and a substitution string. For example:
13703 </para>
13704 <literallayout class="monospaced">
13705 ${sg{abcdefabcdef}{abc}{xyz}}
13706 </literallayout>
13707 <para>
13708 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13709 if any $ or \ characters are required in the regular expression or in the
13710 substitution string, they have to be escaped. For example:
13711 </para>
13712 <literallayout class="monospaced">
13713 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13714 </literallayout>
13715 <para>
13716 yields <quote>defabc</quote>, and
13717 </para>
13718 <literallayout class="monospaced">
13719 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13720 </literallayout>
13721 <para>
13722 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13723 the regular expression from string expansion.
13724 </para>
13725 </listitem></varlistentry>
13726 <varlistentry>
13727 <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>
13728 <listitem>
13729 <para>
13730 <indexterm role="concept">
13731 <primary><option>substr</option> expansion item</primary>
13732 </indexterm>
13733 <indexterm role="concept">
13734 <primary>substring extraction</primary>
13735 </indexterm>
13736 <indexterm role="concept">
13737 <primary>expansion</primary>
13738 <secondary>substring extraction</secondary>
13739 </indexterm>
13740 The three strings are expanded; the first two must yield numbers. Call them
13741 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13742 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13743 can use the simpler operator notation that avoids some of the braces:
13744 </para>
13745 <literallayout class="monospaced">
13746 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13747 </literallayout>
13748 <para>
13749 The second number is optional (in both notations).
13750 If it is absent in the simpler format, the preceding underscore must also be
13751 omitted.
13752 </para>
13753 <para>
13754 The <option>substr</option> item can be used to extract more general substrings than
13755 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13756 length required. For example
13757 </para>
13758 <literallayout class="monospaced">
13759 ${substr{3}{2}{$local_part}}
13760 </literallayout>
13761 <para>
13762 If the starting offset is greater than the string length the result is the
13763 null string; if the length plus starting offset is greater than the string
13764 length, the result is the right-hand part of the string, starting from the
13765 given offset. The first character in the string has offset zero.
13766 </para>
13767 <para>
13768 The <option>substr</option> expansion item can take negative offset values to count
13769 from the right-hand end of its operand. The last character is offset -1, the
13770 second-last is offset -2, and so on. Thus, for example,
13771 </para>
13772 <literallayout class="monospaced">
13773 ${substr{-5}{2}{1234567}}
13774 </literallayout>
13775 <para>
13776 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13777 length of the string, the substring starts at the beginning of the string, and
13778 the length is reduced by the amount of overshoot. Thus, for example,
13779 </para>
13780 <literallayout class="monospaced">
13781 ${substr{-5}{2}{12}}
13782 </literallayout>
13783 <para>
13784 yields an empty string, but
13785 </para>
13786 <literallayout class="monospaced">
13787 ${substr{-3}{2}{12}}
13788 </literallayout>
13789 <para>
13790 yields <quote>1</quote>.
13791 </para>
13792 <para>
13793 When the second number is omitted from <option>substr</option>, the remainder of the string
13794 is taken if the offset is positive. If it is negative, all characters in the
13795 string preceding the offset point are taken. For example, an offset of -1 and
13796 no length, as in these semantically identical examples:
13797 </para>
13798 <literallayout class="monospaced">
13799 ${substr_-1:abcde}
13800 ${substr{-1}{abcde}}
13801 </literallayout>
13802 <para>
13803 yields all but the last character of the string, that is, <quote>abcd</quote>.
13804 </para>
13805 </listitem></varlistentry>
13806 <varlistentry>
13807 <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>
13808 <listitem>
13809 <para>
13810 <indexterm role="concept">
13811 <primary>expansion</primary>
13812 <secondary>character translation</secondary>
13813 </indexterm>
13814 <indexterm role="concept">
13815 <primary><option>tr</option> expansion item</primary>
13816 </indexterm>
13817 This item does single-character translation on its subject string. The second
13818 argument is a list of characters to be translated in the subject string. Each
13819 matching character is replaced by the corresponding character from the
13820 replacement list. For example
13821 </para>
13822 <literallayout class="monospaced">
13823 ${tr{abcdea}{ac}{13}}
13824 </literallayout>
13825 <para>
13826 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13827 last occurrence is used. If the third string is shorter than the second, its
13828 last character is replicated. However, if it is empty, no translation takes
13829 place.
13830 </para>
13831 </listitem></varlistentry>
13832 </variablelist>
13833 </section>
13834 <section id="SECTexpop">
13835 <title>Expansion operators</title>
13836 <para>
13837 <indexterm role="concept">
13838 <primary>expansion</primary>
13839 <secondary>operators</secondary>
13840 </indexterm>
13841 For expansion items that perform transformations on a single argument string,
13842 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13843 The substring is first expanded before the operation is applied to it. The
13844 following operations can be performed:
13845 </para>
13846 <variablelist>
13847 <varlistentry>
13848 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13849 <listitem>
13850 <para>
13851 <indexterm role="concept">
13852 <primary>expansion</primary>
13853 <secondary>RFC 2822 address handling</secondary>
13854 </indexterm>
13855 <indexterm role="concept">
13856 <primary><option>address</option> expansion item</primary>
13857 </indexterm>
13858 The string is interpreted as an RFC 2822 address, as it might appear in a
13859 header line, and the effective address is extracted from it. If the string does
13860 not parse successfully, the result is empty.
13861 </para>
13862 </listitem></varlistentry>
13863 <varlistentry>
13864 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13865 <listitem>
13866 <para>
13867 <indexterm role="concept">
13868 <primary>expansion</primary>
13869 <secondary>RFC 2822 address handling</secondary>
13870 </indexterm>
13871 <indexterm role="concept">
13872 <primary><option>addresses</option> expansion item</primary>
13873 </indexterm>
13874 The string (after expansion) is interpreted as a list of addresses in RFC
13875 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13876 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13877 result of the expansion is a colon-separated list, with appropriate
13878 doubling of colons should any happen to be present in the email addresses.
13879 Syntactically invalid RFC2822 address items are omitted from the output.
13880 </para>
13881 <para>
13882 It is possible to specify a character other than colon for the output
13883 separator by starting the string with &gt; followed by the new separator
13884 character. For example:
13885 </para>
13886 <literallayout class="monospaced">
13887 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
13888 </literallayout>
13889 <para>
13890 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13891 expansion item, which extracts the working address from a single RFC2822
13892 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13893 processing lists.
13894 </para>
13895 </listitem></varlistentry>
13896 <varlistentry>
13897 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13898 <listitem>
13899 <para>
13900 <indexterm role="concept">
13901 <primary><option>base62</option> expansion item</primary>
13902 </indexterm>
13903 <indexterm role="concept">
13904 <primary>expansion</primary>
13905 <secondary>conversion to base 62</secondary>
13906 </indexterm>
13907 The string must consist entirely of decimal digits. The number is converted to
13908 base 62 and output as a string of six characters, including leading zeros. In
13909 the few operating environments where Exim uses base 36 instead of base 62 for
13910 its message identifiers (because those systems do not have case-sensitive file
13911 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13912 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13913 </para>
13914 </listitem></varlistentry>
13915 <varlistentry>
13916 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13917 <listitem>
13918 <para>
13919 <indexterm role="concept">
13920 <primary><option>base62d</option> expansion item</primary>
13921 </indexterm>
13922 <indexterm role="concept">
13923 <primary>expansion</primary>
13924 <secondary>conversion to base 62</secondary>
13925 </indexterm>
13926 The string must consist entirely of base-62 digits, or, in operating
13927 environments where Exim uses base 36 instead of base 62 for its message
13928 identifiers, base-36 digits. The number is converted to decimal and output as a
13929 string.
13930 </para>
13931 </listitem></varlistentry>
13932 <varlistentry>
13933 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13934 <listitem>
13935 <para>
13936 <indexterm role="concept">
13937 <primary>domain</primary>
13938 <secondary>extraction</secondary>
13939 </indexterm>
13940 <indexterm role="concept">
13941 <primary>expansion</primary>
13942 <secondary>domain extraction</secondary>
13943 </indexterm>
13944 The string is interpreted as an RFC 2822 address and the domain is extracted
13945 from it. If the string does not parse successfully, the result is empty.
13946 </para>
13947 </listitem></varlistentry>
13948 <varlistentry>
13949 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13950 <listitem>
13951 <para>
13952 <indexterm role="concept">
13953 <primary>expansion</primary>
13954 <secondary>escaping non-printing characters</secondary>
13955 </indexterm>
13956 <indexterm role="concept">
13957 <primary><option>escape</option> expansion item</primary>
13958 </indexterm>
13959 If the string contains any non-printing characters, they are converted to
13960 escape sequences starting with a backslash. Whether characters with the most
13961 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13962 is controlled by the <option>print_topbitchars</option> option.
13963 </para>
13964 </listitem></varlistentry>
13965 <varlistentry>
13966 <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>
13967 <listitem>
13968 <para>
13969 <indexterm role="concept">
13970 <primary>expansion</primary>
13971 <secondary>expression evaluation</secondary>
13972 </indexterm>
13973 <indexterm role="concept">
13974 <primary>expansion</primary>
13975 <secondary>arithmetic expression</secondary>
13976 </indexterm>
13977 <indexterm role="concept">
13978 <primary><option>eval</option> expansion item</primary>
13979 </indexterm>
13980 These items supports simple arithmetic and bitwise logical operations in
13981 expansion strings. The string (after expansion) must be a conventional
13982 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
13983 logical operators, and parentheses. All operations are carried out using
13984 integer arithmetic. The operator priorities are as follows (the same as in the
13985 C programming language):
13986 </para>
13987 <informaltable frame="none">
13988 <tgroup cols="2" colsep="0" rowsep="0">
13989 <colspec colwidth="70pt" align="left"/>
13990 <colspec colwidth="300pt" align="left"/>
13991 <tbody>
13992 <row>
13993 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
13994 <entry>not (~), negate (-)</entry>
13995 </row>
13996 <row>
13997 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13998 <entry>multiply (*), divide (/), remainder (%)</entry>
13999 </row>
14000 <row>
14001 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14002 <entry>plus (+), minus (-)</entry>
14003 </row>
14004 <row>
14005 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14006 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14007 </row>
14008 <row>
14009 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14010 <entry>and (&amp;)</entry>
14011 </row>
14012 <row>
14013 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14014 <entry>xor (^)</entry>
14015 </row>
14016 <row>
14017 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14018 <entry>or (|)</entry>
14019 </row>
14020 </tbody>
14021 </tgroup>
14022 </informaltable>
14023 <para>
14024 Binary operators with the same priority are evaluated from left to right. White
14025 space is permitted before or after operators.
14026 </para>
14027 <para>
14028 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14029 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14030 decimal, even if they start with a leading zero; hexadecimal numbers are not
14031 permitted. This can be useful when processing numbers extracted from dates or
14032 times, which often do have leading zeros.
14033 </para>
14034 <para>
14035 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14036 respectively. Negative numbers are supported. The result of the computation is
14037 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14038 </para>
14039 <literallayout>
14040 <literal>${eval:1+1}            </literal>  yields 2
14041 <literal>${eval:1+2*3}          </literal>  yields 7
14042 <literal>${eval:(1+2)*3}        </literal>  yields 9
14043 <literal>${eval:2+42%5}         </literal>  yields 4
14044 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14045 <literal>${eval:0xc|5}          </literal>  yields 13
14046 <literal>${eval:0xc^5}          </literal>  yields 9
14047 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14048 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14049 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14050 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14051 </literallayout>
14052 <para>
14053 As a more realistic example, in an ACL you might have
14054 </para>
14055 <literallayout class="monospaced">
14056 deny   message = Too many bad recipients
14057        condition =                    \
14058          ${if and {                   \
14059            {&gt;{$rcpt_count}{10}}       \
14060            {                          \
14061            &lt;                          \
14062              {$recipients_count}      \
14063              {${eval:$rcpt_count/2}}  \
14064            }                          \
14065          }{yes}{no}}
14066 </literallayout>
14067 <para>
14068 The condition is true if there have been more than 10 RCPT commands and
14069 fewer than half of them have resulted in a valid recipient.
14070 </para>
14071 </listitem></varlistentry>
14072 <varlistentry>
14073 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14074 <listitem>
14075 <para>
14076 <indexterm role="concept">
14077 <primary>expansion</primary>
14078 <secondary>re-expansion of substring</secondary>
14079 </indexterm>
14080 The <option>expand</option> operator causes a string to be expanded for a second time. For
14081 example,
14082 </para>
14083 <literallayout class="monospaced">
14084 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14085 </literallayout>
14086 <para>
14087 first looks up a string in a file while expanding the operand for <option>expand</option>,
14088 and then re-expands what it has found.
14089 </para>
14090 </listitem></varlistentry>
14091 <varlistentry>
14092 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14093 <listitem>
14094 <para>
14095 <indexterm role="concept">
14096 <primary>Unicode</primary>
14097 </indexterm>
14098 <indexterm role="concept">
14099 <primary>UTF-8</primary>
14100 <secondary>conversion from</secondary>
14101 </indexterm>
14102 <indexterm role="concept">
14103 <primary>expansion</primary>
14104 <secondary>UTF-8 conversion</secondary>
14105 </indexterm>
14106 <indexterm role="concept">
14107 <primary><option>from_utf8</option> expansion item</primary>
14108 </indexterm>
14109 The world is slowly moving towards Unicode, although there are no standards for
14110 email yet. However, other applications (including some databases) are starting
14111 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14112 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14113 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14114 the result is an undefined sequence of bytes.
14115 </para>
14116 <para>
14117 Unicode code points with values less than 256 are compatible with ASCII and
14118 ISO-8859-1 (also known as Latin-1).
14119 For example, character 169 is the copyright symbol in both cases, though the
14120 way it is encoded is different. In UTF-8, more than one byte is needed for
14121 characters with code values greater than 127, whereas ISO-8859-1 is a
14122 single-byte encoding (but thereby limited to 256 characters). This makes
14123 translation from UTF-8 to ISO-8859-1 straightforward.
14124 </para>
14125 </listitem></varlistentry>
14126 <varlistentry>
14127 <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>
14128 <listitem>
14129 <para>
14130 <indexterm role="concept">
14131 <primary>hash function</primary>
14132 <secondary>textual</secondary>
14133 </indexterm>
14134 <indexterm role="concept">
14135 <primary>expansion</primary>
14136 <secondary>textual hash</secondary>
14137 </indexterm>
14138 The <option>hash</option> operator is a simpler interface to the hashing function that can
14139 be used when the two parameters are fixed numbers (as opposed to strings that
14140 change when expanded). The effect is the same as
14141 </para>
14142 <literallayout class="monospaced">
14143 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14144 </literallayout>
14145 <para>
14146 See the description of the general <option>hash</option> item above for details. The
14147 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14148 </para>
14149 </listitem></varlistentry>
14150 <varlistentry>
14151 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14152 <listitem>
14153 <para>
14154 <indexterm role="concept">
14155 <primary>base64 encoding</primary>
14156 <secondary>conversion from hex</secondary>
14157 </indexterm>
14158 <indexterm role="concept">
14159 <primary>expansion</primary>
14160 <secondary>hex to base64</secondary>
14161 </indexterm>
14162 <indexterm role="concept">
14163 <primary><option>hex2b64</option> expansion item</primary>
14164 </indexterm>
14165 This operator converts a hex string into one that is base64 encoded. This can
14166 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14167 </para>
14168 </listitem></varlistentry>
14169 <varlistentry>
14170 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14171 <listitem>
14172 <para>
14173 <indexterm role="concept">
14174 <primary>case forcing in strings</primary>
14175 </indexterm>
14176 <indexterm role="concept">
14177 <primary>string</primary>
14178 <secondary>case forcing</secondary>
14179 </indexterm>
14180 <indexterm role="concept">
14181 <primary>lower casing</primary>
14182 </indexterm>
14183 <indexterm role="concept">
14184 <primary>expansion</primary>
14185 <secondary>case forcing</secondary>
14186 </indexterm>
14187 <indexterm role="concept">
14188 <primary><option>lc</option> expansion item</primary>
14189 </indexterm>
14190 This forces the letters in the string into lower-case, for example:
14191 </para>
14192 <literallayout class="monospaced">
14193 ${lc:$local_part}
14194 </literallayout>
14195 </listitem></varlistentry>
14196 <varlistentry>
14197 <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>
14198 <listitem>
14199 <para>
14200 <indexterm role="concept">
14201 <primary>expansion</primary>
14202 <secondary>string truncation</secondary>
14203 </indexterm>
14204 <indexterm role="concept">
14205 <primary><option>length</option> expansion item</primary>
14206 </indexterm>
14207 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14208 can be used when the parameter is a fixed number (as opposed to a string that
14209 changes when expanded). The effect is the same as
14210 </para>
14211 <literallayout class="monospaced">
14212 ${length{&lt;number&gt;}{&lt;string&gt;}}
14213 </literallayout>
14214 <para>
14215 See the description of the general <option>length</option> item above for details. Note that
14216 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14217 when <option>length</option> is used as an operator.
14218 </para>
14219 </listitem></varlistentry>
14220 <varlistentry>
14221 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14222 <listitem>
14223 <para>
14224 <indexterm role="concept">
14225 <primary>expansion</primary>
14226 <secondary>local part extraction</secondary>
14227 </indexterm>
14228 <indexterm role="concept">
14229 <primary><option>local_part</option> expansion item</primary>
14230 </indexterm>
14231 The string is interpreted as an RFC 2822 address and the local part is
14232 extracted from it. If the string does not parse successfully, the result is
14233 empty.
14234 </para>
14235 </listitem></varlistentry>
14236 <varlistentry>
14237 <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>
14238 <listitem>
14239 <para>
14240 <indexterm role="concept">
14241 <primary>masked IP address</primary>
14242 </indexterm>
14243 <indexterm role="concept">
14244 <primary>IP address</primary>
14245 <secondary>masking</secondary>
14246 </indexterm>
14247 <indexterm role="concept">
14248 <primary>CIDR notation</primary>
14249 </indexterm>
14250 <indexterm role="concept">
14251 <primary>expansion</primary>
14252 <secondary>IP address masking</secondary>
14253 </indexterm>
14254 <indexterm role="concept">
14255 <primary><option>mask</option> expansion item</primary>
14256 </indexterm>
14257 If the form of the string to be operated on is not an IP address followed by a
14258 slash and an integer (that is, a network address in CIDR notation), the
14259 expansion fails. Otherwise, this operator converts the IP address to binary,
14260 masks off the least significant bits according to the bit count, and converts
14261 the result back to text, with mask appended. For example,
14262 </para>
14263 <literallayout class="monospaced">
14264 ${mask:10.111.131.206/28}
14265 </literallayout>
14266 <para>
14267 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14268 be mostly used for looking up masked addresses in files, the result for an IPv6
14269 address uses dots to separate components instead of colons, because colon
14270 terminates a key string in lsearch files. So, for example,
14271 </para>
14272 <literallayout class="monospaced">
14273 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14274 </literallayout>
14275 <para>
14276 returns the string
14277 </para>
14278 <literallayout class="monospaced">
14279 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14280 </literallayout>
14281 <para>
14282 Letters in IPv6 addresses are always output in lower case.
14283 </para>
14284 </listitem></varlistentry>
14285 <varlistentry>
14286 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14287 <listitem>
14288 <para>
14289 <indexterm role="concept">
14290 <primary>MD5 hash</primary>
14291 </indexterm>
14292 <indexterm role="concept">
14293 <primary>expansion</primary>
14294 <secondary>MD5 hash</secondary>
14295 </indexterm>
14296 <indexterm role="concept">
14297 <primary><option>md5</option> expansion item</primary>
14298 </indexterm>
14299 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14300 as a 32-digit hexadecimal number, in which any letters are in lower case.
14301 </para>
14302 </listitem></varlistentry>
14303 <varlistentry>
14304 <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>
14305 <listitem>
14306 <para>
14307 <indexterm role="concept">
14308 <primary>expansion</primary>
14309 <secondary>numeric hash</secondary>
14310 </indexterm>
14311 <indexterm role="concept">
14312 <primary>hash function</primary>
14313 <secondary>numeric</secondary>
14314 </indexterm>
14315 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14316 that can be used when the two parameters are fixed numbers (as opposed to
14317 strings that change when expanded). The effect is the same as
14318 </para>
14319 <literallayout class="monospaced">
14320 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14321 </literallayout>
14322 <para>
14323 See the description of the general <option>nhash</option> item above for details.
14324 </para>
14325 </listitem></varlistentry>
14326 <varlistentry>
14327 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14328 <listitem>
14329 <para>
14330 <indexterm role="concept">
14331 <primary>quoting</primary>
14332 <secondary>in string expansions</secondary>
14333 </indexterm>
14334 <indexterm role="concept">
14335 <primary>expansion</primary>
14336 <secondary>quoting</secondary>
14337 </indexterm>
14338 <indexterm role="concept">
14339 <primary><option>quote</option> expansion item</primary>
14340 </indexterm>
14341 The <option>quote</option> operator puts its argument into double quotes if it
14342 is an empty string or
14343 contains anything other than letters, digits, underscores, dots, and hyphens.
14344 Any occurrences of double quotes and backslashes are escaped with a backslash.
14345 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14346 respectively For example,
14347 </para>
14348 <literallayout class="monospaced">
14349 ${quote:ab"*"cd}
14350 </literallayout>
14351 <para>
14352 becomes
14353 </para>
14354 <literallayout class="monospaced">
14355 "ab\"*\"cd"
14356 </literallayout>
14357 <para>
14358 The place where this is useful is when the argument is a substitution from a
14359 variable or a message header.
14360 </para>
14361 </listitem></varlistentry>
14362 <varlistentry>
14363 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14364 <listitem>
14365 <para>
14366 <indexterm role="concept">
14367 <primary><option>quote_local_part</option> expansion item</primary>
14368 </indexterm>
14369 This operator is like <option>quote</option>, except that it quotes the string only if
14370 required to do so by the rules of RFC 2822 for quoting local parts. For
14371 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14372 If you are creating a new email address from the contents of <varname>$local_part</varname>
14373 (or any other unknown data), you should always use this operator.
14374 </para>
14375 </listitem></varlistentry>
14376 <varlistentry>
14377 <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>
14378 <listitem>
14379 <para>
14380 <indexterm role="concept">
14381 <primary>quoting</primary>
14382 <secondary>lookup-specific</secondary>
14383 </indexterm>
14384 This operator applies lookup-specific quoting rules to the string. Each
14385 query-style lookup type has its own quoting rules which are described with
14386 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14387 </para>
14388 <literallayout class="monospaced">
14389 ${quote_ldap:two * two}
14390 </literallayout>
14391 <para>
14392 returns
14393 </para>
14394 <literallayout class="monospaced">
14395 two%20%5C2A%20two
14396 </literallayout>
14397 <para>
14398 For single-key lookup types, no quoting is ever necessary and this operator
14399 yields an unchanged string.
14400 </para>
14401 </listitem></varlistentry>
14402 <varlistentry>
14403 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14404 <listitem>
14405 <para>
14406 <indexterm role="concept">
14407 <primary>expansion</primary>
14408 <secondary>RFC 2047</secondary>
14409 </indexterm>
14410 <indexterm role="concept">
14411 <primary>RFC 2047</primary>
14412 <secondary>expansion operator</secondary>
14413 </indexterm>
14414 <indexterm role="concept">
14415 <primary><option>rfc2047</option> expansion item</primary>
14416 </indexterm>
14417 This operator encodes text according to the rules of RFC 2047. This is an
14418 encoding that is used in header lines to encode non-ASCII characters. It is
14419 assumed that the input string is in the encoding specified by the
14420 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14421 contains only characters in the range 33&ndash;126, and no instances of the
14422 characters
14423 </para>
14424 <literallayout class="monospaced">
14425 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14426 </literallayout>
14427 <para>
14428 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14429 string, using as many <quote>encoded words</quote> as necessary to encode all the
14430 characters.
14431 </para>
14432 </listitem></varlistentry>
14433 <varlistentry>
14434 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14435 <listitem>
14436 <para>
14437 <indexterm role="concept">
14438 <primary>expansion</primary>
14439 <secondary>RFC 2047</secondary>
14440 </indexterm>
14441 <indexterm role="concept">
14442 <primary>RFC 2047</primary>
14443 <secondary>decoding</secondary>
14444 </indexterm>
14445 <indexterm role="concept">
14446 <primary><option>rfc2047d</option> expansion item</primary>
14447 </indexterm>
14448 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14449 bytes are replaced by question marks. Characters are converted into the
14450 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14451 not recognized unless <option>check_rfc2047_length</option> is set false.
14452 </para>
14453 <para>
14454 <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
14455 access a header line, RFC 2047 decoding is done automatically. You do not need
14456 to use this operator as well.
14457 </para>
14458 </listitem></varlistentry>
14459 <varlistentry>
14460 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14461 <listitem>
14462 <para>
14463 <indexterm role="concept">
14464 <primary>quoting</primary>
14465 <secondary>in regular expressions</secondary>
14466 </indexterm>
14467 <indexterm role="concept">
14468 <primary>regular expressions</primary>
14469 <secondary>quoting</secondary>
14470 </indexterm>
14471 <indexterm role="concept">
14472 <primary><option>rxquote</option> expansion item</primary>
14473 </indexterm>
14474 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14475 characters in its argument. This is useful when substituting the values of
14476 variables or headers inside regular expressions.
14477 </para>
14478 </listitem></varlistentry>
14479 <varlistentry>
14480 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14481 <listitem>
14482 <para>
14483 <indexterm role="concept">
14484 <primary>SHA-1 hash</primary>
14485 </indexterm>
14486 <indexterm role="concept">
14487 <primary>expansion</primary>
14488 <secondary>SHA-1 hashing</secondary>
14489 </indexterm>
14490 <indexterm role="concept">
14491 <primary><option>sha2</option> expansion item</primary>
14492 </indexterm>
14493 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14494 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14495 </para>
14496 </listitem></varlistentry>
14497 <varlistentry>
14498 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14499 <listitem>
14500 <para>
14501 <indexterm role="concept">
14502 <primary>expansion</primary>
14503 <secondary>statting a file</secondary>
14504 </indexterm>
14505 <indexterm role="concept">
14506 <primary>file</primary>
14507 <secondary>extracting characteristics</secondary>
14508 </indexterm>
14509 <indexterm role="concept">
14510 <primary><option>stat</option> expansion item</primary>
14511 </indexterm>
14512 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14513 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14514 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14515 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14516 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14517 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14518 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14519 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14520 can extract individual fields using the <option>extract</option> expansion item.
14521 </para>
14522 <para>
14523 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14524 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14525 systems for files larger than 2GB.
14526 </para>
14527 </listitem></varlistentry>
14528 <varlistentry>
14529 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14530 <listitem>
14531 <para>
14532 <indexterm role="concept">
14533 <primary>expansion</primary>
14534 <secondary>base64 encoding</secondary>
14535 </indexterm>
14536 <indexterm role="concept">
14537 <primary>base64 encoding</primary>
14538 <secondary>in string expansion</secondary>
14539 </indexterm>
14540 <indexterm role="concept">
14541 <primary><option>str2b64</option> expansion item</primary>
14542 </indexterm>
14543 This operator converts a string into one that is base64 encoded.
14544 </para>
14545 </listitem></varlistentry>
14546 <varlistentry>
14547 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14548 <listitem>
14549 <para>
14550 <indexterm role="concept">
14551 <primary>expansion</primary>
14552 <secondary>string length</secondary>
14553 </indexterm>
14554 <indexterm role="concept">
14555 <primary>string</primary>
14556 <secondary>length in expansion</secondary>
14557 </indexterm>
14558 <indexterm role="concept">
14559 <primary><option>strlen</option> expansion item</primary>
14560 </indexterm>
14561 The item is replace by the length of the expanded string, expressed as a
14562 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14563 </para>
14564 </listitem></varlistentry>
14565 <varlistentry>
14566 <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>
14567 <listitem>
14568 <para>
14569 <indexterm role="concept">
14570 <primary><option>substr</option> expansion item</primary>
14571 </indexterm>
14572 <indexterm role="concept">
14573 <primary>substring extraction</primary>
14574 </indexterm>
14575 <indexterm role="concept">
14576 <primary>expansion</primary>
14577 <secondary>substring expansion</secondary>
14578 </indexterm>
14579 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14580 can be used when the two parameters are fixed numbers (as opposed to strings
14581 that change when expanded). The effect is the same as
14582 </para>
14583 <literallayout class="monospaced">
14584 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14585 </literallayout>
14586 <para>
14587 See the description of the general <option>substr</option> item above for details. The
14588 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14589 </para>
14590 </listitem></varlistentry>
14591 <varlistentry>
14592 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14593 <listitem>
14594 <para>
14595 <indexterm role="concept">
14596 <primary><option>time_eval</option> expansion item</primary>
14597 </indexterm>
14598 <indexterm role="concept">
14599 <primary>time interval</primary>
14600 <secondary>decoding</secondary>
14601 </indexterm>
14602 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14603 seconds.
14604 </para>
14605 </listitem></varlistentry>
14606 <varlistentry>
14607 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14608 <listitem>
14609 <para>
14610 <indexterm role="concept">
14611 <primary><option>time_interval</option> expansion item</primary>
14612 </indexterm>
14613 <indexterm role="concept">
14614 <primary>time interval</primary>
14615 <secondary>formatting</secondary>
14616 </indexterm>
14617 The argument (after sub-expansion) must be a sequence of decimal digits that
14618 represents an interval of time as a number of seconds. It is converted into a
14619 number of larger units and output in Exim&#x2019;s normal time format, for example,
14620 <literal>1w3d4h2m6s</literal>.
14621 </para>
14622 </listitem></varlistentry>
14623 <varlistentry>
14624 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14625 <listitem>
14626 <para>
14627 <indexterm role="concept">
14628 <primary>case forcing in strings</primary>
14629 </indexterm>
14630 <indexterm role="concept">
14631 <primary>string</primary>
14632 <secondary>case forcing</secondary>
14633 </indexterm>
14634 <indexterm role="concept">
14635 <primary>upper casing</primary>
14636 </indexterm>
14637 <indexterm role="concept">
14638 <primary>expansion</primary>
14639 <secondary>case forcing</secondary>
14640 </indexterm>
14641 <indexterm role="concept">
14642 <primary><option>uc</option> expansion item</primary>
14643 </indexterm>
14644 This forces the letters in the string into upper-case.
14645 </para>
14646 </listitem></varlistentry>
14647 </variablelist>
14648 </section>
14649 <section id="SECTexpcond">
14650 <title>Expansion conditions</title>
14651 <para>
14652 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14653 <primary>expansion</primary>
14654 <secondary>conditions</secondary>
14655 </indexterm>
14656 The following conditions are available for testing by the <option>${if</option> construct
14657 while expanding strings:
14658 </para>
14659 <variablelist>
14660 <varlistentry>
14661 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14662 <listitem>
14663 <para>
14664 <indexterm role="concept">
14665 <primary>expansion</primary>
14666 <secondary>negating a condition</secondary>
14667 </indexterm>
14668 <indexterm role="concept">
14669 <primary>negation</primary>
14670 <secondary>in expansion condition</secondary>
14671 </indexterm>
14672 Preceding any condition with an exclamation mark negates the result of the
14673 condition.
14674 </para>
14675 </listitem></varlistentry>
14676 <varlistentry>
14677 <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>
14678 <listitem>
14679 <para>
14680 <indexterm role="concept">
14681 <primary>numeric comparison</primary>
14682 </indexterm>
14683 <indexterm role="concept">
14684 <primary>expansion</primary>
14685 <secondary>numeric comparison</secondary>
14686 </indexterm>
14687 There are a number of symbolic operators for doing numeric comparisons. They
14688 are:
14689 </para>
14690 <literallayout>
14691 <literal>=   </literal>   equal
14692 <literal>==  </literal>   equal
14693 <literal>&gt;   </literal>   greater
14694 <literal>&gt;=  </literal>   greater or equal
14695 <literal>&lt;   </literal>   less
14696 <literal>&lt;=  </literal>   less or equal
14697 </literallayout>
14698 <para>
14699 For example:
14700 </para>
14701 <literallayout class="monospaced">
14702 ${if &gt;{$message_size}{10M} ...
14703 </literallayout>
14704 <para>
14705 Note that the general negation operator provides for inequality testing. The
14706 two strings must take the form of optionally signed decimal integers,
14707 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14708 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14709 As a special case, the numerical value of an empty string is taken as
14710 zero.
14711 </para>
14712 </listitem></varlistentry>
14713 <varlistentry revisionflag="changed">
14714 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14715 <listitem>
14716 <para revisionflag="changed">
14717 <indexterm role="concept">
14718 <primary>expansion</primary>
14719 <secondary>boolean parsing</secondary>
14720 </indexterm>
14721 <indexterm role="concept">
14722 <primary><option>bool</option> expansion condition</primary>
14723 </indexterm>
14724 This condition turns a string holding a true or false representation into
14725 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14726 (case-insensitively); also positive integer numbers map to true if non-zero,
14727 false if zero.  Leading whitespace is ignored.
14728 All other string values will result in expansion failure.
14729 </para>
14730 <para revisionflag="changed">
14731 When combined with ACL variables, this expansion condition will let you
14732 make decisions in one place and act on those decisions in another place.
14733 For example,
14734 </para>
14735 <literallayout class="monospaced" revisionflag="changed">
14736 ${if bool{$acl_m_privileged_sender} ...
14737 </literallayout>
14738 </listitem></varlistentry>
14739 <varlistentry>
14740 <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>
14741 <listitem>
14742 <para>
14743 <indexterm role="concept">
14744 <primary>expansion</primary>
14745 <secondary>encrypted comparison</secondary>
14746 </indexterm>
14747 <indexterm role="concept">
14748 <primary>encrypted strings, comparing</primary>
14749 </indexterm>
14750 <indexterm role="concept">
14751 <primary><option>crypteq</option> expansion condition</primary>
14752 </indexterm>
14753 This condition is included in the Exim binary if it is built to support any
14754 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14755 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14756 included in the binary.
14757 </para>
14758 <para>
14759 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14760 compared against the second, which is already encrypted. The second string may
14761 be in the LDAP form for storing encrypted strings, which starts with the
14762 encryption type in curly brackets, followed by the data. If the second string
14763 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14764 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14765 Typically this will be a field from a password file. An example of an encrypted
14766 string in LDAP form is:
14767 </para>
14768 <literallayout class="monospaced">
14769 {md5}CY9rzUYh03PK3k6DJie09g==
14770 </literallayout>
14771 <para>
14772 If such a string appears directly in an expansion, the curly brackets have to
14773 be quoted, because they are part of the expansion syntax. For example:
14774 </para>
14775 <literallayout class="monospaced">
14776 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14777 </literallayout>
14778 <para>
14779 The following encryption types (whose names are matched case-independently) are
14780 supported:
14781 </para>
14782 <itemizedlist>
14783 <listitem>
14784 <para>
14785 <indexterm role="concept">
14786 <primary>MD5 hash</primary>
14787 </indexterm>
14788 <indexterm role="concept">
14789 <primary>base64 encoding</primary>
14790 <secondary>in encrypted password</secondary>
14791 </indexterm>
14792 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14793 printable characters to compare with the remainder of the second string. If the
14794 length of the comparison string is 24, Exim assumes that it is base64 encoded
14795 (as in the above example). If the length is 32, Exim assumes that it is a
14796 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14797 comparison fails.
14798 </para>
14799 </listitem>
14800 <listitem>
14801 <para>
14802 <indexterm role="concept">
14803 <primary>SHA-1 hash</primary>
14804 </indexterm>
14805 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14806 printable characters to compare with the remainder of the second string. If the
14807 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14808 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14809 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14810 </para>
14811 </listitem>
14812 <listitem>
14813 <para>
14814 <indexterm role="concept">
14815 <primary><function>crypt()</function></primary>
14816 </indexterm>
14817 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14818 only the first eight characters of the password. However, in modern operating
14819 systems this is no longer true, and in many cases the entire password is used,
14820 whatever its length.
14821 </para>
14822 </listitem>
14823 <listitem>
14824 <para>
14825 <indexterm role="concept">
14826 <primary><function>crypt16()</function></primary>
14827 </indexterm>
14828 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14829 use up to 16 characters of the password in some operating systems. Again, in
14830 modern operating systems, more characters may be used.
14831 </para>
14832 </listitem>
14833 </itemizedlist>
14834 <para>
14835 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14836 <function>crypt()</function>. For operating systems that have their own version, setting
14837 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14838 operating system version instead of its own. This option is set by default in
14839 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14840 support <function>crypt16()</function>.
14841 </para>
14842 <para>
14843 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
14844 it was not using the same algorithm as some operating systems&#x2019; versions. It
14845 turns out that as well as <function>crypt16()</function> there is a function called
14846 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14847 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
14848 </para>
14849 <para>
14850 However, since there is now a move away from the traditional <function>crypt()</function>
14851 functions towards using SHA1 and other algorithms, tidying up this area of
14852 Exim is seen as very low priority.
14853 </para>
14854 <para>
14855 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14856 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14857 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14858 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14859 function by specifying it explicitly in curly brackets.
14860 </para>
14861 </listitem></varlistentry>
14862 <varlistentry>
14863 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14864 <listitem>
14865 <para>
14866 <indexterm role="concept">
14867 <primary>expansion</primary>
14868 <secondary>checking for empty variable</secondary>
14869 </indexterm>
14870 <indexterm role="concept">
14871 <primary><option>def</option> expansion condition</primary>
14872 </indexterm>
14873 The <option>def</option> condition must be followed by the name of one of the expansion
14874 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14875 variable does not contain the empty string. For example:
14876 </para>
14877 <literallayout class="monospaced">
14878 ${if def:sender_ident {from $sender_ident}}
14879 </literallayout>
14880 <para>
14881 Note that the variable name is given without a leading <option>$</option> character. If the
14882 variable does not exist, the expansion fails.
14883 </para>
14884 </listitem></varlistentry>
14885 <varlistentry>
14886 <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>
14887 <listitem>
14888 <para>
14889 <indexterm role="concept">
14890 <primary>expansion</primary>
14891 <secondary>checking header line existence</secondary>
14892 </indexterm>
14893 This condition is true if a message is being processed and the named header
14894 exists in the message. For example,
14895 </para>
14896 <literallayout class="monospaced">
14897 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14898 </literallayout>
14899 <para>
14900 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14901 the header name must be terminated by a colon if white space does not follow.
14902 </para>
14903 </listitem></varlistentry>
14904 <varlistentry>
14905 <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>
14906 <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>
14907 <listitem>
14908 <para>
14909 <indexterm role="concept">
14910 <primary>string</primary>
14911 <secondary>comparison</secondary>
14912 </indexterm>
14913 <indexterm role="concept">
14914 <primary>expansion</primary>
14915 <secondary>string comparison</secondary>
14916 </indexterm>
14917 <indexterm role="concept">
14918 <primary><option>eq</option> expansion condition</primary>
14919 </indexterm>
14920 <indexterm role="concept">
14921 <primary><option>eqi</option> expansion condition</primary>
14922 </indexterm>
14923 The two substrings are first expanded. The condition is true if the two
14924 resulting strings are identical. For <option>eq</option> the comparison includes the case of
14925 letters, whereas for <option>eqi</option> the comparison is case-independent.
14926 </para>
14927 </listitem></varlistentry>
14928 <varlistentry>
14929 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14930 <listitem>
14931 <para>
14932 <indexterm role="concept">
14933 <primary>expansion</primary>
14934 <secondary>file existence test</secondary>
14935 </indexterm>
14936 <indexterm role="concept">
14937 <primary>file</primary>
14938 <secondary>existence test</secondary>
14939 </indexterm>
14940 <indexterm role="concept">
14941 <primary><option>exists</option>, expansion condition</primary>
14942 </indexterm>
14943 The substring is first expanded and then interpreted as an absolute path. The
14944 condition is true if the named file (or directory) exists. The existence test
14945 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14946 users&#x2019; filter files may be locked out by the system administrator.
14947 </para>
14948 </listitem></varlistentry>
14949 <varlistentry>
14950 <term><emphasis role="bold">first_delivery</emphasis></term>
14951 <listitem>
14952 <para>
14953 <indexterm role="concept">
14954 <primary>delivery</primary>
14955 <secondary>first</secondary>
14956 </indexterm>
14957 <indexterm role="concept">
14958 <primary>first delivery</primary>
14959 </indexterm>
14960 <indexterm role="concept">
14961 <primary>expansion</primary>
14962 <secondary>first delivery test</secondary>
14963 </indexterm>
14964 <indexterm role="concept">
14965 <primary><option>first_delivery</option> expansion condition</primary>
14966 </indexterm>
14967 This condition, which has no data, is true during a message&#x2019;s first delivery
14968 attempt. It is false during any subsequent delivery attempts.
14969 </para>
14970 </listitem></varlistentry>
14971 <varlistentry>
14972 <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>
14973 <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>
14974 <listitem>
14975 <para>
14976 <indexterm role="concept">
14977 <primary>list</primary>
14978 <secondary>iterative conditions</secondary>
14979 </indexterm>
14980 <indexterm role="concept">
14981 <primary>expansion</primary>
14982 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
14983 </indexterm>
14984 <indexterm role="concept">
14985 <primary>expansion</primary>
14986 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
14987 </indexterm>
14988 <indexterm role="variable">
14989 <primary><varname>$item</varname></primary>
14990 </indexterm>
14991 These conditions iterate over a list. The first argument is expanded to form
14992 the list. By default, the list separator is a colon, but it can be changed by
14993 the normal method. The second argument is interpreted as a condition that is to
14994 be applied to each item in the list in turn. During the interpretation of the
14995 condition, the current list item is placed in a variable called <varname>$item</varname>.
14996 </para>
14997 <itemizedlist>
14998 <listitem>
14999 <para>
15000 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15001 the result of the whole condition is true. If the condition is false for all
15002 items in the list, the overall condition is false.
15003 </para>
15004 </listitem>
15005 <listitem>
15006 <para>
15007 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15008 and the result of the whole condition is false. If the condition is true for
15009 all items in the list, the overall condition is true.
15010 </para>
15011 </listitem>
15012 </itemizedlist>
15013 <para>
15014 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15015 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15016 that the condition must be false for at least one item. In this example, the
15017 list separator is changed to a comma:
15018 </para>
15019 <literallayout class="monospaced">
15020 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15021 </literallayout>
15022 <para>
15023 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15024 being processed, to enable these expansion items to be nested.
15025 </para>
15026 </listitem></varlistentry>
15027 <varlistentry>
15028 <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>
15029 <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>
15030 <listitem>
15031 <para>
15032 <indexterm role="concept">
15033 <primary>string</primary>
15034 <secondary>comparison</secondary>
15035 </indexterm>
15036 <indexterm role="concept">
15037 <primary>expansion</primary>
15038 <secondary>string comparison</secondary>
15039 </indexterm>
15040 <indexterm role="concept">
15041 <primary><option>ge</option> expansion condition</primary>
15042 </indexterm>
15043 <indexterm role="concept">
15044 <primary><option>gei</option> expansion condition</primary>
15045 </indexterm>
15046 The two substrings are first expanded. The condition is true if the first
15047 string is lexically greater than or equal to the second string. For <option>ge</option> the
15048 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15049 case-independent.
15050 </para>
15051 </listitem></varlistentry>
15052 <varlistentry>
15053 <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>
15054 <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>
15055 <listitem>
15056 <para>
15057 <indexterm role="concept">
15058 <primary>string</primary>
15059 <secondary>comparison</secondary>
15060 </indexterm>
15061 <indexterm role="concept">
15062 <primary>expansion</primary>
15063 <secondary>string comparison</secondary>
15064 </indexterm>
15065 <indexterm role="concept">
15066 <primary><option>gt</option> expansion condition</primary>
15067 </indexterm>
15068 <indexterm role="concept">
15069 <primary><option>gti</option> expansion condition</primary>
15070 </indexterm>
15071 The two substrings are first expanded. The condition is true if the first
15072 string is lexically greater than the second string. For <option>gt</option> the comparison
15073 includes the case of letters, whereas for <option>gti</option> the comparison is
15074 case-independent.
15075 </para>
15076 </listitem></varlistentry>
15077 <varlistentry>
15078 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15079 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15080 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15081 <listitem>
15082 <para>
15083 <indexterm role="concept">
15084 <primary>IP address</primary>
15085 <secondary>testing string format</secondary>
15086 </indexterm>
15087 <indexterm role="concept">
15088 <primary>string</primary>
15089 <secondary>testing for IP address</secondary>
15090 </indexterm>
15091 <indexterm role="concept">
15092 <primary><option>isip</option> expansion condition</primary>
15093 </indexterm>
15094 <indexterm role="concept">
15095 <primary><option>isip4</option> expansion condition</primary>
15096 </indexterm>
15097 <indexterm role="concept">
15098 <primary><option>isip6</option> expansion condition</primary>
15099 </indexterm>
15100 The substring is first expanded, and then tested to see if it has the form of
15101 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15102 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15103 </para>
15104 <para>
15105 For an IPv4 address, the test is for four dot-separated components, each of
15106 which consists of from one to three digits. For an IPv6 address, up to eight
15107 colon-separated components are permitted, each containing from one to four
15108 hexadecimal digits. There may be fewer than eight components if an empty
15109 component (adjacent colons) is present. Only one empty component is permitted.
15110 </para>
15111 <para>
15112 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15113 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15114 check. The main use of these tests is to distinguish between IP addresses and
15115 host names, or between IPv4 and IPv6 addresses. For example, you could use
15116 </para>
15117 <literallayout class="monospaced">
15118 ${if isip4{$sender_host_address}...
15119 </literallayout>
15120 <para>
15121 to test which IP version an incoming SMTP connection is using.
15122 </para>
15123 </listitem></varlistentry>
15124 <varlistentry>
15125 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15126 <listitem>
15127 <para>
15128 <indexterm role="concept">
15129 <primary>LDAP</primary>
15130 <secondary>use for authentication</secondary>
15131 </indexterm>
15132 <indexterm role="concept">
15133 <primary>expansion</primary>
15134 <secondary>LDAP authentication test</secondary>
15135 </indexterm>
15136 <indexterm role="concept">
15137 <primary><option>ldapauth</option> expansion condition</primary>
15138 </indexterm>
15139 This condition supports user authentication using LDAP. See section
15140 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15141 queries. For this use, the query must contain a user name and password. The
15142 query itself is not used, and can be empty. The condition is true if the
15143 password is not empty, and the user name and password are accepted by the LDAP
15144 server. An empty password is rejected without calling LDAP because LDAP binds
15145 with an empty password are considered anonymous regardless of the username, and
15146 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15147 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15148 this can be used.
15149 </para>
15150 </listitem></varlistentry>
15151 <varlistentry>
15152 <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>
15153 <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>
15154 <listitem>
15155 <para>
15156 <indexterm role="concept">
15157 <primary>string</primary>
15158 <secondary>comparison</secondary>
15159 </indexterm>
15160 <indexterm role="concept">
15161 <primary>expansion</primary>
15162 <secondary>string comparison</secondary>
15163 </indexterm>
15164 <indexterm role="concept">
15165 <primary><option>le</option> expansion condition</primary>
15166 </indexterm>
15167 <indexterm role="concept">
15168 <primary><option>lei</option> expansion condition</primary>
15169 </indexterm>
15170 The two substrings are first expanded. The condition is true if the first
15171 string is lexically less than or equal to the second string. For <option>le</option> the
15172 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15173 case-independent.
15174 </para>
15175 </listitem></varlistentry>
15176 <varlistentry>
15177 <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>
15178 <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>
15179 <listitem>
15180 <para>
15181 <indexterm role="concept">
15182 <primary>string</primary>
15183 <secondary>comparison</secondary>
15184 </indexterm>
15185 <indexterm role="concept">
15186 <primary>expansion</primary>
15187 <secondary>string comparison</secondary>
15188 </indexterm>
15189 <indexterm role="concept">
15190 <primary><option>lt</option> expansion condition</primary>
15191 </indexterm>
15192 <indexterm role="concept">
15193 <primary><option>lti</option> expansion condition</primary>
15194 </indexterm>
15195 The two substrings are first expanded. The condition is true if the first
15196 string is lexically less than the second string. For <option>lt</option> the comparison
15197 includes the case of letters, whereas for <option>lti</option> the comparison is
15198 case-independent.
15199 </para>
15200 </listitem></varlistentry>
15201 <varlistentry>
15202 <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>
15203 <listitem>
15204 <para>
15205 <indexterm role="concept">
15206 <primary>expansion</primary>
15207 <secondary>regular expression comparison</secondary>
15208 </indexterm>
15209 <indexterm role="concept">
15210 <primary>regular expressions</primary>
15211 <secondary>match in expanded string</secondary>
15212 </indexterm>
15213 <indexterm role="concept">
15214 <primary><option>match</option> expansion condition</primary>
15215 </indexterm>
15216 The two substrings are first expanded. The second is then treated as a regular
15217 expression and applied to the first. Because of the pre-expansion, if the
15218 regular expression contains dollar, or backslash characters, they must be
15219 escaped. Care must also be taken if the regular expression contains braces
15220 (curly brackets). A closing brace must be escaped so that it is not taken as a
15221 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15222 <literal>\N</literal> feature to disable expansion of the regular expression.
15223 For example,
15224 </para>
15225 <literallayout class="monospaced">
15226 ${if match {$local_part}{\N^\d{3}\N} ...
15227 </literallayout>
15228 <para>
15229 If the whole expansion string is in double quotes, further escaping of
15230 backslashes is also required.
15231 </para>
15232 <para>
15233 The condition is true if the regular expression match succeeds.
15234 The regular expression is not required to begin with a circumflex
15235 metacharacter, but if there is no circumflex, the expression is not anchored,
15236 and it may match anywhere in the subject, not just at the start. If you want
15237 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15238 metacharacter at an appropriate point.
15239 </para>
15240 <para>
15241 <indexterm role="concept">
15242 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15243 <secondary>in <option>if</option> expansion</secondary>
15244 </indexterm>
15245 At the start of an <option>if</option> expansion the values of the numeric variable
15246 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15247 succeeds causes them to be reset to the substrings of that condition and they
15248 will have these values during the expansion of the success string. At the end
15249 of the <option>if</option> expansion, the previous values are restored. After testing a
15250 combination of conditions using <option>or</option>, the subsequent values of the numeric
15251 variables are those of the condition that succeeded.
15252 </para>
15253 </listitem></varlistentry>
15254 <varlistentry>
15255 <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>
15256 <listitem>
15257 <para>
15258 <indexterm role="concept">
15259 <primary><option>match_address</option> expansion condition</primary>
15260 </indexterm>
15261 See <emphasis role="bold">match_local_part</emphasis>.
15262 </para>
15263 </listitem></varlistentry>
15264 <varlistentry>
15265 <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>
15266 <listitem>
15267 <para>
15268 <indexterm role="concept">
15269 <primary><option>match_domain</option> expansion condition</primary>
15270 </indexterm>
15271 See <emphasis role="bold">match_local_part</emphasis>.
15272 </para>
15273 </listitem></varlistentry>
15274 <varlistentry>
15275 <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>
15276 <listitem>
15277 <para>
15278 <indexterm role="concept">
15279 <primary><option>match_ip</option> expansion condition</primary>
15280 </indexterm>
15281 This condition matches an IP address to a list of IP address patterns. It must
15282 be followed by two argument strings. The first (after expansion) must be an IP
15283 address or an empty string. The second (after expansion) is a restricted host
15284 list that can match only an IP address, not a host name. For example:
15285 </para>
15286 <literallayout class="monospaced">
15287 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15288 </literallayout>
15289 <para>
15290 The specific types of host list item that are permitted in the list are:
15291 </para>
15292 <itemizedlist>
15293 <listitem>
15294 <para>
15295 An IP address, optionally with a CIDR mask.
15296 </para>
15297 </listitem>
15298 <listitem>
15299 <para>
15300 A single asterisk, which matches any IP address.
15301 </para>
15302 </listitem>
15303 <listitem>
15304 <para>
15305 An empty item, which matches only if the IP address is empty. This could be
15306 useful for testing for a locally submitted message or one from specific hosts
15307 in a single test such as
15308 </para>
15309 <literallayout class="monospaced">
15310   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15311 </literallayout>
15312 <para>
15313 where the first item in the list is the empty string.
15314 </para>
15315 </listitem>
15316 <listitem>
15317 <para>
15318 The item @[] matches any of the local host&#x2019;s interface addresses.
15319 </para>
15320 </listitem>
15321 <listitem>
15322 <para>
15323 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15324 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15325 address into a host name. The most common type of linear search for
15326 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15327 masks. For example:
15328 </para>
15329 <literallayout class="monospaced">
15330   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15331 </literallayout>
15332 <para>
15333 It is of course possible to use other kinds of lookup, and in such a case, you
15334 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15335 address mask, for example:
15336 </para>
15337 <literallayout class="monospaced">
15338   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15339 </literallayout>
15340 <para>
15341 However, unless you are combining a <option>match_ip</option> condition with others, it is
15342 just as easy to use the fact that a lookup is itself a condition, and write:
15343 </para>
15344 <literallayout class="monospaced">
15345   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15346 </literallayout>
15347 </listitem>
15348 </itemizedlist>
15349 <para>
15350 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15351 </para>
15352 </listitem></varlistentry>
15353 <varlistentry>
15354 <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>
15355 <listitem>
15356 <para>
15357 <indexterm role="concept">
15358 <primary>domain list</primary>
15359 <secondary>in expansion condition</secondary>
15360 </indexterm>
15361 <indexterm role="concept">
15362 <primary>address list</primary>
15363 <secondary>in expansion condition</secondary>
15364 </indexterm>
15365 <indexterm role="concept">
15366 <primary>local part</primary>
15367 <secondary>list, in expansion condition</secondary>
15368 </indexterm>
15369 <indexterm role="concept">
15370 <primary><option>match_local_part</option> expansion condition</primary>
15371 </indexterm>
15372 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15373 possible to test domain, address, and local part lists within expansions. Each
15374 condition requires two arguments: an item and a list to match. A trivial
15375 example is:
15376 </para>
15377 <literallayout class="monospaced">
15378 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15379 </literallayout>
15380 <para>
15381 In each case, the second argument may contain any of the allowable items for a
15382 list of the appropriate type. Also, because the second argument (after
15383 expansion) is a standard form of list, it is possible to refer to a named list.
15384 Thus, you can use conditions like this:
15385 </para>
15386 <literallayout class="monospaced">
15387 ${if match_domain{$domain}{+local_domains}{...
15388 </literallayout>
15389 <para>
15390 <indexterm role="concept">
15391 <primary><literal>+caseful</literal></primary>
15392 </indexterm>
15393 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15394 item can be used, as in all address lists, to cause subsequent items to
15395 have their local parts matched casefully. Domains are always matched
15396 caselessly.
15397 </para>
15398 <para>
15399 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15400 hosts have two identities: a name and an IP address, and it is not clear
15401 how to specify cleanly how such a test would work. However, IP addresses can be
15402 matched using <option>match_ip</option>.
15403 </para>
15404 </listitem></varlistentry>
15405 <varlistentry>
15406 <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>
15407 <listitem>
15408 <para>
15409 <indexterm role="concept">
15410 <primary>PAM authentication</primary>
15411 </indexterm>
15412 <indexterm role="concept">
15413 <primary>AUTH</primary>
15414 <secondary>with PAM</secondary>
15415 </indexterm>
15416 <indexterm role="concept">
15417 <primary>Solaris</primary>
15418 <secondary>PAM support</secondary>
15419 </indexterm>
15420 <indexterm role="concept">
15421 <primary>expansion</primary>
15422 <secondary>PAM authentication test</secondary>
15423 </indexterm>
15424 <indexterm role="concept">
15425 <primary><option>pam</option> expansion condition</primary>
15426 </indexterm>
15427 <emphasis>Pluggable Authentication Modules</emphasis>
15428 (<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
15429 available in the latest releases of Solaris and in some GNU/Linux
15430 distributions. The Exim support, which is intended for use in conjunction with
15431 the SMTP AUTH command, is available only if Exim is compiled with
15432 </para>
15433 <literallayout class="monospaced">
15434 SUPPORT_PAM=yes
15435 </literallayout>
15436 <para>
15437 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15438 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15439 </para>
15440 <para>
15441 The argument string is first expanded, and the result must be a
15442 colon-separated list of strings. Leading and trailing white space is ignored.
15443 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15444 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15445 The remaining items in the data string are passed over in response to requests
15446 from the authentication function. In the simple case there will only be one
15447 request, for a password, so the data consists of just two strings.
15448 </para>
15449 <para>
15450 There can be problems if any of the strings are permitted to contain colon
15451 characters. In the usual way, these have to be doubled to avoid being taken as
15452 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15453 item can be used to double any existing colons. For example, the configuration
15454 of a LOGIN authenticator might contain this setting:
15455 </para>
15456 <literallayout class="monospaced">
15457 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15458 </literallayout>
15459 <para>
15460 For a PLAIN authenticator you could use:
15461 </para>
15462 <literallayout class="monospaced">
15463 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15464 </literallayout>
15465 <para>
15466 In some operating systems, PAM authentication can be done only from a process
15467 running as root. Since Exim is running as the Exim user when receiving
15468 messages, this means that PAM cannot be used directly in those systems.
15469 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15470 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>.
15471 The patched module allows one special uid/gid combination, in addition to root,
15472 to authenticate. If you build the patched module to allow the Exim user and
15473 group, PAM can then be used from an Exim authenticator.
15474 </para>
15475 </listitem></varlistentry>
15476 <varlistentry>
15477 <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>
15478 <listitem>
15479 <para>
15480 <indexterm role="concept">
15481 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15482 </indexterm>
15483 <indexterm role="concept">
15484 <primary>Cyrus</primary>
15485 </indexterm>
15486 <indexterm role="concept">
15487 <primary>expansion</primary>
15488 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15489 </indexterm>
15490 <indexterm role="concept">
15491 <primary><option>pwcheck</option> expansion condition</primary>
15492 </indexterm>
15493 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15494 This is one way of making it possible for passwords to be checked by a process
15495 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15496 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15497 </para>
15498 <para>
15499 The pwcheck support is not included in Exim by default. You need to specify
15500 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15501 building Exim. For example:
15502 </para>
15503 <literallayout class="monospaced">
15504 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15505 </literallayout>
15506 <para>
15507 You do not need to install the full Cyrus software suite in order to use
15508 the pwcheck daemon. You can compile and install just the daemon alone
15509 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15510 access to the <filename>/var/pwcheck</filename> directory.
15511 </para>
15512 <para>
15513 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15514 password, separated by a colon. For example, in a LOGIN authenticator
15515 configuration, you might have this:
15516 </para>
15517 <literallayout class="monospaced">
15518 server_condition = ${if pwcheck{$auth1:$auth2}}
15519 </literallayout>
15520 <para revisionflag="changed">
15521 Again, for a PLAIN authenticator configuration, this would be:
15522 </para>
15523 <literallayout class="monospaced" revisionflag="changed">
15524 server_condition = ${if pwcheck{$auth2:$auth3}}
15525 </literallayout>
15526 </listitem></varlistentry>
15527 <varlistentry>
15528 <term><emphasis role="bold">queue_running</emphasis></term>
15529 <listitem>
15530 <para>
15531 <indexterm role="concept">
15532 <primary>queue runner</primary>
15533 <secondary>detecting when delivering from</secondary>
15534 </indexterm>
15535 <indexterm role="concept">
15536 <primary>expansion</primary>
15537 <secondary>queue runner test</secondary>
15538 </indexterm>
15539 <indexterm role="concept">
15540 <primary><option>queue_running</option> expansion condition</primary>
15541 </indexterm>
15542 This condition, which has no data, is true during delivery attempts that are
15543 initiated by queue runner processes, and false otherwise.
15544 </para>
15545 </listitem></varlistentry>
15546 <varlistentry>
15547 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15548 <listitem>
15549 <para>
15550 <indexterm role="concept">
15551 <primary>Radius</primary>
15552 </indexterm>
15553 <indexterm role="concept">
15554 <primary>expansion</primary>
15555 <secondary>Radius authentication</secondary>
15556 </indexterm>
15557 <indexterm role="concept">
15558 <primary><option>radius</option> expansion condition</primary>
15559 </indexterm>
15560 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15561 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15562 the Radius client configuration file in order to build Exim with Radius
15563 support.
15564 </para>
15565 <para>
15566 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15567 library, using the original API. If you are using release 0.4.0 or later of
15568 this library, you need to set
15569 </para>
15570 <literallayout class="monospaced">
15571 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15572 </literallayout>
15573 <para>
15574 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15575 <option>libradius</option> library that comes with FreeBSD. To do this, set
15576 </para>
15577 <literallayout class="monospaced">
15578 RADIUS_LIB_TYPE=RADLIB
15579 </literallayout>
15580 <para>
15581 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15582 You may also have to supply a suitable setting in EXTRALIBS so that the
15583 Radius library can be found when Exim is linked.
15584 </para>
15585 <para>
15586 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15587 Radius client library, which calls the Radius server. The condition is true if
15588 the authentication is successful. For example:
15589 </para>
15590 <literallayout class="monospaced">
15591 server_condition = ${if radius{&lt;arguments&gt;}}
15592 </literallayout>
15593 </listitem></varlistentry>
15594 <varlistentry>
15595 <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>
15596 <listitem>
15597 <para>
15598 <indexterm role="concept">
15599 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15600 </indexterm>
15601 <indexterm role="concept">
15602 <primary>Cyrus</primary>
15603 </indexterm>
15604 <indexterm role="concept">
15605 <primary>expansion</primary>
15606 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15607 </indexterm>
15608 <indexterm role="concept">
15609 <primary><option>saslauthd</option> expansion condition</primary>
15610 </indexterm>
15611 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15612 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15613 Using this daemon is one way of making it possible for passwords to be checked
15614 by a process that is not running as root.
15615 </para>
15616 <para>
15617 The saslauthd support is not included in Exim by default. You need to specify
15618 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15619 building Exim. For example:
15620 </para>
15621 <literallayout class="monospaced">
15622 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15623 </literallayout>
15624 <para>
15625 You do not need to install the full Cyrus software suite in order to use
15626 the saslauthd daemon. You can compile and install just the daemon alone
15627 from the Cyrus SASL library.
15628 </para>
15629 <para>
15630 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15631 two are mandatory. For example:
15632 </para>
15633 <literallayout class="monospaced">
15634 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15635 </literallayout>
15636 <para>
15637 The service and the realm are optional (which is why the arguments are enclosed
15638 in their own set of braces). For details of the meaning of the service and
15639 realm, and how to run the daemon, consult the Cyrus documentation.
15640 </para>
15641 </listitem></varlistentry>
15642 </variablelist>
15643 </section>
15644 <section id="SECID84">
15645 <title>Combining expansion conditions</title>
15646 <para>
15647 <indexterm role="concept">
15648 <primary>expansion</primary>
15649 <secondary>combining conditions</secondary>
15650 </indexterm>
15651 Several conditions can be tested at once by combining them using the <option>and</option>
15652 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15653 conditions on their own, and precede their lists of sub-conditions. Each
15654 sub-condition must be enclosed in braces within the overall braces that contain
15655 the list. No repetition of <option>if</option> is used.
15656 </para>
15657 <variablelist>
15658 <varlistentry>
15659 <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>
15660 <listitem>
15661 <para>
15662 <indexterm role="concept">
15663 <primary><quote>or</quote> expansion condition</primary>
15664 </indexterm>
15665 <indexterm role="concept">
15666 <primary>expansion</primary>
15667 <secondary><quote>or</quote> of conditions</secondary>
15668 </indexterm>
15669 The sub-conditions are evaluated from left to right. The condition is true if
15670 any one of the sub-conditions is true.
15671 For example,
15672 </para>
15673 <literallayout class="monospaced">
15674 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15675 </literallayout>
15676 <para>
15677 When a true sub-condition is found, the following ones are parsed but not
15678 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15679 numeric variables afterwards are taken from the first one that succeeds.
15680 </para>
15681 </listitem></varlistentry>
15682 <varlistentry>
15683 <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>
15684 <listitem>
15685 <para>
15686 <indexterm role="concept">
15687 <primary><quote>and</quote> expansion condition</primary>
15688 </indexterm>
15689 <indexterm role="concept">
15690 <primary>expansion</primary>
15691 <secondary><quote>and</quote> of conditions</secondary>
15692 </indexterm>
15693 The sub-conditions are evaluated from left to right. The condition is true if
15694 all of the sub-conditions are true. If there are several <quote>match</quote>
15695 sub-conditions, the values of the numeric variables afterwards are taken from
15696 the last one. When a false sub-condition is found, the following ones are
15697 parsed but not evaluated.
15698 </para>
15699 </listitem></varlistentry>
15700 </variablelist>
15701 <para>
15702 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15703 </para>
15704 </section>
15705 <section id="SECTexpvar">
15706 <title>Expansion variables</title>
15707 <para>
15708 <indexterm role="concept">
15709 <primary>expansion</primary>
15710 <secondary>variables, list of</secondary>
15711 </indexterm>
15712 This section contains an alphabetical list of all the expansion variables. Some
15713 of them are available only when Exim is compiled with specific options such as
15714 support for TLS or the content scanning extension.
15715 </para>
15716 <variablelist>
15717 <varlistentry>
15718 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15719 <listitem>
15720 <para>
15721 <indexterm role="concept">
15722 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15723 </indexterm>
15724 When a <option>match</option> expansion condition succeeds, these variables contain the
15725 captured substrings identified by the regular expression during subsequent
15726 processing of the success string of the containing <option>if</option> expansion item.
15727 However, they do not retain their values afterwards; in fact, their previous
15728 values are restored at the end of processing an <option>if</option> item. The numerical
15729 variables may also be set externally by some other matching process which
15730 precedes the expansion of the string. For example, the commands available in
15731 Exim filter files include an <option>if</option> command with its own regular expression
15732 matching condition.
15733 </para>
15734 </listitem></varlistentry>
15735 <varlistentry>
15736 <term><varname>$acl_c...</varname></term>
15737 <listitem>
15738 <para>
15739 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15740 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15741 long, but the sixth character must be either a digit or an underscore. For
15742 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15743 variables persist throughout the lifetime of an SMTP connection. They can be
15744 used to pass information between ACLs and between different invocations of the
15745 same ACL. When a message is received, the values of these variables are saved
15746 with the message, and can be accessed by filters, routers, and transports
15747 during subsequent delivery.
15748 </para>
15749 </listitem></varlistentry>
15750 <varlistentry>
15751 <term><varname>$acl_m...</varname></term>
15752 <listitem>
15753 <para>
15754 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15755 are reset after a message has been received. Thus, if several messages are
15756 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15757 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15758 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15759 message is received, the values of these variables are saved with the message,
15760 and can be accessed by filters, routers, and transports during subsequent
15761 delivery.
15762 </para>
15763 </listitem></varlistentry>
15764 <varlistentry>
15765 <term><varname>$acl_verify_message</varname></term>
15766 <listitem>
15767 <para>
15768 <indexterm role="variable">
15769 <primary><varname>$acl_verify_message</varname></primary>
15770 </indexterm>
15771 After an address verification has failed, this variable contains the failure
15772 message. It retains its value for use in subsequent modifiers. The message can
15773 be preserved by coding like this:
15774 </para>
15775 <literallayout class="monospaced">
15776 warn !verify = sender
15777      set acl_m0 = $acl_verify_message
15778 </literallayout>
15779 <para>
15780 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15781 <option>log_message</option> modifiers, to include information about the verification
15782 failure.
15783 </para>
15784 </listitem></varlistentry>
15785 <varlistentry>
15786 <term><varname>$address_data</varname></term>
15787 <listitem>
15788 <para>
15789 <indexterm role="variable">
15790 <primary><varname>$address_data</varname></primary>
15791 </indexterm>
15792 This variable is set by means of the <option>address_data</option> option in routers. The
15793 value then remains with the address while it is processed by subsequent routers
15794 and eventually a transport. If the transport is handling multiple addresses,
15795 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15796 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15797 user filter files.
15798 </para>
15799 <para>
15800 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15801 a recipient address, the final value is still in the variable for subsequent
15802 conditions and modifiers of the ACL statement. If routing the address caused it
15803 to be redirected to just one address, the child address is also routed as part
15804 of the verification, and in this case the final value of <varname>$address_data</varname> is
15805 from the child&#x2019;s routing.
15806 </para>
15807 <para>
15808 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15809 sender address, the final value is also preserved, but this time in
15810 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15811 address.
15812 </para>
15813 <para>
15814 In both cases (recipient and sender verification), the value does not persist
15815 after the end of the current ACL statement. If you want to preserve
15816 these values for longer, you can save them in ACL variables.
15817 </para>
15818 </listitem></varlistentry>
15819 <varlistentry>
15820 <term><varname>$address_file</varname></term>
15821 <listitem>
15822 <para>
15823 <indexterm role="variable">
15824 <primary><varname>$address_file</varname></primary>
15825 </indexterm>
15826 When, as a result of aliasing, forwarding, or filtering, a message is directed
15827 to a specific file, this variable holds the name of the file when the transport
15828 is running. At other times, the variable is empty. For example, using the
15829 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15830 </para>
15831 <literallayout class="monospaced">
15832 /home/r2d2/savemail
15833 </literallayout>
15834 <para>
15835 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15836 contains the text string <literal>/home/r2d2/savemail</literal>.
15837 <indexterm role="concept">
15838 <primary>Sieve filter</primary>
15839 <secondary>value of <varname>$address_file</varname></secondary>
15840 </indexterm>
15841 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15842 then up to the transport configuration to generate an appropriate absolute path
15843 to the relevant file.
15844 </para>
15845 </listitem></varlistentry>
15846 <varlistentry>
15847 <term><varname>$address_pipe</varname></term>
15848 <listitem>
15849 <para>
15850 <indexterm role="variable">
15851 <primary><varname>$address_pipe</varname></primary>
15852 </indexterm>
15853 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15854 this variable holds the pipe command when the transport is running.
15855 </para>
15856 </listitem></varlistentry>
15857 <varlistentry>
15858 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15859 <listitem>
15860 <para>
15861 <indexterm role="variable">
15862 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15863 </indexterm>
15864 These variables are used in SMTP authenticators (see chapters
15865 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15866 </para>
15867 </listitem></varlistentry>
15868 <varlistentry>
15869 <term><varname>$authenticated_id</varname></term>
15870 <listitem>
15871 <para>
15872 <indexterm role="concept">
15873 <primary>authentication</primary>
15874 <secondary>id</secondary>
15875 </indexterm>
15876 <indexterm role="variable">
15877 <primary><varname>$authenticated_id</varname></primary>
15878 </indexterm>
15879 When a server successfully authenticates a client it may be configured to
15880 preserve some of the authentication information in the variable
15881 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15882 user/password authenticator configuration might preserve the user name for use
15883 in the routers. Note that this is not the same information that is saved in
15884 <varname>$sender_host_authenticated</varname>.
15885 When a message is submitted locally (that is, not over a TCP connection)
15886 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15887 process. However, a trusted user can override this by means of the <option>-oMai</option>
15888 command line option.
15889 </para>
15890 </listitem></varlistentry>
15891 <varlistentry>
15892 <term><varname>$authenticated_sender</varname></term>
15893 <listitem>
15894 <para>
15895 <indexterm role="concept">
15896 <primary>sender</primary>
15897 <secondary>authenticated</secondary>
15898 </indexterm>
15899 <indexterm role="concept">
15900 <primary>authentication</primary>
15901 <secondary>sender</secondary>
15902 </indexterm>
15903 <indexterm role="concept">
15904 <primary>AUTH</primary>
15905 <secondary>on MAIL command</secondary>
15906 </indexterm>
15907 <indexterm role="variable">
15908 <primary><varname>$authenticated_sender</varname></primary>
15909 </indexterm>
15910 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15911 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15912 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15913 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15914 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15915 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15916 </para>
15917 <para>
15918 <indexterm role="variable">
15919 <primary><varname>$qualify_domain</varname></primary>
15920 </indexterm>
15921 When a message is submitted locally (that is, not over a TCP connection), the
15922 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15923 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15924 can override this by means of the <option>-oMas</option> command line option.
15925 </para>
15926 </listitem></varlistentry>
15927 <varlistentry>
15928 <term><varname>$authentication_failed</varname></term>
15929 <listitem>
15930 <para>
15931 <indexterm role="concept">
15932 <primary>authentication</primary>
15933 <secondary>failure</secondary>
15934 </indexterm>
15935 <indexterm role="variable">
15936 <primary><varname>$authentication_failed</varname></primary>
15937 </indexterm>
15938 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15939 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15940 possible to distinguish between <quote>did not try to authenticate</quote>
15941 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15942 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15943 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15944 negative response to an AUTH command, including (for example) an attempt to use
15945 an undefined mechanism.
15946 </para>
15947 </listitem></varlistentry>
15948 <varlistentry>
15949 <term><varname>$body_linecount</varname></term>
15950 <listitem>
15951 <para>
15952 <indexterm role="concept">
15953 <primary>message body</primary>
15954 <secondary>line count</secondary>
15955 </indexterm>
15956 <indexterm role="concept">
15957 <primary>body of message</primary>
15958 <secondary>line count</secondary>
15959 </indexterm>
15960 <indexterm role="variable">
15961 <primary><varname>$body_linecount</varname></primary>
15962 </indexterm>
15963 When a message is being received or delivered, this variable contains the
15964 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15965 </para>
15966 </listitem></varlistentry>
15967 <varlistentry>
15968 <term><varname>$body_zerocount</varname></term>
15969 <listitem>
15970 <para>
15971 <indexterm role="concept">
15972 <primary>message body</primary>
15973 <secondary>binary zero count</secondary>
15974 </indexterm>
15975 <indexterm role="concept">
15976 <primary>body of message</primary>
15977 <secondary>binary zero count</secondary>
15978 </indexterm>
15979 <indexterm role="concept">
15980 <primary>binary zero</primary>
15981 <secondary>in message body</secondary>
15982 </indexterm>
15983 <indexterm role="variable">
15984 <primary><varname>$body_zerocount</varname></primary>
15985 </indexterm>
15986 When a message is being received or delivered, this variable contains the
15987 number of binary zero bytes in the message&#x2019;s body.
15988 </para>
15989 </listitem></varlistentry>
15990 <varlistentry>
15991 <term><varname>$bounce_recipient</varname></term>
15992 <listitem>
15993 <para>
15994 <indexterm role="variable">
15995 <primary><varname>$bounce_recipient</varname></primary>
15996 </indexterm>
15997 This is set to the recipient address of a bounce message while Exim is creating
15998 it. It is useful if a customized bounce message text file is in use (see
15999 chapter <xref linkend="CHAPemsgcust"/>).
16000 </para>
16001 </listitem></varlistentry>
16002 <varlistentry>
16003 <term><varname>$bounce_return_size_limit</varname></term>
16004 <listitem>
16005 <para>
16006 <indexterm role="variable">
16007 <primary><varname>$bounce_return_size_limit</varname></primary>
16008 </indexterm>
16009 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16010 up to a multiple of 1000. It is useful when a customized error message text
16011 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16012 </para>
16013 </listitem></varlistentry>
16014 <varlistentry>
16015 <term><varname>$caller_gid</varname></term>
16016 <listitem>
16017 <para>
16018 <indexterm role="concept">
16019 <primary>gid (group id)</primary>
16020 <secondary>caller</secondary>
16021 </indexterm>
16022 <indexterm role="variable">
16023 <primary><varname>$caller_gid</varname></primary>
16024 </indexterm>
16025 The real group id under which the process that called Exim was running. This is
16026 not the same as the group id of the originator of a message (see
16027 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16028 incarnation normally contains the Exim gid.
16029 </para>
16030 </listitem></varlistentry>
16031 <varlistentry>
16032 <term><varname>$caller_uid</varname></term>
16033 <listitem>
16034 <para>
16035 <indexterm role="concept">
16036 <primary>uid (user id)</primary>
16037 <secondary>caller</secondary>
16038 </indexterm>
16039 <indexterm role="variable">
16040 <primary><varname>$caller_uid</varname></primary>
16041 </indexterm>
16042 The real user id under which the process that called Exim was running. This is
16043 not the same as the user id of the originator of a message (see
16044 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16045 incarnation normally contains the Exim uid.
16046 </para>
16047 </listitem></varlistentry>
16048 <varlistentry>
16049 <term><varname>$compile_date</varname></term>
16050 <listitem>
16051 <para>
16052 <indexterm role="variable">
16053 <primary><varname>$compile_date</varname></primary>
16054 </indexterm>
16055 The date on which the Exim binary was compiled.
16056 </para>
16057 </listitem></varlistentry>
16058 <varlistentry>
16059 <term><varname>$compile_number</varname></term>
16060 <listitem>
16061 <para>
16062 <indexterm role="variable">
16063 <primary><varname>$compile_number</varname></primary>
16064 </indexterm>
16065 The building process for Exim keeps a count of the number
16066 of times it has been compiled. This serves to distinguish different
16067 compilations of the same version of the program.
16068 </para>
16069 </listitem></varlistentry>
16070 <varlistentry>
16071 <term><varname>$demime_errorlevel</varname></term>
16072 <listitem>
16073 <para>
16074 <indexterm role="variable">
16075 <primary><varname>$demime_errorlevel</varname></primary>
16076 </indexterm>
16077 This variable is available when Exim is compiled with
16078 the content-scanning extension and the obsolete <option>demime</option> condition. For
16079 details, see section <xref linkend="SECTdemimecond"/>.
16080 </para>
16081 </listitem></varlistentry>
16082 <varlistentry>
16083 <term><varname>$demime_reason</varname></term>
16084 <listitem>
16085 <para>
16086 <indexterm role="variable">
16087 <primary><varname>$demime_reason</varname></primary>
16088 </indexterm>
16089 This variable is available when Exim is compiled with the
16090 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16091 see section <xref linkend="SECTdemimecond"/>.
16092 </para>
16093 </listitem></varlistentry>
16094 <varlistentry>
16095 <term><varname>$dnslist_domain</varname></term>
16096 <term><varname>$dnslist_matched</varname></term>
16097 <term><varname>$dnslist_text</varname></term>
16098 <term><varname>$dnslist_value</varname></term>
16099 <listitem>
16100 <para>
16101 <indexterm role="variable">
16102 <primary><varname>$dnslist_domain</varname></primary>
16103 </indexterm>
16104 <indexterm role="variable">
16105 <primary><varname>$dnslist_matched</varname></primary>
16106 </indexterm>
16107 <indexterm role="variable">
16108 <primary><varname>$dnslist_text</varname></primary>
16109 </indexterm>
16110 <indexterm role="variable">
16111 <primary><varname>$dnslist_value</varname></primary>
16112 </indexterm>
16113 <indexterm role="concept">
16114 <primary>black list (DNS)</primary>
16115 </indexterm>
16116 When a DNS (black) list lookup succeeds, these variables are set to contain
16117 the following data from the lookup: the list&#x2019;s domain name, the key that was
16118 looked up, the contents of any associated TXT record, and the value from the
16119 main A record. See section <xref linkend="SECID204"/> for more details.
16120 </para>
16121 </listitem></varlistentry>
16122 <varlistentry>
16123 <term><varname>$domain</varname></term>
16124 <listitem>
16125 <para>
16126 <indexterm role="variable">
16127 <primary><varname>$domain</varname></primary>
16128 </indexterm>
16129 When an address is being routed, or delivered on its own, this variable
16130 contains the domain. Uppercase letters in the domain are converted into lower
16131 case for <varname>$domain</varname>.
16132 </para>
16133 <para>
16134 Global address rewriting happens when a message is received, so the value of
16135 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16136 is set during user filtering, but not during system filtering, because a
16137 message may have many recipients and the system filter is called just once.
16138 </para>
16139 <para>
16140 When more than one address is being delivered at once (for example, several
16141 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16142 have the same domain. Transports can be restricted to handling only one domain
16143 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16144 the default for local transports. For further details of the environment in
16145 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16146 </para>
16147 <para>
16148 <indexterm role="option">
16149 <primary><option>delay_warning_condition</option></primary>
16150 </indexterm>
16151 At the end of a delivery, if all deferred addresses have the same domain, it is
16152 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16153 </para>
16154 <para>
16155 The <varname>$domain</varname> variable is also used in some other circumstances:
16156 </para>
16157 <itemizedlist>
16158 <listitem>
16159 <para>
16160 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16161 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16162 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16163 normally set during the running of the MAIL ACL. However, if the sender address
16164 is verified with a callout during the MAIL ACL, the sender domain is placed in
16165 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16166 the <command>smtp</command> transport.
16167 </para>
16168 </listitem>
16169 <listitem>
16170 <para>
16171 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16172 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16173 it can be used in the expansion of the replacement address, for example, to
16174 rewrite domains by file lookup.
16175 </para>
16176 </listitem>
16177 <listitem>
16178 <para>
16179 With one important exception, whenever a domain list is being scanned,
16180 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16181 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16182 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16183 that, in a RCPT ACL, the sender domain list can be dependent on the
16184 recipient domain (which is what is in <varname>$domain</varname> at this time).
16185 </para>
16186 </listitem>
16187 <listitem>
16188 <para>
16189 <indexterm role="concept">
16190 <primary>ETRN</primary>
16191 <secondary>value of <varname>$domain</varname></secondary>
16192 </indexterm>
16193 <indexterm role="option">
16194 <primary><option>smtp_etrn_command</option></primary>
16195 </indexterm>
16196 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16197 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16198 </para>
16199 </listitem>
16200 </itemizedlist>
16201 </listitem></varlistentry>
16202 <varlistentry>
16203 <term><varname>$domain_data</varname></term>
16204 <listitem>
16205 <para>
16206 <indexterm role="variable">
16207 <primary><varname>$domain_data</varname></primary>
16208 </indexterm>
16209 When the <option>domains</option> option on a router matches a domain by
16210 means of a lookup, the data read by the lookup is available during the running
16211 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16212 address to a transport, the value is available in that transport. If the
16213 transport is handling multiple addresses, the value from the first address is
16214 used.
16215 </para>
16216 <para>
16217 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16218 domain by means of a lookup. The data read by the lookup is available during
16219 the rest of the ACL statement. In all other situations, this variable expands
16220 to nothing.
16221 </para>
16222 </listitem></varlistentry>
16223 <varlistentry>
16224 <term><varname>$exim_gid</varname></term>
16225 <listitem>
16226 <para>
16227 <indexterm role="variable">
16228 <primary><varname>$exim_gid</varname></primary>
16229 </indexterm>
16230 This variable contains the numerical value of the Exim group id.
16231 </para>
16232 </listitem></varlistentry>
16233 <varlistentry>
16234 <term><varname>$exim_path</varname></term>
16235 <listitem>
16236 <para>
16237 <indexterm role="variable">
16238 <primary><varname>$exim_path</varname></primary>
16239 </indexterm>
16240 This variable contains the path to the Exim binary.
16241 </para>
16242 </listitem></varlistentry>
16243 <varlistentry>
16244 <term><varname>$exim_uid</varname></term>
16245 <listitem>
16246 <para>
16247 <indexterm role="variable">
16248 <primary><varname>$exim_uid</varname></primary>
16249 </indexterm>
16250 This variable contains the numerical value of the Exim user id.
16251 </para>
16252 </listitem></varlistentry>
16253 <varlistentry>
16254 <term><varname>$found_extension</varname></term>
16255 <listitem>
16256 <para>
16257 <indexterm role="variable">
16258 <primary><varname>$found_extension</varname></primary>
16259 </indexterm>
16260 This variable is available when Exim is compiled with the
16261 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16262 see section <xref linkend="SECTdemimecond"/>.
16263 </para>
16264 </listitem></varlistentry>
16265 <varlistentry>
16266 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16267 <listitem>
16268 <para>
16269 This is not strictly an expansion variable. It is expansion syntax for
16270 inserting the message header line with the given name. Note that the name must
16271 be terminated by colon or white space, because it may contain a wide variety of
16272 characters. Note also that braces must <emphasis>not</emphasis> be used.
16273 </para>
16274 </listitem></varlistentry>
16275 <varlistentry>
16276 <term><varname>$home</varname></term>
16277 <listitem>
16278 <para>
16279 <indexterm role="variable">
16280 <primary><varname>$home</varname></primary>
16281 </indexterm>
16282 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16283 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16284 means it is set during the running of users&#x2019; filter files. A router may also
16285 explicitly set a home directory for use by a transport; this can be overridden
16286 by a setting on the transport itself.
16287 </para>
16288 <para>
16289 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16290 of the environment variable HOME.
16291 </para>
16292 </listitem></varlistentry>
16293 <varlistentry>
16294 <term><varname>$host</varname></term>
16295 <listitem>
16296 <para>
16297 <indexterm role="variable">
16298 <primary><varname>$host</varname></primary>
16299 </indexterm>
16300 If a router assigns an address to a transport (any transport), and passes a
16301 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16302 to run is the name of the first host on the list. Note that this applies both
16303 to local and remote transports.
16304 </para>
16305 <para>
16306 <indexterm role="concept">
16307 <primary>transport</primary>
16308 <secondary>filter</secondary>
16309 </indexterm>
16310 <indexterm role="concept">
16311 <primary>filter</primary>
16312 <secondary>transport filter</secondary>
16313 </indexterm>
16314 For the <command>smtp</command> transport, if there is more than one host, the value of
16315 <varname>$host</varname> changes as the transport works its way through the list. In
16316 particular, when the <command>smtp</command> transport is expanding its options for encryption
16317 using TLS, or for specifying a transport filter (see chapter
16318 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16319 is connected.
16320 </para>
16321 <para>
16322 When used in the client part of an authenticator configuration (see chapter
16323 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16324 client is connected.
16325 </para>
16326 </listitem></varlistentry>
16327 <varlistentry>
16328 <term><varname>$host_address</varname></term>
16329 <listitem>
16330 <para>
16331 <indexterm role="variable">
16332 <primary><varname>$host_address</varname></primary>
16333 </indexterm>
16334 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16335 for a remote connection. It is also set to the IP address that is being checked
16336 when the <option>ignore_target_hosts</option> option is being processed.
16337 </para>
16338 </listitem></varlistentry>
16339 <varlistentry>
16340 <term><varname>$host_data</varname></term>
16341 <listitem>
16342 <para>
16343 <indexterm role="variable">
16344 <primary><varname>$host_data</varname></primary>
16345 </indexterm>
16346 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16347 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16348 allows you, for example, to do things like this:
16349 </para>
16350 <literallayout class="monospaced">
16351 deny  hosts = net-lsearch;/some/file
16352 message = $host_data
16353 </literallayout>
16354 </listitem></varlistentry>
16355 <varlistentry>
16356 <term><varname>$host_lookup_deferred</varname></term>
16357 <listitem>
16358 <para>
16359 <indexterm role="concept">
16360 <primary>host name</primary>
16361 <secondary>lookup, failure of</secondary>
16362 </indexterm>
16363 <indexterm role="variable">
16364 <primary><varname>$host_lookup_deferred</varname></primary>
16365 </indexterm>
16366 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16367 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16368 name from its IP address, and the attempt is not successful, one of these
16369 variables is set to <quote>1</quote>.
16370 </para>
16371 <itemizedlist>
16372 <listitem>
16373 <para>
16374 If the lookup receives a definite negative response (for example, a DNS lookup
16375 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16376 </para>
16377 </listitem>
16378 <listitem>
16379 <para>
16380 If there is any kind of problem during the lookup, such that Exim cannot
16381 tell whether or not the host name is defined (for example, a timeout for a DNS
16382 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16383 </para>
16384 </listitem>
16385 </itemizedlist>
16386 <para>
16387 Looking up a host&#x2019;s name from its IP address consists of more than just a
16388 single reverse lookup. Exim checks that a forward lookup of at least one of the
16389 names it receives from a reverse lookup yields the original IP address. If this
16390 is not the case, Exim does not accept the looked up name(s), and
16391 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16392 IP address (for example, the existence of a PTR record in the DNS) is not
16393 sufficient on its own for the success of a host name lookup. If the reverse
16394 lookup succeeds, but there is a lookup problem such as a timeout when checking
16395 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16396 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16397 </para>
16398 </listitem></varlistentry>
16399 <varlistentry>
16400 <term><varname>$host_lookup_failed</varname></term>
16401 <listitem>
16402 <para>
16403 <indexterm role="variable">
16404 <primary><varname>$host_lookup_failed</varname></primary>
16405 </indexterm>
16406 See <varname>$host_lookup_deferred</varname>.
16407 </para>
16408 </listitem></varlistentry>
16409 <varlistentry>
16410 <term><varname>$inode</varname></term>
16411 <listitem>
16412 <para>
16413 <indexterm role="variable">
16414 <primary><varname>$inode</varname></primary>
16415 </indexterm>
16416 The only time this variable is set is while expanding the <option>directory_file</option>
16417 option in the <command>appendfile</command> transport. The variable contains the inode number
16418 of the temporary file which is about to be renamed. It can be used to construct
16419 a unique name for the file.
16420 </para>
16421 </listitem></varlistentry>
16422 <varlistentry>
16423 <term><varname>$interface_address</varname></term>
16424 <listitem>
16425 <para>
16426 <indexterm role="variable">
16427 <primary><varname>$interface_address</varname></primary>
16428 </indexterm>
16429 This is an obsolete name for <varname>$received_ip_address</varname>.
16430 </para>
16431 </listitem></varlistentry>
16432 <varlistentry>
16433 <term><varname>$interface_port</varname></term>
16434 <listitem>
16435 <para>
16436 <indexterm role="variable">
16437 <primary><varname>$interface_port</varname></primary>
16438 </indexterm>
16439 This is an obsolete name for <varname>$received_port</varname>.
16440 </para>
16441 </listitem></varlistentry>
16442 <varlistentry>
16443 <term><varname>$item</varname></term>
16444 <listitem>
16445 <para>
16446 <indexterm role="variable">
16447 <primary><varname>$item</varname></primary>
16448 </indexterm>
16449 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16450 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16451 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16452 empty.
16453 </para>
16454 </listitem></varlistentry>
16455 <varlistentry>
16456 <term><varname>$ldap_dn</varname></term>
16457 <listitem>
16458 <para>
16459 <indexterm role="variable">
16460 <primary><varname>$ldap_dn</varname></primary>
16461 </indexterm>
16462 This variable, which is available only when Exim is compiled with LDAP support,
16463 contains the DN from the last entry in the most recently successful LDAP
16464 lookup.
16465 </para>
16466 </listitem></varlistentry>
16467 <varlistentry>
16468 <term><varname>$load_average</varname></term>
16469 <listitem>
16470 <para>
16471 <indexterm role="variable">
16472 <primary><varname>$load_average</varname></primary>
16473 </indexterm>
16474 This variable contains the system load average, multiplied by 1000 so that it
16475 is an integer. For example, if the load average is 0.21, the value of the
16476 variable is 210. The value is recomputed every time the variable is referenced.
16477 </para>
16478 </listitem></varlistentry>
16479 <varlistentry>
16480 <term><varname>$local_part</varname></term>
16481 <listitem>
16482 <para>
16483 <indexterm role="variable">
16484 <primary><varname>$local_part</varname></primary>
16485 </indexterm>
16486 When an address is being routed, or delivered on its own, this
16487 variable contains the local part. When a number of addresses are being
16488 delivered together (for example, multiple RCPT commands in an SMTP
16489 session), <varname>$local_part</varname> is not set.
16490 </para>
16491 <para>
16492 Global address rewriting happens when a message is received, so the value of
16493 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16494 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16495 because a message may have many recipients and the system filter is called just
16496 once.
16497 </para>
16498 <para>
16499 <indexterm role="variable">
16500 <primary><varname>$local_part_prefix</varname></primary>
16501 </indexterm>
16502 <indexterm role="variable">
16503 <primary><varname>$local_part_suffix</varname></primary>
16504 </indexterm>
16505 If a local part prefix or suffix has been recognized, it is not included in the
16506 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16507 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16508 <varname>$local_part_suffix</varname>, respectively.
16509 </para>
16510 <para>
16511 When a message is being delivered to a file, pipe, or autoreply transport as a
16512 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16513 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16514 <varname>$address_pipe</varname>).
16515 </para>
16516 <para>
16517 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16518 local part of the recipient address.
16519 </para>
16520 <para>
16521 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16522 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16523 it can be used in the expansion of the replacement address, for example.
16524 </para>
16525 <para>
16526 In all cases, all quoting is removed from the local part. For example, for both
16527 the addresses
16528 </para>
16529 <literallayout class="monospaced">
16530 "abc:xyz"@test.example
16531 abc\:xyz@test.example
16532 </literallayout>
16533 <para>
16534 the value of <varname>$local_part</varname> is
16535 </para>
16536 <literallayout class="monospaced">
16537 abc:xyz
16538 </literallayout>
16539 <para>
16540 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16541 inside a quoting operator. For example, in a <command>redirect</command> router you could
16542 have:
16543 </para>
16544 <literallayout class="monospaced">
16545 data = ${quote_local_part:$local_part}@new.domain.example
16546 </literallayout>
16547 <para>
16548 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16549 to process local parts in a case-dependent manner in a router, you can set the
16550 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16551 </para>
16552 </listitem></varlistentry>
16553 <varlistentry>
16554 <term><varname>$local_part_data</varname></term>
16555 <listitem>
16556 <para>
16557 <indexterm role="variable">
16558 <primary><varname>$local_part_data</varname></primary>
16559 </indexterm>
16560 When the <option>local_parts</option> option on a router matches a local part by means of a
16561 lookup, the data read by the lookup is available during the running of the
16562 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16563 to a transport, the value is available in that transport. If the transport is
16564 handling multiple addresses, the value from the first address is used.
16565 </para>
16566 <para>
16567 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16568 matches a local part by means of a lookup. The data read by the lookup is
16569 available during the rest of the ACL statement. In all other situations, this
16570 variable expands to nothing.
16571 </para>
16572 </listitem></varlistentry>
16573 <varlistentry>
16574 <term><varname>$local_part_prefix</varname></term>
16575 <listitem>
16576 <para>
16577 <indexterm role="variable">
16578 <primary><varname>$local_part_prefix</varname></primary>
16579 </indexterm>
16580 When an address is being routed or delivered, and a
16581 specific prefix for the local part was recognized, it is available in this
16582 variable, having been removed from <varname>$local_part</varname>.
16583 </para>
16584 </listitem></varlistentry>
16585 <varlistentry>
16586 <term><varname>$local_part_suffix</varname></term>
16587 <listitem>
16588 <para>
16589 <indexterm role="variable">
16590 <primary><varname>$local_part_suffix</varname></primary>
16591 </indexterm>
16592 When an address is being routed or delivered, and a
16593 specific suffix for the local part was recognized, it is available in this
16594 variable, having been removed from <varname>$local_part</varname>.
16595 </para>
16596 </listitem></varlistentry>
16597 <varlistentry>
16598 <term><varname>$local_scan_data</varname></term>
16599 <listitem>
16600 <para>
16601 <indexterm role="variable">
16602 <primary><varname>$local_scan_data</varname></primary>
16603 </indexterm>
16604 This variable contains the text returned by the <function>local_scan()</function> function when
16605 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16606 </para>
16607 </listitem></varlistentry>
16608 <varlistentry>
16609 <term><varname>$local_user_gid</varname></term>
16610 <listitem>
16611 <para>
16612 <indexterm role="variable">
16613 <primary><varname>$local_user_gid</varname></primary>
16614 </indexterm>
16615 See <varname>$local_user_uid</varname>.
16616 </para>
16617 </listitem></varlistentry>
16618 <varlistentry>
16619 <term><varname>$local_user_uid</varname></term>
16620 <listitem>
16621 <para>
16622 <indexterm role="variable">
16623 <primary><varname>$local_user_uid</varname></primary>
16624 </indexterm>
16625 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16626 <option>check_local_user</option> router precondition succeeds. This means that their values
16627 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16628 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16629 router-specific expansions. At all other times, the values in these variables
16630 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16631 </para>
16632 </listitem></varlistentry>
16633 <varlistentry>
16634 <term><varname>$localhost_number</varname></term>
16635 <listitem>
16636 <para>
16637 <indexterm role="variable">
16638 <primary><varname>$localhost_number</varname></primary>
16639 </indexterm>
16640 This contains the expanded value of the
16641 <option>localhost_number</option> option. The expansion happens after the main options have
16642 been read.
16643 </para>
16644 </listitem></varlistentry>
16645 <varlistentry>
16646 <term><varname>$log_inodes</varname></term>
16647 <listitem>
16648 <para>
16649 <indexterm role="variable">
16650 <primary><varname>$log_inodes</varname></primary>
16651 </indexterm>
16652 The number of free inodes in the disk partition where Exim&#x2019;s
16653 log files are being written. The value is recalculated whenever the variable is
16654 referenced. If the relevant file system does not have the concept of inodes,
16655 the value of is -1. See also the <option>check_log_inodes</option> option.
16656 </para>
16657 </listitem></varlistentry>
16658 <varlistentry>
16659 <term><varname>$log_space</varname></term>
16660 <listitem>
16661 <para>
16662 <indexterm role="variable">
16663 <primary><varname>$log_space</varname></primary>
16664 </indexterm>
16665 The amount of free space (as a number of kilobytes) in the disk
16666 partition where Exim&#x2019;s log files are being written. The value is recalculated
16667 whenever the variable is referenced. If the operating system does not have the
16668 ability to find the amount of free space (only true for experimental systems),
16669 the space value is -1. See also the <option>check_log_space</option> option.
16670 </para>
16671 </listitem></varlistentry>
16672 <varlistentry>
16673 <term><varname>$mailstore_basename</varname></term>
16674 <listitem>
16675 <para>
16676 <indexterm role="variable">
16677 <primary><varname>$mailstore_basename</varname></primary>
16678 </indexterm>
16679 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16680 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16681 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16682 contains the basename of the files that are being written, that is, the name
16683 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16684 variable is empty.
16685 </para>
16686 </listitem></varlistentry>
16687 <varlistentry>
16688 <term><varname>$malware_name</varname></term>
16689 <listitem>
16690 <para>
16691 <indexterm role="variable">
16692 <primary><varname>$malware_name</varname></primary>
16693 </indexterm>
16694 This variable is available when Exim is compiled with the
16695 content-scanning extension. It is set to the name of the virus that was found
16696 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16697 </para>
16698 </listitem></varlistentry>
16699 <varlistentry>
16700 <term><varname>$max_received_linelength</varname></term>
16701 <listitem>
16702 <para>
16703 <indexterm role="variable">
16704 <primary><varname>$max_received_linelength</varname></primary>
16705 </indexterm>
16706 <indexterm role="concept">
16707 <primary>maximum</primary>
16708 <secondary>line length</secondary>
16709 </indexterm>
16710 <indexterm role="concept">
16711 <primary>line length</primary>
16712 <secondary>maximum</secondary>
16713 </indexterm>
16714 This variable contains the number of bytes in the longest line that was
16715 received as part of the message, not counting the line termination
16716 character(s).
16717 </para>
16718 </listitem></varlistentry>
16719 <varlistentry>
16720 <term><varname>$message_age</varname></term>
16721 <listitem>
16722 <para>
16723 <indexterm role="concept">
16724 <primary>message</primary>
16725 <secondary>age of</secondary>
16726 </indexterm>
16727 <indexterm role="variable">
16728 <primary><varname>$message_age</varname></primary>
16729 </indexterm>
16730 This variable is set at the start of a delivery attempt to contain the number
16731 of seconds since the message was received. It does not change during a single
16732 delivery attempt.
16733 </para>
16734 </listitem></varlistentry>
16735 <varlistentry>
16736 <term><varname>$message_body</varname></term>
16737 <listitem>
16738 <para>
16739 <indexterm role="concept">
16740 <primary>body of message</primary>
16741 <secondary>expansion variable</secondary>
16742 </indexterm>
16743 <indexterm role="concept">
16744 <primary>message body</primary>
16745 <secondary>in expansion</secondary>
16746 </indexterm>
16747 <indexterm role="concept">
16748 <primary>binary zero</primary>
16749 <secondary>in message body</secondary>
16750 </indexterm>
16751 <indexterm role="variable">
16752 <primary><varname>$message_body</varname></primary>
16753 </indexterm>
16754 <indexterm role="option">
16755 <primary><option>message_body_visible</option></primary>
16756 </indexterm>
16757 This variable contains the initial portion of a message&#x2019;s body while it is
16758 being delivered, and is intended mainly for use in filter files. The maximum
16759 number of characters of the body that are put into the variable is set by the
16760 <option>message_body_visible</option> configuration option; the default is 500.
16761 </para>
16762 <para>
16763 <indexterm role="option">
16764 <primary><option>message_body_newlines</option></primary>
16765 </indexterm>
16766 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16767 easier to search for phrases that might be split over a line break. However,
16768 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16769 zeros are always converted into spaces.
16770 </para>
16771 </listitem></varlistentry>
16772 <varlistentry>
16773 <term><varname>$message_body_end</varname></term>
16774 <listitem>
16775 <para>
16776 <indexterm role="concept">
16777 <primary>body of message</primary>
16778 <secondary>expansion variable</secondary>
16779 </indexterm>
16780 <indexterm role="concept">
16781 <primary>message body</primary>
16782 <secondary>in expansion</secondary>
16783 </indexterm>
16784 <indexterm role="variable">
16785 <primary><varname>$message_body_end</varname></primary>
16786 </indexterm>
16787 This variable contains the final portion of a message&#x2019;s
16788 body while it is being delivered. The format and maximum size are as for
16789 <varname>$message_body</varname>.
16790 </para>
16791 </listitem></varlistentry>
16792 <varlistentry>
16793 <term><varname>$message_body_size</varname></term>
16794 <listitem>
16795 <para>
16796 <indexterm role="concept">
16797 <primary>body of message</primary>
16798 <secondary>size</secondary>
16799 </indexterm>
16800 <indexterm role="concept">
16801 <primary>message body</primary>
16802 <secondary>size</secondary>
16803 </indexterm>
16804 <indexterm role="variable">
16805 <primary><varname>$message_body_size</varname></primary>
16806 </indexterm>
16807 When a message is being delivered, this variable contains the size of the body
16808 in bytes. The count starts from the character after the blank line that
16809 separates the body from the header. Newlines are included in the count. See
16810 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16811 </para>
16812 </listitem></varlistentry>
16813 <varlistentry>
16814 <term><varname>$message_exim_id</varname></term>
16815 <listitem>
16816 <para>
16817 <indexterm role="variable">
16818 <primary><varname>$message_exim_id</varname></primary>
16819 </indexterm>
16820 When a message is being received or delivered, this variable contains the
16821 unique message id that is generated and used by Exim to identify the message.
16822 An id is not created for a message until after its header has been successfully
16823 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16824 line; it is the local id that Exim assigns to the message, for example:
16825 <literal>1BXTIK-0001yO-VA</literal>.
16826 </para>
16827 </listitem></varlistentry>
16828 <varlistentry>
16829 <term><varname>$message_headers</varname></term>
16830 <listitem>
16831 <para>
16832 <indexterm role="variable">
16833 <primary><varname>$message_headers</varname></primary>
16834 </indexterm>
16835 This variable contains a concatenation of all the header lines when a message
16836 is being processed, except for lines added by routers or transports. The header
16837 lines are separated by newline characters. Their contents are decoded in the
16838 same way as a header line that is inserted by <option>bheader</option>.
16839 </para>
16840 </listitem></varlistentry>
16841 <varlistentry>
16842 <term><varname>$message_headers_raw</varname></term>
16843 <listitem>
16844 <para>
16845 <indexterm role="variable">
16846 <primary><varname>$message_headers_raw</varname></primary>
16847 </indexterm>
16848 This variable is like <varname>$message_headers</varname> except that no processing of the
16849 contents of header lines is done.
16850 </para>
16851 </listitem></varlistentry>
16852 <varlistentry>
16853 <term><varname>$message_id</varname></term>
16854 <listitem>
16855 <para>
16856 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16857 </para>
16858 </listitem></varlistentry>
16859 <varlistentry>
16860 <term><varname>$message_linecount</varname></term>
16861 <listitem>
16862 <para>
16863 <indexterm role="variable">
16864 <primary><varname>$message_linecount</varname></primary>
16865 </indexterm>
16866 This variable contains the total number of lines in the header and body of the
16867 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16868 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16869 number of lines received. Before delivery happens (that is, before filters,
16870 routers, and transports run) the count is increased to include the
16871 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16872 lines that are added by ACLs. The blank line that separates the message header
16873 from the body is not counted. Here is an example of the use of this variable in
16874 a DATA ACL:
16875 </para>
16876 <literallayout class="monospaced">
16877 deny message   = Too many lines in message header
16878      condition = \
16879       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16880 </literallayout>
16881 <para>
16882 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16883 message has not yet been received.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><varname>$message_size</varname></term>
16888 <listitem>
16889 <para>
16890 <indexterm role="concept">
16891 <primary>size</primary>
16892 <secondary>of message</secondary>
16893 </indexterm>
16894 <indexterm role="concept">
16895 <primary>message</primary>
16896 <secondary>size</secondary>
16897 </indexterm>
16898 <indexterm role="variable">
16899 <primary><varname>$message_size</varname></primary>
16900 </indexterm>
16901 When a message is being processed, this variable contains its size in bytes. In
16902 most cases, the size includes those headers that were received with the
16903 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16904 deliveries as they are written. However, there is one special case: during the
16905 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16906 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16907 precise size of the file that has been written. See also
16908 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16909 </para>
16910 <para revisionflag="changed">
16911 <indexterm role="concept">
16912 <primary>RCPT</primary>
16913 <secondary>value of <varname>$message_size</varname></secondary>
16914 </indexterm>
16915 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
16916 contains the size supplied on the MAIL command, or -1 if no size was given. The
16917 value may not, of course, be truthful.
16918 </para>
16919 </listitem></varlistentry>
16920 <varlistentry>
16921 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16922 <listitem>
16923 <para>
16924 A number of variables whose names start with <varname>$mime</varname> are
16925 available when Exim is compiled with the content-scanning extension. For
16926 details, see section <xref linkend="SECTscanmimepart"/>.
16927 </para>
16928 </listitem></varlistentry>
16929 <varlistentry>
16930 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16931 <listitem>
16932 <para>
16933 These variables are counters that can be incremented by means
16934 of the <option>add</option> command in filter files.
16935 </para>
16936 </listitem></varlistentry>
16937 <varlistentry>
16938 <term><varname>$original_domain</varname></term>
16939 <listitem>
16940 <para>
16941 <indexterm role="variable">
16942 <primary><varname>$domain</varname></primary>
16943 </indexterm>
16944 <indexterm role="variable">
16945 <primary><varname>$original_domain</varname></primary>
16946 </indexterm>
16947 When a top-level address is being processed for delivery, this contains the
16948 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16949 generated by an alias, forward, or filter file) is being processed, this
16950 variable contains the domain of the original address (lower cased). This
16951 differs from <varname>$parent_domain</varname> only when there is more than one level of
16952 aliasing or forwarding. When more than one address is being delivered in a
16953 single transport run, <varname>$original_domain</varname> is not set.
16954 </para>
16955 <para>
16956 If a new address is created by means of a <option>deliver</option> command in a system
16957 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16958 part <emphasis>system-filter</emphasis> and the default qualify domain.
16959 </para>
16960 </listitem></varlistentry>
16961 <varlistentry>
16962 <term><varname>$original_local_part</varname></term>
16963 <listitem>
16964 <para>
16965 <indexterm role="variable">
16966 <primary><varname>$local_part</varname></primary>
16967 </indexterm>
16968 <indexterm role="variable">
16969 <primary><varname>$original_local_part</varname></primary>
16970 </indexterm>
16971 When a top-level address is being processed for delivery, this contains the
16972 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16973 local part, because <varname>$original_local_part</varname> always contains the full local
16974 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16975 filter file) is being processed, this variable contains the full local part of
16976 the original address.
16977 </para>
16978 <para>
16979 If the router that did the redirection processed the local part
16980 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16981 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16982 one level of aliasing or forwarding. When more than one address is being
16983 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16984 </para>
16985 <para>
16986 If a new address is created by means of a <option>deliver</option> command in a system
16987 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16988 part <emphasis>system-filter</emphasis> and the default qualify domain.
16989 </para>
16990 </listitem></varlistentry>
16991 <varlistentry>
16992 <term><varname>$originator_gid</varname></term>
16993 <listitem>
16994 <para>
16995 <indexterm role="concept">
16996 <primary>gid (group id)</primary>
16997 <secondary>of originating user</secondary>
16998 </indexterm>
16999 <indexterm role="concept">
17000 <primary>sender</primary>
17001 <secondary>gid</secondary>
17002 </indexterm>
17003 <indexterm role="variable">
17004 <primary><varname>$caller_gid</varname></primary>
17005 </indexterm>
17006 <indexterm role="variable">
17007 <primary><varname>$originator_gid</varname></primary>
17008 </indexterm>
17009 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17010 message was received. For messages received via the command line, this is the
17011 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17012 normally the gid of the Exim user.
17013 </para>
17014 </listitem></varlistentry>
17015 <varlistentry>
17016 <term><varname>$originator_uid</varname></term>
17017 <listitem>
17018 <para>
17019 <indexterm role="concept">
17020 <primary>uid (user id)</primary>
17021 <secondary>of originating user</secondary>
17022 </indexterm>
17023 <indexterm role="concept">
17024 <primary>sender</primary>
17025 <secondary>uid</secondary>
17026 </indexterm>
17027 <indexterm role="variable">
17028 <primary><varname>$caller_uid</varname></primary>
17029 </indexterm>
17030 <indexterm role="variable">
17031 <primary><varname>$originaltor_uid</varname></primary>
17032 </indexterm>
17033 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17034 messages received via the command line, this is the uid of the sending user.
17035 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17036 user.
17037 </para>
17038 </listitem></varlistentry>
17039 <varlistentry>
17040 <term><varname>$parent_domain</varname></term>
17041 <listitem>
17042 <para>
17043 <indexterm role="variable">
17044 <primary><varname>$parent_domain</varname></primary>
17045 </indexterm>
17046 This variable is similar to <varname>$original_domain</varname> (see
17047 above), except that it refers to the immediately preceding parent address.
17048 </para>
17049 </listitem></varlistentry>
17050 <varlistentry>
17051 <term><varname>$parent_local_part</varname></term>
17052 <listitem>
17053 <para>
17054 <indexterm role="variable">
17055 <primary><varname>$parent_local_part</varname></primary>
17056 </indexterm>
17057 This variable is similar to <varname>$original_local_part</varname>
17058 (see above), except that it refers to the immediately preceding parent address.
17059 </para>
17060 </listitem></varlistentry>
17061 <varlistentry>
17062 <term><varname>$pid</varname></term>
17063 <listitem>
17064 <para>
17065 <indexterm role="concept">
17066 <primary>pid (process id)</primary>
17067 <secondary>of current process</secondary>
17068 </indexterm>
17069 <indexterm role="variable">
17070 <primary><varname>$pid</varname></primary>
17071 </indexterm>
17072 This variable contains the current process id.
17073 </para>
17074 </listitem></varlistentry>
17075 <varlistentry>
17076 <term><varname>$pipe_addresses</varname></term>
17077 <listitem>
17078 <para>
17079 <indexterm role="concept">
17080 <primary>filter</primary>
17081 <secondary>transport filter</secondary>
17082 </indexterm>
17083 <indexterm role="concept">
17084 <primary>transport</primary>
17085 <secondary>filter</secondary>
17086 </indexterm>
17087 <indexterm role="variable">
17088 <primary><varname>$pipe_addresses</varname></primary>
17089 </indexterm>
17090 This is not an expansion variable, but is mentioned here because the string
17091 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17092 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17093 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17094 It cannot be used in general expansion strings, and provokes an <quote>unknown
17095 variable</quote> error if encountered.
17096 </para>
17097 </listitem></varlistentry>
17098 <varlistentry>
17099 <term><varname>$primary_hostname</varname></term>
17100 <listitem>
17101 <para>
17102 <indexterm role="variable">
17103 <primary><varname>$primary_hostname</varname></primary>
17104 </indexterm>
17105 This variable contains the value set by <option>primary_hostname</option> in the
17106 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17107 a single-component name, Exim calls <function>gethostbyname()</function> (or
17108 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17109 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17110 </para>
17111 </listitem></varlistentry>
17112 <varlistentry>
17113 <term><varname>$prvscheck_address</varname></term>
17114 <listitem>
17115 <para>
17116 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17117 which is described in sections <xref linkend="SECTexpansionitems"/> and
17118 <xref linkend="SECTverifyPRVS"/>.
17119 </para>
17120 </listitem></varlistentry>
17121 <varlistentry>
17122 <term><varname>$prvscheck_keynum</varname></term>
17123 <listitem>
17124 <para>
17125 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17126 which is described in sections <xref linkend="SECTexpansionitems"/> and
17127 <xref linkend="SECTverifyPRVS"/>.
17128 </para>
17129 </listitem></varlistentry>
17130 <varlistentry>
17131 <term><varname>$prvscheck_result</varname></term>
17132 <listitem>
17133 <para>
17134 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17135 which is described in sections <xref linkend="SECTexpansionitems"/> and
17136 <xref linkend="SECTverifyPRVS"/>.
17137 </para>
17138 </listitem></varlistentry>
17139 <varlistentry>
17140 <term><varname>$qualify_domain</varname></term>
17141 <listitem>
17142 <para>
17143 <indexterm role="variable">
17144 <primary><varname>$qualify_domain</varname></primary>
17145 </indexterm>
17146 The value set for the <option>qualify_domain</option> option in the configuration file.
17147 </para>
17148 </listitem></varlistentry>
17149 <varlistentry>
17150 <term><varname>$qualify_recipient</varname></term>
17151 <listitem>
17152 <para>
17153 <indexterm role="variable">
17154 <primary><varname>$qualify_recipient</varname></primary>
17155 </indexterm>
17156 The value set for the <option>qualify_recipient</option> option in the configuration file,
17157 or if not set, the value of <varname>$qualify_domain</varname>.
17158 </para>
17159 </listitem></varlistentry>
17160 <varlistentry>
17161 <term><varname>$rcpt_count</varname></term>
17162 <listitem>
17163 <para>
17164 <indexterm role="variable">
17165 <primary><varname>$rcpt_count</varname></primary>
17166 </indexterm>
17167 When a message is being received by SMTP, this variable contains the number of
17168 RCPT commands received for the current message. If this variable is used in a
17169 RCPT ACL, its value includes the current command.
17170 </para>
17171 </listitem></varlistentry>
17172 <varlistentry>
17173 <term><varname>$rcpt_defer_count</varname></term>
17174 <listitem>
17175 <para>
17176 <indexterm role="variable">
17177 <primary><varname>$rcpt_defer_count</varname></primary>
17178 </indexterm>
17179 <indexterm role="concept">
17180 <primary>4<emphasis>xx</emphasis> responses</primary>
17181 <secondary>count of</secondary>
17182 </indexterm>
17183 When a message is being received by SMTP, this variable contains the number of
17184 RCPT commands in the current message that have previously been rejected with a
17185 temporary (4<emphasis>xx</emphasis>) response.
17186 </para>
17187 </listitem></varlistentry>
17188 <varlistentry>
17189 <term><varname>$rcpt_fail_count</varname></term>
17190 <listitem>
17191 <para>
17192 <indexterm role="variable">
17193 <primary><varname>$rcpt_fail_count</varname></primary>
17194 </indexterm>
17195 When a message is being received by SMTP, this variable contains the number of
17196 RCPT commands in the current message that have previously been rejected with a
17197 permanent (5<emphasis>xx</emphasis>) response.
17198 </para>
17199 </listitem></varlistentry>
17200 <varlistentry>
17201 <term><varname>$received_count</varname></term>
17202 <listitem>
17203 <para>
17204 <indexterm role="variable">
17205 <primary><varname>$received_count</varname></primary>
17206 </indexterm>
17207 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17208 including the one added by Exim (so its value is always greater than zero). It
17209 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17210 delivering.
17211 </para>
17212 </listitem></varlistentry>
17213 <varlistentry>
17214 <term><varname>$received_for</varname></term>
17215 <listitem>
17216 <para>
17217 <indexterm role="variable">
17218 <primary><varname>$received_for</varname></primary>
17219 </indexterm>
17220 If there is only a single recipient address in an incoming message, this
17221 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17222 built. The value is copied after recipient rewriting has happened, but before
17223 the <function>local_scan()</function> function is run.
17224 </para>
17225 </listitem></varlistentry>
17226 <varlistentry>
17227 <term><varname>$received_ip_address</varname></term>
17228 <listitem>
17229 <para>
17230 <indexterm role="variable">
17231 <primary><varname>$received_ip_address</varname></primary>
17232 </indexterm>
17233 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17234 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17235 is set to the local port number. (The remote IP address and port are in
17236 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17237 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17238 option.
17239 </para>
17240 <para>
17241 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17242 could be used, for example, to make the file name for a TLS certificate depend
17243 on which interface and/or port is being used for the incoming connection. The
17244 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17245 messages that are received, thus making these variables available at delivery
17246 time.
17247 </para>
17248 <para>
17249 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17250 the values are unknown (unless they are explicitly set by options of the
17251 <command>smtp</command> transport).
17252 </para>
17253 </listitem></varlistentry>
17254 <varlistentry>
17255 <term><varname>$received_port</varname></term>
17256 <listitem>
17257 <para>
17258 <indexterm role="variable">
17259 <primary><varname>$received_port</varname></primary>
17260 </indexterm>
17261 See <varname>$received_ip_address</varname>.
17262 </para>
17263 </listitem></varlistentry>
17264 <varlistentry>
17265 <term><varname>$received_protocol</varname></term>
17266 <listitem>
17267 <para>
17268 <indexterm role="variable">
17269 <primary><varname>$received_protocol</varname></primary>
17270 </indexterm>
17271 When a message is being processed, this variable contains the name of the
17272 protocol by which it was received. Most of the names used by Exim are defined
17273 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17274 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17275 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17276 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17277 connection and the client was successfully authenticated.
17278 </para>
17279 <para>
17280 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17281 automatically set up on connection without the use of STARTTLS (see
17282 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17283 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17284 where the client initially uses EHLO, sets up an encrypted connection using
17285 STARTTLS, and then uses HELO afterwards.
17286 </para>
17287 <para>
17288 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17289 messages that are injected locally by trusted callers. This is commonly used to
17290 identify messages that are being re-injected after some kind of scanning.
17291 </para>
17292 </listitem></varlistentry>
17293 <varlistentry>
17294 <term><varname>$received_time</varname></term>
17295 <listitem>
17296 <para>
17297 <indexterm role="variable">
17298 <primary><varname>$received_time</varname></primary>
17299 </indexterm>
17300 This variable contains the date and time when the current message was received,
17301 as a number of seconds since the start of the Unix epoch.
17302 </para>
17303 </listitem></varlistentry>
17304 <varlistentry>
17305 <term><varname>$recipient_data</varname></term>
17306 <listitem>
17307 <para>
17308 <indexterm role="variable">
17309 <primary><varname>$recipient_data</varname></primary>
17310 </indexterm>
17311 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17312 condition. It contains the data from the lookup, and the value remains set
17313 until the next <option>recipients</option> test. Thus, you can do things like this:
17314 </para>
17315 <literallayout>
17316 <literal>require recipients  = cdb*@;/some/file</literal>
17317 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17318 </literallayout>
17319 <para>
17320 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17321 method in the address list, using the semicolon syntax as in the example above.
17322 The variable is not set for a lookup that is used as part of the string
17323 expansion that all such lists undergo before being interpreted.
17324 </para>
17325 </listitem></varlistentry>
17326 <varlistentry>
17327 <term><varname>$recipient_verify_failure</varname></term>
17328 <listitem>
17329 <para>
17330 <indexterm role="variable">
17331 <primary><varname>$recipient_verify_failure</varname></primary>
17332 </indexterm>
17333 In an ACL, when a recipient verification fails, this variable contains
17334 information about the failure. It is set to one of the following words:
17335 </para>
17336 <itemizedlist>
17337 <listitem>
17338 <para>
17339 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17340 was neither local nor came from an exempted host.
17341 </para>
17342 </listitem>
17343 <listitem>
17344 <para>
17345 <quote>route</quote>: Routing failed.
17346 </para>
17347 </listitem>
17348 <listitem>
17349 <para>
17350 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17351 or before the MAIL command (that is, on initial connection, HELO, or
17352 MAIL).
17353 </para>
17354 </listitem>
17355 <listitem>
17356 <para>
17357 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17358 </para>
17359 </listitem>
17360 <listitem>
17361 <para>
17362 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17363 </para>
17364 </listitem>
17365 </itemizedlist>
17366 <para>
17367 The main use of this variable is expected to be to distinguish between
17368 rejections of MAIL and rejections of RCPT.
17369 </para>
17370 </listitem></varlistentry>
17371 <varlistentry>
17372 <term><varname>$recipients</varname></term>
17373 <listitem>
17374 <para>
17375 <indexterm role="variable">
17376 <primary><varname>$recipients</varname></primary>
17377 </indexterm>
17378 This variable contains a list of envelope recipients for a message. A comma and
17379 a space separate the addresses in the replacement text. However, the variable
17380 is not generally available, to prevent exposure of Bcc recipients in
17381 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17382 cases:
17383 </para>
17384 <orderedlist numeration="arabic">
17385 <listitem>
17386 <para>
17387 In a system filter file.
17388 </para>
17389 </listitem>
17390 <listitem>
17391 <para>
17392 In the ACLs associated with the DATA command and with non-SMTP messages, that
17393 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17394 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17395 <option>acl_not_smtp_mime</option>.
17396 </para>
17397 </listitem>
17398 <listitem>
17399 <para>
17400 From within a <function>local_scan()</function> function.
17401 </para>
17402 </listitem>
17403 </orderedlist>
17404 </listitem></varlistentry>
17405 <varlistentry>
17406 <term><varname>$recipients_count</varname></term>
17407 <listitem>
17408 <para>
17409 <indexterm role="variable">
17410 <primary><varname>$recipients_count</varname></primary>
17411 </indexterm>
17412 When a message is being processed, this variable contains the number of
17413 envelope recipients that came with the message. Duplicates are not excluded
17414 from the count. While a message is being received over SMTP, the number
17415 increases for each accepted recipient. It can be referenced in an ACL.
17416 </para>
17417 </listitem></varlistentry>
17418 <varlistentry>
17419 <term><varname>$regex_match_string</varname></term>
17420 <listitem>
17421 <para>
17422 <indexterm role="variable">
17423 <primary><varname>$regex_match_string</varname></primary>
17424 </indexterm>
17425 This variable is set to contain the matching regular expression after a
17426 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17427 </para>
17428 </listitem></varlistentry>
17429 <varlistentry>
17430 <term><varname>$reply_address</varname></term>
17431 <listitem>
17432 <para>
17433 <indexterm role="variable">
17434 <primary><varname>$reply_address</varname></primary>
17435 </indexterm>
17436 When a message is being processed, this variable contains the contents of the
17437 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17438 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17439 white space, the value is not processed in any way. In particular, no RFC 2047
17440 decoding or character code translation takes place.
17441 </para>
17442 </listitem></varlistentry>
17443 <varlistentry>
17444 <term><varname>$return_path</varname></term>
17445 <listitem>
17446 <para>
17447 <indexterm role="variable">
17448 <primary><varname>$return_path</varname></primary>
17449 </indexterm>
17450 When a message is being delivered, this variable contains the return path &ndash;
17451 the sender field that will be sent as part of the envelope. It is not enclosed
17452 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17453 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17454 mailing list has been expanded by a router which specifies a different address
17455 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17456 address, whereas <varname>$sender_address</varname> always contains the original sender address
17457 that was received with the message. In other words, <varname>$sender_address</varname> contains
17458 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17459 envelope sender.
17460 </para>
17461 </listitem></varlistentry>
17462 <varlistentry>
17463 <term><varname>$return_size_limit</varname></term>
17464 <listitem>
17465 <para>
17466 <indexterm role="variable">
17467 <primary><varname>$return_size_limit</varname></primary>
17468 </indexterm>
17469 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17470 </para>
17471 </listitem></varlistentry>
17472 <varlistentry>
17473 <term><varname>$runrc</varname></term>
17474 <listitem>
17475 <para>
17476 <indexterm role="concept">
17477 <primary>return code</primary>
17478 <secondary>from <option>run</option> expansion</secondary>
17479 </indexterm>
17480 <indexterm role="variable">
17481 <primary><varname>$runrc</varname></primary>
17482 </indexterm>
17483 This variable contains the return code from a command that is run by the
17484 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17485 assume the order in which option values are expanded, except for those
17486 preconditions whose order of testing is documented. Therefore, you cannot
17487 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17488 another.
17489 </para>
17490 </listitem></varlistentry>
17491 <varlistentry>
17492 <term><varname>$self_hostname</varname></term>
17493 <listitem>
17494 <para>
17495 <indexterm role="option">
17496 <primary><option>self</option></primary>
17497 <secondary>value of host name</secondary>
17498 </indexterm>
17499 <indexterm role="variable">
17500 <primary><varname>$self_hostname</varname></primary>
17501 </indexterm>
17502 When an address is routed to a supposedly remote host that turns out to be the
17503 local host, what happens is controlled by the <option>self</option> generic router option.
17504 One of its values causes the address to be passed to another router. When this
17505 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17506 original router encountered. In other circumstances its contents are null.
17507 </para>
17508 </listitem></varlistentry>
17509 <varlistentry>
17510 <term><varname>$sender_address</varname></term>
17511 <listitem>
17512 <para>
17513 <indexterm role="variable">
17514 <primary><varname>$sender_address</varname></primary>
17515 </indexterm>
17516 When a message is being processed, this variable contains the sender&#x2019;s address
17517 that was received in the message&#x2019;s envelope. The case of letters in the address
17518 is retained, in both the local part and the domain. For bounce messages, the
17519 value of this variable is the empty string. See also <varname>$return_path</varname>.
17520 </para>
17521 </listitem></varlistentry>
17522 <varlistentry>
17523 <term><varname>$sender_address_data</varname></term>
17524 <listitem>
17525 <para>
17526 <indexterm role="variable">
17527 <primary><varname>$address_data</varname></primary>
17528 </indexterm>
17529 <indexterm role="variable">
17530 <primary><varname>$sender_address_data</varname></primary>
17531 </indexterm>
17532 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17533 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17534 distinguish it from data from a recipient address. The value does not persist
17535 after the end of the current ACL statement. If you want to preserve it for
17536 longer, you can save it in an ACL variable.
17537 </para>
17538 </listitem></varlistentry>
17539 <varlistentry>
17540 <term><varname>$sender_address_domain</varname></term>
17541 <listitem>
17542 <para>
17543 <indexterm role="variable">
17544 <primary><varname>$sender_address_domain</varname></primary>
17545 </indexterm>
17546 The domain portion of <varname>$sender_address</varname>.
17547 </para>
17548 </listitem></varlistentry>
17549 <varlistentry>
17550 <term><varname>$sender_address_local_part</varname></term>
17551 <listitem>
17552 <para>
17553 <indexterm role="variable">
17554 <primary><varname>$sender_address_local_part</varname></primary>
17555 </indexterm>
17556 The local part portion of <varname>$sender_address</varname>.
17557 </para>
17558 </listitem></varlistentry>
17559 <varlistentry>
17560 <term><varname>$sender_data</varname></term>
17561 <listitem>
17562 <para>
17563 <indexterm role="variable">
17564 <primary><varname>$sender_data</varname></primary>
17565 </indexterm>
17566 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17567 in a router <option>senders</option> option. It contains the data from the lookup, and the
17568 value remains set until the next <option>senders</option> test. Thus, you can do things like
17569 this:
17570 </para>
17571 <literallayout>
17572 <literal>require senders      = cdb*@;/some/file</literal>
17573 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17574 </literallayout>
17575 <para>
17576 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17577 method in the address list, using the semicolon syntax as in the example above.
17578 The variable is not set for a lookup that is used as part of the string
17579 expansion that all such lists undergo before being interpreted.
17580 </para>
17581 </listitem></varlistentry>
17582 <varlistentry>
17583 <term><varname>$sender_fullhost</varname></term>
17584 <listitem>
17585 <para>
17586 <indexterm role="variable">
17587 <primary><varname>$sender_fullhost</varname></primary>
17588 </indexterm>
17589 When a message is received from a remote host, this variable contains the host
17590 name and IP address in a single string. It ends with the IP address in square
17591 brackets, followed by a colon and a port number if the logging of ports is
17592 enabled. The format of the rest of the string depends on whether the host
17593 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17594 looking up its IP address. (Looking up the IP address can be forced by the
17595 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17596 start of the string is a verified host name; if this is not present,
17597 verification either failed or was not requested. A host name in parentheses is
17598 the argument of a HELO or EHLO command. This is omitted if it is identical to
17599 the verified host name or to the host&#x2019;s IP address in square brackets.
17600 </para>
17601 </listitem></varlistentry>
17602 <varlistentry>
17603 <term><varname>$sender_helo_name</varname></term>
17604 <listitem>
17605 <para>
17606 <indexterm role="variable">
17607 <primary><varname>$sender_helo_name</varname></primary>
17608 </indexterm>
17609 When a message is received from a remote host that has issued a HELO or EHLO
17610 command, the argument of that command is placed in this variable. It is also
17611 set if HELO or EHLO is used when a message is received using SMTP locally via
17612 the <option>-bs</option> or <option>-bS</option> options.
17613 </para>
17614 </listitem></varlistentry>
17615 <varlistentry>
17616 <term><varname>$sender_host_address</varname></term>
17617 <listitem>
17618 <para>
17619 <indexterm role="variable">
17620 <primary><varname>$sender_host_address</varname></primary>
17621 </indexterm>
17622 When a message is received from a remote host, this variable contains that
17623 host&#x2019;s IP address. For locally submitted messages, it is empty.
17624 </para>
17625 </listitem></varlistentry>
17626 <varlistentry>
17627 <term><varname>$sender_host_authenticated</varname></term>
17628 <listitem>
17629 <para>
17630 <indexterm role="variable">
17631 <primary><varname>$sender_host_authenticated</varname></primary>
17632 </indexterm>
17633 This variable contains the name (not the public name) of the authenticator
17634 driver that successfully authenticated the client from which the message was
17635 received. It is empty if there was no successful authentication. See also
17636 <varname>$authenticated_id</varname>.
17637 </para>
17638 </listitem></varlistentry>
17639 <varlistentry>
17640 <term><varname>$sender_host_name</varname></term>
17641 <listitem>
17642 <para>
17643 <indexterm role="variable">
17644 <primary><varname>$sender_host_name</varname></primary>
17645 </indexterm>
17646 When a message is received from a remote host, this variable contains the
17647 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17648 other means, this variable is empty.
17649 </para>
17650 <para>
17651 <indexterm role="variable">
17652 <primary><varname>$host_lookup_failed</varname></primary>
17653 </indexterm>
17654 If the host name has not previously been looked up, a reference to
17655 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17656 A looked up name is accepted only if it leads back to the original IP address
17657 via a forward lookup. If either the reverse or the forward lookup fails to find
17658 any data, or if the forward lookup does not yield the original IP address,
17659 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17660 </para>
17661 <para>
17662 <indexterm role="variable">
17663 <primary><varname>$host_lookup_deferred</varname></primary>
17664 </indexterm>
17665 However, if either of the lookups cannot be completed (for example, there is a
17666 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17667 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17668 </para>
17669 <para>
17670 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17671 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17672 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17673 is set to <quote>1</quote>.
17674 </para>
17675 <para>
17676 Exim does not automatically look up every calling host&#x2019;s name. If you want
17677 maximum efficiency, you should arrange your configuration so that it avoids
17678 these lookups altogether. The lookup happens only if one or more of the
17679 following are true:
17680 </para>
17681 <itemizedlist>
17682 <listitem>
17683 <para>
17684 A string containing <varname>$sender_host_name</varname> is expanded.
17685 </para>
17686 </listitem>
17687 <listitem>
17688 <para>
17689 The calling host matches the list in <option>host_lookup</option>. In the default
17690 configuration, this option is set to *, so it must be changed if lookups are
17691 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17692 </para>
17693 </listitem>
17694 <listitem>
17695 <para>
17696 Exim needs the host name in order to test an item in a host list. The items
17697 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17698 <xref linkend="SECThoslispatnamsk"/>.
17699 </para>
17700 </listitem>
17701 <listitem>
17702 <para>
17703 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17704 In this case, the host name is required to compare with the name quoted in any
17705 EHLO or HELO commands that the client issues.
17706 </para>
17707 </listitem>
17708 <listitem>
17709 <para>
17710 The remote host issues a EHLO or HELO command that quotes one of the
17711 domains in <option>helo_lookup_domains</option>. The default value of this option is
17712 </para>
17713 <literallayout class="monospaced">
17714   helo_lookup_domains = @ : @[]
17715 </literallayout>
17716 <para>
17717 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17718 IP address in an EHLO or HELO command.
17719 </para>
17720 </listitem>
17721 </itemizedlist>
17722 </listitem></varlistentry>
17723 <varlistentry>
17724 <term><varname>$sender_host_port</varname></term>
17725 <listitem>
17726 <para>
17727 <indexterm role="variable">
17728 <primary><varname>$sender_host_port</varname></primary>
17729 </indexterm>
17730 When a message is received from a remote host, this variable contains the port
17731 number that was used on the remote host.
17732 </para>
17733 </listitem></varlistentry>
17734 <varlistentry>
17735 <term><varname>$sender_ident</varname></term>
17736 <listitem>
17737 <para>
17738 <indexterm role="variable">
17739 <primary><varname>$sender_ident</varname></primary>
17740 </indexterm>
17741 When a message is received from a remote host, this variable contains the
17742 identification received in response to an RFC 1413 request. When a message has
17743 been received locally, this variable contains the login name of the user that
17744 called Exim.
17745 </para>
17746 </listitem></varlistentry>
17747 <varlistentry>
17748 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17749 <listitem>
17750 <para>
17751 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17752 <option>ratelimit</option> ACL condition. Details are given in section
17753 <xref linkend="SECTratelimiting"/>.
17754 </para>
17755 </listitem></varlistentry>
17756 <varlistentry>
17757 <term><varname>$sender_rcvhost</varname></term>
17758 <listitem>
17759 <para>
17760 <indexterm role="concept">
17761 <primary>DNS</primary>
17762 <secondary>reverse lookup</secondary>
17763 </indexterm>
17764 <indexterm role="concept">
17765 <primary>reverse DNS lookup</primary>
17766 </indexterm>
17767 <indexterm role="variable">
17768 <primary><varname>$sender_rcvhost</varname></primary>
17769 </indexterm>
17770 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17771 either the verified host name (as obtained from a reverse DNS lookup) or, if
17772 there is no verified host name, the IP address in square brackets. After that
17773 there may be text in parentheses. When the first item is a verified host name,
17774 the first thing in the parentheses is the IP address in square brackets,
17775 followed by a colon and a port number if port logging is enabled. When the
17776 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17777 the parentheses.
17778 </para>
17779 <para>
17780 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17781 was used and its argument was not identical to the real host name or IP
17782 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17783 all three items are present in the parentheses, a newline and tab are inserted
17784 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17785 </para>
17786 </listitem></varlistentry>
17787 <varlistentry>
17788 <term><varname>$sender_verify_failure</varname></term>
17789 <listitem>
17790 <para>
17791 <indexterm role="variable">
17792 <primary><varname>$sender_verify_failure</varname></primary>
17793 </indexterm>
17794 In an ACL, when a sender verification fails, this variable contains information
17795 about the failure. The details are the same as for
17796 <varname>$recipient_verify_failure</varname>.
17797 </para>
17798 </listitem></varlistentry>
17799 <varlistentry>
17800 <term><varname>$sending_ip_address</varname></term>
17801 <listitem>
17802 <para>
17803 <indexterm role="variable">
17804 <primary><varname>$sending_ip_address</varname></primary>
17805 </indexterm>
17806 This variable is set whenever an outgoing SMTP connection to another host has
17807 been set up. It contains the IP address of the local interface that is being
17808 used. This is useful if a host that has more than one IP address wants to take
17809 on different personalities depending on which one is being used. For incoming
17810 connections, see <varname>$received_ip_address</varname>.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$sending_port</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="variable">
17818 <primary><varname>$sending_port</varname></primary>
17819 </indexterm>
17820 This variable is set whenever an outgoing SMTP connection to another host has
17821 been set up. It contains the local port that is being used. For incoming
17822 connections, see <varname>$received_port</varname>.
17823 </para>
17824 </listitem></varlistentry>
17825 <varlistentry>
17826 <term><varname>$smtp_active_hostname</varname></term>
17827 <listitem>
17828 <para>
17829 <indexterm role="variable">
17830 <primary><varname>$smtp_active_hostname</varname></primary>
17831 </indexterm>
17832 During an incoming SMTP session, this variable contains the value of the active
17833 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17834 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17835 value can be consulted during routing and delivery.
17836 </para>
17837 </listitem></varlistentry>
17838 <varlistentry>
17839 <term><varname>$smtp_command</varname></term>
17840 <listitem>
17841 <para>
17842 <indexterm role="variable">
17843 <primary><varname>$smtp_command</varname></primary>
17844 </indexterm>
17845 During the processing of an incoming SMTP command, this variable contains the
17846 entire command. This makes it possible to distinguish between HELO and EHLO in
17847 the HELO ACL, and also to distinguish between commands such as these:
17848 </para>
17849 <literallayout class="monospaced">
17850 MAIL FROM:&lt;&gt;
17851 MAIL FROM: &lt;&gt;
17852 </literallayout>
17853 <para>
17854 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17855 command, the address in <varname>$smtp_command</varname> is the original address before any
17856 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17857 the address after SMTP-time rewriting.
17858 </para>
17859 </listitem></varlistentry>
17860 <varlistentry>
17861 <term><varname>$smtp_command_argument</varname></term>
17862 <listitem>
17863 <para>
17864 <indexterm role="concept">
17865 <primary>SMTP</primary>
17866 <secondary>command, argument for</secondary>
17867 </indexterm>
17868 <indexterm role="variable">
17869 <primary><varname>$smtp_command_argument</varname></primary>
17870 </indexterm>
17871 While an ACL is running to check an SMTP command, this variable contains the
17872 argument, that is, the text that follows the command name, with leading white
17873 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17874 somewhat redundant, but is retained for backwards compatibility.
17875 </para>
17876 </listitem></varlistentry>
17877 <varlistentry>
17878 <term><varname>$smtp_count_at_connection_start</varname></term>
17879 <listitem>
17880 <para>
17881 <indexterm role="variable">
17882 <primary><varname>$smtp_count_at_connection_start</varname></primary>
17883 </indexterm>
17884 This variable is set greater than zero only in processes spawned by the Exim
17885 daemon for handling incoming SMTP connections. The name is deliberately long,
17886 in order to emphasize what the contents are. When the daemon accepts a new
17887 connection, it increments this variable. A copy of the variable is passed to
17888 the child process that handles the connection, but its value is fixed, and
17889 never changes. It is only an approximation of how many incoming connections
17890 there actually are, because many other connections may come and go while a
17891 single connection is being processed. When a child process terminates, the
17892 daemon decrements its copy of the variable.
17893 </para>
17894 </listitem></varlistentry>
17895 <varlistentry>
17896 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17897 <listitem>
17898 <para>
17899 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17900 that were current at the end of the system filter file. This allows a system
17901 filter file to set values that can be tested in users&#x2019; filter files. For
17902 example, a system filter could set a value indicating how likely it is that a
17903 message is junk mail.
17904 </para>
17905 </listitem></varlistentry>
17906 <varlistentry>
17907 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17908 <listitem>
17909 <para>
17910 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17911 is compiled with the content-scanning extension. For details, see section
17912 <xref linkend="SECTscanspamass"/>.
17913 </para>
17914 </listitem></varlistentry>
17915 <varlistentry>
17916 <term><varname>$spool_directory</varname></term>
17917 <listitem>
17918 <para>
17919 <indexterm role="variable">
17920 <primary><varname>$spool_directory</varname></primary>
17921 </indexterm>
17922 The name of Exim&#x2019;s spool directory.
17923 </para>
17924 </listitem></varlistentry>
17925 <varlistentry>
17926 <term><varname>$spool_inodes</varname></term>
17927 <listitem>
17928 <para>
17929 <indexterm role="variable">
17930 <primary><varname>$spool_inodes</varname></primary>
17931 </indexterm>
17932 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17933 being written. The value is recalculated whenever the variable is referenced.
17934 If the relevant file system does not have the concept of inodes, the value of
17935 is -1. See also the <option>check_spool_inodes</option> option.
17936 </para>
17937 </listitem></varlistentry>
17938 <varlistentry>
17939 <term><varname>$spool_space</varname></term>
17940 <listitem>
17941 <para>
17942 <indexterm role="variable">
17943 <primary><varname>$spool_space</varname></primary>
17944 </indexterm>
17945 The amount of free space (as a number of kilobytes) in the disk partition where
17946 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17947 variable is referenced. If the operating system does not have the ability to
17948 find the amount of free space (only true for experimental systems), the space
17949 value is -1. For example, to check in an ACL that there is at least 50
17950 megabytes free on the spool, you could write:
17951 </para>
17952 <literallayout class="monospaced">
17953 condition = ${if &gt; {$spool_space}{50000}}
17954 </literallayout>
17955 <para>
17956 See also the <option>check_spool_space</option> option.
17957 </para>
17958 </listitem></varlistentry>
17959 <varlistentry>
17960 <term><varname>$thisaddress</varname></term>
17961 <listitem>
17962 <para>
17963 <indexterm role="variable">
17964 <primary><varname>$thisaddress</varname></primary>
17965 </indexterm>
17966 This variable is set only during the processing of the <option>foranyaddress</option>
17967 command in a filter file. Its use is explained in the description of that
17968 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
17969 interfaces to mail filtering</emphasis>.
17970 </para>
17971 </listitem></varlistentry>
17972 <varlistentry>
17973 <term><varname>$tls_certificate_verified</varname></term>
17974 <listitem>
17975 <para>
17976 <indexterm role="variable">
17977 <primary><varname>$tls_certificate_verified</varname></primary>
17978 </indexterm>
17979 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17980 message was received, and <quote>0</quote> otherwise.
17981 </para>
17982 </listitem></varlistentry>
17983 <varlistentry>
17984 <term><varname>$tls_cipher</varname></term>
17985 <listitem>
17986 <para>
17987 <indexterm role="variable">
17988 <primary><varname>$tls_cipher</varname></primary>
17989 </indexterm>
17990 When a message is received from a remote host over an encrypted SMTP
17991 connection, this variable is set to the cipher suite that was negotiated, for
17992 example DES-CBC3-SHA. In other circumstances, in particular, for message
17993 received over unencrypted connections, the variable is empty. Testing
17994 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
17995 non-encrypted connections during ACL processing.
17996 </para>
17997 <para>
17998 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
17999 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18000 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18001 and then set to the outgoing cipher suite if one is negotiated. See chapter
18002 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18003 details of the <command>smtp</command> transport.
18004 </para>
18005 </listitem></varlistentry>
18006 <varlistentry>
18007 <term><varname>$tls_peerdn</varname></term>
18008 <listitem>
18009 <para>
18010 <indexterm role="variable">
18011 <primary><varname>$tls_peerdn</varname></primary>
18012 </indexterm>
18013 When a message is received from a remote host over an encrypted SMTP
18014 connection, and Exim is configured to request a certificate from the client,
18015 the value of the Distinguished Name of the certificate is made available in the
18016 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18017 value is retained during message delivery, except during outbound SMTP
18018 deliveries.
18019 </para>
18020 </listitem></varlistentry>
18021 <varlistentry>
18022 <term><varname>$tod_bsdinbox</varname></term>
18023 <listitem>
18024 <para>
18025 <indexterm role="variable">
18026 <primary><varname>$tod_bsdinbox</varname></primary>
18027 </indexterm>
18028 The time of day and the date, in the format required for BSD-style mailbox
18029 files, for example: Thu Oct 17 17:14:09 1995.
18030 </para>
18031 </listitem></varlistentry>
18032 <varlistentry>
18033 <term><varname>$tod_epoch</varname></term>
18034 <listitem>
18035 <para>
18036 <indexterm role="variable">
18037 <primary><varname>$tod_epoch</varname></primary>
18038 </indexterm>
18039 The time and date as a number of seconds since the start of the Unix epoch.
18040 </para>
18041 </listitem></varlistentry>
18042 <varlistentry>
18043 <term><varname>$tod_full</varname></term>
18044 <listitem>
18045 <para>
18046 <indexterm role="variable">
18047 <primary><varname>$tod_full</varname></primary>
18048 </indexterm>
18049 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18050 +0100. The timezone is always given as a numerical offset from UTC, with
18051 positive values used for timezones that are ahead (east) of UTC, and negative
18052 values for those that are behind (west).
18053 </para>
18054 </listitem></varlistentry>
18055 <varlistentry>
18056 <term><varname>$tod_log</varname></term>
18057 <listitem>
18058 <para>
18059 <indexterm role="variable">
18060 <primary><varname>$tod_log</varname></primary>
18061 </indexterm>
18062 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18063 1995-10-12 15:32:29, but without a timezone.
18064 </para>
18065 </listitem></varlistentry>
18066 <varlistentry>
18067 <term><varname>$tod_logfile</varname></term>
18068 <listitem>
18069 <para>
18070 <indexterm role="variable">
18071 <primary><varname>$tod_logfile</varname></primary>
18072 </indexterm>
18073 This variable contains the date in the format yyyymmdd. This is the format that
18074 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18075 flag.
18076 </para>
18077 </listitem></varlistentry>
18078 <varlistentry>
18079 <term><varname>$tod_zone</varname></term>
18080 <listitem>
18081 <para>
18082 <indexterm role="variable">
18083 <primary><varname>$tod_zone</varname></primary>
18084 </indexterm>
18085 This variable contains the numerical value of the local timezone, for example:
18086 -0500.
18087 </para>
18088 </listitem></varlistentry>
18089 <varlistentry>
18090 <term><varname>$tod_zulu</varname></term>
18091 <listitem>
18092 <para>
18093 <indexterm role="variable">
18094 <primary><varname>$tod_zulu</varname></primary>
18095 </indexterm>
18096 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18097 by ISO 8601, for example: 20030221154023Z.
18098 </para>
18099 </listitem></varlistentry>
18100 <varlistentry>
18101 <term><varname>$value</varname></term>
18102 <listitem>
18103 <para>
18104 <indexterm role="variable">
18105 <primary><varname>$value</varname></primary>
18106 </indexterm>
18107 This variable contains the result of an expansion lookup, extraction operation,
18108 or external command, as described above. It is also used during a
18109 <emphasis role="bold">reduce</emphasis> expansion.
18110 </para>
18111 </listitem></varlistentry>
18112 <varlistentry>
18113 <term><varname>$version_number</varname></term>
18114 <listitem>
18115 <para>
18116 <indexterm role="variable">
18117 <primary><varname>$version_number</varname></primary>
18118 </indexterm>
18119 The version number of Exim.
18120 </para>
18121 </listitem></varlistentry>
18122 <varlistentry>
18123 <term><varname>$warn_message_delay</varname></term>
18124 <listitem>
18125 <para>
18126 <indexterm role="variable">
18127 <primary><varname>$warn_message_delay</varname></primary>
18128 </indexterm>
18129 This variable is set only during the creation of a message warning about a
18130 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18131 </para>
18132 </listitem></varlistentry>
18133 <varlistentry>
18134 <term><varname>$warn_message_recipients</varname></term>
18135 <listitem>
18136 <para>
18137 <indexterm role="variable">
18138 <primary><varname>$warn_message_recipients</varname></primary>
18139 </indexterm>
18140 This variable is set only during the creation of a message warning about a
18141 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18142 </para>
18143 </listitem></varlistentry>
18144 </variablelist>
18145 <para>
18146 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18147 </para>
18148 </section>
18149 </chapter>
18150
18151 <chapter id="CHAPperl">
18152 <title>Embedded Perl</title>
18153 <para>
18154 <indexterm role="concept" id="IIDperl" class="startofrange">
18155 <primary>Perl</primary>
18156 <secondary>calling from Exim</secondary>
18157 </indexterm>
18158 Exim can be built to include an embedded Perl interpreter. When this is done,
18159 Perl subroutines can be called as part of the string expansion process. To make
18160 use of the Perl support, you need version 5.004 or later of Perl installed on
18161 your system. To include the embedded interpreter in the Exim binary, include
18162 the line
18163 </para>
18164 <literallayout class="monospaced">
18165 EXIM_PERL = perl.o
18166 </literallayout>
18167 <para>
18168 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18169 </para>
18170 <section id="SECID85">
18171 <title>Setting up so Perl can be used</title>
18172 <para>
18173 <indexterm role="option">
18174 <primary><option>perl_startup</option></primary>
18175 </indexterm>
18176 Access to Perl subroutines is via a global configuration option called
18177 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18178 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18179 interpreter is started and there is almost no overhead for Exim (since none of
18180 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18181 option then the associated value is taken to be Perl code which is executed in
18182 a newly created Perl interpreter.
18183 </para>
18184 <para>
18185 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18186 need backslashes before any characters to escape special meanings. The option
18187 should usually be something like
18188 </para>
18189 <literallayout class="monospaced">
18190 perl_startup = do '/etc/exim.pl'
18191 </literallayout>
18192 <para>
18193 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18194 use from Exim. Exim can be configured either to start up a Perl interpreter as
18195 soon as it is entered, or to wait until the first time it is needed. Starting
18196 the interpreter at the beginning ensures that it is done while Exim still has
18197 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18198 fact used in a particular run. Also, note that this does not mean that Exim is
18199 necessarily running as root when Perl is called at a later time. By default,
18200 the interpreter is started only when it is needed, but this can be changed in
18201 two ways:
18202 </para>
18203 <itemizedlist>
18204 <listitem>
18205 <para>
18206 <indexterm role="option">
18207 <primary><option>perl_at_start</option></primary>
18208 </indexterm>
18209 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18210 a startup when Exim is entered.
18211 </para>
18212 </listitem>
18213 <listitem>
18214 <para>
18215 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18216 overriding the setting of <option>perl_at_start</option>.
18217 </para>
18218 </listitem>
18219 </itemizedlist>
18220 <para>
18221 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18222 initial startup, even if <option>perl_at_start</option> is set.
18223 </para>
18224 </section>
18225 <section id="SECID86">
18226 <title>Calling Perl subroutines</title>
18227 <para>
18228 When the configuration file includes a <option>perl_startup</option> option you can make use
18229 of the string expansion item to call the Perl subroutines that are defined
18230 by the <option>perl_startup</option> code. The operator is used in any of the following
18231 forms:
18232 </para>
18233 <literallayout class="monospaced">
18234 ${perl{foo}}
18235 ${perl{foo}{argument}}
18236 ${perl{foo}{argument1}{argument2} ... }
18237 </literallayout>
18238 <para>
18239 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18240 arguments may be passed. Passing more than this results in an expansion failure
18241 with an error message of the form
18242 </para>
18243 <literallayout class="monospaced">
18244 Too many arguments passed to Perl subroutine "foo" (max is 8)
18245 </literallayout>
18246 <para>
18247 The return value of the Perl subroutine is evaluated in a scalar context before
18248 it is passed back to Exim to be inserted into the expanded string. If the
18249 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18250 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18251 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18252 that was passed to <option>die</option>.
18253 </para>
18254 </section>
18255 <section id="SECID87">
18256 <title>Calling Exim functions from Perl</title>
18257 <para>
18258 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18259 is available to call back into Exim&#x2019;s string expansion function. For example,
18260 the Perl code
18261 </para>
18262 <literallayout class="monospaced">
18263 my $lp = Exim::expand_string('$local_part');
18264 </literallayout>
18265 <para>
18266 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18267 Note those are single quotes and not double quotes to protect against
18268 <varname>$local_part</varname> being interpolated as a Perl variable.
18269 </para>
18270 <para>
18271 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18272 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18273 expansion string, the Perl call from the original expansion string fails with
18274 an appropriate error message, in the same way as if <option>die</option> were used.
18275 </para>
18276 <para>
18277 <indexterm role="concept">
18278 <primary>debugging</primary>
18279 <secondary>from embedded Perl</secondary>
18280 </indexterm>
18281 <indexterm role="concept">
18282 <primary>log</primary>
18283 <secondary>writing from embedded Perl</secondary>
18284 </indexterm>
18285 Two other Exim functions are available for use from within Perl code.
18286 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18287 debugging is enabled. If you want a newline at the end, you must supply it.
18288 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18289 timestamp. In this case, you should not supply a terminating newline.
18290 </para>
18291 </section>
18292 <section id="SECID88">
18293 <title>Use of standard output and error by Perl</title>
18294 <para>
18295 <indexterm role="concept">
18296 <primary>Perl</primary>
18297 <secondary>standard output and error</secondary>
18298 </indexterm>
18299 You should not write to the standard error or output streams from within your
18300 Perl code, as it is not defined how these are set up. In versions of Exim
18301 before 4.50, it is possible for the standard output or error to refer to the
18302 SMTP connection during message reception via the daemon. Writing to this stream
18303 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18304 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18305 avoided, but the output is lost.
18306 </para>
18307 <para>
18308 <indexterm role="concept">
18309 <primary>Perl</primary>
18310 <secondary>use of <option>warn</option></secondary>
18311 </indexterm>
18312 The Perl <option>warn</option> statement writes to the standard error stream by default.
18313 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18314 you have no control. When Exim starts up the Perl interpreter, it arranges for
18315 output from the <option>warn</option> statement to be written to the Exim main log. You can
18316 change this by including appropriate Perl magic somewhere in your Perl code.
18317 For example, to discard <option>warn</option> output completely, you need this:
18318 </para>
18319 <literallayout class="monospaced">
18320 $SIG{__WARN__} = sub { };
18321 </literallayout>
18322 <para>
18323 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18324 example, the code for the subroutine is empty, so it does nothing, but you can
18325 include any Perl code that you like. The text of the <option>warn</option> message is passed
18326 as the first subroutine argument.
18327 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18328 </para>
18329 </section>
18330 </chapter>
18331
18332 <chapter id="CHAPinterfaces">
18333 <title>Starting the daemon and the use of network interfaces</title>
18334 <titleabbrev>Starting the daemon</titleabbrev>
18335 <para>
18336 <indexterm role="concept">
18337 <primary>daemon</primary>
18338 <secondary>starting</secondary>
18339 </indexterm>
18340 <indexterm role="concept">
18341 <primary>interface</primary>
18342 <secondary>listening</secondary>
18343 </indexterm>
18344 <indexterm role="concept">
18345 <primary>network interface</primary>
18346 </indexterm>
18347 <indexterm role="concept">
18348 <primary>interface</primary>
18349 <secondary>network</secondary>
18350 </indexterm>
18351 <indexterm role="concept">
18352 <primary>IP address</primary>
18353 <secondary>for listening</secondary>
18354 </indexterm>
18355 <indexterm role="concept">
18356 <primary>daemon</primary>
18357 <secondary>listening IP addresses</secondary>
18358 </indexterm>
18359 <indexterm role="concept">
18360 <primary>TCP/IP</primary>
18361 <secondary>setting listening interfaces</secondary>
18362 </indexterm>
18363 <indexterm role="concept">
18364 <primary>TCP/IP</primary>
18365 <secondary>setting listening ports</secondary>
18366 </indexterm>
18367 A host that is connected to a TCP/IP network may have one or more physical
18368 hardware network interfaces. Each of these interfaces may be configured as one
18369 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18370 works with. Each of these logical interfaces is associated with an IP address.
18371 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18372 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18373 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18374 </para>
18375 <orderedlist numeration="arabic">
18376 <listitem>
18377 <para>
18378 When a listening daemon is started, Exim needs to know which interfaces
18379 and ports to listen on.
18380 </para>
18381 </listitem>
18382 <listitem>
18383 <para>
18384 When Exim is routing an address, it needs to know which IP addresses
18385 are associated with local interfaces. This is required for the correct
18386 processing of MX lists by removing the local host and others with the
18387 same or higher priority values. Also, Exim needs to detect cases
18388 when an address is routed to an IP address that in fact belongs to the
18389 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18390 option of the smtp transport is set (as appropriate), this is treated
18391 as an error situation.
18392 </para>
18393 </listitem>
18394 <listitem>
18395 <para>
18396 When Exim connects to a remote host, it may need to know which interface to use
18397 for the outgoing connection.
18398 </para>
18399 </listitem>
18400 </orderedlist>
18401 <para>
18402 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18403 of cases. If your host has only one interface, and you want all its IP
18404 addresses to be treated in the same way, and you are using only the
18405 standard SMTP port, you should not need to take any special action. The
18406 rest of this chapter does not apply to you.
18407 </para>
18408 <para>
18409 In a more complicated situation you may want to listen only on certain
18410 interfaces, or on different ports, and for this reason there are a number of
18411 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18412 chapter describes how they operate.
18413 </para>
18414 <para>
18415 When a message is received over TCP/IP, the interface and port that were
18416 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18417 </para>
18418 <section id="SECID89">
18419 <title>Starting a listening daemon</title>
18420 <para>
18421 When a listening daemon is started (by means of the <option>-bd</option> command line
18422 option), the interfaces and ports on which it listens are controlled by the
18423 following options:
18424 </para>
18425 <itemizedlist>
18426 <listitem>
18427 <para>
18428 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18429 compatibility, this option can also be specified in the singular.)
18430 </para>
18431 </listitem>
18432 <listitem>
18433 <para>
18434 <option>local_interfaces</option> contains list of interface IP addresses on which to
18435 listen. Each item may optionally also specify a port.
18436 </para>
18437 </listitem>
18438 </itemizedlist>
18439 <para>
18440 The default list separator in both cases is a colon, but this can be changed as
18441 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18442 it is usually best to change the separator to avoid having to double all the
18443 colons. For example:
18444 </para>
18445 <literallayout class="monospaced">
18446 local_interfaces = &lt;; 127.0.0.1 ; \
18447                       192.168.23.65 ; \
18448                       ::1 ; \
18449                       3ffe:ffff:836f::fe86:a061
18450 </literallayout>
18451 <para>
18452 There are two different formats for specifying a port along with an IP address
18453 in <option>local_interfaces</option>:
18454 </para>
18455 <orderedlist numeration="arabic">
18456 <listitem>
18457 <para>
18458 The port is added onto the address with a dot separator. For example, to listen
18459 on port 1234 on two different IP addresses:
18460 </para>
18461 <literallayout class="monospaced">
18462 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18463                       3ffe:ffff:836f::fe86:a061.1234
18464 </literallayout>
18465 </listitem>
18466 <listitem>
18467 <para>
18468 The IP address is enclosed in square brackets, and the port is added
18469 with a colon separator, for example:
18470 </para>
18471 <literallayout class="monospaced">
18472 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18473                       [3ffe:ffff:836f::fe86:a061]:1234
18474 </literallayout>
18475 </listitem>
18476 </orderedlist>
18477 <para>
18478 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18479 default setting contains just one port:
18480 </para>
18481 <literallayout class="monospaced">
18482 daemon_smtp_ports = smtp
18483 </literallayout>
18484 <para>
18485 If more than one port is listed, each interface that does not have its own port
18486 specified listens on all of them. Ports that are listed in
18487 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18488 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18489 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18490 </para>
18491 </section>
18492 <section id="SECID90">
18493 <title>Special IP listening addresses</title>
18494 <para>
18495 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18496 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18497 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18498 instead of setting up separate listening sockets for each interface. The
18499 default value of <option>local_interfaces</option> is
18500 </para>
18501 <literallayout class="monospaced">
18502 local_interfaces = 0.0.0.0
18503 </literallayout>
18504 <para>
18505 when Exim is built without IPv6 support; otherwise it is:
18506 </para>
18507 <literallayout class="monospaced">
18508 local_interfaces = &lt;; ::0 ; 0.0.0.0
18509 </literallayout>
18510 <para>
18511 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18512 </para>
18513 </section>
18514 <section id="SECID91">
18515 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18516 <para>
18517 The <option>-oX</option> command line option can be used to override the values of
18518 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18519 instance. Another way of doing this would be to use macros and the <option>-D</option>
18520 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18521 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18522 exim.
18523 </para>
18524 <para>
18525 The value of <option>-oX</option> is a list of items. The default colon separator can be
18526 changed in the usual way if required. If there are any items that do not
18527 contain dots or colons (that is, are not IP addresses), the value of
18528 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18529 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18530 replaced by those items. Thus, for example,
18531 </para>
18532 <literallayout class="monospaced">
18533 -oX 1225
18534 </literallayout>
18535 <para>
18536 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18537 whereas
18538 </para>
18539 <literallayout class="monospaced">
18540 -oX 192.168.34.5.1125
18541 </literallayout>
18542 <para>
18543 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18544 (However, since <option>local_interfaces</option> now contains no items without ports, the
18545 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18546 </para>
18547 </section>
18548 <section id="SECTsupobssmt">
18549 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18550 <para>
18551 <indexterm role="concept">
18552 <primary>ssmtp protocol</primary>
18553 </indexterm>
18554 <indexterm role="concept">
18555 <primary>smtps protocol</primary>
18556 </indexterm>
18557 <indexterm role="concept">
18558 <primary>SMTP</primary>
18559 <secondary>ssmtp protocol</secondary>
18560 </indexterm>
18561 <indexterm role="concept">
18562 <primary>SMTP</primary>
18563 <secondary>smtps protocol</secondary>
18564 </indexterm>
18565 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18566 before the STARTTLS command was standardized for SMTP. Some legacy clients
18567 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18568 list of port numbers, connections to those ports must use SSMTP. The most
18569 common use of this option is expected to be
18570 </para>
18571 <literallayout class="monospaced">
18572 tls_on_connect_ports = 465
18573 </literallayout>
18574 <para>
18575 because 465 is the usual port number used by the legacy clients. There is also
18576 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18577 this way when a daemon is started.
18578 </para>
18579 <para>
18580 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18581 daemon to listen on those ports. You must still specify them in
18582 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18583 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18584 connections via the daemon.)
18585 </para>
18586 </section>
18587 <section id="SECID92">
18588 <title>IPv6 address scopes</title>
18589 <para>
18590 <indexterm role="concept">
18591 <primary>IPv6</primary>
18592 <secondary>address scopes</secondary>
18593 </indexterm>
18594 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18595 can, in principle, have the same link-local IPv6 address on different
18596 interfaces. Thus, additional information is needed, over and above the IP
18597 address, to distinguish individual interfaces. A convention of using a
18598 percent sign followed by something (often the interface name) has been
18599 adopted in some cases, leading to addresses like this:
18600 </para>
18601 <literallayout class="monospaced">
18602 fe80::202:b3ff:fe03:45c1%eth0
18603 </literallayout>
18604 <para>
18605 To accommodate this usage, a percent sign followed by an arbitrary string is
18606 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18607 to convert a textual IPv6 address for actual use. This function recognizes the
18608 percent convention in operating systems that support it, and it processes the
18609 address appropriately. Unfortunately, some older libraries have problems with
18610 <function>getaddrinfo()</function>. If
18611 </para>
18612 <literallayout class="monospaced">
18613 IPV6_USE_INET_PTON=yes
18614 </literallayout>
18615 <para>
18616 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18617 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18618 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18619 function.) Of course, this means that the additional functionality of
18620 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18621 </para>
18622 </section>
18623 <section id="SECID93">
18624 <title>Disabling IPv6</title>
18625 <para>
18626 <indexterm role="concept">
18627 <primary>IPv6</primary>
18628 <secondary>disabling</secondary>
18629 </indexterm>
18630 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18631 run on a host whose kernel does not support IPv6. The binary will fall back to
18632 using IPv4, but it may waste resources looking up AAAA records, and trying to
18633 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18634 <indexterm role="option">
18635 <primary><option>disable_ipv6</option></primary>
18636 </indexterm>
18637 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18638 activities take place. AAAA records are never looked up, and any IPv6 addresses
18639 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18640 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18641 to handle IPv6 literal addresses.
18642 </para>
18643 <para>
18644 On the other hand, when IPv6 is in use, there may be times when you want to
18645 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18646 option to globally suppress the lookup of AAAA records for specified domains,
18647 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18648 IPv6 addresses in an individual router.
18649 </para>
18650 </section>
18651 <section id="SECID94">
18652 <title>Examples of starting a listening daemon</title>
18653 <para>
18654 The default case in an IPv6 environment is
18655 </para>
18656 <literallayout class="monospaced">
18657 daemon_smtp_ports = smtp
18658 local_interfaces = &lt;; ::0 ; 0.0.0.0
18659 </literallayout>
18660 <para>
18661 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18662 Either one or two sockets may be used, depending on the characteristics of
18663 the TCP/IP stack. (This is complicated and messy; for more information,
18664 read the comments in the <filename>daemon.c</filename> source file.)
18665 </para>
18666 <para>
18667 To specify listening on ports 25 and 26 on all interfaces:
18668 </para>
18669 <literallayout class="monospaced">
18670 daemon_smtp_ports = 25 : 26
18671 </literallayout>
18672 <para>
18673 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18674 </para>
18675 <literallayout class="monospaced">
18676 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18677                       0.0.0.0.25 ; 0.0.0.0.26
18678 </literallayout>
18679 <para>
18680 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18681 IPv4 loopback address only:
18682 </para>
18683 <literallayout class="monospaced">
18684 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18685 </literallayout>
18686 <para>
18687 To specify listening on the default port on specific interfaces only:
18688 </para>
18689 <literallayout class="monospaced">
18690 local_interfaces = 192.168.34.67 : 192.168.34.67
18691 </literallayout>
18692 <para>
18693 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18694 </para>
18695 </section>
18696 <section id="SECTreclocipadd">
18697 <title>Recognizing the local host</title>
18698 <para>
18699 The <option>local_interfaces</option> option is also used when Exim needs to determine
18700 whether or not an IP address refers to the local host. That is, the IP
18701 addresses of all the interfaces on which a daemon is listening are always
18702 treated as local.
18703 </para>
18704 <para>
18705 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18706 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18707 available interfaces from the operating system, and extracts the relevant
18708 (that is, IPv4 or IPv6) addresses to use for checking.
18709 </para>
18710 <para>
18711 Some systems set up large numbers of virtual interfaces in order to provide
18712 many virtual web servers. In this situation, you may want to listen for
18713 email on only a few of the available interfaces, but nevertheless treat all
18714 interfaces as local when routing. You can do this by setting
18715 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18716 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18717 used for listening. Consider this example:
18718 </para>
18719 <literallayout class="monospaced">
18720 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18721                       192.168.53.235 ; \
18722                       3ffe:2101:12:1:a00:20ff:fe86:a061
18723
18724 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18725 </literallayout>
18726 <para>
18727 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18728 address, but all available interface addresses are treated as local when
18729 Exim is routing.
18730 </para>
18731 <para>
18732 In some environments the local host name may be in an MX list, but with an IP
18733 address that is not assigned to any local interface. In other cases it may be
18734 desirable to treat other host names as if they referred to the local host. Both
18735 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18736 This contains host names rather than IP addresses. When a host is referenced
18737 during routing, either via an MX record or directly, it is treated as the local
18738 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18739 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18740 </para>
18741 </section>
18742 <section id="SECID95">
18743 <title>Delivering to a remote host</title>
18744 <para>
18745 Delivery to a remote host is handled by the smtp transport. By default, it
18746 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18747 there is more than one) when connecting to a remote host. However, the
18748 <option>interface</option> option can be set to specify which interface is used. See the
18749 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18750 details.
18751 </para>
18752 </section>
18753 </chapter>
18754
18755 <chapter id="CHAPmainconfig">
18756 <title>Main configuration</title>
18757 <para>
18758 <indexterm role="concept" id="IIDconfima" class="startofrange">
18759 <primary>configuration file</primary>
18760 <secondary>main section</secondary>
18761 </indexterm>
18762 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18763 <primary>main configuration</primary>
18764 </indexterm>
18765 The first part of the run time configuration file contains three types of item:
18766 </para>
18767 <itemizedlist>
18768 <listitem>
18769 <para>
18770 Macro definitions: These lines start with an upper case letter. See section
18771 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18772 </para>
18773 </listitem>
18774 <listitem>
18775 <para>
18776 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18777 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18778 section <xref linkend="SECTnamedlists"/>.
18779 </para>
18780 </listitem>
18781 <listitem>
18782 <para>
18783 Main configuration settings: Each setting occupies one line of the file
18784 (with possible continuations). If any setting is preceded by the word
18785 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18786 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18787 settings.
18788 </para>
18789 </listitem>
18790 </itemizedlist>
18791 <para>
18792 This chapter specifies all the main configuration options, along with their
18793 types and default values. For ease of finding a particular option, they appear
18794 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18795 are now so many options, they are first listed briefly in functional groups, as
18796 an aid to finding the name of the option you are looking for. Some options are
18797 listed in more than one group.
18798 </para>
18799 <section id="SECID96">
18800 <title>Miscellaneous</title>
18801 <informaltable frame="none">
18802 <tgroup cols="2" colsep="0" rowsep="0">
18803 <colspec colwidth="196pt" align="left"/>
18804 <colspec colwidth="254pt" align="left"/>
18805 <tbody>
18806 <row>
18807 <entry><option>bi_command</option></entry>
18808 <entry>to run for <option>-bi</option> command line option</entry>
18809 </row>
18810 <row>
18811 <entry><option>disable_ipv6</option></entry>
18812 <entry>do no IPv6 processing</entry>
18813 </row>
18814 <row>
18815 <entry><option>keep_malformed</option></entry>
18816 <entry>for broken files &ndash; should not happen</entry>
18817 </row>
18818 <row>
18819 <entry><option>localhost_number</option></entry>
18820 <entry>for unique message ids in clusters</entry>
18821 </row>
18822 <row>
18823 <entry><option>message_body_newlines</option></entry>
18824 <entry>retain newlines in <varname>$message_body</varname></entry>
18825 </row>
18826 <row>
18827 <entry><option>message_body_visible</option></entry>
18828 <entry>how much to show in <varname>$message_body</varname></entry>
18829 </row>
18830 <row>
18831 <entry><option>mua_wrapper</option></entry>
18832 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18833 </row>
18834 <row>
18835 <entry><option>print_topbitchars</option></entry>
18836 <entry>top-bit characters are printing</entry>
18837 </row>
18838 <row>
18839 <entry><option>timezone</option></entry>
18840 <entry>force time zone</entry>
18841 </row>
18842 </tbody>
18843 </tgroup>
18844 </informaltable>
18845 </section>
18846 <section id="SECID97">
18847 <title>Exim parameters</title>
18848 <informaltable frame="none">
18849 <tgroup cols="2" colsep="0" rowsep="0">
18850 <colspec colwidth="196pt" align="left"/>
18851 <colspec colwidth="254pt" align="left"/>
18852 <tbody>
18853 <row>
18854 <entry><option>exim_group</option></entry>
18855 <entry>override compiled-in value</entry>
18856 </row>
18857 <row>
18858 <entry><option>exim_path</option></entry>
18859 <entry>override compiled-in value</entry>
18860 </row>
18861 <row>
18862 <entry><option>exim_user</option></entry>
18863 <entry>override compiled-in value</entry>
18864 </row>
18865 <row>
18866 <entry><option>primary_hostname</option></entry>
18867 <entry>default from <function>uname()</function></entry>
18868 </row>
18869 <row>
18870 <entry><option>split_spool_directory</option></entry>
18871 <entry>use multiple directories</entry>
18872 </row>
18873 <row>
18874 <entry><option>spool_directory</option></entry>
18875 <entry>override compiled-in value</entry>
18876 </row>
18877 </tbody>
18878 </tgroup>
18879 </informaltable>
18880 </section>
18881 <section id="SECID98">
18882 <title>Privilege controls</title>
18883 <informaltable frame="none">
18884 <tgroup cols="2" colsep="0" rowsep="0">
18885 <colspec colwidth="196pt" align="left"/>
18886 <colspec colwidth="254pt" align="left"/>
18887 <tbody>
18888 <row>
18889 <entry><option>admin_groups</option></entry>
18890 <entry>groups that are Exim admin users</entry>
18891 </row>
18892 <row>
18893 <entry><option>deliver_drop_privilege</option></entry>
18894 <entry>drop root for delivery processes</entry>
18895 </row>
18896 <row>
18897 <entry><option>local_from_check</option></entry>
18898 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18899 </row>
18900 <row>
18901 <entry><option>local_from_prefix</option></entry>
18902 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18903 </row>
18904 <row>
18905 <entry><option>local_from_suffix</option></entry>
18906 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18907 </row>
18908 <row>
18909 <entry><option>local_sender_retain</option></entry>
18910 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18911 </row>
18912 <row>
18913 <entry><option>never_users</option></entry>
18914 <entry>do not run deliveries as these</entry>
18915 </row>
18916 <row>
18917 <entry><option>prod_requires_admin</option></entry>
18918 <entry>forced delivery requires admin user</entry>
18919 </row>
18920 <row>
18921 <entry><option>queue_list_requires_admin</option></entry>
18922 <entry>queue listing requires admin user</entry>
18923 </row>
18924 <row>
18925 <entry><option>trusted_groups</option></entry>
18926 <entry>groups that are trusted</entry>
18927 </row>
18928 <row>
18929 <entry><option>trusted_users</option></entry>
18930 <entry>users that are trusted</entry>
18931 </row>
18932 </tbody>
18933 </tgroup>
18934 </informaltable>
18935 </section>
18936 <section id="SECID99">
18937 <title>Logging</title>
18938 <informaltable frame="none">
18939 <tgroup cols="2" colsep="0" rowsep="0">
18940 <colspec colwidth="196pt" align="left"/>
18941 <colspec colwidth="254pt" align="left"/>
18942 <tbody>
18943 <row>
18944 <entry><option>hosts_connection_nolog</option></entry>
18945 <entry>exemption from connect logging</entry>
18946 </row>
18947 <row>
18948 <entry><option>log_file_path</option></entry>
18949 <entry>override compiled-in value</entry>
18950 </row>
18951 <row>
18952 <entry><option>log_selector</option></entry>
18953 <entry>set/unset optional logging</entry>
18954 </row>
18955 <row>
18956 <entry><option>log_timezone</option></entry>
18957 <entry>add timezone to log lines</entry>
18958 </row>
18959 <row>
18960 <entry><option>message_logs</option></entry>
18961 <entry>create per-message logs</entry>
18962 </row>
18963 <row>
18964 <entry><option>preserve_message_logs</option></entry>
18965 <entry>after message completion</entry>
18966 </row>
18967 <row>
18968 <entry><option>process_log_path</option></entry>
18969 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18970 </row>
18971 <row>
18972 <entry><option>syslog_duplication</option></entry>
18973 <entry>controls duplicate log lines on syslog</entry>
18974 </row>
18975 <row>
18976 <entry><option>syslog_facility</option></entry>
18977 <entry>set syslog <quote>facility</quote> field</entry>
18978 </row>
18979 <row>
18980 <entry><option>syslog_processname</option></entry>
18981 <entry>set syslog <quote>ident</quote> field</entry>
18982 </row>
18983 <row>
18984 <entry><option>syslog_timestamp</option></entry>
18985 <entry>timestamp syslog lines</entry>
18986 </row>
18987 <row>
18988 <entry><option>write_rejectlog</option></entry>
18989 <entry>control use of message log</entry>
18990 </row>
18991 </tbody>
18992 </tgroup>
18993 </informaltable>
18994 </section>
18995 <section id="SECID100">
18996 <title>Frozen messages</title>
18997 <informaltable frame="none">
18998 <tgroup cols="2" colsep="0" rowsep="0">
18999 <colspec colwidth="196pt" align="left"/>
19000 <colspec colwidth="254pt" align="left"/>
19001 <tbody>
19002 <row>
19003 <entry><option>auto_thaw</option></entry>
19004 <entry>sets time for retrying frozen messages</entry>
19005 </row>
19006 <row>
19007 <entry><option>freeze_tell</option></entry>
19008 <entry>send message when freezing</entry>
19009 </row>
19010 <row>
19011 <entry><option>move_frozen_messages</option></entry>
19012 <entry>to another directory</entry>
19013 </row>
19014 <row>
19015 <entry><option>timeout_frozen_after</option></entry>
19016 <entry>keep frozen messages only so long</entry>
19017 </row>
19018 </tbody>
19019 </tgroup>
19020 </informaltable>
19021 </section>
19022 <section id="SECID101">
19023 <title>Data lookups</title>
19024 <informaltable frame="none">
19025 <tgroup cols="2" colsep="0" rowsep="0">
19026 <colspec colwidth="196pt" align="left"/>
19027 <colspec colwidth="254pt" align="left"/>
19028 <tbody>
19029 <row>
19030 <entry><option>ibase_servers</option></entry>
19031 <entry>InterBase servers</entry>
19032 </row>
19033 <row>
19034 <entry><option>ldap_default_servers</option></entry>
19035 <entry>used if no server in query</entry>
19036 </row>
19037 <row>
19038 <entry><option>ldap_version</option></entry>
19039 <entry>set protocol version</entry>
19040 </row>
19041 <row>
19042 <entry><option>lookup_open_max</option></entry>
19043 <entry>lookup files held open</entry>
19044 </row>
19045 <row>
19046 <entry><option>mysql_servers</option></entry>
19047 <entry>default MySQL servers</entry>
19048 </row>
19049 <row>
19050 <entry><option>oracle_servers</option></entry>
19051 <entry>Oracle servers</entry>
19052 </row>
19053 <row>
19054 <entry><option>pgsql_servers</option></entry>
19055 <entry>default PostgreSQL servers</entry>
19056 </row>
19057 <row>
19058 <entry><option>sqlite_lock_timeout</option></entry>
19059 <entry>as it says</entry>
19060 </row>
19061 </tbody>
19062 </tgroup>
19063 </informaltable>
19064 </section>
19065 <section id="SECID102">
19066 <title>Message ids</title>
19067 <informaltable frame="none">
19068 <tgroup cols="2" colsep="0" rowsep="0">
19069 <colspec colwidth="196pt" align="left"/>
19070 <colspec colwidth="254pt" align="left"/>
19071 <tbody>
19072 <row>
19073 <entry><option>message_id_header_domain</option></entry>
19074 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19075 </row>
19076 <row>
19077 <entry><option>message_id_header_text</option></entry>
19078 <entry>ditto</entry>
19079 </row>
19080 </tbody>
19081 </tgroup>
19082 </informaltable>
19083 </section>
19084 <section id="SECID103">
19085 <title>Embedded Perl Startup</title>
19086 <informaltable frame="none">
19087 <tgroup cols="2" colsep="0" rowsep="0">
19088 <colspec colwidth="196pt" align="left"/>
19089 <colspec colwidth="254pt" align="left"/>
19090 <tbody>
19091 <row>
19092 <entry><option>perl_at_start</option></entry>
19093 <entry>always start the interpreter</entry>
19094 </row>
19095 <row>
19096 <entry><option>perl_startup</option></entry>
19097 <entry>code to obey when starting Perl</entry>
19098 </row>
19099 </tbody>
19100 </tgroup>
19101 </informaltable>
19102 </section>
19103 <section id="SECID104">
19104 <title>Daemon</title>
19105 <informaltable frame="none">
19106 <tgroup cols="2" colsep="0" rowsep="0">
19107 <colspec colwidth="196pt" align="left"/>
19108 <colspec colwidth="254pt" align="left"/>
19109 <tbody>
19110 <row>
19111 <entry><option>daemon_smtp_ports</option></entry>
19112 <entry>default ports</entry>
19113 </row>
19114 <row>
19115 <entry><option>daemon_startup_retries</option></entry>
19116 <entry>number of times to retry</entry>
19117 </row>
19118 <row>
19119 <entry><option>daemon_startup_sleep</option></entry>
19120 <entry>time to sleep between tries</entry>
19121 </row>
19122 <row>
19123 <entry><option>extra_local_interfaces</option></entry>
19124 <entry>not necessarily listened on</entry>
19125 </row>
19126 <row>
19127 <entry><option>local_interfaces</option></entry>
19128 <entry>on which to listen, with optional ports</entry>
19129 </row>
19130 <row>
19131 <entry><option>pid_file_path</option></entry>
19132 <entry>override compiled-in value</entry>
19133 </row>
19134 <row>
19135 <entry><option>queue_run_max</option></entry>
19136 <entry>maximum simultaneous queue runners</entry>
19137 </row>
19138 </tbody>
19139 </tgroup>
19140 </informaltable>
19141 </section>
19142 <section id="SECID105">
19143 <title>Resource control</title>
19144 <informaltable frame="none">
19145 <tgroup cols="2" colsep="0" rowsep="0">
19146 <colspec colwidth="196pt" align="left"/>
19147 <colspec colwidth="254pt" align="left"/>
19148 <tbody>
19149 <row>
19150 <entry><option>check_log_inodes</option></entry>
19151 <entry>before accepting a message</entry>
19152 </row>
19153 <row>
19154 <entry><option>check_log_space</option></entry>
19155 <entry>before accepting a message</entry>
19156 </row>
19157 <row>
19158 <entry><option>check_spool_inodes</option></entry>
19159 <entry>before accepting a message</entry>
19160 </row>
19161 <row>
19162 <entry><option>check_spool_space</option></entry>
19163 <entry>before accepting a message</entry>
19164 </row>
19165 <row>
19166 <entry><option>deliver_queue_load_max</option></entry>
19167 <entry>no queue deliveries if load high</entry>
19168 </row>
19169 <row>
19170 <entry><option>queue_only_load</option></entry>
19171 <entry>queue incoming if load high</entry>
19172 </row>
19173 <row>
19174 <entry><option>queue_only_load_latch</option></entry>
19175 <entry>don&#x2019;t re-evaluate load for each message</entry>
19176 </row>
19177 <row>
19178 <entry><option>queue_run_max</option></entry>
19179 <entry>maximum simultaneous queue runners</entry>
19180 </row>
19181 <row>
19182 <entry><option>remote_max_parallel</option></entry>
19183 <entry>parallel SMTP delivery per message</entry>
19184 </row>
19185 <row>
19186 <entry><option>smtp_accept_max</option></entry>
19187 <entry>simultaneous incoming connections</entry>
19188 </row>
19189 <row>
19190 <entry><option>smtp_accept_max_nonmail</option></entry>
19191 <entry>non-mail commands</entry>
19192 </row>
19193 <row>
19194 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19195 <entry>hosts to which the limit applies</entry>
19196 </row>
19197 <row>
19198 <entry><option>smtp_accept_max_per_connection</option></entry>
19199 <entry>messages per connection</entry>
19200 </row>
19201 <row>
19202 <entry><option>smtp_accept_max_per_host</option></entry>
19203 <entry>connections from one host</entry>
19204 </row>
19205 <row>
19206 <entry><option>smtp_accept_queue</option></entry>
19207 <entry>queue mail if more connections</entry>
19208 </row>
19209 <row>
19210 <entry><option>smtp_accept_queue_per_connection</option></entry>
19211 <entry>queue if more messages per connection</entry>
19212 </row>
19213 <row>
19214 <entry><option>smtp_accept_reserve</option></entry>
19215 <entry>only reserve hosts if more connections</entry>
19216 </row>
19217 <row>
19218 <entry><option>smtp_check_spool_space</option></entry>
19219 <entry>from SIZE on MAIL command</entry>
19220 </row>
19221 <row>
19222 <entry><option>smtp_connect_backlog</option></entry>
19223 <entry>passed to TCP/IP stack</entry>
19224 </row>
19225 <row>
19226 <entry><option>smtp_load_reserve</option></entry>
19227 <entry>SMTP from reserved hosts if load high</entry>
19228 </row>
19229 <row>
19230 <entry><option>smtp_reserve_hosts</option></entry>
19231 <entry>these are the reserve hosts</entry>
19232 </row>
19233 </tbody>
19234 </tgroup>
19235 </informaltable>
19236 </section>
19237 <section id="SECID106">
19238 <title>Policy controls</title>
19239 <informaltable frame="none">
19240 <tgroup cols="2" colsep="0" rowsep="0">
19241 <colspec colwidth="196pt" align="left"/>
19242 <colspec colwidth="254pt" align="left"/>
19243 <tbody>
19244 <row>
19245 <entry><option>acl_not_smtp</option></entry>
19246 <entry>ACL for non-SMTP messages</entry>
19247 </row>
19248 <row>
19249 <entry><option>acl_not_smtp_mime</option></entry>
19250 <entry>ACL for non-SMTP MIME parts</entry>
19251 </row>
19252 <row>
19253 <entry><option>acl_not_smtp_start</option></entry>
19254 <entry>ACL for start of non-SMTP message</entry>
19255 </row>
19256 <row>
19257 <entry><option>acl_smtp_auth</option></entry>
19258 <entry>ACL for AUTH</entry>
19259 </row>
19260 <row>
19261 <entry><option>acl_smtp_connect</option></entry>
19262 <entry>ACL for connection</entry>
19263 </row>
19264 <row>
19265 <entry><option>acl_smtp_data</option></entry>
19266 <entry>ACL for DATA</entry>
19267 </row>
19268 <row>
19269 <entry><option>acl_smtp_etrn</option></entry>
19270 <entry>ACL for ETRN</entry>
19271 </row>
19272 <row>
19273 <entry><option>acl_smtp_expn</option></entry>
19274 <entry>ACL for EXPN</entry>
19275 </row>
19276 <row>
19277 <entry><option>acl_smtp_helo</option></entry>
19278 <entry>ACL for EHLO or HELO</entry>
19279 </row>
19280 <row>
19281 <entry><option>acl_smtp_mail</option></entry>
19282 <entry>ACL for MAIL</entry>
19283 </row>
19284 <row>
19285 <entry><option>acl_smtp_mailauth</option></entry>
19286 <entry>ACL for AUTH on MAIL command</entry>
19287 </row>
19288 <row>
19289 <entry><option>acl_smtp_mime</option></entry>
19290 <entry>ACL for MIME parts</entry>
19291 </row>
19292 <row>
19293 <entry><option>acl_smtp_predata</option></entry>
19294 <entry>ACL for start of data</entry>
19295 </row>
19296 <row>
19297 <entry><option>acl_smtp_quit</option></entry>
19298 <entry>ACL for QUIT</entry>
19299 </row>
19300 <row>
19301 <entry><option>acl_smtp_rcpt</option></entry>
19302 <entry>ACL for RCPT</entry>
19303 </row>
19304 <row>
19305 <entry><option>acl_smtp_starttls</option></entry>
19306 <entry>ACL for STARTTLS</entry>
19307 </row>
19308 <row>
19309 <entry><option>acl_smtp_vrfy</option></entry>
19310 <entry>ACL for VRFY</entry>
19311 </row>
19312 <row>
19313 <entry><option>av_scanner</option></entry>
19314 <entry>specify virus scanner</entry>
19315 </row>
19316 <row>
19317 <entry><option>check_rfc2047_length</option></entry>
19318 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19319 </row>
19320 <row>
19321 <entry><option>dns_csa_search_limit</option></entry>
19322 <entry>control CSA parent search depth</entry>
19323 </row>
19324 <row>
19325 <entry><option>dns_csa_use_reverse</option></entry>
19326 <entry>en/disable CSA IP reverse search</entry>
19327 </row>
19328 <row>
19329 <entry><option>header_maxsize</option></entry>
19330 <entry>total size of message header</entry>
19331 </row>
19332 <row>
19333 <entry><option>header_line_maxsize</option></entry>
19334 <entry>individual header line limit</entry>
19335 </row>
19336 <row>
19337 <entry><option>helo_accept_junk_hosts</option></entry>
19338 <entry>allow syntactic junk from these hosts</entry>
19339 </row>
19340 <row>
19341 <entry><option>helo_allow_chars</option></entry>
19342 <entry>allow illegal chars in HELO names</entry>
19343 </row>
19344 <row>
19345 <entry><option>helo_lookup_domains</option></entry>
19346 <entry>lookup hostname for these HELO names</entry>
19347 </row>
19348 <row>
19349 <entry><option>helo_try_verify_hosts</option></entry>
19350 <entry>HELO soft-checked for these hosts</entry>
19351 </row>
19352 <row>
19353 <entry><option>helo_verify_hosts</option></entry>
19354 <entry>HELO hard-checked for these hosts</entry>
19355 </row>
19356 <row>
19357 <entry><option>host_lookup</option></entry>
19358 <entry>host name looked up for these hosts</entry>
19359 </row>
19360 <row>
19361 <entry><option>host_lookup_order</option></entry>
19362 <entry>order of DNS and local name lookups</entry>
19363 </row>
19364 <row>
19365 <entry><option>host_reject_connection</option></entry>
19366 <entry>reject connection from these hosts</entry>
19367 </row>
19368 <row>
19369 <entry><option>hosts_treat_as_local</option></entry>
19370 <entry>useful in some cluster configurations</entry>
19371 </row>
19372 <row>
19373 <entry><option>local_scan_timeout</option></entry>
19374 <entry>timeout for <function>local_scan()</function></entry>
19375 </row>
19376 <row>
19377 <entry><option>message_size_limit</option></entry>
19378 <entry>for all messages</entry>
19379 </row>
19380 <row>
19381 <entry><option>percent_hack_domains</option></entry>
19382 <entry>recognize %-hack for these domains</entry>
19383 </row>
19384 <row>
19385 <entry><option>spamd_address</option></entry>
19386 <entry>set interface to SpamAssassin</entry>
19387 </row>
19388 <row>
19389 <entry><option>strict_acl_vars</option></entry>
19390 <entry>object to unset ACL variables</entry>
19391 </row>
19392 </tbody>
19393 </tgroup>
19394 </informaltable>
19395 </section>
19396 <section id="SECID107">
19397 <title>Callout cache</title>
19398 <informaltable frame="none">
19399 <tgroup cols="2" colsep="0" rowsep="0">
19400 <colspec colwidth="196pt" align="left"/>
19401 <colspec colwidth="254pt" align="left"/>
19402 <tbody>
19403 <row>
19404 <entry><option>callout_domain_negative_expire</option></entry>
19405 <entry>timeout for negative domain cache item</entry>
19406 </row>
19407 <row>
19408 <entry><option>callout_domain_positive_expire</option></entry>
19409 <entry>timeout for positive domain cache item</entry>
19410 </row>
19411 <row>
19412 <entry><option>callout_negative_expire</option></entry>
19413 <entry>timeout for negative address cache item</entry>
19414 </row>
19415 <row>
19416 <entry><option>callout_positive_expire</option></entry>
19417 <entry>timeout for positive address cache item</entry>
19418 </row>
19419 <row>
19420 <entry><option>callout_random_local_part</option></entry>
19421 <entry>string to use for <quote>random</quote> testing</entry>
19422 </row>
19423 </tbody>
19424 </tgroup>
19425 </informaltable>
19426 </section>
19427 <section id="SECID108">
19428 <title>TLS</title>
19429 <informaltable frame="none">
19430 <tgroup cols="2" colsep="0" rowsep="0">
19431 <colspec colwidth="196pt" align="left"/>
19432 <colspec colwidth="254pt" align="left"/>
19433 <tbody>
19434 <row>
19435 <entry><option>gnutls_require_kx</option></entry>
19436 <entry>control GnuTLS key exchanges</entry>
19437 </row>
19438 <row>
19439 <entry><option>gnutls_require_mac</option></entry>
19440 <entry>control GnuTLS MAC algorithms</entry>
19441 </row>
19442 <row>
19443 <entry><option>gnutls_require_protocols</option></entry>
19444 <entry>control GnuTLS protocols</entry>
19445 </row>
19446 <row>
19447 <entry><option>gnutls_compat_mode</option></entry>
19448 <entry>use GnuTLS compatibility mode</entry>
19449 </row>
19450 <row>
19451 <entry><option>tls_advertise_hosts</option></entry>
19452 <entry>advertise TLS to these hosts</entry>
19453 </row>
19454 <row>
19455 <entry><option>tls_certificate</option></entry>
19456 <entry>location of server certificate</entry>
19457 </row>
19458 <row>
19459 <entry><option>tls_crl</option></entry>
19460 <entry>certificate revocation list</entry>
19461 </row>
19462 <row>
19463 <entry><option>tls_dhparam</option></entry>
19464 <entry>DH parameters for server</entry>
19465 </row>
19466 <row>
19467 <entry><option>tls_on_connect_ports</option></entry>
19468 <entry>specify SSMTP (SMTPS) ports</entry>
19469 </row>
19470 <row>
19471 <entry><option>tls_privatekey</option></entry>
19472 <entry>location of server private key</entry>
19473 </row>
19474 <row>
19475 <entry><option>tls_remember_esmtp</option></entry>
19476 <entry>don&#x2019;t reset after starting TLS</entry>
19477 </row>
19478 <row>
19479 <entry><option>tls_require_ciphers</option></entry>
19480 <entry>specify acceptable ciphers</entry>
19481 </row>
19482 <row>
19483 <entry><option>tls_try_verify_hosts</option></entry>
19484 <entry>try to verify client certificate</entry>
19485 </row>
19486 <row>
19487 <entry><option>tls_verify_certificates</option></entry>
19488 <entry>expected client certificates</entry>
19489 </row>
19490 <row>
19491 <entry><option>tls_verify_hosts</option></entry>
19492 <entry>insist on client certificate verify</entry>
19493 </row>
19494 </tbody>
19495 </tgroup>
19496 </informaltable>
19497 </section>
19498 <section id="SECID109">
19499 <title>Local user handling</title>
19500 <informaltable frame="none">
19501 <tgroup cols="2" colsep="0" rowsep="0">
19502 <colspec colwidth="196pt" align="left"/>
19503 <colspec colwidth="254pt" align="left"/>
19504 <tbody>
19505 <row>
19506 <entry><option>finduser_retries</option></entry>
19507 <entry>useful in NIS environments</entry>
19508 </row>
19509 <row>
19510 <entry><option>gecos_name</option></entry>
19511 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19512 </row>
19513 <row>
19514 <entry><option>gecos_pattern</option></entry>
19515 <entry>ditto</entry>
19516 </row>
19517 <row>
19518 <entry><option>max_username_length</option></entry>
19519 <entry>for systems that truncate</entry>
19520 </row>
19521 <row>
19522 <entry><option>unknown_login</option></entry>
19523 <entry>used when no login name found</entry>
19524 </row>
19525 <row>
19526 <entry><option>unknown_username</option></entry>
19527 <entry>ditto</entry>
19528 </row>
19529 <row>
19530 <entry><option>uucp_from_pattern</option></entry>
19531 <entry>for recognizing <quote>From </quote> lines</entry>
19532 </row>
19533 <row>
19534 <entry><option>uucp_from_sender</option></entry>
19535 <entry>ditto</entry>
19536 </row>
19537 </tbody>
19538 </tgroup>
19539 </informaltable>
19540 </section>
19541 <section id="SECID110">
19542 <title>All incoming messages (SMTP and non-SMTP)</title>
19543 <informaltable frame="none">
19544 <tgroup cols="2" colsep="0" rowsep="0">
19545 <colspec colwidth="196pt" align="left"/>
19546 <colspec colwidth="254pt" align="left"/>
19547 <tbody>
19548 <row>
19549 <entry><option>header_maxsize</option></entry>
19550 <entry>total size of message header</entry>
19551 </row>
19552 <row>
19553 <entry><option>header_line_maxsize</option></entry>
19554 <entry>individual header line limit</entry>
19555 </row>
19556 <row>
19557 <entry><option>message_size_limit</option></entry>
19558 <entry>applies to all messages</entry>
19559 </row>
19560 <row>
19561 <entry><option>percent_hack_domains</option></entry>
19562 <entry>recognize %-hack for these domains</entry>
19563 </row>
19564 <row>
19565 <entry><option>received_header_text</option></entry>
19566 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19567 </row>
19568 <row>
19569 <entry><option>received_headers_max</option></entry>
19570 <entry>for mail loop detection</entry>
19571 </row>
19572 <row>
19573 <entry><option>recipients_max</option></entry>
19574 <entry>limit per message</entry>
19575 </row>
19576 <row>
19577 <entry><option>recipients_max_reject</option></entry>
19578 <entry>permanently reject excess recipients</entry>
19579 </row>
19580 </tbody>
19581 </tgroup>
19582 </informaltable>
19583 </section>
19584 <section id="SECID111">
19585 <title>Non-SMTP incoming messages</title>
19586 <informaltable frame="none">
19587 <tgroup cols="2" colsep="0" rowsep="0">
19588 <colspec colwidth="196pt" align="left"/>
19589 <colspec colwidth="254pt" align="left"/>
19590 <tbody>
19591 <row>
19592 <entry><option>receive_timeout</option></entry>
19593 <entry>for non-SMTP messages</entry>
19594 </row>
19595 </tbody>
19596 </tgroup>
19597 </informaltable>
19598 </section>
19599 <section id="SECID112">
19600 <title>Incoming SMTP messages</title>
19601 <para>
19602 See also the <emphasis>Policy controls</emphasis> section above.
19603 </para>
19604 <informaltable frame="none">
19605 <tgroup cols="2" colsep="0" rowsep="0">
19606 <colspec colwidth="196pt" align="left"/>
19607 <colspec colwidth="254pt" align="left"/>
19608 <tbody>
19609 <row>
19610 <entry><option>host_lookup</option></entry>
19611 <entry>host name looked up for these hosts</entry>
19612 </row>
19613 <row>
19614 <entry><option>host_lookup_order</option></entry>
19615 <entry>order of DNS and local name lookups</entry>
19616 </row>
19617 <row>
19618 <entry><option>recipient_unqualified_hosts</option></entry>
19619 <entry>may send unqualified recipients</entry>
19620 </row>
19621 <row>
19622 <entry><option>rfc1413_hosts</option></entry>
19623 <entry>make ident calls to these hosts</entry>
19624 </row>
19625 <row>
19626 <entry><option>rfc1413_query_timeout</option></entry>
19627 <entry>zero disables ident calls</entry>
19628 </row>
19629 <row>
19630 <entry><option>sender_unqualified_hosts</option></entry>
19631 <entry>may send unqualified senders</entry>
19632 </row>
19633 <row>
19634 <entry><option>smtp_accept_keepalive</option></entry>
19635 <entry>some TCP/IP magic</entry>
19636 </row>
19637 <row>
19638 <entry><option>smtp_accept_max</option></entry>
19639 <entry>simultaneous incoming connections</entry>
19640 </row>
19641 <row>
19642 <entry><option>smtp_accept_max_nonmail</option></entry>
19643 <entry>non-mail commands</entry>
19644 </row>
19645 <row>
19646 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19647 <entry>hosts to which the limit applies</entry>
19648 </row>
19649 <row>
19650 <entry><option>smtp_accept_max_per_connection</option></entry>
19651 <entry>messages per connection</entry>
19652 </row>
19653 <row>
19654 <entry><option>smtp_accept_max_per_host</option></entry>
19655 <entry>connections from one host</entry>
19656 </row>
19657 <row>
19658 <entry><option>smtp_accept_queue</option></entry>
19659 <entry>queue mail if more connections</entry>
19660 </row>
19661 <row>
19662 <entry><option>smtp_accept_queue_per_connection</option></entry>
19663 <entry>queue if more messages per connection</entry>
19664 </row>
19665 <row>
19666 <entry><option>smtp_accept_reserve</option></entry>
19667 <entry>only reserve hosts if more connections</entry>
19668 </row>
19669 <row>
19670 <entry><option>smtp_active_hostname</option></entry>
19671 <entry>host name to use in messages</entry>
19672 </row>
19673 <row>
19674 <entry><option>smtp_banner</option></entry>
19675 <entry>text for welcome banner</entry>
19676 </row>
19677 <row>
19678 <entry><option>smtp_check_spool_space</option></entry>
19679 <entry>from SIZE on MAIL command</entry>
19680 </row>
19681 <row>
19682 <entry><option>smtp_connect_backlog</option></entry>
19683 <entry>passed to TCP/IP stack</entry>
19684 </row>
19685 <row>
19686 <entry><option>smtp_enforce_sync</option></entry>
19687 <entry>of SMTP command/responses</entry>
19688 </row>
19689 <row>
19690 <entry><option>smtp_etrn_command</option></entry>
19691 <entry>what to run for ETRN</entry>
19692 </row>
19693 <row>
19694 <entry><option>smtp_etrn_serialize</option></entry>
19695 <entry>only one at once</entry>
19696 </row>
19697 <row>
19698 <entry><option>smtp_load_reserve</option></entry>
19699 <entry>only reserve hosts if this load</entry>
19700 </row>
19701 <row>
19702 <entry><option>smtp_max_unknown_commands</option></entry>
19703 <entry>before dropping connection</entry>
19704 </row>
19705 <row>
19706 <entry><option>smtp_ratelimit_hosts</option></entry>
19707 <entry>apply ratelimiting to these hosts</entry>
19708 </row>
19709 <row>
19710 <entry><option>smtp_ratelimit_mail</option></entry>
19711 <entry>ratelimit for MAIL commands</entry>
19712 </row>
19713 <row>
19714 <entry><option>smtp_ratelimit_rcpt</option></entry>
19715 <entry>ratelimit for RCPT commands</entry>
19716 </row>
19717 <row>
19718 <entry><option>smtp_receive_timeout</option></entry>
19719 <entry>per command or data line</entry>
19720 </row>
19721 <row>
19722 <entry><option>smtp_reserve_hosts</option></entry>
19723 <entry>these are the reserve hosts</entry>
19724 </row>
19725 <row>
19726 <entry><option>smtp_return_error_details</option></entry>
19727 <entry>give detail on rejections</entry>
19728 </row>
19729 </tbody>
19730 </tgroup>
19731 </informaltable>
19732 </section>
19733 <section id="SECID113">
19734 <title>SMTP extensions</title>
19735 <informaltable frame="none">
19736 <tgroup cols="2" colsep="0" rowsep="0">
19737 <colspec colwidth="196pt" align="left"/>
19738 <colspec colwidth="254pt" align="left"/>
19739 <tbody>
19740 <row>
19741 <entry><option>accept_8bitmime</option></entry>
19742 <entry>advertise 8BITMIME</entry>
19743 </row>
19744 <row>
19745 <entry><option>auth_advertise_hosts</option></entry>
19746 <entry>advertise AUTH to these hosts</entry>
19747 </row>
19748 <row>
19749 <entry><option>ignore_fromline_hosts</option></entry>
19750 <entry>allow <quote>From </quote> from these hosts</entry>
19751 </row>
19752 <row>
19753 <entry><option>ignore_fromline_local</option></entry>
19754 <entry>allow <quote>From </quote> from local SMTP</entry>
19755 </row>
19756 <row>
19757 <entry><option>pipelining_advertise_hosts</option></entry>
19758 <entry>advertise pipelining to these hosts</entry>
19759 </row>
19760 <row>
19761 <entry><option>tls_advertise_hosts</option></entry>
19762 <entry>advertise TLS to these hosts</entry>
19763 </row>
19764 </tbody>
19765 </tgroup>
19766 </informaltable>
19767 </section>
19768 <section id="SECID114">
19769 <title>Processing messages</title>
19770 <informaltable frame="none">
19771 <tgroup cols="2" colsep="0" rowsep="0">
19772 <colspec colwidth="196pt" align="left"/>
19773 <colspec colwidth="254pt" align="left"/>
19774 <tbody>
19775 <row>
19776 <entry><option>allow_domain_literals</option></entry>
19777 <entry>recognize domain literal syntax</entry>
19778 </row>
19779 <row>
19780 <entry><option>allow_mx_to_ip</option></entry>
19781 <entry>allow MX to point to IP address</entry>
19782 </row>
19783 <row>
19784 <entry><option>allow_utf8_domains</option></entry>
19785 <entry>in addresses</entry>
19786 </row>
19787 <row>
19788 <entry><option>check_rfc2047_length</option></entry>
19789 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19790 </row>
19791 <row>
19792 <entry><option>delivery_date_remove</option></entry>
19793 <entry>from incoming messages</entry>
19794 </row>
19795 <row>
19796 <entry><option>envelope_to_remove</option></entry>
19797 <entry>from incoming messages</entry>
19798 </row>
19799 <row>
19800 <entry><option>extract_addresses_remove_arguments</option></entry>
19801 <entry>affects <option>-t</option> processing</entry>
19802 </row>
19803 <row>
19804 <entry><option>headers_charset</option></entry>
19805 <entry>default for translations</entry>
19806 </row>
19807 <row>
19808 <entry><option>qualify_domain</option></entry>
19809 <entry>default for senders</entry>
19810 </row>
19811 <row>
19812 <entry><option>qualify_recipient</option></entry>
19813 <entry>default for recipients</entry>
19814 </row>
19815 <row>
19816 <entry><option>return_path_remove</option></entry>
19817 <entry>from incoming messages</entry>
19818 </row>
19819 <row>
19820 <entry><option>strip_excess_angle_brackets</option></entry>
19821 <entry>in addresses</entry>
19822 </row>
19823 <row>
19824 <entry><option>strip_trailing_dot</option></entry>
19825 <entry>at end of addresses</entry>
19826 </row>
19827 <row>
19828 <entry><option>untrusted_set_sender</option></entry>
19829 <entry>untrusted can set envelope sender</entry>
19830 </row>
19831 </tbody>
19832 </tgroup>
19833 </informaltable>
19834 </section>
19835 <section id="SECID115">
19836 <title>System filter</title>
19837 <informaltable frame="none">
19838 <tgroup cols="2" colsep="0" rowsep="0">
19839 <colspec colwidth="196pt" align="left"/>
19840 <colspec colwidth="254pt" align="left"/>
19841 <tbody>
19842 <row>
19843 <entry><option>system_filter</option></entry>
19844 <entry>locate system filter</entry>
19845 </row>
19846 <row>
19847 <entry><option>system_filter_directory_transport</option></entry>
19848 <entry>transport for delivery to a directory</entry>
19849 </row>
19850 <row>
19851 <entry><option>system_filter_file_transport</option></entry>
19852 <entry>transport for delivery to a file</entry>
19853 </row>
19854 <row>
19855 <entry><option>system_filter_group</option></entry>
19856 <entry>group for filter running</entry>
19857 </row>
19858 <row>
19859 <entry><option>system_filter_pipe_transport</option></entry>
19860 <entry>transport for delivery to a pipe</entry>
19861 </row>
19862 <row>
19863 <entry><option>system_filter_reply_transport</option></entry>
19864 <entry>transport for autoreply delivery</entry>
19865 </row>
19866 <row>
19867 <entry><option>system_filter_user</option></entry>
19868 <entry>user for filter running</entry>
19869 </row>
19870 </tbody>
19871 </tgroup>
19872 </informaltable>
19873 </section>
19874 <section id="SECID116">
19875 <title>Routing and delivery</title>
19876 <informaltable frame="none">
19877 <tgroup cols="2" colsep="0" rowsep="0">
19878 <colspec colwidth="196pt" align="left"/>
19879 <colspec colwidth="254pt" align="left"/>
19880 <tbody>
19881 <row>
19882 <entry><option>disable_ipv6</option></entry>
19883 <entry>do no IPv6 processing</entry>
19884 </row>
19885 <row>
19886 <entry><option>dns_again_means_nonexist</option></entry>
19887 <entry>for broken domains</entry>
19888 </row>
19889 <row>
19890 <entry><option>dns_check_names_pattern</option></entry>
19891 <entry>pre-DNS syntax check</entry>
19892 </row>
19893 <row>
19894 <entry><option>dns_ipv4_lookup</option></entry>
19895 <entry>only v4 lookup for these domains</entry>
19896 </row>
19897 <row>
19898 <entry><option>dns_retrans</option></entry>
19899 <entry>parameter for resolver</entry>
19900 </row>
19901 <row>
19902 <entry><option>dns_retry</option></entry>
19903 <entry>parameter for resolver</entry>
19904 </row>
19905 <row>
19906 <entry><option>hold_domains</option></entry>
19907 <entry>hold delivery for these domains</entry>
19908 </row>
19909 <row>
19910 <entry><option>local_interfaces</option></entry>
19911 <entry>for routing checks</entry>
19912 </row>
19913 <row>
19914 <entry><option>queue_domains</option></entry>
19915 <entry>no immediate delivery for these</entry>
19916 </row>
19917 <row>
19918 <entry><option>queue_only</option></entry>
19919 <entry>no immediate delivery at all</entry>
19920 </row>
19921 <row>
19922 <entry><option>queue_only_file</option></entry>
19923 <entry>no immediate delivery if file exists</entry>
19924 </row>
19925 <row>
19926 <entry><option>queue_only_load</option></entry>
19927 <entry>no immediate delivery if load is high</entry>
19928 </row>
19929 <row>
19930 <entry><option>queue_only_load_latch</option></entry>
19931 <entry>don&#x2019;t re-evaluate load for each message</entry>
19932 </row>
19933 <row>
19934 <entry><option>queue_only_override</option></entry>
19935 <entry>allow command line to override</entry>
19936 </row>
19937 <row>
19938 <entry><option>queue_run_in_order</option></entry>
19939 <entry>order of arrival</entry>
19940 </row>
19941 <row>
19942 <entry><option>queue_run_max</option></entry>
19943 <entry>of simultaneous queue runners</entry>
19944 </row>
19945 <row>
19946 <entry><option>queue_smtp_domains</option></entry>
19947 <entry>no immediate SMTP delivery for these</entry>
19948 </row>
19949 <row>
19950 <entry><option>remote_max_parallel</option></entry>
19951 <entry>parallel SMTP delivery per message</entry>
19952 </row>
19953 <row>
19954 <entry><option>remote_sort_domains</option></entry>
19955 <entry>order of remote deliveries</entry>
19956 </row>
19957 <row>
19958 <entry><option>retry_data_expire</option></entry>
19959 <entry>timeout for retry data</entry>
19960 </row>
19961 <row>
19962 <entry><option>retry_interval_max</option></entry>
19963 <entry>safety net for retry rules</entry>
19964 </row>
19965 </tbody>
19966 </tgroup>
19967 </informaltable>
19968 </section>
19969 <section id="SECID117">
19970 <title>Bounce and warning messages</title>
19971 <informaltable frame="none">
19972 <tgroup cols="2" colsep="0" rowsep="0">
19973 <colspec colwidth="196pt" align="left"/>
19974 <colspec colwidth="254pt" align="left"/>
19975 <tbody>
19976 <row>
19977 <entry><option>bounce_message_file</option></entry>
19978 <entry>content of bounce</entry>
19979 </row>
19980 <row>
19981 <entry><option>bounce_message_text</option></entry>
19982 <entry>content of bounce</entry>
19983 </row>
19984 <row>
19985 <entry><option>bounce_return_body</option></entry>
19986 <entry>include body if returning message</entry>
19987 </row>
19988 <row>
19989 <entry><option>bounce_return_message</option></entry>
19990 <entry>include original message in bounce</entry>
19991 </row>
19992 <row>
19993 <entry><option>bounce_return_size_limit</option></entry>
19994 <entry>limit on returned message</entry>
19995 </row>
19996 <row>
19997 <entry><option>bounce_sender_authentication</option></entry>
19998 <entry>send authenticated sender with bounce</entry>
19999 </row>
20000 <row>
20001 <entry><option>dsn_from</option></entry>
20002 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20003 </row>
20004 <row>
20005 <entry><option>errors_copy</option></entry>
20006 <entry>copy bounce messages</entry>
20007 </row>
20008 <row>
20009 <entry><option>errors_reply_to</option></entry>
20010 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20011 </row>
20012 <row>
20013 <entry><option>delay_warning</option></entry>
20014 <entry>time schedule</entry>
20015 </row>
20016 <row>
20017 <entry><option>delay_warning_condition</option></entry>
20018 <entry>condition for warning messages</entry>
20019 </row>
20020 <row>
20021 <entry><option>ignore_bounce_errors_after</option></entry>
20022 <entry>discard undeliverable bounces</entry>
20023 </row>
20024 <row>
20025 <entry><option>smtp_return_error_details</option></entry>
20026 <entry>give detail on rejections</entry>
20027 </row>
20028 <row>
20029 <entry><option>warn_message_file</option></entry>
20030 <entry>content of warning message</entry>
20031 </row>
20032 </tbody>
20033 </tgroup>
20034 </informaltable>
20035 </section>
20036 <section id="SECTalomo">
20037 <title>Alphabetical list of main options</title>
20038 <para>
20039 Those options that undergo string expansion before use are marked with
20040 &dagger;.
20041 </para>
20042 <para>
20043 <indexterm role="option">
20044 <primary><option>accept_8bitmime</option></primary>
20045 </indexterm>
20046 </para>
20047 <informaltable frame="all">
20048 <tgroup cols="4" colsep="0" rowsep="0">
20049 <colspec colwidth="8*" align="left"/>
20050 <colspec colwidth="6*" align="center"/>
20051 <colspec colwidth="6*" align="center"/>
20052 <colspec colwidth="6*" align="right"/>
20053 <tbody>
20054 <row>
20055 <entry><option>accept_8bitmime</option></entry>
20056 <entry>Use: <emphasis>main</emphasis></entry>
20057 <entry>Type: <emphasis>boolean</emphasis></entry>
20058 <entry>Default: <emphasis>false</emphasis></entry>
20059 </row>
20060 </tbody>
20061 </tgroup>
20062 </informaltable>
20063 <para>
20064 <indexterm role="concept">
20065 <primary>8BITMIME</primary>
20066 </indexterm>
20067 <indexterm role="concept">
20068 <primary>8-bit characters</primary>
20069 </indexterm>
20070 This option causes Exim to send 8BITMIME in its response to an SMTP
20071 EHLO command, and to accept the BODY= parameter on MAIL commands.
20072 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20073 takes no steps to do anything special with messages received by this route.
20074 Consequently, this option is turned off by default.
20075 </para>
20076 <para>
20077 <indexterm role="option">
20078 <primary><option>acl_not_smtp</option></primary>
20079 </indexterm>
20080 </para>
20081 <informaltable frame="all">
20082 <tgroup cols="4" colsep="0" rowsep="0">
20083 <colspec colwidth="8*" align="left"/>
20084 <colspec colwidth="6*" align="center"/>
20085 <colspec colwidth="6*" align="center"/>
20086 <colspec colwidth="6*" align="right"/>
20087 <tbody>
20088 <row>
20089 <entry><option>acl_not_smtp</option></entry>
20090 <entry>Use: <emphasis>main</emphasis></entry>
20091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20092 <entry>Default: <emphasis>unset</emphasis></entry>
20093 </row>
20094 </tbody>
20095 </tgroup>
20096 </informaltable>
20097 <para>
20098 <indexterm role="concept">
20099 <primary>access control lists (ACLs)</primary>
20100 <secondary>for non-SMTP messages</secondary>
20101 </indexterm>
20102 <indexterm role="concept">
20103 <primary>non-SMTP messages</primary>
20104 <secondary>ACLs for</secondary>
20105 </indexterm>
20106 This option defines the ACL that is run when a non-SMTP message has been
20107 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20108 further details.
20109 </para>
20110 <para>
20111 <indexterm role="option">
20112 <primary><option>acl_not_smtp_mime</option></primary>
20113 </indexterm>
20114 </para>
20115 <informaltable frame="all">
20116 <tgroup cols="4" colsep="0" rowsep="0">
20117 <colspec colwidth="8*" align="left"/>
20118 <colspec colwidth="6*" align="center"/>
20119 <colspec colwidth="6*" align="center"/>
20120 <colspec colwidth="6*" align="right"/>
20121 <tbody>
20122 <row>
20123 <entry><option>acl_not_smtp_mime</option></entry>
20124 <entry>Use: <emphasis>main</emphasis></entry>
20125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20126 <entry>Default: <emphasis>unset</emphasis></entry>
20127 </row>
20128 </tbody>
20129 </tgroup>
20130 </informaltable>
20131 <para>
20132 This option defines the ACL that is run for individual MIME parts of non-SMTP
20133 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20134 SMTP messages.
20135 </para>
20136 <para>
20137 <indexterm role="option">
20138 <primary><option>acl_not_smtp_start</option></primary>
20139 </indexterm>
20140 </para>
20141 <informaltable frame="all">
20142 <tgroup cols="4" colsep="0" rowsep="0">
20143 <colspec colwidth="8*" align="left"/>
20144 <colspec colwidth="6*" align="center"/>
20145 <colspec colwidth="6*" align="center"/>
20146 <colspec colwidth="6*" align="right"/>
20147 <tbody>
20148 <row>
20149 <entry><option>acl_not_smtp_start</option></entry>
20150 <entry>Use: <emphasis>main</emphasis></entry>
20151 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20152 <entry>Default: <emphasis>unset</emphasis></entry>
20153 </row>
20154 </tbody>
20155 </tgroup>
20156 </informaltable>
20157 <para>
20158 <indexterm role="concept">
20159 <primary>access control lists (ACLs)</primary>
20160 <secondary>at start of non-SMTP message</secondary>
20161 </indexterm>
20162 <indexterm role="concept">
20163 <primary>non-SMTP messages</primary>
20164 <secondary>ACLs for</secondary>
20165 </indexterm>
20166 This option defines the ACL that is run before Exim starts reading a
20167 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20168 </para>
20169 <para>
20170 <indexterm role="option">
20171 <primary><option>acl_smtp_auth</option></primary>
20172 </indexterm>
20173 </para>
20174 <informaltable frame="all">
20175 <tgroup cols="4" colsep="0" rowsep="0">
20176 <colspec colwidth="8*" align="left"/>
20177 <colspec colwidth="6*" align="center"/>
20178 <colspec colwidth="6*" align="center"/>
20179 <colspec colwidth="6*" align="right"/>
20180 <tbody>
20181 <row>
20182 <entry><option>acl_smtp_auth</option></entry>
20183 <entry>Use: <emphasis>main</emphasis></entry>
20184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20185 <entry>Default: <emphasis>unset</emphasis></entry>
20186 </row>
20187 </tbody>
20188 </tgroup>
20189 </informaltable>
20190 <para>
20191 <indexterm role="concept">
20192 <primary>access control lists (ACLs)</primary>
20193 <secondary>setting up for SMTP commands</secondary>
20194 </indexterm>
20195 <indexterm role="concept">
20196 <primary>AUTH</primary>
20197 <secondary>ACL for</secondary>
20198 </indexterm>
20199 This option defines the ACL that is run when an SMTP AUTH command is
20200 received. See chapter <xref linkend="CHAPACL"/> for further details.
20201 </para>
20202 <para>
20203 <indexterm role="option">
20204 <primary><option>acl_smtp_connect</option></primary>
20205 </indexterm>
20206 </para>
20207 <informaltable frame="all">
20208 <tgroup cols="4" colsep="0" rowsep="0">
20209 <colspec colwidth="8*" align="left"/>
20210 <colspec colwidth="6*" align="center"/>
20211 <colspec colwidth="6*" align="center"/>
20212 <colspec colwidth="6*" align="right"/>
20213 <tbody>
20214 <row>
20215 <entry><option>acl_smtp_connect</option></entry>
20216 <entry>Use: <emphasis>main</emphasis></entry>
20217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20218 <entry>Default: <emphasis>unset</emphasis></entry>
20219 </row>
20220 </tbody>
20221 </tgroup>
20222 </informaltable>
20223 <para>
20224 <indexterm role="concept">
20225 <primary>access control lists (ACLs)</primary>
20226 <secondary>on SMTP connection</secondary>
20227 </indexterm>
20228 This option defines the ACL that is run when an SMTP connection is received.
20229 See chapter <xref linkend="CHAPACL"/> for further details.
20230 </para>
20231 <para>
20232 <indexterm role="option">
20233 <primary><option>acl_smtp_data</option></primary>
20234 </indexterm>
20235 </para>
20236 <informaltable frame="all">
20237 <tgroup cols="4" colsep="0" rowsep="0">
20238 <colspec colwidth="8*" align="left"/>
20239 <colspec colwidth="6*" align="center"/>
20240 <colspec colwidth="6*" align="center"/>
20241 <colspec colwidth="6*" align="right"/>
20242 <tbody>
20243 <row>
20244 <entry><option>acl_smtp_data</option></entry>
20245 <entry>Use: <emphasis>main</emphasis></entry>
20246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20247 <entry>Default: <emphasis>unset</emphasis></entry>
20248 </row>
20249 </tbody>
20250 </tgroup>
20251 </informaltable>
20252 <para>
20253 <indexterm role="concept">
20254 <primary>DATA</primary>
20255 <secondary>ACL for</secondary>
20256 </indexterm>
20257 This option defines the ACL that is run after an SMTP DATA command has been
20258 processed and the message itself has been received, but before the final
20259 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20260 </para>
20261 <para>
20262 <indexterm role="option">
20263 <primary><option>acl_smtp_etrn</option></primary>
20264 </indexterm>
20265 </para>
20266 <informaltable frame="all">
20267 <tgroup cols="4" colsep="0" rowsep="0">
20268 <colspec colwidth="8*" align="left"/>
20269 <colspec colwidth="6*" align="center"/>
20270 <colspec colwidth="6*" align="center"/>
20271 <colspec colwidth="6*" align="right"/>
20272 <tbody>
20273 <row>
20274 <entry><option>acl_smtp_etrn</option></entry>
20275 <entry>Use: <emphasis>main</emphasis></entry>
20276 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20277 <entry>Default: <emphasis>unset</emphasis></entry>
20278 </row>
20279 </tbody>
20280 </tgroup>
20281 </informaltable>
20282 <para>
20283 <indexterm role="concept">
20284 <primary>ETRN</primary>
20285 <secondary>ACL for</secondary>
20286 </indexterm>
20287 This option defines the ACL that is run when an SMTP ETRN command is
20288 received. See chapter <xref linkend="CHAPACL"/> for further details.
20289 </para>
20290 <para>
20291 <indexterm role="option">
20292 <primary><option>acl_smtp_expn</option></primary>
20293 </indexterm>
20294 </para>
20295 <informaltable frame="all">
20296 <tgroup cols="4" colsep="0" rowsep="0">
20297 <colspec colwidth="8*" align="left"/>
20298 <colspec colwidth="6*" align="center"/>
20299 <colspec colwidth="6*" align="center"/>
20300 <colspec colwidth="6*" align="right"/>
20301 <tbody>
20302 <row>
20303 <entry><option>acl_smtp_expn</option></entry>
20304 <entry>Use: <emphasis>main</emphasis></entry>
20305 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20306 <entry>Default: <emphasis>unset</emphasis></entry>
20307 </row>
20308 </tbody>
20309 </tgroup>
20310 </informaltable>
20311 <para>
20312 <indexterm role="concept">
20313 <primary>EXPN</primary>
20314 <secondary>ACL for</secondary>
20315 </indexterm>
20316 This option defines the ACL that is run when an SMTP EXPN command is
20317 received. See chapter <xref linkend="CHAPACL"/> for further details.
20318 </para>
20319 <para>
20320 <indexterm role="option">
20321 <primary><option>acl_smtp_helo</option></primary>
20322 </indexterm>
20323 </para>
20324 <informaltable frame="all">
20325 <tgroup cols="4" colsep="0" rowsep="0">
20326 <colspec colwidth="8*" align="left"/>
20327 <colspec colwidth="6*" align="center"/>
20328 <colspec colwidth="6*" align="center"/>
20329 <colspec colwidth="6*" align="right"/>
20330 <tbody>
20331 <row>
20332 <entry><option>acl_smtp_helo</option></entry>
20333 <entry>Use: <emphasis>main</emphasis></entry>
20334 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20335 <entry>Default: <emphasis>unset</emphasis></entry>
20336 </row>
20337 </tbody>
20338 </tgroup>
20339 </informaltable>
20340 <para>
20341 <indexterm role="concept">
20342 <primary>EHLO</primary>
20343 <secondary>ACL for</secondary>
20344 </indexterm>
20345 <indexterm role="concept">
20346 <primary>HELO</primary>
20347 <secondary>ACL for</secondary>
20348 </indexterm>
20349 This option defines the ACL that is run when an SMTP EHLO or HELO
20350 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20351 </para>
20352 <para>
20353 <indexterm role="option">
20354 <primary><option>acl_smtp_mail</option></primary>
20355 </indexterm>
20356 </para>
20357 <informaltable frame="all">
20358 <tgroup cols="4" colsep="0" rowsep="0">
20359 <colspec colwidth="8*" align="left"/>
20360 <colspec colwidth="6*" align="center"/>
20361 <colspec colwidth="6*" align="center"/>
20362 <colspec colwidth="6*" align="right"/>
20363 <tbody>
20364 <row>
20365 <entry><option>acl_smtp_mail</option></entry>
20366 <entry>Use: <emphasis>main</emphasis></entry>
20367 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20368 <entry>Default: <emphasis>unset</emphasis></entry>
20369 </row>
20370 </tbody>
20371 </tgroup>
20372 </informaltable>
20373 <para>
20374 <indexterm role="concept">
20375 <primary>MAIL</primary>
20376 <secondary>ACL for</secondary>
20377 </indexterm>
20378 This option defines the ACL that is run when an SMTP MAIL command is
20379 received. See chapter <xref linkend="CHAPACL"/> for further details.
20380 </para>
20381 <para>
20382 <indexterm role="option">
20383 <primary><option>acl_smtp_mailauth</option></primary>
20384 </indexterm>
20385 </para>
20386 <informaltable frame="all">
20387 <tgroup cols="4" colsep="0" rowsep="0">
20388 <colspec colwidth="8*" align="left"/>
20389 <colspec colwidth="6*" align="center"/>
20390 <colspec colwidth="6*" align="center"/>
20391 <colspec colwidth="6*" align="right"/>
20392 <tbody>
20393 <row>
20394 <entry><option>acl_smtp_mailauth</option></entry>
20395 <entry>Use: <emphasis>main</emphasis></entry>
20396 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20397 <entry>Default: <emphasis>unset</emphasis></entry>
20398 </row>
20399 </tbody>
20400 </tgroup>
20401 </informaltable>
20402 <para>
20403 <indexterm role="concept">
20404 <primary>AUTH</primary>
20405 <secondary>on MAIL command</secondary>
20406 </indexterm>
20407 This option defines the ACL that is run when there is an AUTH parameter on
20408 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20409 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20410 </para>
20411 <para>
20412 <indexterm role="option">
20413 <primary><option>acl_smtp_mime</option></primary>
20414 </indexterm>
20415 </para>
20416 <informaltable frame="all">
20417 <tgroup cols="4" colsep="0" rowsep="0">
20418 <colspec colwidth="8*" align="left"/>
20419 <colspec colwidth="6*" align="center"/>
20420 <colspec colwidth="6*" align="center"/>
20421 <colspec colwidth="6*" align="right"/>
20422 <tbody>
20423 <row>
20424 <entry><option>acl_smtp_mime</option></entry>
20425 <entry>Use: <emphasis>main</emphasis></entry>
20426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20427 <entry>Default: <emphasis>unset</emphasis></entry>
20428 </row>
20429 </tbody>
20430 </tgroup>
20431 </informaltable>
20432 <para>
20433 <indexterm role="concept">
20434 <primary>MIME content scanning</primary>
20435 <secondary>ACL for</secondary>
20436 </indexterm>
20437 This option is available when Exim is built with the content-scanning
20438 extension. It defines the ACL that is run for each MIME part in a message. See
20439 section <xref linkend="SECTscanmimepart"/> for details.
20440 </para>
20441 <para>
20442 <indexterm role="option">
20443 <primary><option>acl_smtp_predata</option></primary>
20444 </indexterm>
20445 </para>
20446 <informaltable frame="all">
20447 <tgroup cols="4" colsep="0" rowsep="0">
20448 <colspec colwidth="8*" align="left"/>
20449 <colspec colwidth="6*" align="center"/>
20450 <colspec colwidth="6*" align="center"/>
20451 <colspec colwidth="6*" align="right"/>
20452 <tbody>
20453 <row>
20454 <entry><option>acl_smtp_predata</option></entry>
20455 <entry>Use: <emphasis>main</emphasis></entry>
20456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20457 <entry>Default: <emphasis>unset</emphasis></entry>
20458 </row>
20459 </tbody>
20460 </tgroup>
20461 </informaltable>
20462 <para>
20463 This option defines the ACL that is run when an SMTP DATA command is
20464 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20465 further details.
20466 </para>
20467 <para>
20468 <indexterm role="option">
20469 <primary><option>acl_smtp_quit</option></primary>
20470 </indexterm>
20471 </para>
20472 <informaltable frame="all">
20473 <tgroup cols="4" colsep="0" rowsep="0">
20474 <colspec colwidth="8*" align="left"/>
20475 <colspec colwidth="6*" align="center"/>
20476 <colspec colwidth="6*" align="center"/>
20477 <colspec colwidth="6*" align="right"/>
20478 <tbody>
20479 <row>
20480 <entry><option>acl_smtp_quit</option></entry>
20481 <entry>Use: <emphasis>main</emphasis></entry>
20482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20483 <entry>Default: <emphasis>unset</emphasis></entry>
20484 </row>
20485 </tbody>
20486 </tgroup>
20487 </informaltable>
20488 <para>
20489 <indexterm role="concept">
20490 <primary>QUIT, ACL for</primary>
20491 </indexterm>
20492 This option defines the ACL that is run when an SMTP QUIT command is
20493 received. See chapter <xref linkend="CHAPACL"/> for further details.
20494 </para>
20495 <para>
20496 <indexterm role="option">
20497 <primary><option>acl_smtp_rcpt</option></primary>
20498 </indexterm>
20499 </para>
20500 <informaltable frame="all">
20501 <tgroup cols="4" colsep="0" rowsep="0">
20502 <colspec colwidth="8*" align="left"/>
20503 <colspec colwidth="6*" align="center"/>
20504 <colspec colwidth="6*" align="center"/>
20505 <colspec colwidth="6*" align="right"/>
20506 <tbody>
20507 <row>
20508 <entry><option>acl_smtp_rcpt</option></entry>
20509 <entry>Use: <emphasis>main</emphasis></entry>
20510 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20511 <entry>Default: <emphasis>unset</emphasis></entry>
20512 </row>
20513 </tbody>
20514 </tgroup>
20515 </informaltable>
20516 <para>
20517 <indexterm role="concept">
20518 <primary>RCPT</primary>
20519 <secondary>ACL for</secondary>
20520 </indexterm>
20521 This option defines the ACL that is run when an SMTP RCPT command is
20522 received. See chapter <xref linkend="CHAPACL"/> for further details.
20523 </para>
20524 <para>
20525 <indexterm role="option">
20526 <primary><option>acl_smtp_starttls</option></primary>
20527 </indexterm>
20528 </para>
20529 <informaltable frame="all">
20530 <tgroup cols="4" colsep="0" rowsep="0">
20531 <colspec colwidth="8*" align="left"/>
20532 <colspec colwidth="6*" align="center"/>
20533 <colspec colwidth="6*" align="center"/>
20534 <colspec colwidth="6*" align="right"/>
20535 <tbody>
20536 <row>
20537 <entry><option>acl_smtp_starttls</option></entry>
20538 <entry>Use: <emphasis>main</emphasis></entry>
20539 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20540 <entry>Default: <emphasis>unset</emphasis></entry>
20541 </row>
20542 </tbody>
20543 </tgroup>
20544 </informaltable>
20545 <para>
20546 <indexterm role="concept">
20547 <primary>STARTTLS, ACL for</primary>
20548 </indexterm>
20549 This option defines the ACL that is run when an SMTP STARTTLS command is
20550 received. See chapter <xref linkend="CHAPACL"/> for further details.
20551 </para>
20552 <para>
20553 <indexterm role="option">
20554 <primary><option>acl_smtp_vrfy</option></primary>
20555 </indexterm>
20556 </para>
20557 <informaltable frame="all">
20558 <tgroup cols="4" colsep="0" rowsep="0">
20559 <colspec colwidth="8*" align="left"/>
20560 <colspec colwidth="6*" align="center"/>
20561 <colspec colwidth="6*" align="center"/>
20562 <colspec colwidth="6*" align="right"/>
20563 <tbody>
20564 <row>
20565 <entry><option>acl_smtp_vrfy</option></entry>
20566 <entry>Use: <emphasis>main</emphasis></entry>
20567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20568 <entry>Default: <emphasis>unset</emphasis></entry>
20569 </row>
20570 </tbody>
20571 </tgroup>
20572 </informaltable>
20573 <para>
20574 <indexterm role="concept">
20575 <primary>VRFY</primary>
20576 <secondary>ACL for</secondary>
20577 </indexterm>
20578 This option defines the ACL that is run when an SMTP VRFY command is
20579 received. See chapter <xref linkend="CHAPACL"/> for further details.
20580 </para>
20581 <para>
20582 <indexterm role="option">
20583 <primary><option>admin_groups</option></primary>
20584 </indexterm>
20585 </para>
20586 <informaltable frame="all">
20587 <tgroup cols="4" colsep="0" rowsep="0">
20588 <colspec colwidth="8*" align="left"/>
20589 <colspec colwidth="6*" align="center"/>
20590 <colspec colwidth="6*" align="center"/>
20591 <colspec colwidth="6*" align="right"/>
20592 <tbody>
20593 <row>
20594 <entry><option>admin_groups</option></entry>
20595 <entry>Use: <emphasis>main</emphasis></entry>
20596 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20597 <entry>Default: <emphasis>unset</emphasis></entry>
20598 </row>
20599 </tbody>
20600 </tgroup>
20601 </informaltable>
20602 <para>
20603 <indexterm role="concept">
20604 <primary>admin user</primary>
20605 </indexterm>
20606 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20607 current group or any of the supplementary groups of an Exim caller is in this
20608 colon-separated list, the caller has admin privileges. If all your system
20609 programmers are in a specific group, for example, you can give them all Exim
20610 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20611 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20612 To permit this, you have to add individuals to the Exim group.
20613 </para>
20614 <para>
20615 <indexterm role="option">
20616 <primary><option>allow_domain_literals</option></primary>
20617 </indexterm>
20618 </para>
20619 <informaltable frame="all">
20620 <tgroup cols="4" colsep="0" rowsep="0">
20621 <colspec colwidth="8*" align="left"/>
20622 <colspec colwidth="6*" align="center"/>
20623 <colspec colwidth="6*" align="center"/>
20624 <colspec colwidth="6*" align="right"/>
20625 <tbody>
20626 <row>
20627 <entry><option>allow_domain_literals</option></entry>
20628 <entry>Use: <emphasis>main</emphasis></entry>
20629 <entry>Type: <emphasis>boolean</emphasis></entry>
20630 <entry>Default: <emphasis>false</emphasis></entry>
20631 </row>
20632 </tbody>
20633 </tgroup>
20634 </informaltable>
20635 <para>
20636 <indexterm role="concept">
20637 <primary>domain literal</primary>
20638 </indexterm>
20639 If this option is set, the RFC 2822 domain literal format is permitted in
20640 email addresses. The option is not set by default, because the domain literal
20641 format is not normally required these days, and few people know about it. It
20642 has, however, been exploited by mail abusers.
20643 </para>
20644 <para>
20645 Unfortunately, it seems that some DNS black list maintainers are using this
20646 format to report black listing to postmasters. If you want to accept messages
20647 addressed to your hosts by IP address, you need to set
20648 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20649 domains (defined in the named domain list <option>local_domains</option> in the default
20650 configuration). This <quote>magic string</quote> matches the domain literal form of all
20651 the local host&#x2019;s IP addresses.
20652 </para>
20653 <para>
20654 <indexterm role="option">
20655 <primary><option>allow_mx_to_ip</option></primary>
20656 </indexterm>
20657 </para>
20658 <informaltable frame="all">
20659 <tgroup cols="4" colsep="0" rowsep="0">
20660 <colspec colwidth="8*" align="left"/>
20661 <colspec colwidth="6*" align="center"/>
20662 <colspec colwidth="6*" align="center"/>
20663 <colspec colwidth="6*" align="right"/>
20664 <tbody>
20665 <row>
20666 <entry><option>allow_mx_to_ip</option></entry>
20667 <entry>Use: <emphasis>main</emphasis></entry>
20668 <entry>Type: <emphasis>boolean</emphasis></entry>
20669 <entry>Default: <emphasis>false</emphasis></entry>
20670 </row>
20671 </tbody>
20672 </tgroup>
20673 </informaltable>
20674 <para>
20675 <indexterm role="concept">
20676 <primary>MX record</primary>
20677 <secondary>pointing to IP address</secondary>
20678 </indexterm>
20679 It appears that more and more DNS zone administrators are breaking the rules
20680 and putting domain names that look like IP addresses on the right hand side of
20681 MX records. Exim follows the rules and rejects this, giving an error message
20682 that explains the mis-configuration. However, some other MTAs support this
20683 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20684 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20685 recommended, except when you have no other choice.
20686 </para>
20687 <para>
20688 <indexterm role="option">
20689 <primary><option>allow_utf8_domains</option></primary>
20690 </indexterm>
20691 </para>
20692 <informaltable frame="all">
20693 <tgroup cols="4" colsep="0" rowsep="0">
20694 <colspec colwidth="8*" align="left"/>
20695 <colspec colwidth="6*" align="center"/>
20696 <colspec colwidth="6*" align="center"/>
20697 <colspec colwidth="6*" align="right"/>
20698 <tbody>
20699 <row>
20700 <entry><option>allow_utf8_domains</option></entry>
20701 <entry>Use: <emphasis>main</emphasis></entry>
20702 <entry>Type: <emphasis>boolean</emphasis></entry>
20703 <entry>Default: <emphasis>false</emphasis></entry>
20704 </row>
20705 </tbody>
20706 </tgroup>
20707 </informaltable>
20708 <para>
20709 <indexterm role="concept">
20710 <primary>domain</primary>
20711 <secondary>UTF-8 characters in</secondary>
20712 </indexterm>
20713 <indexterm role="concept">
20714 <primary>UTF-8</primary>
20715 <secondary>in domain name</secondary>
20716 </indexterm>
20717 Lots of discussion is going on about internationalized domain names. One
20718 camp is strongly in favour of just using UTF-8 characters, and it seems
20719 that at least two other MTAs permit this. This option allows Exim users to
20720 experiment if they wish.
20721 </para>
20722 <para>
20723 If it is set true, Exim&#x2019;s domain parsing function allows valid
20724 UTF-8 multicharacters to appear in domain name components, in addition to
20725 letters, digits, and hyphens. However, just setting this option is not
20726 enough; if you want to look up these domain names in the DNS, you must also
20727 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20728 suitable setting is:
20729 </para>
20730 <literallayout class="monospaced">
20731 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20732   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20733 </literallayout>
20734 <para>
20735 Alternatively, you can just disable this feature by setting
20736 </para>
20737 <literallayout class="monospaced">
20738 dns_check_names_pattern =
20739 </literallayout>
20740 <para>
20741 That is, set the option to an empty string so that no check is done.
20742 </para>
20743 <para>
20744 <indexterm role="option">
20745 <primary><option>auth_advertise_hosts</option></primary>
20746 </indexterm>
20747 </para>
20748 <informaltable frame="all">
20749 <tgroup cols="4" colsep="0" rowsep="0">
20750 <colspec colwidth="8*" align="left"/>
20751 <colspec colwidth="6*" align="center"/>
20752 <colspec colwidth="6*" align="center"/>
20753 <colspec colwidth="6*" align="right"/>
20754 <tbody>
20755 <row>
20756 <entry><option>auth_advertise_hosts</option></entry>
20757 <entry>Use: <emphasis>main</emphasis></entry>
20758 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20759 <entry>Default: <emphasis>*</emphasis></entry>
20760 </row>
20761 </tbody>
20762 </tgroup>
20763 </informaltable>
20764 <para>
20765 <indexterm role="concept">
20766 <primary>authentication</primary>
20767 <secondary>advertising</secondary>
20768 </indexterm>
20769 <indexterm role="concept">
20770 <primary>AUTH</primary>
20771 <secondary>advertising</secondary>
20772 </indexterm>
20773 If any server authentication mechanisms are configured, Exim advertises them in
20774 response to an EHLO command only if the calling host matches this list.
20775 Otherwise, Exim does not advertise AUTH.
20776 Exim does not accept AUTH commands from clients to which it has not
20777 advertised the availability of AUTH. The advertising of individual
20778 authentication mechanisms can be controlled by the use of the
20779 <option>server_advertise_condition</option> generic authenticator option on the individual
20780 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20781 </para>
20782 <para>
20783 Certain mail clients (for example, Netscape) require the user to provide a name
20784 and password for authentication if AUTH is advertised, even though it may
20785 not be needed (the host may accept messages from hosts on its local LAN without
20786 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20787 to make these clients more friendly by excluding them from the set of hosts to
20788 which Exim advertises AUTH.
20789 </para>
20790 <para>
20791 <indexterm role="concept">
20792 <primary>AUTH</primary>
20793 <secondary>advertising when encrypted</secondary>
20794 </indexterm>
20795 If you want to advertise the availability of AUTH only when the connection
20796 is encrypted using TLS, you can make use of the fact that the value of this
20797 option is expanded, with a setting like this:
20798 </para>
20799 <literallayout class="monospaced">
20800 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20801 </literallayout>
20802 <para>
20803 <indexterm role="variable">
20804 <primary><varname>$tls_cipher</varname></primary>
20805 </indexterm>
20806 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20807 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20808 expansion is *, which matches all hosts.
20809 </para>
20810 <para>
20811 <indexterm role="option">
20812 <primary><option>auto_thaw</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>auto_thaw</option></entry>
20824 <entry>Use: <emphasis>main</emphasis></entry>
20825 <entry>Type: <emphasis>time</emphasis></entry>
20826 <entry>Default: <emphasis>0s</emphasis></entry>
20827 </row>
20828 </tbody>
20829 </tgroup>
20830 </informaltable>
20831 <para>
20832 <indexterm role="concept">
20833 <primary>thawing messages</primary>
20834 </indexterm>
20835 <indexterm role="concept">
20836 <primary>unfreezing messages</primary>
20837 </indexterm>
20838 If this option is set to a time greater than zero, a queue runner will try a
20839 new delivery attempt on any frozen message, other than a bounce message, if
20840 this much time has passed since it was frozen. This may result in the message
20841 being re-frozen if nothing has changed since the last attempt. It is a way of
20842 saying <quote>keep on trying, even though there are big problems</quote>.
20843 </para>
20844 <para>
20845 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20846 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20847 thought to be very useful any more, and its use should probably be avoided.
20848 </para>
20849 <para>
20850 <indexterm role="option">
20851 <primary><option>av_scanner</option></primary>
20852 </indexterm>
20853 </para>
20854 <informaltable frame="all">
20855 <tgroup cols="4" colsep="0" rowsep="0">
20856 <colspec colwidth="8*" align="left"/>
20857 <colspec colwidth="6*" align="center"/>
20858 <colspec colwidth="6*" align="center"/>
20859 <colspec colwidth="6*" align="right"/>
20860 <tbody>
20861 <row>
20862 <entry><option>av_scanner</option></entry>
20863 <entry>Use: <emphasis>main</emphasis></entry>
20864 <entry>Type: <emphasis>string</emphasis></entry>
20865 <entry>Default: <emphasis>see below</emphasis></entry>
20866 </row>
20867 </tbody>
20868 </tgroup>
20869 </informaltable>
20870 <para>
20871 This option is available if Exim is built with the content-scanning extension.
20872 It specifies which anti-virus scanner to use. The default value is:
20873 </para>
20874 <literallayout class="monospaced">
20875 sophie:/var/run/sophie
20876 </literallayout>
20877 <para>
20878 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20879 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20880 </para>
20881 <para>
20882 <indexterm role="option">
20883 <primary><option>bi_command</option></primary>
20884 </indexterm>
20885 </para>
20886 <informaltable frame="all">
20887 <tgroup cols="4" colsep="0" rowsep="0">
20888 <colspec colwidth="8*" align="left"/>
20889 <colspec colwidth="6*" align="center"/>
20890 <colspec colwidth="6*" align="center"/>
20891 <colspec colwidth="6*" align="right"/>
20892 <tbody>
20893 <row>
20894 <entry><option>bi_command</option></entry>
20895 <entry>Use: <emphasis>main</emphasis></entry>
20896 <entry>Type: <emphasis>string</emphasis></entry>
20897 <entry>Default: <emphasis>unset</emphasis></entry>
20898 </row>
20899 </tbody>
20900 </tgroup>
20901 </informaltable>
20902 <para>
20903 <indexterm role="option">
20904 <primary><option>-bi</option></primary>
20905 </indexterm>
20906 This option supplies the name of a command that is run when Exim is called with
20907 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20908 just the command name, it is not a complete command line. If an argument is
20909 required, it must come from the <option>-oA</option> command line option.
20910 </para>
20911 <para>
20912 <indexterm role="option">
20913 <primary><option>bounce_message_file</option></primary>
20914 </indexterm>
20915 </para>
20916 <informaltable frame="all">
20917 <tgroup cols="4" colsep="0" rowsep="0">
20918 <colspec colwidth="8*" align="left"/>
20919 <colspec colwidth="6*" align="center"/>
20920 <colspec colwidth="6*" align="center"/>
20921 <colspec colwidth="6*" align="right"/>
20922 <tbody>
20923 <row>
20924 <entry><option>bounce_message_file</option></entry>
20925 <entry>Use: <emphasis>main</emphasis></entry>
20926 <entry>Type: <emphasis>string</emphasis></entry>
20927 <entry>Default: <emphasis>unset</emphasis></entry>
20928 </row>
20929 </tbody>
20930 </tgroup>
20931 </informaltable>
20932 <para>
20933 <indexterm role="concept">
20934 <primary>bounce message</primary>
20935 <secondary>customizing</secondary>
20936 </indexterm>
20937 <indexterm role="concept">
20938 <primary>customizing</primary>
20939 <secondary>bounce message</secondary>
20940 </indexterm>
20941 This option defines a template file containing paragraphs of text to be used
20942 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20943 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20944 </para>
20945 <para>
20946 <indexterm role="option">
20947 <primary><option>bounce_message_text</option></primary>
20948 </indexterm>
20949 </para>
20950 <informaltable frame="all">
20951 <tgroup cols="4" colsep="0" rowsep="0">
20952 <colspec colwidth="8*" align="left"/>
20953 <colspec colwidth="6*" align="center"/>
20954 <colspec colwidth="6*" align="center"/>
20955 <colspec colwidth="6*" align="right"/>
20956 <tbody>
20957 <row>
20958 <entry><option>bounce_message_text</option></entry>
20959 <entry>Use: <emphasis>main</emphasis></entry>
20960 <entry>Type: <emphasis>string</emphasis></entry>
20961 <entry>Default: <emphasis>unset</emphasis></entry>
20962 </row>
20963 </tbody>
20964 </tgroup>
20965 </informaltable>
20966 <para>
20967 When this option is set, its contents are included in the default bounce
20968 message immediately after <quote>This message was created automatically by mail
20969 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20970 </para>
20971 <para>
20972 <indexterm role="option">
20973 <primary><option>bounce_return_body</option></primary>
20974 </indexterm>
20975 </para>
20976 <informaltable frame="all">
20977 <tgroup cols="4" colsep="0" rowsep="0">
20978 <colspec colwidth="8*" align="left"/>
20979 <colspec colwidth="6*" align="center"/>
20980 <colspec colwidth="6*" align="center"/>
20981 <colspec colwidth="6*" align="right"/>
20982 <tbody>
20983 <row>
20984 <entry><option>bounce_return_body</option></entry>
20985 <entry>Use: <emphasis>main</emphasis></entry>
20986 <entry>Type: <emphasis>boolean</emphasis></entry>
20987 <entry>Default: <emphasis>true</emphasis></entry>
20988 </row>
20989 </tbody>
20990 </tgroup>
20991 </informaltable>
20992 <para>
20993 <indexterm role="concept">
20994 <primary>bounce message</primary>
20995 <secondary>including body</secondary>
20996 </indexterm>
20997 This option controls whether the body of an incoming message is included in a
20998 bounce message when <option>bounce_return_message</option> is true. The default setting
20999 causes the entire message, both header and body, to be returned (subject to the
21000 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21001 message header is included. In the case of a non-SMTP message containing an
21002 error that is detected during reception, only those header lines preceding the
21003 point at which the error was detected are returned.
21004 <indexterm role="concept">
21005 <primary>bounce message</primary>
21006 <secondary>including original</secondary>
21007 </indexterm>
21008 </para>
21009 <para>
21010 <indexterm role="option">
21011 <primary><option>bounce_return_message</option></primary>
21012 </indexterm>
21013 </para>
21014 <informaltable frame="all">
21015 <tgroup cols="4" colsep="0" rowsep="0">
21016 <colspec colwidth="8*" align="left"/>
21017 <colspec colwidth="6*" align="center"/>
21018 <colspec colwidth="6*" align="center"/>
21019 <colspec colwidth="6*" align="right"/>
21020 <tbody>
21021 <row>
21022 <entry><option>bounce_return_message</option></entry>
21023 <entry>Use: <emphasis>main</emphasis></entry>
21024 <entry>Type: <emphasis>boolean</emphasis></entry>
21025 <entry>Default: <emphasis>true</emphasis></entry>
21026 </row>
21027 </tbody>
21028 </tgroup>
21029 </informaltable>
21030 <para>
21031 If this option is set false, none of the original message is included in
21032 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21033 <option>bounce_return_body</option>.
21034 </para>
21035 <para>
21036 <indexterm role="option">
21037 <primary><option>bounce_return_size_limit</option></primary>
21038 </indexterm>
21039 </para>
21040 <informaltable frame="all">
21041 <tgroup cols="4" colsep="0" rowsep="0">
21042 <colspec colwidth="8*" align="left"/>
21043 <colspec colwidth="6*" align="center"/>
21044 <colspec colwidth="6*" align="center"/>
21045 <colspec colwidth="6*" align="right"/>
21046 <tbody>
21047 <row>
21048 <entry><option>bounce_return_size_limit</option></entry>
21049 <entry>Use: <emphasis>main</emphasis></entry>
21050 <entry>Type: <emphasis>integer</emphasis></entry>
21051 <entry>Default: <emphasis>100K</emphasis></entry>
21052 </row>
21053 </tbody>
21054 </tgroup>
21055 </informaltable>
21056 <para>
21057 <indexterm role="concept">
21058 <primary>size</primary>
21059 <secondary>of bounce, limit</secondary>
21060 </indexterm>
21061 <indexterm role="concept">
21062 <primary>bounce message</primary>
21063 <secondary>size limit</secondary>
21064 </indexterm>
21065 <indexterm role="concept">
21066 <primary>limit</primary>
21067 <secondary>bounce message size</secondary>
21068 </indexterm>
21069 This option sets a limit in bytes on the size of messages that are returned to
21070 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21071 limit should be less than the value of the global <option>message_size_limit</option> and of
21072 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21073 that Exim generates. If this option is set to zero there is no limit.
21074 </para>
21075 <para>
21076 When the body of any message that is to be included in a bounce message is
21077 greater than the limit, it is truncated, and a comment pointing this out is
21078 added at the top. The actual cutoff may be greater than the value given, owing
21079 to the use of buffering for transferring the message in chunks (typically 8K in
21080 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21081 messages.
21082 </para>
21083 <para>
21084 <indexterm role="option">
21085 <primary><option>bounce_sender_authentication</option></primary>
21086 </indexterm>
21087 </para>
21088 <informaltable frame="all">
21089 <tgroup cols="4" colsep="0" rowsep="0">
21090 <colspec colwidth="8*" align="left"/>
21091 <colspec colwidth="6*" align="center"/>
21092 <colspec colwidth="6*" align="center"/>
21093 <colspec colwidth="6*" align="right"/>
21094 <tbody>
21095 <row>
21096 <entry><option>bounce_sender_authentication</option></entry>
21097 <entry>Use: <emphasis>main</emphasis></entry>
21098 <entry>Type: <emphasis>string</emphasis></entry>
21099 <entry>Default: <emphasis>unset</emphasis></entry>
21100 </row>
21101 </tbody>
21102 </tgroup>
21103 </informaltable>
21104 <para>
21105 <indexterm role="concept">
21106 <primary>bounce message</primary>
21107 <secondary>sender authentication</secondary>
21108 </indexterm>
21109 <indexterm role="concept">
21110 <primary>authentication</primary>
21111 <secondary>bounce message</secondary>
21112 </indexterm>
21113 <indexterm role="concept">
21114 <primary>AUTH</primary>
21115 <secondary>on bounce message</secondary>
21116 </indexterm>
21117 This option provides an authenticated sender address that is sent with any
21118 bounce messages generated by Exim that are sent over an authenticated SMTP
21119 connection. A typical setting might be:
21120 </para>
21121 <literallayout class="monospaced">
21122 bounce_sender_authentication = mailer-daemon@my.domain.example
21123 </literallayout>
21124 <para>
21125 which would cause bounce messages to be sent using the SMTP command:
21126 </para>
21127 <literallayout class="monospaced">
21128 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21129 </literallayout>
21130 <para>
21131 The value of <option>bounce_sender_authentication</option> must always be a complete email
21132 address.
21133 </para>
21134 <para>
21135 <indexterm role="option">
21136 <primary><option>callout_domain_negative_expire</option></primary>
21137 </indexterm>
21138 </para>
21139 <informaltable frame="all">
21140 <tgroup cols="4" colsep="0" rowsep="0">
21141 <colspec colwidth="8*" align="left"/>
21142 <colspec colwidth="6*" align="center"/>
21143 <colspec colwidth="6*" align="center"/>
21144 <colspec colwidth="6*" align="right"/>
21145 <tbody>
21146 <row>
21147 <entry><option>callout_domain_negative_expire</option></entry>
21148 <entry>Use: <emphasis>main</emphasis></entry>
21149 <entry>Type: <emphasis>time</emphasis></entry>
21150 <entry>Default: <emphasis>3h</emphasis></entry>
21151 </row>
21152 </tbody>
21153 </tgroup>
21154 </informaltable>
21155 <para>
21156 <indexterm role="concept">
21157 <primary>caching</primary>
21158 <secondary>callout timeouts</secondary>
21159 </indexterm>
21160 <indexterm role="concept">
21161 <primary>callout</primary>
21162 <secondary>caching timeouts</secondary>
21163 </indexterm>
21164 This option specifies the expiry time for negative callout cache data for a
21165 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21166 section <xref linkend="SECTcallvercache"/> for details of the caching.
21167 </para>
21168 <para>
21169 <indexterm role="option">
21170 <primary><option>callout_domain_positive_expire</option></primary>
21171 </indexterm>
21172 </para>
21173 <informaltable frame="all">
21174 <tgroup cols="4" colsep="0" rowsep="0">
21175 <colspec colwidth="8*" align="left"/>
21176 <colspec colwidth="6*" align="center"/>
21177 <colspec colwidth="6*" align="center"/>
21178 <colspec colwidth="6*" align="right"/>
21179 <tbody>
21180 <row>
21181 <entry><option>callout_domain_positive_expire</option></entry>
21182 <entry>Use: <emphasis>main</emphasis></entry>
21183 <entry>Type: <emphasis>time</emphasis></entry>
21184 <entry>Default: <emphasis>7d</emphasis></entry>
21185 </row>
21186 </tbody>
21187 </tgroup>
21188 </informaltable>
21189 <para>
21190 This option specifies the expiry time for positive callout cache data for a
21191 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21192 section <xref linkend="SECTcallvercache"/> for details of the caching.
21193 </para>
21194 <para>
21195 <indexterm role="option">
21196 <primary><option>callout_negative_expire</option></primary>
21197 </indexterm>
21198 </para>
21199 <informaltable frame="all">
21200 <tgroup cols="4" colsep="0" rowsep="0">
21201 <colspec colwidth="8*" align="left"/>
21202 <colspec colwidth="6*" align="center"/>
21203 <colspec colwidth="6*" align="center"/>
21204 <colspec colwidth="6*" align="right"/>
21205 <tbody>
21206 <row>
21207 <entry><option>callout_negative_expire</option></entry>
21208 <entry>Use: <emphasis>main</emphasis></entry>
21209 <entry>Type: <emphasis>time</emphasis></entry>
21210 <entry>Default: <emphasis>2h</emphasis></entry>
21211 </row>
21212 </tbody>
21213 </tgroup>
21214 </informaltable>
21215 <para>
21216 This option specifies the expiry time for negative callout cache data for an
21217 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21218 section <xref linkend="SECTcallvercache"/> for details of the caching.
21219 </para>
21220 <para>
21221 <indexterm role="option">
21222 <primary><option>callout_positive_expire</option></primary>
21223 </indexterm>
21224 </para>
21225 <informaltable frame="all">
21226 <tgroup cols="4" colsep="0" rowsep="0">
21227 <colspec colwidth="8*" align="left"/>
21228 <colspec colwidth="6*" align="center"/>
21229 <colspec colwidth="6*" align="center"/>
21230 <colspec colwidth="6*" align="right"/>
21231 <tbody>
21232 <row>
21233 <entry><option>callout_positive_expire</option></entry>
21234 <entry>Use: <emphasis>main</emphasis></entry>
21235 <entry>Type: <emphasis>time</emphasis></entry>
21236 <entry>Default: <emphasis>24h</emphasis></entry>
21237 </row>
21238 </tbody>
21239 </tgroup>
21240 </informaltable>
21241 <para>
21242 This option specifies the expiry time for positive callout cache data for an
21243 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21244 section <xref linkend="SECTcallvercache"/> for details of the caching.
21245 </para>
21246 <para>
21247 <indexterm role="option">
21248 <primary><option>callout_random_local_part</option></primary>
21249 </indexterm>
21250 </para>
21251 <informaltable frame="all">
21252 <tgroup cols="4" colsep="0" rowsep="0">
21253 <colspec colwidth="8*" align="left"/>
21254 <colspec colwidth="6*" align="center"/>
21255 <colspec colwidth="6*" align="center"/>
21256 <colspec colwidth="6*" align="right"/>
21257 <tbody>
21258 <row>
21259 <entry><option>callout_random_local_part</option></entry>
21260 <entry>Use: <emphasis>main</emphasis></entry>
21261 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21262 <entry>Default: <emphasis>see below</emphasis></entry>
21263 </row>
21264 </tbody>
21265 </tgroup>
21266 </informaltable>
21267 <para>
21268 This option defines the <quote>random</quote> local part that can be used as part of
21269 callout verification. The default value is
21270 </para>
21271 <literallayout class="monospaced">
21272 $primary_host_name-$tod_epoch-testing
21273 </literallayout>
21274 <para>
21275 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21276 </para>
21277 <para>
21278 <indexterm role="option">
21279 <primary><option>check_log_inodes</option></primary>
21280 </indexterm>
21281 </para>
21282 <informaltable frame="all">
21283 <tgroup cols="4" colsep="0" rowsep="0">
21284 <colspec colwidth="8*" align="left"/>
21285 <colspec colwidth="6*" align="center"/>
21286 <colspec colwidth="6*" align="center"/>
21287 <colspec colwidth="6*" align="right"/>
21288 <tbody>
21289 <row>
21290 <entry><option>check_log_inodes</option></entry>
21291 <entry>Use: <emphasis>main</emphasis></entry>
21292 <entry>Type: <emphasis>integer</emphasis></entry>
21293 <entry>Default: <emphasis>0</emphasis></entry>
21294 </row>
21295 </tbody>
21296 </tgroup>
21297 </informaltable>
21298 <para>
21299 See <option>check_spool_space</option> below.
21300 </para>
21301 <para>
21302 <indexterm role="option">
21303 <primary><option>check_log_space</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>check_log_space</option></entry>
21315 <entry>Use: <emphasis>main</emphasis></entry>
21316 <entry>Type: <emphasis>integer</emphasis></entry>
21317 <entry>Default: <emphasis>0</emphasis></entry>
21318 </row>
21319 </tbody>
21320 </tgroup>
21321 </informaltable>
21322 <para>
21323 See <option>check_spool_space</option> below.
21324 </para>
21325 <para>
21326 <indexterm role="option">
21327 <primary><option>check_rfc2047_length</option></primary>
21328 </indexterm>
21329 <indexterm role="concept">
21330 <primary>RFC 2047</primary>
21331 <secondary>disabling length check</secondary>
21332 </indexterm>
21333 <indexterm role="option">
21334 <primary><option>check_rfc2047_length</option></primary>
21335 </indexterm>
21336 </para>
21337 <informaltable frame="all">
21338 <tgroup cols="4" colsep="0" rowsep="0">
21339 <colspec colwidth="8*" align="left"/>
21340 <colspec colwidth="6*" align="center"/>
21341 <colspec colwidth="6*" align="center"/>
21342 <colspec colwidth="6*" align="right"/>
21343 <tbody>
21344 <row>
21345 <entry><option>check_rfc2047_length</option></entry>
21346 <entry>Use: <emphasis>main</emphasis></entry>
21347 <entry>Type: <emphasis>boolean</emphasis></entry>
21348 <entry>Default: <emphasis>true</emphasis></entry>
21349 </row>
21350 </tbody>
21351 </tgroup>
21352 </informaltable>
21353 <para>
21354 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21355 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21356 word; strings to be encoded that exceed this length are supposed to use
21357 multiple encoded words. By default, Exim does not recognize encoded words that
21358 exceed the maximum length. However, it seems that some software, in violation
21359 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21360 set false, Exim recognizes encoded words of any length.
21361 </para>
21362 <para>
21363 <indexterm role="option">
21364 <primary><option>check_spool_inodes</option></primary>
21365 </indexterm>
21366 </para>
21367 <informaltable frame="all">
21368 <tgroup cols="4" colsep="0" rowsep="0">
21369 <colspec colwidth="8*" align="left"/>
21370 <colspec colwidth="6*" align="center"/>
21371 <colspec colwidth="6*" align="center"/>
21372 <colspec colwidth="6*" align="right"/>
21373 <tbody>
21374 <row>
21375 <entry><option>check_spool_inodes</option></entry>
21376 <entry>Use: <emphasis>main</emphasis></entry>
21377 <entry>Type: <emphasis>integer</emphasis></entry>
21378 <entry>Default: <emphasis>0</emphasis></entry>
21379 </row>
21380 </tbody>
21381 </tgroup>
21382 </informaltable>
21383 <para>
21384 See <option>check_spool_space</option> below.
21385 </para>
21386 <para>
21387 <indexterm role="option">
21388 <primary><option>check_spool_space</option></primary>
21389 </indexterm>
21390 </para>
21391 <informaltable frame="all">
21392 <tgroup cols="4" colsep="0" rowsep="0">
21393 <colspec colwidth="8*" align="left"/>
21394 <colspec colwidth="6*" align="center"/>
21395 <colspec colwidth="6*" align="center"/>
21396 <colspec colwidth="6*" align="right"/>
21397 <tbody>
21398 <row>
21399 <entry><option>check_spool_space</option></entry>
21400 <entry>Use: <emphasis>main</emphasis></entry>
21401 <entry>Type: <emphasis>integer</emphasis></entry>
21402 <entry>Default: <emphasis>0</emphasis></entry>
21403 </row>
21404 </tbody>
21405 </tgroup>
21406 </informaltable>
21407 <para>
21408 <indexterm role="concept">
21409 <primary>checking disk space</primary>
21410 </indexterm>
21411 <indexterm role="concept">
21412 <primary>disk space, checking</primary>
21413 </indexterm>
21414 <indexterm role="concept">
21415 <primary>spool directory</primary>
21416 <secondary>checking space</secondary>
21417 </indexterm>
21418 The four <option>check_...</option> options allow for checking of disk resources before a
21419 message is accepted.
21420 </para>
21421 <para>
21422 <indexterm role="variable">
21423 <primary><varname>$log_inodes</varname></primary>
21424 </indexterm>
21425 <indexterm role="variable">
21426 <primary><varname>$log_space</varname></primary>
21427 </indexterm>
21428 <indexterm role="variable">
21429 <primary><varname>$spool_inodes</varname></primary>
21430 </indexterm>
21431 <indexterm role="variable">
21432 <primary><varname>$spool_space</varname></primary>
21433 </indexterm>
21434 When any of these options are set, they apply to all incoming messages. If you
21435 want to apply different checks to different kinds of message, you can do so by
21436 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21437 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21438 </para>
21439 <para>
21440 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21441 either value is greater than zero, for example:
21442 </para>
21443 <literallayout class="monospaced">
21444 check_spool_space = 10M
21445 check_spool_inodes = 100
21446 </literallayout>
21447 <para>
21448 The spool partition is the one that contains the directory defined by
21449 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21450 transit.
21451 </para>
21452 <para>
21453 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21454 files are written if either is greater than zero. These should be set only if
21455 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21456 </para>
21457 <para>
21458 If there is less space or fewer inodes than requested, Exim refuses to accept
21459 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21460 error response to the MAIL command. If ESMTP is in use and there was a
21461 SIZE parameter on the MAIL command, its value is added to the
21462 <option>check_spool_space</option> value, and the check is performed even if
21463 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21464 </para>
21465 <para>
21466 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21467 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21468 </para>
21469 <para>
21470 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21471 failure a message is written to stderr and Exim exits with a non-zero code, as
21472 it obviously cannot send an error message of any kind.
21473 </para>
21474 <para>
21475 <indexterm role="option">
21476 <primary><option>daemon_smtp_ports</option></primary>
21477 </indexterm>
21478 </para>
21479 <informaltable frame="all">
21480 <tgroup cols="4" colsep="0" rowsep="0">
21481 <colspec colwidth="8*" align="left"/>
21482 <colspec colwidth="6*" align="center"/>
21483 <colspec colwidth="6*" align="center"/>
21484 <colspec colwidth="6*" align="right"/>
21485 <tbody>
21486 <row>
21487 <entry><option>daemon_smtp_ports</option></entry>
21488 <entry>Use: <emphasis>main</emphasis></entry>
21489 <entry>Type: <emphasis>string</emphasis></entry>
21490 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21491 </row>
21492 </tbody>
21493 </tgroup>
21494 </informaltable>
21495 <para>
21496 <indexterm role="concept">
21497 <primary>port</primary>
21498 <secondary>for daemon</secondary>
21499 </indexterm>
21500 <indexterm role="concept">
21501 <primary>TCP/IP</primary>
21502 <secondary>setting listening ports</secondary>
21503 </indexterm>
21504 This option specifies one or more default SMTP ports on which the Exim daemon
21505 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21506 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21507 </para>
21508 <para>
21509 <indexterm role="option">
21510 <primary><option>daemon_startup_retries</option></primary>
21511 </indexterm>
21512 </para>
21513 <informaltable frame="all">
21514 <tgroup cols="4" colsep="0" rowsep="0">
21515 <colspec colwidth="8*" align="left"/>
21516 <colspec colwidth="6*" align="center"/>
21517 <colspec colwidth="6*" align="center"/>
21518 <colspec colwidth="6*" align="right"/>
21519 <tbody>
21520 <row>
21521 <entry><option>daemon_startup_retries</option></entry>
21522 <entry>Use: <emphasis>main</emphasis></entry>
21523 <entry>Type: <emphasis>integer</emphasis></entry>
21524 <entry>Default: <emphasis>9</emphasis></entry>
21525 </row>
21526 </tbody>
21527 </tgroup>
21528 </informaltable>
21529 <para>
21530 <indexterm role="concept">
21531 <primary>daemon startup, retrying</primary>
21532 </indexterm>
21533 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21534 the daemon at startup when it cannot immediately bind a listening socket
21535 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21536 defines the number of retries after the first failure, and
21537 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21538 </para>
21539 <para>
21540 <indexterm role="option">
21541 <primary><option>daemon_startup_sleep</option></primary>
21542 </indexterm>
21543 </para>
21544 <informaltable frame="all">
21545 <tgroup cols="4" colsep="0" rowsep="0">
21546 <colspec colwidth="8*" align="left"/>
21547 <colspec colwidth="6*" align="center"/>
21548 <colspec colwidth="6*" align="center"/>
21549 <colspec colwidth="6*" align="right"/>
21550 <tbody>
21551 <row>
21552 <entry><option>daemon_startup_sleep</option></entry>
21553 <entry>Use: <emphasis>main</emphasis></entry>
21554 <entry>Type: <emphasis>time</emphasis></entry>
21555 <entry>Default: <emphasis>30s</emphasis></entry>
21556 </row>
21557 </tbody>
21558 </tgroup>
21559 </informaltable>
21560 <para>
21561 See <option>daemon_startup_retries</option>.
21562 </para>
21563 <para>
21564 <indexterm role="option">
21565 <primary><option>delay_warning</option></primary>
21566 </indexterm>
21567 </para>
21568 <informaltable frame="all">
21569 <tgroup cols="4" colsep="0" rowsep="0">
21570 <colspec colwidth="8*" align="left"/>
21571 <colspec colwidth="6*" align="center"/>
21572 <colspec colwidth="6*" align="center"/>
21573 <colspec colwidth="6*" align="right"/>
21574 <tbody>
21575 <row>
21576 <entry><option>delay_warning</option></entry>
21577 <entry>Use: <emphasis>main</emphasis></entry>
21578 <entry>Type: <emphasis>time list</emphasis></entry>
21579 <entry>Default: <emphasis>24h</emphasis></entry>
21580 </row>
21581 </tbody>
21582 </tgroup>
21583 </informaltable>
21584 <para>
21585 <indexterm role="concept">
21586 <primary>warning of delay</primary>
21587 </indexterm>
21588 <indexterm role="concept">
21589 <primary>delay warning, specifying</primary>
21590 </indexterm>
21591 When a message is delayed, Exim sends a warning message to the sender at
21592 intervals specified by this option. The data is a colon-separated list of times
21593 after which to send warning messages. If the value of the option is an empty
21594 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21595 message has been on the queue for longer than the last time, the last interval
21596 between the times is used to compute subsequent warning times. For example,
21597 with
21598 </para>
21599 <literallayout class="monospaced">
21600 delay_warning = 4h:8h:24h
21601 </literallayout>
21602 <para>
21603 the first message is sent after 4 hours, the second after 8 hours, and
21604 the third one after 24 hours. After that, messages are sent every 16 hours,
21605 because that is the interval between the last two times on the list. If you set
21606 just one time, it specifies the repeat interval. For example, with:
21607 </para>
21608 <literallayout class="monospaced">
21609 delay_warning = 6h
21610 </literallayout>
21611 <para>
21612 messages are repeated every six hours. To stop warnings after a given time, set
21613 a very large time at the end of the list. For example:
21614 </para>
21615 <literallayout class="monospaced">
21616 delay_warning = 2h:12h:99d
21617 </literallayout>
21618 <para>
21619 <indexterm role="option">
21620 <primary><option>delay_warning_condition</option></primary>
21621 </indexterm>
21622 </para>
21623 <informaltable frame="all">
21624 <tgroup cols="4" colsep="0" rowsep="0">
21625 <colspec colwidth="8*" align="left"/>
21626 <colspec colwidth="6*" align="center"/>
21627 <colspec colwidth="6*" align="center"/>
21628 <colspec colwidth="6*" align="right"/>
21629 <tbody>
21630 <row>
21631 <entry><option>delay_warning_condition</option></entry>
21632 <entry>Use: <emphasis>main</emphasis></entry>
21633 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21634 <entry>Default: <emphasis>see below</emphasis></entry>
21635 </row>
21636 </tbody>
21637 </tgroup>
21638 </informaltable>
21639 <para>
21640 <indexterm role="variable">
21641 <primary><varname>$domain</varname></primary>
21642 </indexterm>
21643 The string is expanded at the time a warning message might be sent. If all the
21644 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21645 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21646 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21647 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21648 not sent. The default is:
21649 </para>
21650 <literallayout class="monospaced">
21651 delay_warning_condition = ${if or {\
21652   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21653   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21654   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21655   } {no}{yes}}
21656 </literallayout>
21657 <para>
21658 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21659 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21660 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21661 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21662 </para>
21663 <para>
21664 <indexterm role="option">
21665 <primary><option>deliver_drop_privilege</option></primary>
21666 </indexterm>
21667 </para>
21668 <informaltable frame="all">
21669 <tgroup cols="4" colsep="0" rowsep="0">
21670 <colspec colwidth="8*" align="left"/>
21671 <colspec colwidth="6*" align="center"/>
21672 <colspec colwidth="6*" align="center"/>
21673 <colspec colwidth="6*" align="right"/>
21674 <tbody>
21675 <row>
21676 <entry><option>deliver_drop_privilege</option></entry>
21677 <entry>Use: <emphasis>main</emphasis></entry>
21678 <entry>Type: <emphasis>boolean</emphasis></entry>
21679 <entry>Default: <emphasis>false</emphasis></entry>
21680 </row>
21681 </tbody>
21682 </tgroup>
21683 </informaltable>
21684 <para>
21685 <indexterm role="concept">
21686 <primary>unprivileged delivery</primary>
21687 </indexterm>
21688 <indexterm role="concept">
21689 <primary>delivery</primary>
21690 <secondary>unprivileged</secondary>
21691 </indexterm>
21692 If this option is set true, Exim drops its root privilege at the start of a
21693 delivery process, and runs as the Exim user throughout. This severely restricts
21694 the kinds of local delivery that are possible, but is viable in certain types
21695 of configuration. There is a discussion about the use of root privilege in
21696 chapter <xref linkend="CHAPsecurity"/>.
21697 </para>
21698 <para>
21699 <indexterm role="option">
21700 <primary><option>deliver_queue_load_max</option></primary>
21701 </indexterm>
21702 </para>
21703 <informaltable frame="all">
21704 <tgroup cols="4" colsep="0" rowsep="0">
21705 <colspec colwidth="8*" align="left"/>
21706 <colspec colwidth="6*" align="center"/>
21707 <colspec colwidth="6*" align="center"/>
21708 <colspec colwidth="6*" align="right"/>
21709 <tbody>
21710 <row>
21711 <entry><option>deliver_queue_load_max</option></entry>
21712 <entry>Use: <emphasis>main</emphasis></entry>
21713 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21714 <entry>Default: <emphasis>unset</emphasis></entry>
21715 </row>
21716 </tbody>
21717 </tgroup>
21718 </informaltable>
21719 <para>
21720 <indexterm role="concept">
21721 <primary>load average</primary>
21722 </indexterm>
21723 <indexterm role="concept">
21724 <primary>queue runner</primary>
21725 <secondary>abandoning</secondary>
21726 </indexterm>
21727 When this option is set, a queue run is abandoned if the system load average
21728 becomes greater than the value of the option. The option has no effect on
21729 ancient operating systems on which Exim cannot determine the load average.
21730 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21731 </para>
21732 <para>
21733 <indexterm role="option">
21734 <primary><option>delivery_date_remove</option></primary>
21735 </indexterm>
21736 </para>
21737 <informaltable frame="all">
21738 <tgroup cols="4" colsep="0" rowsep="0">
21739 <colspec colwidth="8*" align="left"/>
21740 <colspec colwidth="6*" align="center"/>
21741 <colspec colwidth="6*" align="center"/>
21742 <colspec colwidth="6*" align="right"/>
21743 <tbody>
21744 <row>
21745 <entry><option>delivery_date_remove</option></entry>
21746 <entry>Use: <emphasis>main</emphasis></entry>
21747 <entry>Type: <emphasis>boolean</emphasis></entry>
21748 <entry>Default: <emphasis>true</emphasis></entry>
21749 </row>
21750 </tbody>
21751 </tgroup>
21752 </informaltable>
21753 <para>
21754 <indexterm role="concept">
21755 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21756 </indexterm>
21757 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21758 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21759 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21760 should not be present in incoming messages, and this option causes them to be
21761 removed at the time the message is received, to avoid any problems that might
21762 occur when a delivered message is subsequently sent on to some other recipient.
21763 </para>
21764 <para>
21765 <indexterm role="option">
21766 <primary><option>disable_fsync</option></primary>
21767 </indexterm>
21768 </para>
21769 <informaltable frame="all">
21770 <tgroup cols="4" colsep="0" rowsep="0">
21771 <colspec colwidth="8*" align="left"/>
21772 <colspec colwidth="6*" align="center"/>
21773 <colspec colwidth="6*" align="center"/>
21774 <colspec colwidth="6*" align="right"/>
21775 <tbody>
21776 <row>
21777 <entry><option>disable_fsync</option></entry>
21778 <entry>Use: <emphasis>main</emphasis></entry>
21779 <entry>Type: <emphasis>boolean</emphasis></entry>
21780 <entry>Default: <emphasis>false</emphasis></entry>
21781 </row>
21782 </tbody>
21783 </tgroup>
21784 </informaltable>
21785 <para>
21786 <indexterm role="concept">
21787 <primary><function>fsync()</function>, disabling</primary>
21788 </indexterm>
21789 This option is available only if Exim was built with the compile-time option
21790 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21791 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21792 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21793 really, really, really understand what you are doing. <emphasis>No pre-compiled
21794 distributions of Exim should ever make this option available.</emphasis>
21795 </para>
21796 <para>
21797 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21798 updated files&#x2019; data to be written to disc before continuing. Unexpected events
21799 such as crashes and power outages may cause data to be lost or scrambled.
21800 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21801 </para>
21802 <para>
21803 <indexterm role="option">
21804 <primary><option>disable_ipv6</option></primary>
21805 </indexterm>
21806 </para>
21807 <informaltable frame="all">
21808 <tgroup cols="4" colsep="0" rowsep="0">
21809 <colspec colwidth="8*" align="left"/>
21810 <colspec colwidth="6*" align="center"/>
21811 <colspec colwidth="6*" align="center"/>
21812 <colspec colwidth="6*" align="right"/>
21813 <tbody>
21814 <row>
21815 <entry><option>disable_ipv6</option></entry>
21816 <entry>Use: <emphasis>main</emphasis></entry>
21817 <entry>Type: <emphasis>boolean</emphasis></entry>
21818 <entry>Default: <emphasis>false</emphasis></entry>
21819 </row>
21820 </tbody>
21821 </tgroup>
21822 </informaltable>
21823 <para>
21824 <indexterm role="concept">
21825 <primary>IPv6</primary>
21826 <secondary>disabling</secondary>
21827 </indexterm>
21828 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21829 activities take place. AAAA records are never looked up, and any IPv6 addresses
21830 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21831 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21832 to handle IPv6 literal addresses.
21833 </para>
21834 <para>
21835 <indexterm role="option">
21836 <primary><option>dns_again_means_nonexist</option></primary>
21837 </indexterm>
21838 </para>
21839 <informaltable frame="all">
21840 <tgroup cols="4" colsep="0" rowsep="0">
21841 <colspec colwidth="8*" align="left"/>
21842 <colspec colwidth="6*" align="center"/>
21843 <colspec colwidth="6*" align="center"/>
21844 <colspec colwidth="6*" align="right"/>
21845 <tbody>
21846 <row>
21847 <entry><option>dns_again_means_nonexist</option></entry>
21848 <entry>Use: <emphasis>main</emphasis></entry>
21849 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21850 <entry>Default: <emphasis>unset</emphasis></entry>
21851 </row>
21852 </tbody>
21853 </tgroup>
21854 </informaltable>
21855 <para>
21856 <indexterm role="concept">
21857 <primary>DNS</primary>
21858 <secondary><quote>try again</quote> response; overriding</secondary>
21859 </indexterm>
21860 DNS lookups give a <quote>try again</quote> response for the DNS errors
21861 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21862 keep trying to deliver a message, or to give repeated temporary errors to
21863 incoming mail. Sometimes the effect is caused by a badly set up name server and
21864 may persist for a long time. If a domain which exhibits this problem matches
21865 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21866 This option should be used with care. You can make it apply to reverse lookups
21867 by a setting such as this:
21868 </para>
21869 <literallayout class="monospaced">
21870 dns_again_means_nonexist = *.in-addr.arpa
21871 </literallayout>
21872 <para>
21873 This option applies to all DNS lookups that Exim does. It also applies when the
21874 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21875 since these are most likely to be caused by DNS lookup problems. The
21876 <command>dnslookup</command> router has some options of its own for controlling what happens
21877 when lookups for MX or SRV records give temporary errors. These more specific
21878 options are applied after this global option.
21879 </para>
21880 <para>
21881 <indexterm role="option">
21882 <primary><option>dns_check_names_pattern</option></primary>
21883 </indexterm>
21884 </para>
21885 <informaltable frame="all">
21886 <tgroup cols="4" colsep="0" rowsep="0">
21887 <colspec colwidth="8*" align="left"/>
21888 <colspec colwidth="6*" align="center"/>
21889 <colspec colwidth="6*" align="center"/>
21890 <colspec colwidth="6*" align="right"/>
21891 <tbody>
21892 <row>
21893 <entry><option>dns_check_names_pattern</option></entry>
21894 <entry>Use: <emphasis>main</emphasis></entry>
21895 <entry>Type: <emphasis>string</emphasis></entry>
21896 <entry>Default: <emphasis>see below</emphasis></entry>
21897 </row>
21898 </tbody>
21899 </tgroup>
21900 </informaltable>
21901 <para>
21902 <indexterm role="concept">
21903 <primary>DNS</primary>
21904 <secondary>pre-check of name syntax</secondary>
21905 </indexterm>
21906 When this option is set to a non-empty string, it causes Exim to check domain
21907 names for characters that are not allowed in host names before handing them to
21908 the DNS resolver, because some resolvers give temporary errors for names that
21909 contain unusual characters. If a domain name contains any unwanted characters,
21910 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21911 done by matching the domain name against a regular expression, which is the
21912 value of this option. The default pattern is
21913 </para>
21914 <literallayout class="monospaced">
21915 dns_check_names_pattern = \
21916   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21917 </literallayout>
21918 <para>
21919 which permits only letters, digits, slashes, and hyphens in components, but
21920 they must start and end with a letter or digit. Slashes are not, in fact,
21921 permitted in host names, but they are found in certain NS records (which can be
21922 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21923 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21924 empty string.
21925 </para>
21926 <para>
21927 <indexterm role="option">
21928 <primary><option>dns_csa_search_limit</option></primary>
21929 </indexterm>
21930 </para>
21931 <informaltable frame="all">
21932 <tgroup cols="4" colsep="0" rowsep="0">
21933 <colspec colwidth="8*" align="left"/>
21934 <colspec colwidth="6*" align="center"/>
21935 <colspec colwidth="6*" align="center"/>
21936 <colspec colwidth="6*" align="right"/>
21937 <tbody>
21938 <row>
21939 <entry><option>dns_csa_search_limit</option></entry>
21940 <entry>Use: <emphasis>main</emphasis></entry>
21941 <entry>Type: <emphasis>integer</emphasis></entry>
21942 <entry>Default: <emphasis>5</emphasis></entry>
21943 </row>
21944 </tbody>
21945 </tgroup>
21946 </informaltable>
21947 <para>
21948 This option controls the depth of parental searching for CSA SRV records in the
21949 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21950 </para>
21951 <para>
21952 <indexterm role="option">
21953 <primary><option>dns_csa_use_reverse</option></primary>
21954 </indexterm>
21955 </para>
21956 <informaltable frame="all">
21957 <tgroup cols="4" colsep="0" rowsep="0">
21958 <colspec colwidth="8*" align="left"/>
21959 <colspec colwidth="6*" align="center"/>
21960 <colspec colwidth="6*" align="center"/>
21961 <colspec colwidth="6*" align="right"/>
21962 <tbody>
21963 <row>
21964 <entry><option>dns_csa_use_reverse</option></entry>
21965 <entry>Use: <emphasis>main</emphasis></entry>
21966 <entry>Type: <emphasis>boolean</emphasis></entry>
21967 <entry>Default: <emphasis>true</emphasis></entry>
21968 </row>
21969 </tbody>
21970 </tgroup>
21971 </informaltable>
21972 <para>
21973 This option controls whether or not an IP address, given as a CSA domain, is
21974 reversed and looked up in the reverse DNS, as described in more detail in
21975 section <xref linkend="SECTverifyCSA"/>.
21976 </para>
21977 <para>
21978 <indexterm role="option">
21979 <primary><option>dns_ipv4_lookup</option></primary>
21980 </indexterm>
21981 </para>
21982 <informaltable frame="all">
21983 <tgroup cols="4" colsep="0" rowsep="0">
21984 <colspec colwidth="8*" align="left"/>
21985 <colspec colwidth="6*" align="center"/>
21986 <colspec colwidth="6*" align="center"/>
21987 <colspec colwidth="6*" align="right"/>
21988 <tbody>
21989 <row>
21990 <entry><option>dns_ipv4_lookup</option></entry>
21991 <entry>Use: <emphasis>main</emphasis></entry>
21992 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21993 <entry>Default: <emphasis>unset</emphasis></entry>
21994 </row>
21995 </tbody>
21996 </tgroup>
21997 </informaltable>
21998 <para>
21999 <indexterm role="concept">
22000 <primary>IPv6</primary>
22001 <secondary>DNS lookup for AAAA records</secondary>
22002 </indexterm>
22003 <indexterm role="concept">
22004 <primary>DNS</primary>
22005 <secondary>IPv6 lookup for AAAA records</secondary>
22006 </indexterm>
22007 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22008 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22009 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22010 domain matches this list.
22011 </para>
22012 <para>
22013 This is a fudge to help with name servers that give big delays or otherwise do
22014 not work for the AAAA record type. In due course, when the world&#x2019;s name
22015 servers have all been upgraded, there should be no need for this option.
22016 </para>
22017 <para>
22018 <indexterm role="option">
22019 <primary><option>dns_retrans</option></primary>
22020 </indexterm>
22021 </para>
22022 <informaltable frame="all">
22023 <tgroup cols="4" colsep="0" rowsep="0">
22024 <colspec colwidth="8*" align="left"/>
22025 <colspec colwidth="6*" align="center"/>
22026 <colspec colwidth="6*" align="center"/>
22027 <colspec colwidth="6*" align="right"/>
22028 <tbody>
22029 <row>
22030 <entry><option>dns_retrans</option></entry>
22031 <entry>Use: <emphasis>main</emphasis></entry>
22032 <entry>Type: <emphasis>time</emphasis></entry>
22033 <entry>Default: <emphasis>0s</emphasis></entry>
22034 </row>
22035 </tbody>
22036 </tgroup>
22037 </informaltable>
22038 <para>
22039 <indexterm role="concept">
22040 <primary>DNS</primary>
22041 <secondary>resolver options</secondary>
22042 </indexterm>
22043 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22044 retransmission and retry parameters for DNS lookups. Values of zero (the
22045 defaults) leave the system default settings unchanged. The first value is the
22046 time between retries, and the second is the number of retries. It isn&#x2019;t
22047 totally clear exactly how these settings affect the total time a DNS lookup may
22048 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22049 parameter values are available in the external resolver interface structure,
22050 but nowhere does it seem to describe how they are used or what you might want
22051 to set in them.
22052 </para>
22053 <para>
22054 <indexterm role="option">
22055 <primary><option>dns_retry</option></primary>
22056 </indexterm>
22057 </para>
22058 <informaltable frame="all">
22059 <tgroup cols="4" colsep="0" rowsep="0">
22060 <colspec colwidth="8*" align="left"/>
22061 <colspec colwidth="6*" align="center"/>
22062 <colspec colwidth="6*" align="center"/>
22063 <colspec colwidth="6*" align="right"/>
22064 <tbody>
22065 <row>
22066 <entry><option>dns_retry</option></entry>
22067 <entry>Use: <emphasis>main</emphasis></entry>
22068 <entry>Type: <emphasis>integer</emphasis></entry>
22069 <entry>Default: <emphasis>0</emphasis></entry>
22070 </row>
22071 </tbody>
22072 </tgroup>
22073 </informaltable>
22074 <para>
22075 See <option>dns_retrans</option> above.
22076 </para>
22077 <para>
22078 <indexterm role="option">
22079 <primary><option>drop_cr</option></primary>
22080 </indexterm>
22081 </para>
22082 <informaltable frame="all">
22083 <tgroup cols="4" colsep="0" rowsep="0">
22084 <colspec colwidth="8*" align="left"/>
22085 <colspec colwidth="6*" align="center"/>
22086 <colspec colwidth="6*" align="center"/>
22087 <colspec colwidth="6*" align="right"/>
22088 <tbody>
22089 <row>
22090 <entry><option>drop_cr</option></entry>
22091 <entry>Use: <emphasis>main</emphasis></entry>
22092 <entry>Type: <emphasis>boolean</emphasis></entry>
22093 <entry>Default: <emphasis>false</emphasis></entry>
22094 </row>
22095 </tbody>
22096 </tgroup>
22097 </informaltable>
22098 <para>
22099 This is an obsolete option that is now a no-op. It used to affect the way Exim
22100 handled CR and LF characters in incoming messages. What happens now is
22101 described in section <xref linkend="SECTlineendings"/>.
22102 </para>
22103 <para>
22104 <indexterm role="option">
22105 <primary><option>dsn_from</option></primary>
22106 </indexterm>
22107 </para>
22108 <informaltable frame="all">
22109 <tgroup cols="4" colsep="0" rowsep="0">
22110 <colspec colwidth="8*" align="left"/>
22111 <colspec colwidth="6*" align="center"/>
22112 <colspec colwidth="6*" align="center"/>
22113 <colspec colwidth="6*" align="right"/>
22114 <tbody>
22115 <row>
22116 <entry><option>dsn_from</option></entry>
22117 <entry>Use: <emphasis>main</emphasis></entry>
22118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22119 <entry>Default: <emphasis>see below</emphasis></entry>
22120 </row>
22121 </tbody>
22122 </tgroup>
22123 </informaltable>
22124 <para>
22125 <indexterm role="concept">
22126 <primary><emphasis>From:</emphasis> header line</primary>
22127 <secondary>in bounces</secondary>
22128 </indexterm>
22129 <indexterm role="concept">
22130 <primary>bounce messages</primary>
22131 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22132 </indexterm>
22133 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22134 bounces and other automatically generated messages (<quote>Delivery Status
22135 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22136 </para>
22137 <literallayout class="monospaced">
22138 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22139 </literallayout>
22140 <para>
22141 The value is expanded every time it is needed. If the expansion fails, a
22142 panic is logged, and the default value is used.
22143 </para>
22144 <para>
22145 <indexterm role="option">
22146 <primary><option>envelope_to_remove</option></primary>
22147 </indexterm>
22148 </para>
22149 <informaltable frame="all">
22150 <tgroup cols="4" colsep="0" rowsep="0">
22151 <colspec colwidth="8*" align="left"/>
22152 <colspec colwidth="6*" align="center"/>
22153 <colspec colwidth="6*" align="center"/>
22154 <colspec colwidth="6*" align="right"/>
22155 <tbody>
22156 <row>
22157 <entry><option>envelope_to_remove</option></entry>
22158 <entry>Use: <emphasis>main</emphasis></entry>
22159 <entry>Type: <emphasis>boolean</emphasis></entry>
22160 <entry>Default: <emphasis>true</emphasis></entry>
22161 </row>
22162 </tbody>
22163 </tgroup>
22164 </informaltable>
22165 <para>
22166 <indexterm role="concept">
22167 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22168 </indexterm>
22169 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22170 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22171 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22172 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22173 be present in incoming messages, and this option causes them to be removed at
22174 the time the message is received, to avoid any problems that might occur when a
22175 delivered message is subsequently sent on to some other recipient.
22176 </para>
22177 <para>
22178 <indexterm role="option">
22179 <primary><option>errors_copy</option></primary>
22180 </indexterm>
22181 </para>
22182 <informaltable frame="all">
22183 <tgroup cols="4" colsep="0" rowsep="0">
22184 <colspec colwidth="8*" align="left"/>
22185 <colspec colwidth="6*" align="center"/>
22186 <colspec colwidth="6*" align="center"/>
22187 <colspec colwidth="6*" align="right"/>
22188 <tbody>
22189 <row>
22190 <entry><option>errors_copy</option></entry>
22191 <entry>Use: <emphasis>main</emphasis></entry>
22192 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22193 <entry>Default: <emphasis>unset</emphasis></entry>
22194 </row>
22195 </tbody>
22196 </tgroup>
22197 </informaltable>
22198 <para>
22199 <indexterm role="concept">
22200 <primary>bounce message</primary>
22201 <secondary>copy to other address</secondary>
22202 </indexterm>
22203 <indexterm role="concept">
22204 <primary>copy of bounce message</primary>
22205 </indexterm>
22206 Setting this option causes Exim to send bcc copies of bounce messages that it
22207 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22208 coming from elsewhere. The value of the option is a colon-separated list of
22209 items. Each item consists of a pattern, terminated by white space, followed by
22210 a comma-separated list of email addresses. If a pattern contains spaces, it
22211 must be enclosed in double quotes.
22212 </para>
22213 <para>
22214 Each pattern is processed in the same way as a single item in an address list
22215 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22216 the bounce message, the message is copied to the addresses on the list. The
22217 items are scanned in order, and once a matching one is found, no further items
22218 are examined. For example:
22219 </para>
22220 <literallayout class="monospaced">
22221 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22222               rqps@mydomain   hostmaster@mydomain.example,\
22223                               postmaster@mydomain.example
22224 </literallayout>
22225 <para>
22226 <indexterm role="variable">
22227 <primary><varname>$domain</varname></primary>
22228 </indexterm>
22229 <indexterm role="variable">
22230 <primary><varname>$local_part</varname></primary>
22231 </indexterm>
22232 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22233 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22234 there was any wildcard matching in the pattern, the expansion
22235 <indexterm role="concept">
22236 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22237 <secondary>in <option>errors_copy</option></secondary>
22238 </indexterm>
22239 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22240 </para>
22241 <para>
22242 <indexterm role="option">
22243 <primary><option>errors_reply_to</option></primary>
22244 </indexterm>
22245 </para>
22246 <informaltable frame="all">
22247 <tgroup cols="4" colsep="0" rowsep="0">
22248 <colspec colwidth="8*" align="left"/>
22249 <colspec colwidth="6*" align="center"/>
22250 <colspec colwidth="6*" align="center"/>
22251 <colspec colwidth="6*" align="right"/>
22252 <tbody>
22253 <row>
22254 <entry><option>errors_reply_to</option></entry>
22255 <entry>Use: <emphasis>main</emphasis></entry>
22256 <entry>Type: <emphasis>string</emphasis></entry>
22257 <entry>Default: <emphasis>unset</emphasis></entry>
22258 </row>
22259 </tbody>
22260 </tgroup>
22261 </informaltable>
22262 <para>
22263 <indexterm role="concept">
22264 <primary>bounce message</primary>
22265 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22266 </indexterm>
22267 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22268 </para>
22269 <literallayout>
22270 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22271 </literallayout>
22272 <para>
22273 <indexterm role="option">
22274 <primary><option>quota_warn_message</option></primary>
22275 </indexterm>
22276 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22277 A warning message that is generated by the <option>quota_warn_message</option> option in an
22278 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22279 overrides the default.
22280 </para>
22281 <para>
22282 Experience shows that people reply to bounce messages. If the
22283 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22284 and warning messages. For example:
22285 </para>
22286 <literallayout class="monospaced">
22287 errors_reply_to = postmaster@my.domain.example
22288 </literallayout>
22289 <para>
22290 The value of the option is not expanded. It must specify a valid RFC 2822
22291 address. However, if a warning message that is generated by the
22292 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22293 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22294 not used.
22295 </para>
22296 <para>
22297 <indexterm role="option">
22298 <primary><option>exim_group</option></primary>
22299 </indexterm>
22300 </para>
22301 <informaltable frame="all">
22302 <tgroup cols="4" colsep="0" rowsep="0">
22303 <colspec colwidth="8*" align="left"/>
22304 <colspec colwidth="6*" align="center"/>
22305 <colspec colwidth="6*" align="center"/>
22306 <colspec colwidth="6*" align="right"/>
22307 <tbody>
22308 <row>
22309 <entry><option>exim_group</option></entry>
22310 <entry>Use: <emphasis>main</emphasis></entry>
22311 <entry>Type: <emphasis>string</emphasis></entry>
22312 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22313 </row>
22314 </tbody>
22315 </tgroup>
22316 </informaltable>
22317 <para>
22318 <indexterm role="concept">
22319 <primary>gid (group id)</primary>
22320 <secondary>Exim&#x2019;s own</secondary>
22321 </indexterm>
22322 <indexterm role="concept">
22323 <primary>Exim group</primary>
22324 </indexterm>
22325 This option changes the gid under which Exim runs when it gives up root
22326 privilege. The default value is compiled into the binary. The value of this
22327 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22328 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22329 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22330 security issues.
22331 </para>
22332 <para>
22333 <indexterm role="option">
22334 <primary><option>exim_path</option></primary>
22335 </indexterm>
22336 </para>
22337 <informaltable frame="all">
22338 <tgroup cols="4" colsep="0" rowsep="0">
22339 <colspec colwidth="8*" align="left"/>
22340 <colspec colwidth="6*" align="center"/>
22341 <colspec colwidth="6*" align="center"/>
22342 <colspec colwidth="6*" align="right"/>
22343 <tbody>
22344 <row>
22345 <entry><option>exim_path</option></entry>
22346 <entry>Use: <emphasis>main</emphasis></entry>
22347 <entry>Type: <emphasis>string</emphasis></entry>
22348 <entry>Default: <emphasis>see below</emphasis></entry>
22349 </row>
22350 </tbody>
22351 </tgroup>
22352 </informaltable>
22353 <para>
22354 <indexterm role="concept">
22355 <primary>Exim binary, path name</primary>
22356 </indexterm>
22357 This option specifies the path name of the Exim binary, which is used when Exim
22358 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22359 the directory configured at compile time by the BIN_DIRECTORY setting. It
22360 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22361 other place.
22362 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22363 you will break those Exim utilities that scan the configuration file to find
22364 where the binary is. (They then use the <option>-bP</option> option to extract option
22365 settings such as the value of <option>spool_directory</option>.)
22366 </para>
22367 <para>
22368 <indexterm role="option">
22369 <primary><option>exim_user</option></primary>
22370 </indexterm>
22371 </para>
22372 <informaltable frame="all">
22373 <tgroup cols="4" colsep="0" rowsep="0">
22374 <colspec colwidth="8*" align="left"/>
22375 <colspec colwidth="6*" align="center"/>
22376 <colspec colwidth="6*" align="center"/>
22377 <colspec colwidth="6*" align="right"/>
22378 <tbody>
22379 <row>
22380 <entry><option>exim_user</option></entry>
22381 <entry>Use: <emphasis>main</emphasis></entry>
22382 <entry>Type: <emphasis>string</emphasis></entry>
22383 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22384 </row>
22385 </tbody>
22386 </tgroup>
22387 </informaltable>
22388 <para>
22389 <indexterm role="concept">
22390 <primary>uid (user id)</primary>
22391 <secondary>Exim&#x2019;s own</secondary>
22392 </indexterm>
22393 <indexterm role="concept">
22394 <primary>Exim user</primary>
22395 </indexterm>
22396 This option changes the uid under which Exim runs when it gives up root
22397 privilege. The default value is compiled into the binary. Ownership of the run
22398 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22399 options is checked against the values in the binary, not what is set here.
22400 </para>
22401 <para>
22402 Unless it consists entirely of digits, the string is looked up using
22403 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22404 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22405 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22406 </para>
22407 <para>
22408 <indexterm role="option">
22409 <primary><option>extra_local_interfaces</option></primary>
22410 </indexterm>
22411 </para>
22412 <informaltable frame="all">
22413 <tgroup cols="4" colsep="0" rowsep="0">
22414 <colspec colwidth="8*" align="left"/>
22415 <colspec colwidth="6*" align="center"/>
22416 <colspec colwidth="6*" align="center"/>
22417 <colspec colwidth="6*" align="right"/>
22418 <tbody>
22419 <row>
22420 <entry><option>extra_local_interfaces</option></entry>
22421 <entry>Use: <emphasis>main</emphasis></entry>
22422 <entry>Type: <emphasis>string list</emphasis></entry>
22423 <entry>Default: <emphasis>unset</emphasis></entry>
22424 </row>
22425 </tbody>
22426 </tgroup>
22427 </informaltable>
22428 <para>
22429 This option defines network interfaces that are to be considered local when
22430 routing, but which are not used for listening by the daemon. See section
22431 <xref linkend="SECTreclocipadd"/> for details.
22432 </para>
22433 <para>
22434 <indexterm role="option">
22435 <primary><option>extract_addresses_remove_arguments</option></primary>
22436 </indexterm>
22437 </para>
22438 <informaltable frame="all">
22439 <tgroup cols="4" colsep="0" rowsep="0">
22440 <colspec colwidth="8*" align="left"/>
22441 <colspec colwidth="6*" align="center"/>
22442 <colspec colwidth="6*" align="center"/>
22443 <colspec colwidth="6*" align="right"/>
22444 <tbody>
22445 <row>
22446 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22447 <entry>Use: <emphasis>main</emphasis></entry>
22448 <entry>Type: <emphasis>boolean</emphasis></entry>
22449 <entry>Default: <emphasis>true</emphasis></entry>
22450 </row>
22451 </tbody>
22452 </tgroup>
22453 </informaltable>
22454 <para>
22455 <indexterm role="option">
22456 <primary><option>-t</option></primary>
22457 </indexterm>
22458 <indexterm role="concept">
22459 <primary>command line</primary>
22460 <secondary>addresses with <option>-t</option></secondary>
22461 </indexterm>
22462 <indexterm role="concept">
22463 <primary>Sendmail compatibility</primary>
22464 <secondary><option>-t</option> option</secondary>
22465 </indexterm>
22466 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22467 are present on the command line when the <option>-t</option> option is used to build an
22468 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22469 line addresses are removed from the recipients list. This is also how Smail
22470 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22471 command line addresses are added to those obtained from the header lines. When
22472 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22473 argument headers. If it is set false, Exim adds rather than removes argument
22474 addresses.
22475 </para>
22476 <para>
22477 <indexterm role="option">
22478 <primary><option>finduser_retries</option></primary>
22479 </indexterm>
22480 </para>
22481 <informaltable frame="all">
22482 <tgroup cols="4" colsep="0" rowsep="0">
22483 <colspec colwidth="8*" align="left"/>
22484 <colspec colwidth="6*" align="center"/>
22485 <colspec colwidth="6*" align="center"/>
22486 <colspec colwidth="6*" align="right"/>
22487 <tbody>
22488 <row>
22489 <entry><option>finduser_retries</option></entry>
22490 <entry>Use: <emphasis>main</emphasis></entry>
22491 <entry>Type: <emphasis>integer</emphasis></entry>
22492 <entry>Default: <emphasis>0</emphasis></entry>
22493 </row>
22494 </tbody>
22495 </tgroup>
22496 </informaltable>
22497 <para>
22498 <indexterm role="concept">
22499 <primary>NIS, retrying user lookups</primary>
22500 </indexterm>
22501 On systems running NIS or other schemes in which user and group information is
22502 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22503 related functions fail, even when given valid data, because things time out.
22504 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22505 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22506 many extra times to find a user or a group, waiting for one second between
22507 retries.
22508 </para>
22509 <para>
22510 <indexterm role="concept">
22511 <primary><filename>/etc/passwd</filename></primary>
22512 <secondary>multiple reading of</secondary>
22513 </indexterm>
22514 You should not set this option greater than zero if your user information is in
22515 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22516 search the file multiple times for non-existent users, and also cause delay.
22517 </para>
22518 <para>
22519 <indexterm role="option">
22520 <primary><option>freeze_tell</option></primary>
22521 </indexterm>
22522 </para>
22523 <informaltable frame="all">
22524 <tgroup cols="4" colsep="0" rowsep="0">
22525 <colspec colwidth="8*" align="left"/>
22526 <colspec colwidth="6*" align="center"/>
22527 <colspec colwidth="6*" align="center"/>
22528 <colspec colwidth="6*" align="right"/>
22529 <tbody>
22530 <row>
22531 <entry><option>freeze_tell</option></entry>
22532 <entry>Use: <emphasis>main</emphasis></entry>
22533 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22534 <entry>Default: <emphasis>unset</emphasis></entry>
22535 </row>
22536 </tbody>
22537 </tgroup>
22538 </informaltable>
22539 <para>
22540 <indexterm role="concept">
22541 <primary>freezing messages</primary>
22542 <secondary>sending a message when freezing</secondary>
22543 </indexterm>
22544 On encountering certain errors, or when configured to do so in a system filter,
22545 ACL, or special router, Exim freezes a message. This means that no further
22546 delivery attempts take place until an administrator thaws the message, or the
22547 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22548 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22549 warning message whenever it freezes something, unless the message it is
22550 freezing is a locally-generated bounce message. (Without this exception there
22551 is the possibility of looping.) The warning message is sent to the addresses
22552 supplied as the comma-separated value of this option. If several of the
22553 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22554 freezing was automatic, the reason(s) for freezing can be found in the message
22555 log. If you configure freezing in a filter or ACL, you must arrange for any
22556 logging that you require.
22557 </para>
22558 <para>
22559 <indexterm role="option">
22560 <primary><option>gecos_name</option></primary>
22561 </indexterm>
22562 </para>
22563 <informaltable frame="all">
22564 <tgroup cols="4" colsep="0" rowsep="0">
22565 <colspec colwidth="8*" align="left"/>
22566 <colspec colwidth="6*" align="center"/>
22567 <colspec colwidth="6*" align="center"/>
22568 <colspec colwidth="6*" align="right"/>
22569 <tbody>
22570 <row>
22571 <entry><option>gecos_name</option></entry>
22572 <entry>Use: <emphasis>main</emphasis></entry>
22573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22574 <entry>Default: <emphasis>unset</emphasis></entry>
22575 </row>
22576 </tbody>
22577 </tgroup>
22578 </informaltable>
22579 <para>
22580 <indexterm role="concept">
22581 <primary>HP-UX</primary>
22582 </indexterm>
22583 <indexterm role="concept">
22584 <primary><quote>gecos</quote> field, parsing</primary>
22585 </indexterm>
22586 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22587 password file to hold other information in addition to users&#x2019; real names. Exim
22588 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22589 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22590 of the field are used unchanged, except that, if an ampersand is encountered,
22591 it is replaced by the user&#x2019;s login name with the first character forced to
22592 upper case, since this is a convention that is observed on many systems.
22593 </para>
22594 <para>
22595 When these options are set, <option>gecos_pattern</option> is treated as a regular
22596 expression that is to be applied to the field (again with &amp; replaced by the
22597 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22598 user&#x2019;s name.
22599 </para>
22600 <para>
22601 <indexterm role="concept">
22602 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22603 <secondary>in <option>gecos_name</option></secondary>
22604 </indexterm>
22605 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22606 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22607 name terminates at the first comma, the following can be used:
22608 </para>
22609 <literallayout class="monospaced">
22610 gecos_pattern = ([^,]*)
22611 gecos_name = $1
22612 </literallayout>
22613 <para>
22614 <indexterm role="option">
22615 <primary><option>gecos_pattern</option></primary>
22616 </indexterm>
22617 </para>
22618 <informaltable frame="all">
22619 <tgroup cols="4" colsep="0" rowsep="0">
22620 <colspec colwidth="8*" align="left"/>
22621 <colspec colwidth="6*" align="center"/>
22622 <colspec colwidth="6*" align="center"/>
22623 <colspec colwidth="6*" align="right"/>
22624 <tbody>
22625 <row>
22626 <entry><option>gecos_pattern</option></entry>
22627 <entry>Use: <emphasis>main</emphasis></entry>
22628 <entry>Type: <emphasis>string</emphasis></entry>
22629 <entry>Default: <emphasis>unset</emphasis></entry>
22630 </row>
22631 </tbody>
22632 </tgroup>
22633 </informaltable>
22634 <para>
22635 See <option>gecos_name</option> above.
22636 </para>
22637 <para>
22638 <indexterm role="option">
22639 <primary><option>gnutls_require_kx</option></primary>
22640 </indexterm>
22641 </para>
22642 <informaltable frame="all">
22643 <tgroup cols="4" colsep="0" rowsep="0">
22644 <colspec colwidth="8*" align="left"/>
22645 <colspec colwidth="6*" align="center"/>
22646 <colspec colwidth="6*" align="center"/>
22647 <colspec colwidth="6*" align="right"/>
22648 <tbody>
22649 <row>
22650 <entry><option>gnutls_require_kx</option></entry>
22651 <entry>Use: <emphasis>main</emphasis></entry>
22652 <entry>Type: <emphasis>string</emphasis></entry>
22653 <entry>Default: <emphasis>unset</emphasis></entry>
22654 </row>
22655 </tbody>
22656 </tgroup>
22657 </informaltable>
22658 <para>
22659 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22660 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22661 </para>
22662 <para>
22663 <indexterm role="option">
22664 <primary><option>gnutls_require_mac</option></primary>
22665 </indexterm>
22666 </para>
22667 <informaltable frame="all">
22668 <tgroup cols="4" colsep="0" rowsep="0">
22669 <colspec colwidth="8*" align="left"/>
22670 <colspec colwidth="6*" align="center"/>
22671 <colspec colwidth="6*" align="center"/>
22672 <colspec colwidth="6*" align="right"/>
22673 <tbody>
22674 <row>
22675 <entry><option>gnutls_require_mac</option></entry>
22676 <entry>Use: <emphasis>main</emphasis></entry>
22677 <entry>Type: <emphasis>string</emphasis></entry>
22678 <entry>Default: <emphasis>unset</emphasis></entry>
22679 </row>
22680 </tbody>
22681 </tgroup>
22682 </informaltable>
22683 <para>
22684 This option controls the MAC algorithms when GnuTLS is used in an Exim
22685 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22686 </para>
22687 <para>
22688 <indexterm role="option">
22689 <primary><option>gnutls_require_protocols</option></primary>
22690 </indexterm>
22691 </para>
22692 <informaltable frame="all">
22693 <tgroup cols="4" colsep="0" rowsep="0">
22694 <colspec colwidth="8*" align="left"/>
22695 <colspec colwidth="6*" align="center"/>
22696 <colspec colwidth="6*" align="center"/>
22697 <colspec colwidth="6*" align="right"/>
22698 <tbody>
22699 <row>
22700 <entry><option>gnutls_require_protocols</option></entry>
22701 <entry>Use: <emphasis>main</emphasis></entry>
22702 <entry>Type: <emphasis>string</emphasis></entry>
22703 <entry>Default: <emphasis>unset</emphasis></entry>
22704 </row>
22705 </tbody>
22706 </tgroup>
22707 </informaltable>
22708 <para>
22709 This option controls the protocols when GnuTLS is used in an Exim
22710 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22711 </para>
22712 <para revisionflag="changed">
22713 <indexterm role="option">
22714 <primary><option>gnutls_compat_mode</option></primary>
22715 </indexterm>
22716 </para>
22717 <informaltable frame="all" revisionflag="changed">
22718 <tgroup cols="4" colsep="0" rowsep="0">
22719 <colspec colwidth="8*" align="left"/>
22720 <colspec colwidth="6*" align="center"/>
22721 <colspec colwidth="6*" align="center"/>
22722 <colspec colwidth="6*" align="right"/>
22723 <tbody>
22724 <row>
22725 <entry><option>gnutls_compat_mode</option></entry>
22726 <entry>Use: <emphasis>main</emphasis></entry>
22727 <entry>Type: <emphasis>boolean</emphasis></entry>
22728 <entry>Default: <emphasis>unset</emphasis></entry>
22729 </row>
22730 </tbody>
22731 </tgroup>
22732 </informaltable>
22733 <para revisionflag="changed">
22734 This option controls whether GnuTLS is used in compatibility mode in an Exim
22735 server. This reduces security slightly, but improves interworking with older
22736 implementations of TLS.
22737 </para>
22738 <para>
22739 <indexterm role="option">
22740 <primary><option>headers_charset</option></primary>
22741 </indexterm>
22742 </para>
22743 <informaltable frame="all">
22744 <tgroup cols="4" colsep="0" rowsep="0">
22745 <colspec colwidth="8*" align="left"/>
22746 <colspec colwidth="6*" align="center"/>
22747 <colspec colwidth="6*" align="center"/>
22748 <colspec colwidth="6*" align="right"/>
22749 <tbody>
22750 <row>
22751 <entry><option>headers_charset</option></entry>
22752 <entry>Use: <emphasis>main</emphasis></entry>
22753 <entry>Type: <emphasis>string</emphasis></entry>
22754 <entry>Default: <emphasis>see below</emphasis></entry>
22755 </row>
22756 </tbody>
22757 </tgroup>
22758 </informaltable>
22759 <para>
22760 This option sets a default character set for translating from encoded MIME
22761 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22762 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22763 ultimate default is ISO-8859-1. For more details see the description of header
22764 insertions in section <xref linkend="SECTexpansionitems"/>.
22765 </para>
22766 <para>
22767 <indexterm role="option">
22768 <primary><option>header_maxsize</option></primary>
22769 </indexterm>
22770 </para>
22771 <informaltable frame="all">
22772 <tgroup cols="4" colsep="0" rowsep="0">
22773 <colspec colwidth="8*" align="left"/>
22774 <colspec colwidth="6*" align="center"/>
22775 <colspec colwidth="6*" align="center"/>
22776 <colspec colwidth="6*" align="right"/>
22777 <tbody>
22778 <row>
22779 <entry><option>header_maxsize</option></entry>
22780 <entry>Use: <emphasis>main</emphasis></entry>
22781 <entry>Type: <emphasis>integer</emphasis></entry>
22782 <entry>Default: <emphasis>see below</emphasis></entry>
22783 </row>
22784 </tbody>
22785 </tgroup>
22786 </informaltable>
22787 <para>
22788 <indexterm role="concept">
22789 <primary>header section</primary>
22790 <secondary>maximum size of</secondary>
22791 </indexterm>
22792 <indexterm role="concept">
22793 <primary>limit</primary>
22794 <secondary>size of message header section</secondary>
22795 </indexterm>
22796 This option controls the overall maximum size of a message&#x2019;s header
22797 section. The default is the value of HEADER_MAXSIZE in
22798 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22799 sections are rejected.
22800 </para>
22801 <para>
22802 <indexterm role="option">
22803 <primary><option>header_line_maxsize</option></primary>
22804 </indexterm>
22805 </para>
22806 <informaltable frame="all">
22807 <tgroup cols="4" colsep="0" rowsep="0">
22808 <colspec colwidth="8*" align="left"/>
22809 <colspec colwidth="6*" align="center"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="right"/>
22812 <tbody>
22813 <row>
22814 <entry><option>header_line_maxsize</option></entry>
22815 <entry>Use: <emphasis>main</emphasis></entry>
22816 <entry>Type: <emphasis>integer</emphasis></entry>
22817 <entry>Default: <emphasis>0</emphasis></entry>
22818 </row>
22819 </tbody>
22820 </tgroup>
22821 </informaltable>
22822 <para>
22823 <indexterm role="concept">
22824 <primary>header lines</primary>
22825 <secondary>maximum size of</secondary>
22826 </indexterm>
22827 <indexterm role="concept">
22828 <primary>limit</primary>
22829 <secondary>size of one header line</secondary>
22830 </indexterm>
22831 This option limits the length of any individual header line in a message, after
22832 all the continuations have been joined together. Messages with individual
22833 header lines that are longer than the limit are rejected. The default value of
22834 zero means <quote>no limit</quote>.
22835 </para>
22836 <para>
22837 <indexterm role="option">
22838 <primary><option>helo_accept_junk_hosts</option></primary>
22839 </indexterm>
22840 </para>
22841 <informaltable frame="all">
22842 <tgroup cols="4" colsep="0" rowsep="0">
22843 <colspec colwidth="8*" align="left"/>
22844 <colspec colwidth="6*" align="center"/>
22845 <colspec colwidth="6*" align="center"/>
22846 <colspec colwidth="6*" align="right"/>
22847 <tbody>
22848 <row>
22849 <entry><option>helo_accept_junk_hosts</option></entry>
22850 <entry>Use: <emphasis>main</emphasis></entry>
22851 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22852 <entry>Default: <emphasis>unset</emphasis></entry>
22853 </row>
22854 </tbody>
22855 </tgroup>
22856 </informaltable>
22857 <para>
22858 <indexterm role="concept">
22859 <primary>HELO</primary>
22860 <secondary>accepting junk data</secondary>
22861 </indexterm>
22862 <indexterm role="concept">
22863 <primary>EHLO</primary>
22864 <secondary>accepting junk data</secondary>
22865 </indexterm>
22866 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22867 mail, and gives an error response for invalid data. Unfortunately, there are
22868 some SMTP clients that send syntactic junk. They can be accommodated by setting
22869 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22870 if you want to do semantic checking.
22871 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22872 set.
22873 </para>
22874 <para>
22875 <indexterm role="option">
22876 <primary><option>helo_allow_chars</option></primary>
22877 </indexterm>
22878 </para>
22879 <informaltable frame="all">
22880 <tgroup cols="4" colsep="0" rowsep="0">
22881 <colspec colwidth="8*" align="left"/>
22882 <colspec colwidth="6*" align="center"/>
22883 <colspec colwidth="6*" align="center"/>
22884 <colspec colwidth="6*" align="right"/>
22885 <tbody>
22886 <row>
22887 <entry><option>helo_allow_chars</option></entry>
22888 <entry>Use: <emphasis>main</emphasis></entry>
22889 <entry>Type: <emphasis>string</emphasis></entry>
22890 <entry>Default: <emphasis>unset</emphasis></entry>
22891 </row>
22892 </tbody>
22893 </tgroup>
22894 </informaltable>
22895 <para>
22896 <indexterm role="concept">
22897 <primary>HELO</primary>
22898 <secondary>underscores in</secondary>
22899 </indexterm>
22900 <indexterm role="concept">
22901 <primary>EHLO</primary>
22902 <secondary>underscores in</secondary>
22903 </indexterm>
22904 <indexterm role="concept">
22905 <primary>underscore in EHLO/HELO</primary>
22906 </indexterm>
22907 This option can be set to a string of rogue characters that are permitted in
22908 all EHLO and HELO names in addition to the standard letters, digits,
22909 hyphens, and dots. If you really must allow underscores, you can set
22910 </para>
22911 <literallayout class="monospaced">
22912 helo_allow_chars = _
22913 </literallayout>
22914 <para>
22915 Note that the value is one string, not a list.
22916 </para>
22917 <para>
22918 <indexterm role="option">
22919 <primary><option>helo_lookup_domains</option></primary>
22920 </indexterm>
22921 </para>
22922 <informaltable frame="all">
22923 <tgroup cols="4" colsep="0" rowsep="0">
22924 <colspec colwidth="8*" align="left"/>
22925 <colspec colwidth="6*" align="center"/>
22926 <colspec colwidth="6*" align="center"/>
22927 <colspec colwidth="6*" align="right"/>
22928 <tbody>
22929 <row>
22930 <entry><option>helo_lookup_domains</option></entry>
22931 <entry>Use: <emphasis>main</emphasis></entry>
22932 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22933 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22934 </row>
22935 </tbody>
22936 </tgroup>
22937 </informaltable>
22938 <para>
22939 <indexterm role="concept">
22940 <primary>HELO</primary>
22941 <secondary>forcing reverse lookup</secondary>
22942 </indexterm>
22943 <indexterm role="concept">
22944 <primary>EHLO</primary>
22945 <secondary>forcing reverse lookup</secondary>
22946 </indexterm>
22947 If the domain given by a client in a HELO or EHLO command matches this
22948 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22949 default forces a lookup if the client host gives the server&#x2019;s name or any of
22950 its IP addresses (in brackets), something that broken clients have been seen to
22951 do.
22952 </para>
22953 <para>
22954 <indexterm role="option">
22955 <primary><option>helo_try_verify_hosts</option></primary>
22956 </indexterm>
22957 </para>
22958 <informaltable frame="all">
22959 <tgroup cols="4" colsep="0" rowsep="0">
22960 <colspec colwidth="8*" align="left"/>
22961 <colspec colwidth="6*" align="center"/>
22962 <colspec colwidth="6*" align="center"/>
22963 <colspec colwidth="6*" align="right"/>
22964 <tbody>
22965 <row>
22966 <entry><option>helo_try_verify_hosts</option></entry>
22967 <entry>Use: <emphasis>main</emphasis></entry>
22968 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22969 <entry>Default: <emphasis>unset</emphasis></entry>
22970 </row>
22971 </tbody>
22972 </tgroup>
22973 </informaltable>
22974 <para>
22975 <indexterm role="concept">
22976 <primary>HELO verifying</primary>
22977 <secondary>optional</secondary>
22978 </indexterm>
22979 <indexterm role="concept">
22980 <primary>EHLO</primary>
22981 <secondary>verifying, optional</secondary>
22982 </indexterm>
22983 By default, Exim just checks the syntax of HELO and EHLO commands (see
22984 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22985 to do more extensive checking of the data supplied by these commands. The ACL
22986 condition <literal>verify = helo</literal> is provided to make this possible.
22987 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22988 to force the check to occur. From release 4.53 onwards, this is no longer
22989 necessary. If the check has not been done before <literal>verify = helo</literal> is
22990 encountered, it is done at that time. Consequently, this option is obsolete.
22991 Its specification is retained here for backwards compatibility.
22992 </para>
22993 <para>
22994 When an EHLO or HELO command is received, if the calling host matches
22995 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22996 EHLO command either:
22997 </para>
22998 <itemizedlist>
22999 <listitem>
23000 <para>
23001 is an IP literal matching the calling address of the host, or
23002 </para>
23003 </listitem>
23004 <listitem>
23005 <para>
23006 <indexterm role="concept">
23007 <primary>DNS</primary>
23008 <secondary>reverse lookup</secondary>
23009 </indexterm>
23010 <indexterm role="concept">
23011 <primary>reverse DNS lookup</primary>
23012 </indexterm>
23013 matches the host name that Exim obtains by doing a reverse lookup of the
23014 calling host address, or
23015 </para>
23016 </listitem>
23017 <listitem>
23018 <para>
23019 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23020 available) yields the calling host address.
23021 </para>
23022 </listitem>
23023 </itemizedlist>
23024 <para>
23025 However, the EHLO or HELO command is not rejected if any of the checks
23026 fail. Processing continues, but the result of the check is remembered, and can
23027 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23028 </para>
23029 <para>
23030 <indexterm role="option">
23031 <primary><option>helo_verify_hosts</option></primary>
23032 </indexterm>
23033 </para>
23034 <informaltable frame="all">
23035 <tgroup cols="4" colsep="0" rowsep="0">
23036 <colspec colwidth="8*" align="left"/>
23037 <colspec colwidth="6*" align="center"/>
23038 <colspec colwidth="6*" align="center"/>
23039 <colspec colwidth="6*" align="right"/>
23040 <tbody>
23041 <row>
23042 <entry><option>helo_verify_hosts</option></entry>
23043 <entry>Use: <emphasis>main</emphasis></entry>
23044 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23045 <entry>Default: <emphasis>unset</emphasis></entry>
23046 </row>
23047 </tbody>
23048 </tgroup>
23049 </informaltable>
23050 <para>
23051 <indexterm role="concept">
23052 <primary>HELO verifying</primary>
23053 <secondary>mandatory</secondary>
23054 </indexterm>
23055 <indexterm role="concept">
23056 <primary>EHLO</primary>
23057 <secondary>verifying, mandatory</secondary>
23058 </indexterm>
23059 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23060 backwards compatibility. For hosts that match this option, Exim checks the host
23061 name given in the HELO or EHLO in the same way as for
23062 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23063 rejected with a 550 error, and entries are written to the main and reject logs.
23064 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23065 error.
23066 </para>
23067 <para>
23068 <indexterm role="option">
23069 <primary><option>hold_domains</option></primary>
23070 </indexterm>
23071 </para>
23072 <informaltable frame="all">
23073 <tgroup cols="4" colsep="0" rowsep="0">
23074 <colspec colwidth="8*" align="left"/>
23075 <colspec colwidth="6*" align="center"/>
23076 <colspec colwidth="6*" align="center"/>
23077 <colspec colwidth="6*" align="right"/>
23078 <tbody>
23079 <row>
23080 <entry><option>hold_domains</option></entry>
23081 <entry>Use: <emphasis>main</emphasis></entry>
23082 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23083 <entry>Default: <emphasis>unset</emphasis></entry>
23084 </row>
23085 </tbody>
23086 </tgroup>
23087 </informaltable>
23088 <para>
23089 <indexterm role="concept">
23090 <primary>domain</primary>
23091 <secondary>delaying delivery</secondary>
23092 </indexterm>
23093 <indexterm role="concept">
23094 <primary>delivery</primary>
23095 <secondary>delaying certain domains</secondary>
23096 </indexterm>
23097 This option allows mail for particular domains to be held on the queue
23098 manually. The option is overridden if a message delivery is forced with the
23099 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23100 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23101 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23102 it is deferred every time the message is looked at.
23103 </para>
23104 <para>
23105 This option is intended as a temporary operational measure for delaying the
23106 delivery of mail while some problem is being sorted out, or some new
23107 configuration tested. If you just want to delay the processing of some
23108 domains until a queue run occurs, you should use <option>queue_domains</option> or
23109 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23110 </para>
23111 <para>
23112 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23113 messages from the queue if they have been there longer than the longest retry
23114 time in any retry rule. If you want to hold messages for longer than the normal
23115 retry times, insert a dummy retry rule with a long retry time.
23116 </para>
23117 <para>
23118 <indexterm role="option">
23119 <primary><option>host_lookup</option></primary>
23120 </indexterm>
23121 </para>
23122 <informaltable frame="all">
23123 <tgroup cols="4" colsep="0" rowsep="0">
23124 <colspec colwidth="8*" align="left"/>
23125 <colspec colwidth="6*" align="center"/>
23126 <colspec colwidth="6*" align="center"/>
23127 <colspec colwidth="6*" align="right"/>
23128 <tbody>
23129 <row>
23130 <entry><option>host_lookup</option></entry>
23131 <entry>Use: <emphasis>main</emphasis></entry>
23132 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23133 <entry>Default: <emphasis>unset</emphasis></entry>
23134 </row>
23135 </tbody>
23136 </tgroup>
23137 </informaltable>
23138 <para>
23139 <indexterm role="concept">
23140 <primary>host name</primary>
23141 <secondary>lookup, forcing</secondary>
23142 </indexterm>
23143 Exim does not look up the name of a calling host from its IP address unless it
23144 is required to compare against some host list, or the host matches
23145 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23146 option (which normally contains IP addresses rather than host names). The
23147 default configuration file contains
23148 </para>
23149 <literallayout class="monospaced">
23150 host_lookup = *
23151 </literallayout>
23152 <para>
23153 which causes a lookup to happen for all hosts. If the expense of these lookups
23154 is felt to be too great, the setting can be changed or removed.
23155 </para>
23156 <para>
23157 After a successful reverse lookup, Exim does a forward lookup on the name it
23158 has obtained, to verify that it yields the IP address that it started with. If
23159 this check fails, Exim behaves as if the name lookup failed.
23160 </para>
23161 <para>
23162 <indexterm role="variable">
23163 <primary><varname>$host_lookup_failed</varname></primary>
23164 </indexterm>
23165 <indexterm role="variable">
23166 <primary><varname>$sender_host_name</varname></primary>
23167 </indexterm>
23168 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23169 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23170 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23171 <literal>verify = reverse_host_lookup</literal> in ACLs.
23172 </para>
23173 <para>
23174 <indexterm role="option">
23175 <primary><option>host_lookup_order</option></primary>
23176 </indexterm>
23177 </para>
23178 <informaltable frame="all">
23179 <tgroup cols="4" colsep="0" rowsep="0">
23180 <colspec colwidth="8*" align="left"/>
23181 <colspec colwidth="6*" align="center"/>
23182 <colspec colwidth="6*" align="center"/>
23183 <colspec colwidth="6*" align="right"/>
23184 <tbody>
23185 <row>
23186 <entry><option>host_lookup_order</option></entry>
23187 <entry>Use: <emphasis>main</emphasis></entry>
23188 <entry>Type: <emphasis>string list</emphasis></entry>
23189 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23190 </row>
23191 </tbody>
23192 </tgroup>
23193 </informaltable>
23194 <para>
23195 This option specifies the order of different lookup methods when Exim is trying
23196 to find a host name from an IP address. The default is to do a DNS lookup
23197 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23198 if that fails. You can change the order of these lookups, or omit one entirely,
23199 if you want.
23200 </para>
23201 <para>
23202 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23203 multiple PTR records in the DNS and the IP address is not listed in
23204 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23205 case. That is why the default tries a DNS lookup first.
23206 </para>
23207 <para>
23208 <indexterm role="option">
23209 <primary><option>host_reject_connection</option></primary>
23210 </indexterm>
23211 </para>
23212 <informaltable frame="all">
23213 <tgroup cols="4" colsep="0" rowsep="0">
23214 <colspec colwidth="8*" align="left"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="center"/>
23217 <colspec colwidth="6*" align="right"/>
23218 <tbody>
23219 <row>
23220 <entry><option>host_reject_connection</option></entry>
23221 <entry>Use: <emphasis>main</emphasis></entry>
23222 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23223 <entry>Default: <emphasis>unset</emphasis></entry>
23224 </row>
23225 </tbody>
23226 </tgroup>
23227 </informaltable>
23228 <para>
23229 <indexterm role="concept">
23230 <primary>host</primary>
23231 <secondary>rejecting connections from</secondary>
23232 </indexterm>
23233 If this option is set, incoming SMTP calls from the hosts listed are rejected
23234 as soon as the connection is made.
23235 This option is obsolete, and retained only for backward compatibility, because
23236 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23237 connections immediately.
23238 </para>
23239 <para>
23240 The ability to give an immediate rejection (either by this option or using an
23241 ACL) is provided for use in unusual cases. Many hosts will just try again,
23242 sometimes without much delay. Normally, it is better to use an ACL to reject
23243 incoming messages at a later stage, such as after RCPT commands. See
23244 chapter <xref linkend="CHAPACL"/>.
23245 </para>
23246 <para>
23247 <indexterm role="option">
23248 <primary><option>hosts_connection_nolog</option></primary>
23249 </indexterm>
23250 </para>
23251 <informaltable frame="all">
23252 <tgroup cols="4" colsep="0" rowsep="0">
23253 <colspec colwidth="8*" align="left"/>
23254 <colspec colwidth="6*" align="center"/>
23255 <colspec colwidth="6*" align="center"/>
23256 <colspec colwidth="6*" align="right"/>
23257 <tbody>
23258 <row>
23259 <entry><option>hosts_connection_nolog</option></entry>
23260 <entry>Use: <emphasis>main</emphasis></entry>
23261 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23262 <entry>Default: <emphasis>unset</emphasis></entry>
23263 </row>
23264 </tbody>
23265 </tgroup>
23266 </informaltable>
23267 <para>
23268 <indexterm role="concept">
23269 <primary>host</primary>
23270 <secondary>not logging connections from</secondary>
23271 </indexterm>
23272 This option defines a list of hosts for which connection logging does not
23273 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23274 you might want not to log SMTP connections from local processes, or from
23275 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23276 the daemon; you should therefore strive to restrict its value to a short inline
23277 list of IP addresses and networks. To disable logging SMTP connections from
23278 local processes, you must create a host list with an empty item. For example:
23279 </para>
23280 <literallayout class="monospaced">
23281 hosts_connection_nolog = :
23282 </literallayout>
23283 <para>
23284 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23285 </para>
23286 <para>
23287 <indexterm role="option">
23288 <primary><option>hosts_treat_as_local</option></primary>
23289 </indexterm>
23290 </para>
23291 <informaltable frame="all">
23292 <tgroup cols="4" colsep="0" rowsep="0">
23293 <colspec colwidth="8*" align="left"/>
23294 <colspec colwidth="6*" align="center"/>
23295 <colspec colwidth="6*" align="center"/>
23296 <colspec colwidth="6*" align="right"/>
23297 <tbody>
23298 <row>
23299 <entry><option>hosts_treat_as_local</option></entry>
23300 <entry>Use: <emphasis>main</emphasis></entry>
23301 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23302 <entry>Default: <emphasis>unset</emphasis></entry>
23303 </row>
23304 </tbody>
23305 </tgroup>
23306 </informaltable>
23307 <para>
23308 <indexterm role="concept">
23309 <primary>local host</primary>
23310 <secondary>domains treated as</secondary>
23311 </indexterm>
23312 <indexterm role="concept">
23313 <primary>host</primary>
23314 <secondary>treated as local</secondary>
23315 </indexterm>
23316 If this option is set, any host names that match the domain list are treated as
23317 if they were the local host when Exim is scanning host lists obtained from MX
23318 records
23319 or other sources. Note that the value of this option is a domain list, not a
23320 host list, because it is always used to check host names, not IP addresses.
23321 </para>
23322 <para>
23323 This option also applies when Exim is matching the special items
23324 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23325 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23326 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23327 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23328 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23329 interfaces and recognizing the local host.
23330 </para>
23331 <para>
23332 <indexterm role="option">
23333 <primary><option>ibase_servers</option></primary>
23334 </indexterm>
23335 </para>
23336 <informaltable frame="all">
23337 <tgroup cols="4" colsep="0" rowsep="0">
23338 <colspec colwidth="8*" align="left"/>
23339 <colspec colwidth="6*" align="center"/>
23340 <colspec colwidth="6*" align="center"/>
23341 <colspec colwidth="6*" align="right"/>
23342 <tbody>
23343 <row>
23344 <entry><option>ibase_servers</option></entry>
23345 <entry>Use: <emphasis>main</emphasis></entry>
23346 <entry>Type: <emphasis>string list</emphasis></entry>
23347 <entry>Default: <emphasis>unset</emphasis></entry>
23348 </row>
23349 </tbody>
23350 </tgroup>
23351 </informaltable>
23352 <para>
23353 <indexterm role="concept">
23354 <primary>InterBase</primary>
23355 <secondary>server list</secondary>
23356 </indexterm>
23357 This option provides a list of InterBase servers and associated connection data,
23358 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23359 The option is available only if Exim has been built with InterBase support.
23360 </para>
23361 <para>
23362 <indexterm role="option">
23363 <primary><option>ignore_bounce_errors_after</option></primary>
23364 </indexterm>
23365 </para>
23366 <informaltable frame="all">
23367 <tgroup cols="4" colsep="0" rowsep="0">
23368 <colspec colwidth="8*" align="left"/>
23369 <colspec colwidth="6*" align="center"/>
23370 <colspec colwidth="6*" align="center"/>
23371 <colspec colwidth="6*" align="right"/>
23372 <tbody>
23373 <row>
23374 <entry><option>ignore_bounce_errors_after</option></entry>
23375 <entry>Use: <emphasis>main</emphasis></entry>
23376 <entry>Type: <emphasis>time</emphasis></entry>
23377 <entry>Default: <emphasis>10w</emphasis></entry>
23378 </row>
23379 </tbody>
23380 </tgroup>
23381 </informaltable>
23382 <para>
23383 <indexterm role="concept">
23384 <primary>bounce message</primary>
23385 <secondary>discarding</secondary>
23386 </indexterm>
23387 <indexterm role="concept">
23388 <primary>discarding bounce message</primary>
23389 </indexterm>
23390 This option affects the processing of bounce messages that cannot be delivered,
23391 that is, those that suffer a permanent delivery failure. (Bounce messages that
23392 suffer temporary delivery failures are of course retried in the usual way.)
23393 </para>
23394 <para>
23395 After a permanent delivery failure, bounce messages are frozen,
23396 because there is no sender to whom they can be returned. When a frozen bounce
23397 message has been on the queue for more than the given time, it is unfrozen at
23398 the next queue run, and a further delivery is attempted. If delivery fails
23399 again, the bounce message is discarded. This makes it possible to keep failed
23400 bounce messages around for a shorter time than the normal maximum retry time
23401 for frozen messages. For example,
23402 </para>
23403 <literallayout class="monospaced">
23404 ignore_bounce_errors_after = 12h
23405 </literallayout>
23406 <para>
23407 retries failed bounce message deliveries after 12 hours, discarding any further
23408 failures. If the value of this option is set to a zero time period, bounce
23409 failures are discarded immediately. Setting a very long time (as in the default
23410 value) has the effect of disabling this option. For ways of automatically
23411 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23412 <option>timeout_frozen_after</option>.
23413 </para>
23414 <para>
23415 <indexterm role="option">
23416 <primary><option>ignore_fromline_hosts</option></primary>
23417 </indexterm>
23418 </para>
23419 <informaltable frame="all">
23420 <tgroup cols="4" colsep="0" rowsep="0">
23421 <colspec colwidth="8*" align="left"/>
23422 <colspec colwidth="6*" align="center"/>
23423 <colspec colwidth="6*" align="center"/>
23424 <colspec colwidth="6*" align="right"/>
23425 <tbody>
23426 <row>
23427 <entry><option>ignore_fromline_hosts</option></entry>
23428 <entry>Use: <emphasis>main</emphasis></entry>
23429 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23430 <entry>Default: <emphasis>unset</emphasis></entry>
23431 </row>
23432 </tbody>
23433 </tgroup>
23434 </informaltable>
23435 <para>
23436 <indexterm role="concept">
23437 <primary><quote>From</quote> line</primary>
23438 </indexterm>
23439 <indexterm role="concept">
23440 <primary>UUCP</primary>
23441 <secondary><quote>From</quote> line</secondary>
23442 </indexterm>
23443 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23444 the headers of a message. By default this is treated as the start of the
23445 message&#x2019;s body, which means that any following headers are not recognized as
23446 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23447 match those hosts that insist on sending it. If the sender is actually a local
23448 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23449 <option>ignore_fromline_local</option> must be set to achieve this effect.
23450 </para>
23451 <para>
23452 <indexterm role="option">
23453 <primary><option>ignore_fromline_local</option></primary>
23454 </indexterm>
23455 </para>
23456 <informaltable frame="all">
23457 <tgroup cols="4" colsep="0" rowsep="0">
23458 <colspec colwidth="8*" align="left"/>
23459 <colspec colwidth="6*" align="center"/>
23460 <colspec colwidth="6*" align="center"/>
23461 <colspec colwidth="6*" align="right"/>
23462 <tbody>
23463 <row>
23464 <entry><option>ignore_fromline_local</option></entry>
23465 <entry>Use: <emphasis>main</emphasis></entry>
23466 <entry>Type: <emphasis>boolean</emphasis></entry>
23467 <entry>Default: <emphasis>false</emphasis></entry>
23468 </row>
23469 </tbody>
23470 </tgroup>
23471 </informaltable>
23472 <para>
23473 See <option>ignore_fromline_hosts</option> above.
23474 </para>
23475 <para>
23476 <indexterm role="option">
23477 <primary><option>keep_malformed</option></primary>
23478 </indexterm>
23479 </para>
23480 <informaltable frame="all">
23481 <tgroup cols="4" colsep="0" rowsep="0">
23482 <colspec colwidth="8*" align="left"/>
23483 <colspec colwidth="6*" align="center"/>
23484 <colspec colwidth="6*" align="center"/>
23485 <colspec colwidth="6*" align="right"/>
23486 <tbody>
23487 <row>
23488 <entry><option>keep_malformed</option></entry>
23489 <entry>Use: <emphasis>main</emphasis></entry>
23490 <entry>Type: <emphasis>time</emphasis></entry>
23491 <entry>Default: <emphasis>4d</emphasis></entry>
23492 </row>
23493 </tbody>
23494 </tgroup>
23495 </informaltable>
23496 <para>
23497 This option specifies the length of time to keep messages whose spool files
23498 have been corrupted in some way. This should, of course, never happen. At the
23499 next attempt to deliver such a message, it gets removed. The incident is
23500 logged.
23501 </para>
23502 <para>
23503 <indexterm role="option">
23504 <primary><option>ldap_default_servers</option></primary>
23505 </indexterm>
23506 </para>
23507 <informaltable frame="all">
23508 <tgroup cols="4" colsep="0" rowsep="0">
23509 <colspec colwidth="8*" align="left"/>
23510 <colspec colwidth="6*" align="center"/>
23511 <colspec colwidth="6*" align="center"/>
23512 <colspec colwidth="6*" align="right"/>
23513 <tbody>
23514 <row>
23515 <entry><option>ldap_default_servers</option></entry>
23516 <entry>Use: <emphasis>main</emphasis></entry>
23517 <entry>Type: <emphasis>string list</emphasis></entry>
23518 <entry>Default: <emphasis>unset</emphasis></entry>
23519 </row>
23520 </tbody>
23521 </tgroup>
23522 </informaltable>
23523 <para>
23524 <indexterm role="concept">
23525 <primary>LDAP</primary>
23526 <secondary>default servers</secondary>
23527 </indexterm>
23528 This option provides a list of LDAP servers which are tried in turn when an
23529 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23530 details of LDAP queries. This option is available only when Exim has been built
23531 with LDAP support.
23532 </para>
23533 <para>
23534 <indexterm role="option">
23535 <primary><option>ldap_version</option></primary>
23536 </indexterm>
23537 </para>
23538 <informaltable frame="all">
23539 <tgroup cols="4" colsep="0" rowsep="0">
23540 <colspec colwidth="8*" align="left"/>
23541 <colspec colwidth="6*" align="center"/>
23542 <colspec colwidth="6*" align="center"/>
23543 <colspec colwidth="6*" align="right"/>
23544 <tbody>
23545 <row>
23546 <entry><option>ldap_version</option></entry>
23547 <entry>Use: <emphasis>main</emphasis></entry>
23548 <entry>Type: <emphasis>integer</emphasis></entry>
23549 <entry>Default: <emphasis>unset</emphasis></entry>
23550 </row>
23551 </tbody>
23552 </tgroup>
23553 </informaltable>
23554 <para>
23555 <indexterm role="concept">
23556 <primary>LDAP</primary>
23557 <secondary>protocol version, forcing</secondary>
23558 </indexterm>
23559 This option can be used to force Exim to set a specific protocol version for
23560 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23561 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23562 the LDAP headers; otherwise it is 2. This option is available only when Exim
23563 has been built with LDAP support.
23564 </para>
23565 <para>
23566 <indexterm role="option">
23567 <primary><option>local_from_check</option></primary>
23568 </indexterm>
23569 </para>
23570 <informaltable frame="all">
23571 <tgroup cols="4" colsep="0" rowsep="0">
23572 <colspec colwidth="8*" align="left"/>
23573 <colspec colwidth="6*" align="center"/>
23574 <colspec colwidth="6*" align="center"/>
23575 <colspec colwidth="6*" align="right"/>
23576 <tbody>
23577 <row>
23578 <entry><option>local_from_check</option></entry>
23579 <entry>Use: <emphasis>main</emphasis></entry>
23580 <entry>Type: <emphasis>boolean</emphasis></entry>
23581 <entry>Default: <emphasis>true</emphasis></entry>
23582 </row>
23583 </tbody>
23584 </tgroup>
23585 </informaltable>
23586 <para>
23587 <indexterm role="concept">
23588 <primary><emphasis>Sender:</emphasis> header line</primary>
23589 <secondary>disabling addition of</secondary>
23590 </indexterm>
23591 <indexterm role="concept">
23592 <primary><emphasis>From:</emphasis> header line</primary>
23593 <secondary>disabling checking of</secondary>
23594 </indexterm>
23595 When a message is submitted locally (that is, not over a TCP/IP connection) by
23596 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23597 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23598 the domain specified by <option>qualify_domain</option>.
23599 </para>
23600 <para>
23601 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23602 locally submitted message is automatically qualified by Exim, unless the
23603 <option>-bnq</option> command line option is used.
23604 </para>
23605 <para>
23606 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23607 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23608 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
23609 and the default qualify domain.
23610 </para>
23611 <para>
23612 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23613 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23614 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23615 <option>local_sender_retain</option> to be true.
23616 </para>
23617 <para>
23618 <indexterm role="concept">
23619 <primary>envelope sender</primary>
23620 </indexterm>
23621 These options affect only the header lines in the message. The envelope sender
23622 is still forced to be the login id at the qualify domain unless
23623 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23624 </para>
23625 <para>
23626 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23627 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23628 has more details about <emphasis>Sender:</emphasis> processing.
23629 </para>
23630 <para>
23631 <indexterm role="option">
23632 <primary><option>local_from_prefix</option></primary>
23633 </indexterm>
23634 </para>
23635 <informaltable frame="all">
23636 <tgroup cols="4" colsep="0" rowsep="0">
23637 <colspec colwidth="8*" align="left"/>
23638 <colspec colwidth="6*" align="center"/>
23639 <colspec colwidth="6*" align="center"/>
23640 <colspec colwidth="6*" align="right"/>
23641 <tbody>
23642 <row>
23643 <entry><option>local_from_prefix</option></entry>
23644 <entry>Use: <emphasis>main</emphasis></entry>
23645 <entry>Type: <emphasis>string</emphasis></entry>
23646 <entry>Default: <emphasis>unset</emphasis></entry>
23647 </row>
23648 </tbody>
23649 </tgroup>
23650 </informaltable>
23651 <para>
23652 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23653 matching the login id (see <option>local_from_check</option> above), it can be configured to
23654 ignore certain prefixes and suffixes in the local part of the address. This is
23655 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23656 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23657 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23658 example, if
23659 </para>
23660 <literallayout class="monospaced">
23661 local_from_prefix = *-
23662 </literallayout>
23663 <para>
23664 is set, a <emphasis>From:</emphasis> line containing
23665 </para>
23666 <literallayout class="monospaced">
23667 From: anything-user@your.domain.example
23668 </literallayout>
23669 <para>
23670 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23671 matches the actual sender address that is constructed from the login name and
23672 qualify domain.
23673 </para>
23674 <para>
23675 <indexterm role="option">
23676 <primary><option>local_from_suffix</option></primary>
23677 </indexterm>
23678 </para>
23679 <informaltable frame="all">
23680 <tgroup cols="4" colsep="0" rowsep="0">
23681 <colspec colwidth="8*" align="left"/>
23682 <colspec colwidth="6*" align="center"/>
23683 <colspec colwidth="6*" align="center"/>
23684 <colspec colwidth="6*" align="right"/>
23685 <tbody>
23686 <row>
23687 <entry><option>local_from_suffix</option></entry>
23688 <entry>Use: <emphasis>main</emphasis></entry>
23689 <entry>Type: <emphasis>string</emphasis></entry>
23690 <entry>Default: <emphasis>unset</emphasis></entry>
23691 </row>
23692 </tbody>
23693 </tgroup>
23694 </informaltable>
23695 <para>
23696 See <option>local_from_prefix</option> above.
23697 </para>
23698 <para>
23699 <indexterm role="option">
23700 <primary><option>local_interfaces</option></primary>
23701 </indexterm>
23702 </para>
23703 <informaltable frame="all">
23704 <tgroup cols="4" colsep="0" rowsep="0">
23705 <colspec colwidth="8*" align="left"/>
23706 <colspec colwidth="6*" align="center"/>
23707 <colspec colwidth="6*" align="center"/>
23708 <colspec colwidth="6*" align="right"/>
23709 <tbody>
23710 <row>
23711 <entry><option>local_interfaces</option></entry>
23712 <entry>Use: <emphasis>main</emphasis></entry>
23713 <entry>Type: <emphasis>string list</emphasis></entry>
23714 <entry>Default: <emphasis>see below</emphasis></entry>
23715 </row>
23716 </tbody>
23717 </tgroup>
23718 </informaltable>
23719 <para>
23720 This option controls which network interfaces are used by the daemon for
23721 listening; they are also used to identify the local host when routing. Chapter
23722 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23723 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23724 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23725 <option>local_interfaces</option> is
23726 </para>
23727 <literallayout class="monospaced">
23728 local_interfaces = 0.0.0.0
23729 </literallayout>
23730 <para>
23731 when Exim is built without IPv6 support; otherwise it is
23732 </para>
23733 <literallayout class="monospaced">
23734 local_interfaces = &lt;; ::0 ; 0.0.0.0
23735 </literallayout>
23736 <para>
23737 <indexterm role="option">
23738 <primary><option>local_scan_timeout</option></primary>
23739 </indexterm>
23740 </para>
23741 <informaltable frame="all">
23742 <tgroup cols="4" colsep="0" rowsep="0">
23743 <colspec colwidth="8*" align="left"/>
23744 <colspec colwidth="6*" align="center"/>
23745 <colspec colwidth="6*" align="center"/>
23746 <colspec colwidth="6*" align="right"/>
23747 <tbody>
23748 <row>
23749 <entry><option>local_scan_timeout</option></entry>
23750 <entry>Use: <emphasis>main</emphasis></entry>
23751 <entry>Type: <emphasis>time</emphasis></entry>
23752 <entry>Default: <emphasis>5m</emphasis></entry>
23753 </row>
23754 </tbody>
23755 </tgroup>
23756 </informaltable>
23757 <para>
23758 <indexterm role="concept">
23759 <primary>timeout</primary>
23760 <secondary>for <function>local_scan()</function> function</secondary>
23761 </indexterm>
23762 <indexterm role="concept">
23763 <primary><function>local_scan()</function> function</primary>
23764 <secondary>timeout</secondary>
23765 </indexterm>
23766 This timeout applies to the <function>local_scan()</function> function (see chapter
23767 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23768 the incoming message is rejected with a temporary error if it is an SMTP
23769 message. For a non-SMTP message, the message is dropped and Exim ends with a
23770 non-zero code. The incident is logged on the main and reject logs.
23771 </para>
23772 <para>
23773 <indexterm role="option">
23774 <primary><option>local_sender_retain</option></primary>
23775 </indexterm>
23776 </para>
23777 <informaltable frame="all">
23778 <tgroup cols="4" colsep="0" rowsep="0">
23779 <colspec colwidth="8*" align="left"/>
23780 <colspec colwidth="6*" align="center"/>
23781 <colspec colwidth="6*" align="center"/>
23782 <colspec colwidth="6*" align="right"/>
23783 <tbody>
23784 <row>
23785 <entry><option>local_sender_retain</option></entry>
23786 <entry>Use: <emphasis>main</emphasis></entry>
23787 <entry>Type: <emphasis>boolean</emphasis></entry>
23788 <entry>Default: <emphasis>false</emphasis></entry>
23789 </row>
23790 </tbody>
23791 </tgroup>
23792 </informaltable>
23793 <para>
23794 <indexterm role="concept">
23795 <primary><emphasis>Sender:</emphasis> header line</primary>
23796 <secondary>retaining from local submission</secondary>
23797 </indexterm>
23798 When a message is submitted locally (that is, not over a TCP/IP connection) by
23799 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23800 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23801 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23802 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23803 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23804 </para>
23805 <para>
23806 <indexterm role="option">
23807 <primary><option>localhost_number</option></primary>
23808 </indexterm>
23809 </para>
23810 <informaltable frame="all">
23811 <tgroup cols="4" colsep="0" rowsep="0">
23812 <colspec colwidth="8*" align="left"/>
23813 <colspec colwidth="6*" align="center"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="right"/>
23816 <tbody>
23817 <row>
23818 <entry><option>localhost_number</option></entry>
23819 <entry>Use: <emphasis>main</emphasis></entry>
23820 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23821 <entry>Default: <emphasis>unset</emphasis></entry>
23822 </row>
23823 </tbody>
23824 </tgroup>
23825 </informaltable>
23826 <para>
23827 <indexterm role="concept">
23828 <primary>host</primary>
23829 <secondary>locally unique number for</secondary>
23830 </indexterm>
23831 <indexterm role="concept">
23832 <primary>message ids</primary>
23833 <secondary>with multiple hosts</secondary>
23834 </indexterm>
23835 <indexterm role="variable">
23836 <primary><varname>$localhost_number</varname></primary>
23837 </indexterm>
23838 Exim&#x2019;s message ids are normally unique only within the local host. If
23839 uniqueness among a set of hosts is required, each host must set a different
23840 value for the <option>localhost_number</option> option. The string is expanded immediately
23841 after reading the configuration file (so that a number can be computed from the
23842 host name, for example) and the result of the expansion must be a number in the
23843 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
23844 systems). This is available in subsequent string expansions via the variable
23845 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23846 characters of the message id, instead of just being a fractional part of the
23847 time, are computed from the time and the local host number as described in
23848 section <xref linkend="SECTmessiden"/>.
23849 </para>
23850 <para>
23851 <indexterm role="option">
23852 <primary><option>log_file_path</option></primary>
23853 </indexterm>
23854 </para>
23855 <informaltable frame="all">
23856 <tgroup cols="4" colsep="0" rowsep="0">
23857 <colspec colwidth="8*" align="left"/>
23858 <colspec colwidth="6*" align="center"/>
23859 <colspec colwidth="6*" align="center"/>
23860 <colspec colwidth="6*" align="right"/>
23861 <tbody>
23862 <row>
23863 <entry><option>log_file_path</option></entry>
23864 <entry>Use: <emphasis>main</emphasis></entry>
23865 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23866 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23867 </row>
23868 </tbody>
23869 </tgroup>
23870 </informaltable>
23871 <para>
23872 <indexterm role="concept">
23873 <primary>log</primary>
23874 <secondary>file path for</secondary>
23875 </indexterm>
23876 This option sets the path which is used to determine the names of Exim&#x2019;s log
23877 files, or indicates that logging is to be to syslog, or both. It is expanded
23878 when Exim is entered, so it can, for example, contain a reference to the host
23879 name. If no specific path is set for the log files at compile or run time, they
23880 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
23881 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
23882 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23883 used. If this string is fixed at your installation (contains no expansion
23884 variables) it is recommended that you do not set this option in the
23885 configuration file, but instead supply the path using LOG_FILE_PATH in
23886 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23887 early on &ndash; in particular, failure to read the configuration file.
23888 </para>
23889 <para>
23890 <indexterm role="option">
23891 <primary><option>log_selector</option></primary>
23892 </indexterm>
23893 </para>
23894 <informaltable frame="all">
23895 <tgroup cols="4" colsep="0" rowsep="0">
23896 <colspec colwidth="8*" align="left"/>
23897 <colspec colwidth="6*" align="center"/>
23898 <colspec colwidth="6*" align="center"/>
23899 <colspec colwidth="6*" align="right"/>
23900 <tbody>
23901 <row>
23902 <entry><option>log_selector</option></entry>
23903 <entry>Use: <emphasis>main</emphasis></entry>
23904 <entry>Type: <emphasis>string</emphasis></entry>
23905 <entry>Default: <emphasis>unset</emphasis></entry>
23906 </row>
23907 </tbody>
23908 </tgroup>
23909 </informaltable>
23910 <para>
23911 <indexterm role="concept">
23912 <primary>log</primary>
23913 <secondary>selectors</secondary>
23914 </indexterm>
23915 This option can be used to reduce or increase the number of things that Exim
23916 writes to its log files. Its argument is made up of names preceded by plus or
23917 minus characters. For example:
23918 </para>
23919 <literallayout class="monospaced">
23920 log_selector = +arguments -retry_defer
23921 </literallayout>
23922 <para>
23923 A list of possible names and what they control is given in the chapter on
23924 logging, in section <xref linkend="SECTlogselector"/>.
23925 </para>
23926 <para>
23927 <indexterm role="option">
23928 <primary><option>log_timezone</option></primary>
23929 </indexterm>
23930 </para>
23931 <informaltable frame="all">
23932 <tgroup cols="4" colsep="0" rowsep="0">
23933 <colspec colwidth="8*" align="left"/>
23934 <colspec colwidth="6*" align="center"/>
23935 <colspec colwidth="6*" align="center"/>
23936 <colspec colwidth="6*" align="right"/>
23937 <tbody>
23938 <row>
23939 <entry><option>log_timezone</option></entry>
23940 <entry>Use: <emphasis>main</emphasis></entry>
23941 <entry>Type: <emphasis>boolean</emphasis></entry>
23942 <entry>Default: <emphasis>false</emphasis></entry>
23943 </row>
23944 </tbody>
23945 </tgroup>
23946 </informaltable>
23947 <para>
23948 <indexterm role="concept">
23949 <primary>log</primary>
23950 <secondary>timezone for entries</secondary>
23951 </indexterm>
23952 <indexterm role="variable">
23953 <primary><varname>$tod_log</varname></primary>
23954 </indexterm>
23955 <indexterm role="variable">
23956 <primary><varname>$tod_zone</varname></primary>
23957 </indexterm>
23958 By default, the timestamps on log lines are in local time without the
23959 timezone. This means that if your timezone changes twice a year, the timestamps
23960 in log lines are ambiguous for an hour when the clocks go back. One way of
23961 avoiding this problem is to set the timezone to UTC. An alternative is to set
23962 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23963 timestamps in log lines. Turning on this option can add quite a lot to the size
23964 of log files because each line is extended by 6 characters. Note that the
23965 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23966 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23967 </para>
23968 <para>
23969 <indexterm role="option">
23970 <primary><option>lookup_open_max</option></primary>
23971 </indexterm>
23972 </para>
23973 <informaltable frame="all">
23974 <tgroup cols="4" colsep="0" rowsep="0">
23975 <colspec colwidth="8*" align="left"/>
23976 <colspec colwidth="6*" align="center"/>
23977 <colspec colwidth="6*" align="center"/>
23978 <colspec colwidth="6*" align="right"/>
23979 <tbody>
23980 <row>
23981 <entry><option>lookup_open_max</option></entry>
23982 <entry>Use: <emphasis>main</emphasis></entry>
23983 <entry>Type: <emphasis>integer</emphasis></entry>
23984 <entry>Default: <emphasis>25</emphasis></entry>
23985 </row>
23986 </tbody>
23987 </tgroup>
23988 </informaltable>
23989 <para>
23990 <indexterm role="concept">
23991 <primary>too many open files</primary>
23992 </indexterm>
23993 <indexterm role="concept">
23994 <primary>open files, too many</primary>
23995 </indexterm>
23996 <indexterm role="concept">
23997 <primary>file</primary>
23998 <secondary>too many open</secondary>
23999 </indexterm>
24000 <indexterm role="concept">
24001 <primary>lookup</primary>
24002 <secondary>maximum open files</secondary>
24003 </indexterm>
24004 <indexterm role="concept">
24005 <primary>limit</primary>
24006 <secondary>open files for lookups</secondary>
24007 </indexterm>
24008 This option limits the number of simultaneously open files for single-key
24009 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24010 Exim normally keeps these files open during routing, because often the same
24011 file is required several times. If the limit is reached, Exim closes the least
24012 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24013 actually opens two files for each logical DBM database, though it still counts
24014 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24015 open files</quote> errors with NDBM, you need to reduce the value of
24016 <option>lookup_open_max</option>.
24017 </para>
24018 <para>
24019 <indexterm role="option">
24020 <primary><option>max_username_length</option></primary>
24021 </indexterm>
24022 </para>
24023 <informaltable frame="all">
24024 <tgroup cols="4" colsep="0" rowsep="0">
24025 <colspec colwidth="8*" align="left"/>
24026 <colspec colwidth="6*" align="center"/>
24027 <colspec colwidth="6*" align="center"/>
24028 <colspec colwidth="6*" align="right"/>
24029 <tbody>
24030 <row>
24031 <entry><option>max_username_length</option></entry>
24032 <entry>Use: <emphasis>main</emphasis></entry>
24033 <entry>Type: <emphasis>integer</emphasis></entry>
24034 <entry>Default: <emphasis>0</emphasis></entry>
24035 </row>
24036 </tbody>
24037 </tgroup>
24038 </informaltable>
24039 <para>
24040 <indexterm role="concept">
24041 <primary>length of login name</primary>
24042 </indexterm>
24043 <indexterm role="concept">
24044 <primary>user name</primary>
24045 <secondary>maximum length</secondary>
24046 </indexterm>
24047 <indexterm role="concept">
24048 <primary>limit</primary>
24049 <secondary>user name length</secondary>
24050 </indexterm>
24051 Some operating systems are broken in that they truncate long arguments to
24052 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24053 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24054 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24055 </para>
24056 <para>
24057 <indexterm role="option">
24058 <primary><option>message_body_newlines</option></primary>
24059 </indexterm>
24060 </para>
24061 <informaltable frame="all">
24062 <tgroup cols="4" colsep="0" rowsep="0">
24063 <colspec colwidth="8*" align="left"/>
24064 <colspec colwidth="6*" align="center"/>
24065 <colspec colwidth="6*" align="center"/>
24066 <colspec colwidth="6*" align="right"/>
24067 <tbody>
24068 <row>
24069 <entry><option>message_body_newlines</option></entry>
24070 <entry>Use: <emphasis>main</emphasis></entry>
24071 <entry>Type: <emphasis>bool</emphasis></entry>
24072 <entry>Default: <emphasis>false</emphasis></entry>
24073 </row>
24074 </tbody>
24075 </tgroup>
24076 </informaltable>
24077 <para>
24078 <indexterm role="concept">
24079 <primary>message body</primary>
24080 <secondary>newlines in variables</secondary>
24081 </indexterm>
24082 <indexterm role="concept">
24083 <primary>newline</primary>
24084 <secondary>in message body variables</secondary>
24085 </indexterm>
24086 <indexterm role="variable">
24087 <primary><varname>$message_body</varname></primary>
24088 </indexterm>
24089 <indexterm role="variable">
24090 <primary><varname>$message_body_end</varname></primary>
24091 </indexterm>
24092 By default, newlines in the message body are replaced by spaces when setting
24093 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24094 option is set true, this no longer happens.
24095 </para>
24096 <para>
24097 <indexterm role="option">
24098 <primary><option>message_body_visible</option></primary>
24099 </indexterm>
24100 </para>
24101 <informaltable frame="all">
24102 <tgroup cols="4" colsep="0" rowsep="0">
24103 <colspec colwidth="8*" align="left"/>
24104 <colspec colwidth="6*" align="center"/>
24105 <colspec colwidth="6*" align="center"/>
24106 <colspec colwidth="6*" align="right"/>
24107 <tbody>
24108 <row>
24109 <entry><option>message_body_visible</option></entry>
24110 <entry>Use: <emphasis>main</emphasis></entry>
24111 <entry>Type: <emphasis>integer</emphasis></entry>
24112 <entry>Default: <emphasis>500</emphasis></entry>
24113 </row>
24114 </tbody>
24115 </tgroup>
24116 </informaltable>
24117 <para>
24118 <indexterm role="concept">
24119 <primary>body of message</primary>
24120 <secondary>visible size</secondary>
24121 </indexterm>
24122 <indexterm role="concept">
24123 <primary>message body</primary>
24124 <secondary>visible size</secondary>
24125 </indexterm>
24126 <indexterm role="variable">
24127 <primary><varname>$message_body</varname></primary>
24128 </indexterm>
24129 <indexterm role="variable">
24130 <primary><varname>$message_body_end</varname></primary>
24131 </indexterm>
24132 This option specifies how much of a message&#x2019;s body is to be included in the
24133 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24134 </para>
24135 <para>
24136 <indexterm role="option">
24137 <primary><option>message_id_header_domain</option></primary>
24138 </indexterm>
24139 </para>
24140 <informaltable frame="all">
24141 <tgroup cols="4" colsep="0" rowsep="0">
24142 <colspec colwidth="8*" align="left"/>
24143 <colspec colwidth="6*" align="center"/>
24144 <colspec colwidth="6*" align="center"/>
24145 <colspec colwidth="6*" align="right"/>
24146 <tbody>
24147 <row>
24148 <entry><option>message_id_header_domain</option></entry>
24149 <entry>Use: <emphasis>main</emphasis></entry>
24150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24151 <entry>Default: <emphasis>unset</emphasis></entry>
24152 </row>
24153 </tbody>
24154 </tgroup>
24155 </informaltable>
24156 <para>
24157 <indexterm role="concept">
24158 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24159 </indexterm>
24160 If this option is set, the string is expanded and used as the right hand side
24161 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24162 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24163 means <quote>not received over TCP/IP.</quote>
24164 Otherwise, the primary host name is used.
24165 Only letters, digits, dot and hyphen are accepted; any other characters are
24166 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24167 empty string, the option is ignored.
24168 </para>
24169 <para>
24170 <indexterm role="option">
24171 <primary><option>message_id_header_text</option></primary>
24172 </indexterm>
24173 </para>
24174 <informaltable frame="all">
24175 <tgroup cols="4" colsep="0" rowsep="0">
24176 <colspec colwidth="8*" align="left"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="center"/>
24179 <colspec colwidth="6*" align="right"/>
24180 <tbody>
24181 <row>
24182 <entry><option>message_id_header_text</option></entry>
24183 <entry>Use: <emphasis>main</emphasis></entry>
24184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24185 <entry>Default: <emphasis>unset</emphasis></entry>
24186 </row>
24187 </tbody>
24188 </tgroup>
24189 </informaltable>
24190 <para>
24191 If this variable is set, the string is expanded and used to augment the text of
24192 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24193 message does not have one. The text of this header is required by RFC 2822 to
24194 take the form of an address. By default, Exim uses its internal message id as
24195 the local part, and the primary host name as the domain. If this option is set,
24196 it is expanded, and provided the expansion is not forced to fail, and does not
24197 yield an empty string, the result is inserted into the header immediately
24198 before the @, separated from the internal message id by a dot. Any characters
24199 that are illegal in an address are automatically converted into hyphens. This
24200 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24201 colons will become hyphens.
24202 </para>
24203 <para>
24204 <indexterm role="option">
24205 <primary><option>message_logs</option></primary>
24206 </indexterm>
24207 </para>
24208 <informaltable frame="all">
24209 <tgroup cols="4" colsep="0" rowsep="0">
24210 <colspec colwidth="8*" align="left"/>
24211 <colspec colwidth="6*" align="center"/>
24212 <colspec colwidth="6*" align="center"/>
24213 <colspec colwidth="6*" align="right"/>
24214 <tbody>
24215 <row>
24216 <entry><option>message_logs</option></entry>
24217 <entry>Use: <emphasis>main</emphasis></entry>
24218 <entry>Type: <emphasis>boolean</emphasis></entry>
24219 <entry>Default: <emphasis>true</emphasis></entry>
24220 </row>
24221 </tbody>
24222 </tgroup>
24223 </informaltable>
24224 <para>
24225 <indexterm role="concept">
24226 <primary>message logs</primary>
24227 <secondary>disabling</secondary>
24228 </indexterm>
24229 <indexterm role="concept">
24230 <primary>log</primary>
24231 <secondary>message log; disabling</secondary>
24232 </indexterm>
24233 If this option is turned off, per-message log files are not created in the
24234 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24235 Exim, by reducing the number of files involved in handling a message from a
24236 minimum of four (header spool file, body spool file, delivery journal, and
24237 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24238 which is not affected by this option.
24239 </para>
24240 <para>
24241 <indexterm role="option">
24242 <primary><option>message_size_limit</option></primary>
24243 </indexterm>
24244 </para>
24245 <informaltable frame="all">
24246 <tgroup cols="4" colsep="0" rowsep="0">
24247 <colspec colwidth="8*" align="left"/>
24248 <colspec colwidth="6*" align="center"/>
24249 <colspec colwidth="6*" align="center"/>
24250 <colspec colwidth="6*" align="right"/>
24251 <tbody>
24252 <row>
24253 <entry><option>message_size_limit</option></entry>
24254 <entry>Use: <emphasis>main</emphasis></entry>
24255 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24256 <entry>Default: <emphasis>50M</emphasis></entry>
24257 </row>
24258 </tbody>
24259 </tgroup>
24260 </informaltable>
24261 <para>
24262 <indexterm role="concept">
24263 <primary>message</primary>
24264 <secondary>size limit</secondary>
24265 </indexterm>
24266 <indexterm role="concept">
24267 <primary>limit</primary>
24268 <secondary>message size</secondary>
24269 </indexterm>
24270 <indexterm role="concept">
24271 <primary>size</primary>
24272 <secondary>of message, limit</secondary>
24273 </indexterm>
24274 This option limits the maximum size of message that Exim will process. The
24275 value is expanded for each incoming connection so, for example, it can be made
24276 to depend on the IP address of the remote host for messages arriving via
24277 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24278 optionally followed by K or M.
24279 </para>
24280 <para>
24281 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24282 other properties of an individual message, because it has to be advertised in
24283 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24284 error. A value of zero means no limit, but its use is not recommended. See also
24285 <option>bounce_return_size_limit</option>.
24286 </para>
24287 <para>
24288 Incoming SMTP messages are failed with a 552 error if the limit is
24289 exceeded; locally-generated messages either get a stderr message or a delivery
24290 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24291 an oversized message is logged in both the main and the reject logs. See also
24292 the generic transport option <option>message_size_limit</option>, which limits the size of
24293 message that an individual transport can process.
24294 </para>
24295 <para>
24296 <indexterm role="option">
24297 <primary><option>move_frozen_messages</option></primary>
24298 </indexterm>
24299 </para>
24300 <informaltable frame="all">
24301 <tgroup cols="4" colsep="0" rowsep="0">
24302 <colspec colwidth="8*" align="left"/>
24303 <colspec colwidth="6*" align="center"/>
24304 <colspec colwidth="6*" align="center"/>
24305 <colspec colwidth="6*" align="right"/>
24306 <tbody>
24307 <row>
24308 <entry><option>move_frozen_messages</option></entry>
24309 <entry>Use: <emphasis>main</emphasis></entry>
24310 <entry>Type: <emphasis>boolean</emphasis></entry>
24311 <entry>Default: <emphasis>false</emphasis></entry>
24312 </row>
24313 </tbody>
24314 </tgroup>
24315 </informaltable>
24316 <para>
24317 <indexterm role="concept">
24318 <primary>frozen messages</primary>
24319 <secondary>moving</secondary>
24320 </indexterm>
24321 This option, which is available only if Exim has been built with the setting
24322 </para>
24323 <literallayout class="monospaced">
24324 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24325 </literallayout>
24326 <para>
24327 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24328 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24329 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24330 standard utilities for handling such moved messages, and they do not show up in
24331 lists generated by <option>-bp</option> or by the Exim monitor.
24332 </para>
24333 <para>
24334 <indexterm role="option">
24335 <primary><option>mua_wrapper</option></primary>
24336 </indexterm>
24337 </para>
24338 <informaltable frame="all">
24339 <tgroup cols="4" colsep="0" rowsep="0">
24340 <colspec colwidth="8*" align="left"/>
24341 <colspec colwidth="6*" align="center"/>
24342 <colspec colwidth="6*" align="center"/>
24343 <colspec colwidth="6*" align="right"/>
24344 <tbody>
24345 <row>
24346 <entry><option>mua_wrapper</option></entry>
24347 <entry>Use: <emphasis>main</emphasis></entry>
24348 <entry>Type: <emphasis>boolean</emphasis></entry>
24349 <entry>Default: <emphasis>false</emphasis></entry>
24350 </row>
24351 </tbody>
24352 </tgroup>
24353 </informaltable>
24354 <para>
24355 Setting this option true causes Exim to run in a very restrictive mode in which
24356 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24357 contains a full description of this facility.
24358 </para>
24359 <para>
24360 <indexterm role="option">
24361 <primary><option>mysql_servers</option></primary>
24362 </indexterm>
24363 </para>
24364 <informaltable frame="all">
24365 <tgroup cols="4" colsep="0" rowsep="0">
24366 <colspec colwidth="8*" align="left"/>
24367 <colspec colwidth="6*" align="center"/>
24368 <colspec colwidth="6*" align="center"/>
24369 <colspec colwidth="6*" align="right"/>
24370 <tbody>
24371 <row>
24372 <entry><option>mysql_servers</option></entry>
24373 <entry>Use: <emphasis>main</emphasis></entry>
24374 <entry>Type: <emphasis>string list</emphasis></entry>
24375 <entry>Default: <emphasis>unset</emphasis></entry>
24376 </row>
24377 </tbody>
24378 </tgroup>
24379 </informaltable>
24380 <para>
24381 <indexterm role="concept">
24382 <primary>MySQL</primary>
24383 <secondary>server list</secondary>
24384 </indexterm>
24385 This option provides a list of MySQL servers and associated connection data, to
24386 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24387 option is available only if Exim has been built with MySQL support.
24388 </para>
24389 <para>
24390 <indexterm role="option">
24391 <primary><option>never_users</option></primary>
24392 </indexterm>
24393 </para>
24394 <informaltable frame="all">
24395 <tgroup cols="4" colsep="0" rowsep="0">
24396 <colspec colwidth="8*" align="left"/>
24397 <colspec colwidth="6*" align="center"/>
24398 <colspec colwidth="6*" align="center"/>
24399 <colspec colwidth="6*" align="right"/>
24400 <tbody>
24401 <row>
24402 <entry><option>never_users</option></entry>
24403 <entry>Use: <emphasis>main</emphasis></entry>
24404 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24405 <entry>Default: <emphasis>unset</emphasis></entry>
24406 </row>
24407 </tbody>
24408 </tgroup>
24409 </informaltable>
24410 <para>
24411 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24412 message deliveries are normally run in processes that are setuid to the
24413 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24414 It is usually desirable to prevent any deliveries from running as root, as a
24415 safety precaution.
24416 </para>
24417 <para>
24418 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24419 list of users that must not be used for local deliveries. This list is fixed in
24420 the binary and cannot be overridden by the configuration file. By default, it
24421 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24422 can be used to add more users to the fixed list.
24423 </para>
24424 <para>
24425 If a message is to be delivered as one of the users on the fixed list or the
24426 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24427 example is
24428 </para>
24429 <literallayout class="monospaced">
24430 never_users = root:daemon:bin
24431 </literallayout>
24432 <para>
24433 Including root is redundant if it is also on the fixed list, but it does no
24434 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24435 transport driver.
24436 </para>
24437 <para>
24438 <indexterm role="option">
24439 <primary><option>oracle_servers</option></primary>
24440 </indexterm>
24441 </para>
24442 <informaltable frame="all">
24443 <tgroup cols="4" colsep="0" rowsep="0">
24444 <colspec colwidth="8*" align="left"/>
24445 <colspec colwidth="6*" align="center"/>
24446 <colspec colwidth="6*" align="center"/>
24447 <colspec colwidth="6*" align="right"/>
24448 <tbody>
24449 <row>
24450 <entry><option>oracle_servers</option></entry>
24451 <entry>Use: <emphasis>main</emphasis></entry>
24452 <entry>Type: <emphasis>string list</emphasis></entry>
24453 <entry>Default: <emphasis>unset</emphasis></entry>
24454 </row>
24455 </tbody>
24456 </tgroup>
24457 </informaltable>
24458 <para>
24459 <indexterm role="concept">
24460 <primary>Oracle</primary>
24461 <secondary>server list</secondary>
24462 </indexterm>
24463 This option provides a list of Oracle servers and associated connection data,
24464 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24465 The option is available only if Exim has been built with Oracle support.
24466 </para>
24467 <para>
24468 <indexterm role="option">
24469 <primary><option>percent_hack_domains</option></primary>
24470 </indexterm>
24471 </para>
24472 <informaltable frame="all">
24473 <tgroup cols="4" colsep="0" rowsep="0">
24474 <colspec colwidth="8*" align="left"/>
24475 <colspec colwidth="6*" align="center"/>
24476 <colspec colwidth="6*" align="center"/>
24477 <colspec colwidth="6*" align="right"/>
24478 <tbody>
24479 <row>
24480 <entry><option>percent_hack_domains</option></entry>
24481 <entry>Use: <emphasis>main</emphasis></entry>
24482 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24483 <entry>Default: <emphasis>unset</emphasis></entry>
24484 </row>
24485 </tbody>
24486 </tgroup>
24487 </informaltable>
24488 <para>
24489 <indexterm role="concept">
24490 <primary><quote>percent hack</quote></primary>
24491 </indexterm>
24492 <indexterm role="concept">
24493 <primary>source routing</primary>
24494 <secondary>in email address</secondary>
24495 </indexterm>
24496 <indexterm role="concept">
24497 <primary>address</primary>
24498 <secondary>source-routed</secondary>
24499 </indexterm>
24500 The <quote>percent hack</quote> is the convention whereby a local part containing a
24501 percent sign is re-interpreted as a new email address, with the percent
24502 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24503 also applied to RFC 2822 addresses that begin with an @ character. If this
24504 option is set, Exim implements the percent facility for those domains listed,
24505 but no others. This happens before an incoming SMTP address is tested against
24506 an ACL.
24507 </para>
24508 <para>
24509 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24510 trying to get round relaying restrictions. For this reason, it is best avoided
24511 if at all possible. Unfortunately, a number of less security-conscious MTAs
24512 implement it unconditionally. If you are running Exim on a gateway host, and
24513 routing mail through to internal MTAs without processing the local parts, it is
24514 a good idea to reject recipient addresses with percent characters in their
24515 local parts. Exim&#x2019;s default configuration does this.
24516 </para>
24517 <para>
24518 <indexterm role="option">
24519 <primary><option>perl_at_start</option></primary>
24520 </indexterm>
24521 </para>
24522 <informaltable frame="all">
24523 <tgroup cols="4" colsep="0" rowsep="0">
24524 <colspec colwidth="8*" align="left"/>
24525 <colspec colwidth="6*" align="center"/>
24526 <colspec colwidth="6*" align="center"/>
24527 <colspec colwidth="6*" align="right"/>
24528 <tbody>
24529 <row>
24530 <entry><option>perl_at_start</option></entry>
24531 <entry>Use: <emphasis>main</emphasis></entry>
24532 <entry>Type: <emphasis>boolean</emphasis></entry>
24533 <entry>Default: <emphasis>false</emphasis></entry>
24534 </row>
24535 </tbody>
24536 </tgroup>
24537 </informaltable>
24538 <para>
24539 This option is available only when Exim is built with an embedded Perl
24540 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24541 </para>
24542 <para>
24543 <indexterm role="option">
24544 <primary><option>perl_startup</option></primary>
24545 </indexterm>
24546 </para>
24547 <informaltable frame="all">
24548 <tgroup cols="4" colsep="0" rowsep="0">
24549 <colspec colwidth="8*" align="left"/>
24550 <colspec colwidth="6*" align="center"/>
24551 <colspec colwidth="6*" align="center"/>
24552 <colspec colwidth="6*" align="right"/>
24553 <tbody>
24554 <row>
24555 <entry><option>perl_startup</option></entry>
24556 <entry>Use: <emphasis>main</emphasis></entry>
24557 <entry>Type: <emphasis>string</emphasis></entry>
24558 <entry>Default: <emphasis>unset</emphasis></entry>
24559 </row>
24560 </tbody>
24561 </tgroup>
24562 </informaltable>
24563 <para>
24564 This option is available only when Exim is built with an embedded Perl
24565 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24566 </para>
24567 <para>
24568 <indexterm role="option">
24569 <primary><option>pgsql_servers</option></primary>
24570 </indexterm>
24571 </para>
24572 <informaltable frame="all">
24573 <tgroup cols="4" colsep="0" rowsep="0">
24574 <colspec colwidth="8*" align="left"/>
24575 <colspec colwidth="6*" align="center"/>
24576 <colspec colwidth="6*" align="center"/>
24577 <colspec colwidth="6*" align="right"/>
24578 <tbody>
24579 <row>
24580 <entry><option>pgsql_servers</option></entry>
24581 <entry>Use: <emphasis>main</emphasis></entry>
24582 <entry>Type: <emphasis>string list</emphasis></entry>
24583 <entry>Default: <emphasis>unset</emphasis></entry>
24584 </row>
24585 </tbody>
24586 </tgroup>
24587 </informaltable>
24588 <para>
24589 <indexterm role="concept">
24590 <primary>PostgreSQL lookup type</primary>
24591 <secondary>server list</secondary>
24592 </indexterm>
24593 This option provides a list of PostgreSQL servers and associated connection
24594 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24595 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24596 PostgreSQL support.
24597 </para>
24598 <para>
24599 <indexterm role="option">
24600 <primary><option>pid_file_path</option></primary>
24601 </indexterm>
24602 </para>
24603 <informaltable frame="all">
24604 <tgroup cols="4" colsep="0" rowsep="0">
24605 <colspec colwidth="8*" align="left"/>
24606 <colspec colwidth="6*" align="center"/>
24607 <colspec colwidth="6*" align="center"/>
24608 <colspec colwidth="6*" align="right"/>
24609 <tbody>
24610 <row>
24611 <entry><option>pid_file_path</option></entry>
24612 <entry>Use: <emphasis>main</emphasis></entry>
24613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24614 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24615 </row>
24616 </tbody>
24617 </tgroup>
24618 </informaltable>
24619 <para>
24620 <indexterm role="concept">
24621 <primary>daemon</primary>
24622 <secondary>pid file path</secondary>
24623 </indexterm>
24624 <indexterm role="concept">
24625 <primary>pid file, path for</primary>
24626 </indexterm>
24627 This option sets the name of the file to which the Exim daemon writes its
24628 process id. The string is expanded, so it can contain, for example, references
24629 to the host name:
24630 </para>
24631 <literallayout class="monospaced">
24632 pid_file_path = /var/log/$primary_hostname/exim.pid
24633 </literallayout>
24634 <para>
24635 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
24636 spool directory.
24637 The value set by the option can be overridden by the <option>-oP</option> command line
24638 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24639 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24640 </para>
24641 <para>
24642 <indexterm role="option">
24643 <primary><option>pipelining_advertise_hosts</option></primary>
24644 </indexterm>
24645 </para>
24646 <informaltable frame="all">
24647 <tgroup cols="4" colsep="0" rowsep="0">
24648 <colspec colwidth="8*" align="left"/>
24649 <colspec colwidth="6*" align="center"/>
24650 <colspec colwidth="6*" align="center"/>
24651 <colspec colwidth="6*" align="right"/>
24652 <tbody>
24653 <row>
24654 <entry><option>pipelining_advertise_hosts</option></entry>
24655 <entry>Use: <emphasis>main</emphasis></entry>
24656 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24657 <entry>Default: <emphasis>*</emphasis></entry>
24658 </row>
24659 </tbody>
24660 </tgroup>
24661 </informaltable>
24662 <para>
24663 <indexterm role="concept">
24664 <primary>PIPELINING</primary>
24665 <secondary>suppressing advertising</secondary>
24666 </indexterm>
24667 This option can be used to suppress the advertisement of the SMTP
24668 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24669 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24670 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24671 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24672 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24673 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24674 </para>
24675 <para>
24676 <indexterm role="option">
24677 <primary><option>preserve_message_logs</option></primary>
24678 </indexterm>
24679 </para>
24680 <informaltable frame="all">
24681 <tgroup cols="4" colsep="0" rowsep="0">
24682 <colspec colwidth="8*" align="left"/>
24683 <colspec colwidth="6*" align="center"/>
24684 <colspec colwidth="6*" align="center"/>
24685 <colspec colwidth="6*" align="right"/>
24686 <tbody>
24687 <row>
24688 <entry><option>preserve_message_logs</option></entry>
24689 <entry>Use: <emphasis>main</emphasis></entry>
24690 <entry>Type: <emphasis>boolean</emphasis></entry>
24691 <entry>Default: <emphasis>false</emphasis></entry>
24692 </row>
24693 </tbody>
24694 </tgroup>
24695 </informaltable>
24696 <para>
24697 <indexterm role="concept">
24698 <primary>message logs</primary>
24699 <secondary>preserving</secondary>
24700 </indexterm>
24701 If this option is set, message log files are not deleted when messages are
24702 completed. Instead, they are moved to a sub-directory of the spool directory
24703 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24704 purposes. This is a dangerous option to set on systems with any appreciable
24705 volume of mail. Use with care!
24706 </para>
24707 <para>
24708 <indexterm role="option">
24709 <primary><option>primary_hostname</option></primary>
24710 </indexterm>
24711 </para>
24712 <informaltable frame="all">
24713 <tgroup cols="4" colsep="0" rowsep="0">
24714 <colspec colwidth="8*" align="left"/>
24715 <colspec colwidth="6*" align="center"/>
24716 <colspec colwidth="6*" align="center"/>
24717 <colspec colwidth="6*" align="right"/>
24718 <tbody>
24719 <row>
24720 <entry><option>primary_hostname</option></entry>
24721 <entry>Use: <emphasis>main</emphasis></entry>
24722 <entry>Type: <emphasis>string</emphasis></entry>
24723 <entry>Default: <emphasis>see below</emphasis></entry>
24724 </row>
24725 </tbody>
24726 </tgroup>
24727 </informaltable>
24728 <para>
24729 <indexterm role="concept">
24730 <primary>name</primary>
24731 <secondary>of local host</secondary>
24732 </indexterm>
24733 <indexterm role="concept">
24734 <primary>host</primary>
24735 <secondary>name of local</secondary>
24736 </indexterm>
24737 <indexterm role="concept">
24738 <primary>local host</primary>
24739 <secondary>name of</secondary>
24740 </indexterm>
24741 <indexterm role="variable">
24742 <primary><varname>$primary_hostname</varname></primary>
24743 </indexterm>
24744 This specifies the name of the current host. It is used in the default EHLO or
24745 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24746 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24747 The value is also used by default in some SMTP response messages from an Exim
24748 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24749 </para>
24750 <para>
24751 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24752 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24753 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24754 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24755 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24756 explicitly by this option, or defaulted.
24757 </para>
24758 <para>
24759 <indexterm role="option">
24760 <primary><option>print_topbitchars</option></primary>
24761 </indexterm>
24762 </para>
24763 <informaltable frame="all">
24764 <tgroup cols="4" colsep="0" rowsep="0">
24765 <colspec colwidth="8*" align="left"/>
24766 <colspec colwidth="6*" align="center"/>
24767 <colspec colwidth="6*" align="center"/>
24768 <colspec colwidth="6*" align="right"/>
24769 <tbody>
24770 <row>
24771 <entry><option>print_topbitchars</option></entry>
24772 <entry>Use: <emphasis>main</emphasis></entry>
24773 <entry>Type: <emphasis>boolean</emphasis></entry>
24774 <entry>Default: <emphasis>false</emphasis></entry>
24775 </row>
24776 </tbody>
24777 </tgroup>
24778 </informaltable>
24779 <para>
24780 <indexterm role="concept">
24781 <primary>printing characters</primary>
24782 </indexterm>
24783 <indexterm role="concept">
24784 <primary>8-bit characters</primary>
24785 </indexterm>
24786 By default, Exim considers only those characters whose codes lie in the range
24787 32&ndash;126 to be printing characters. In a number of circumstances (for example,
24788 when writing log entries) non-printing characters are converted into escape
24789 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24790 is set, code values of 128 and above are also considered to be printing
24791 characters.
24792 </para>
24793 <para>
24794 This option also affects the header syntax checks performed by the
24795 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24796 the user&#x2019;s full name when constructing From: and Sender: addresses (as
24797 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24798 Exim to generate eight bit message headers that do not conform to the
24799 standards.
24800 </para>
24801 <para>
24802 <indexterm role="option">
24803 <primary><option>process_log_path</option></primary>
24804 </indexterm>
24805 </para>
24806 <informaltable frame="all">
24807 <tgroup cols="4" colsep="0" rowsep="0">
24808 <colspec colwidth="8*" align="left"/>
24809 <colspec colwidth="6*" align="center"/>
24810 <colspec colwidth="6*" align="center"/>
24811 <colspec colwidth="6*" align="right"/>
24812 <tbody>
24813 <row>
24814 <entry><option>process_log_path</option></entry>
24815 <entry>Use: <emphasis>main</emphasis></entry>
24816 <entry>Type: <emphasis>string</emphasis></entry>
24817 <entry>Default: <emphasis>unset</emphasis></entry>
24818 </row>
24819 </tbody>
24820 </tgroup>
24821 </informaltable>
24822 <para>
24823 <indexterm role="concept">
24824 <primary>process log path</primary>
24825 </indexterm>
24826 <indexterm role="concept">
24827 <primary>log</primary>
24828 <secondary>process log</secondary>
24829 </indexterm>
24830 <indexterm role="concept">
24831 <primary><emphasis>exiwhat</emphasis></primary>
24832 </indexterm>
24833 This option sets the name of the file to which an Exim process writes its
24834 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24835 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24836 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
24837 can be useful in environments where two different Exims are running, using
24838 different spool directories.
24839 </para>
24840 <para>
24841 <indexterm role="option">
24842 <primary><option>prod_requires_admin</option></primary>
24843 </indexterm>
24844 </para>
24845 <informaltable frame="all">
24846 <tgroup cols="4" colsep="0" rowsep="0">
24847 <colspec colwidth="8*" align="left"/>
24848 <colspec colwidth="6*" align="center"/>
24849 <colspec colwidth="6*" align="center"/>
24850 <colspec colwidth="6*" align="right"/>
24851 <tbody>
24852 <row>
24853 <entry><option>prod_requires_admin</option></entry>
24854 <entry>Use: <emphasis>main</emphasis></entry>
24855 <entry>Type: <emphasis>boolean</emphasis></entry>
24856 <entry>Default: <emphasis>true</emphasis></entry>
24857 </row>
24858 </tbody>
24859 </tgroup>
24860 </informaltable>
24861 <para>
24862 <indexterm role="option">
24863 <primary><option>-M</option></primary>
24864 </indexterm>
24865 <indexterm role="option">
24866 <primary><option>-R</option></primary>
24867 </indexterm>
24868 <indexterm role="option">
24869 <primary><option>-q</option></primary>
24870 </indexterm>
24871 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24872 admin user unless <option>prod_requires_admin</option> is set false. See also
24873 <option>queue_list_requires_admin</option>.
24874 </para>
24875 <para>
24876 <indexterm role="option">
24877 <primary><option>qualify_domain</option></primary>
24878 </indexterm>
24879 </para>
24880 <informaltable frame="all">
24881 <tgroup cols="4" colsep="0" rowsep="0">
24882 <colspec colwidth="8*" align="left"/>
24883 <colspec colwidth="6*" align="center"/>
24884 <colspec colwidth="6*" align="center"/>
24885 <colspec colwidth="6*" align="right"/>
24886 <tbody>
24887 <row>
24888 <entry><option>qualify_domain</option></entry>
24889 <entry>Use: <emphasis>main</emphasis></entry>
24890 <entry>Type: <emphasis>string</emphasis></entry>
24891 <entry>Default: <emphasis>see below</emphasis></entry>
24892 </row>
24893 </tbody>
24894 </tgroup>
24895 </informaltable>
24896 <para>
24897 <indexterm role="concept">
24898 <primary>domain</primary>
24899 <secondary>for qualifying addresses</secondary>
24900 </indexterm>
24901 <indexterm role="concept">
24902 <primary>address</primary>
24903 <secondary>qualification</secondary>
24904 </indexterm>
24905 This option specifies the domain name that is added to any envelope sender
24906 addresses that do not have a domain qualification. It also applies to
24907 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24908 are accepted by default only for locally-generated messages. Qualification is
24909 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24910 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24911 </para>
24912 <para>
24913 Messages from external sources must always contain fully qualified addresses,
24914 unless the sending host matches <option>sender_unqualified_hosts</option> or
24915 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24916 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24917 necessary. Internally, Exim always works with fully qualified envelope
24918 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24919 <option>primary_hostname</option> value.
24920 </para>
24921 <para>
24922 <indexterm role="option">
24923 <primary><option>qualify_recipient</option></primary>
24924 </indexterm>
24925 </para>
24926 <informaltable frame="all">
24927 <tgroup cols="4" colsep="0" rowsep="0">
24928 <colspec colwidth="8*" align="left"/>
24929 <colspec colwidth="6*" align="center"/>
24930 <colspec colwidth="6*" align="center"/>
24931 <colspec colwidth="6*" align="right"/>
24932 <tbody>
24933 <row>
24934 <entry><option>qualify_recipient</option></entry>
24935 <entry>Use: <emphasis>main</emphasis></entry>
24936 <entry>Type: <emphasis>string</emphasis></entry>
24937 <entry>Default: <emphasis>see below</emphasis></entry>
24938 </row>
24939 </tbody>
24940 </tgroup>
24941 </informaltable>
24942 <para>
24943 This option allows you to specify a different domain for qualifying recipient
24944 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24945 </para>
24946 <para>
24947 <indexterm role="option">
24948 <primary><option>queue_domains</option></primary>
24949 </indexterm>
24950 </para>
24951 <informaltable frame="all">
24952 <tgroup cols="4" colsep="0" rowsep="0">
24953 <colspec colwidth="8*" align="left"/>
24954 <colspec colwidth="6*" align="center"/>
24955 <colspec colwidth="6*" align="center"/>
24956 <colspec colwidth="6*" align="right"/>
24957 <tbody>
24958 <row>
24959 <entry><option>queue_domains</option></entry>
24960 <entry>Use: <emphasis>main</emphasis></entry>
24961 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24962 <entry>Default: <emphasis>unset</emphasis></entry>
24963 </row>
24964 </tbody>
24965 </tgroup>
24966 </informaltable>
24967 <para>
24968 <indexterm role="concept">
24969 <primary>domain</primary>
24970 <secondary>specifying non-immediate delivery</secondary>
24971 </indexterm>
24972 <indexterm role="concept">
24973 <primary>queueing incoming messages</primary>
24974 </indexterm>
24975 <indexterm role="concept">
24976 <primary>message</primary>
24977 <secondary>queueing certain domains</secondary>
24978 </indexterm>
24979 This option lists domains for which immediate delivery is not required.
24980 A delivery process is started whenever a message is received, but only those
24981 domains that do not match are processed. All other deliveries wait until the
24982 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24983 </para>
24984 <para>
24985 <indexterm role="option">
24986 <primary><option>queue_list_requires_admin</option></primary>
24987 </indexterm>
24988 </para>
24989 <informaltable frame="all">
24990 <tgroup cols="4" colsep="0" rowsep="0">
24991 <colspec colwidth="8*" align="left"/>
24992 <colspec colwidth="6*" align="center"/>
24993 <colspec colwidth="6*" align="center"/>
24994 <colspec colwidth="6*" align="right"/>
24995 <tbody>
24996 <row>
24997 <entry><option>queue_list_requires_admin</option></entry>
24998 <entry>Use: <emphasis>main</emphasis></entry>
24999 <entry>Type: <emphasis>boolean</emphasis></entry>
25000 <entry>Default: <emphasis>true</emphasis></entry>
25001 </row>
25002 </tbody>
25003 </tgroup>
25004 </informaltable>
25005 <para>
25006 <indexterm role="option">
25007 <primary><option>-bp</option></primary>
25008 </indexterm>
25009 The <option>-bp</option> command-line option, which lists the messages that are on the
25010 queue, requires the caller to be an admin user unless
25011 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25012 </para>
25013 <para>
25014 <indexterm role="option">
25015 <primary><option>queue_only</option></primary>
25016 </indexterm>
25017 </para>
25018 <informaltable frame="all">
25019 <tgroup cols="4" colsep="0" rowsep="0">
25020 <colspec colwidth="8*" align="left"/>
25021 <colspec colwidth="6*" align="center"/>
25022 <colspec colwidth="6*" align="center"/>
25023 <colspec colwidth="6*" align="right"/>
25024 <tbody>
25025 <row>
25026 <entry><option>queue_only</option></entry>
25027 <entry>Use: <emphasis>main</emphasis></entry>
25028 <entry>Type: <emphasis>boolean</emphasis></entry>
25029 <entry>Default: <emphasis>false</emphasis></entry>
25030 </row>
25031 </tbody>
25032 </tgroup>
25033 </informaltable>
25034 <para>
25035 <indexterm role="concept">
25036 <primary>queueing incoming messages</primary>
25037 </indexterm>
25038 <indexterm role="concept">
25039 <primary>message</primary>
25040 <secondary>queueing unconditionally</secondary>
25041 </indexterm>
25042 If <option>queue_only</option> is set, a delivery process is not automatically started
25043 whenever a message is received. Instead, the message waits on the queue for the
25044 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25045 delivered immediately when certain conditions (such as heavy load) occur.
25046 </para>
25047 <para>
25048 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25049 and <option>-odi</option> command line options override <option>queue_only</option> unless
25050 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25051 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25052 </para>
25053 <para>
25054 <indexterm role="option">
25055 <primary><option>queue_only_file</option></primary>
25056 </indexterm>
25057 </para>
25058 <informaltable frame="all">
25059 <tgroup cols="4" colsep="0" rowsep="0">
25060 <colspec colwidth="8*" align="left"/>
25061 <colspec colwidth="6*" align="center"/>
25062 <colspec colwidth="6*" align="center"/>
25063 <colspec colwidth="6*" align="right"/>
25064 <tbody>
25065 <row>
25066 <entry><option>queue_only_file</option></entry>
25067 <entry>Use: <emphasis>main</emphasis></entry>
25068 <entry>Type: <emphasis>string</emphasis></entry>
25069 <entry>Default: <emphasis>unset</emphasis></entry>
25070 </row>
25071 </tbody>
25072 </tgroup>
25073 </informaltable>
25074 <para>
25075 <indexterm role="concept">
25076 <primary>queueing incoming messages</primary>
25077 </indexterm>
25078 <indexterm role="concept">
25079 <primary>message</primary>
25080 <secondary>queueing by file existence</secondary>
25081 </indexterm>
25082 This option can be set to a colon-separated list of absolute path names, each
25083 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25084 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25085 each path that exists, the corresponding queueing option is set.
25086 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25087 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25088 </para>
25089 <literallayout class="monospaced">
25090 queue_only_file = smtp/some/file
25091 </literallayout>
25092 <para>
25093 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25094 <filename>/some/file</filename> exists.
25095 </para>
25096 <para>
25097 <indexterm role="option">
25098 <primary><option>queue_only_load</option></primary>
25099 </indexterm>
25100 </para>
25101 <informaltable frame="all">
25102 <tgroup cols="4" colsep="0" rowsep="0">
25103 <colspec colwidth="8*" align="left"/>
25104 <colspec colwidth="6*" align="center"/>
25105 <colspec colwidth="6*" align="center"/>
25106 <colspec colwidth="6*" align="right"/>
25107 <tbody>
25108 <row>
25109 <entry><option>queue_only_load</option></entry>
25110 <entry>Use: <emphasis>main</emphasis></entry>
25111 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25112 <entry>Default: <emphasis>unset</emphasis></entry>
25113 </row>
25114 </tbody>
25115 </tgroup>
25116 </informaltable>
25117 <para>
25118 <indexterm role="concept">
25119 <primary>load average</primary>
25120 </indexterm>
25121 <indexterm role="concept">
25122 <primary>queueing incoming messages</primary>
25123 </indexterm>
25124 <indexterm role="concept">
25125 <primary>message</primary>
25126 <secondary>queueing by load</secondary>
25127 </indexterm>
25128 If the system load average is higher than this value, incoming messages from
25129 all sources are queued, and no automatic deliveries are started. If this
25130 happens during local or remote SMTP input, all subsequent messages received on
25131 the same SMTP connection are queued by default, whatever happens to the load in
25132 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25133 false.
25134 </para>
25135 <para>
25136 Deliveries will subsequently be performed by queue runner processes. This
25137 option has no effect on ancient operating systems on which Exim cannot
25138 determine the load average. See also <option>deliver_queue_load_max</option> and
25139 <option>smtp_load_reserve</option>.
25140 </para>
25141 <para>
25142 <indexterm role="option">
25143 <primary><option>queue_only_load_latch</option></primary>
25144 </indexterm>
25145 </para>
25146 <informaltable frame="all">
25147 <tgroup cols="4" colsep="0" rowsep="0">
25148 <colspec colwidth="8*" align="left"/>
25149 <colspec colwidth="6*" align="center"/>
25150 <colspec colwidth="6*" align="center"/>
25151 <colspec colwidth="6*" align="right"/>
25152 <tbody>
25153 <row>
25154 <entry><option>queue_only_load_latch</option></entry>
25155 <entry>Use: <emphasis>main</emphasis></entry>
25156 <entry>Type: <emphasis>boolean</emphasis></entry>
25157 <entry>Default: <emphasis>true</emphasis></entry>
25158 </row>
25159 </tbody>
25160 </tgroup>
25161 </informaltable>
25162 <para>
25163 <indexterm role="concept">
25164 <primary>load average</primary>
25165 <secondary>re-evaluating per message</secondary>
25166 </indexterm>
25167 When this option is true (the default), once one message has been queued
25168 because the load average is higher than the value set by <option>queue_only_load</option>,
25169 all subsequent messages received on the same SMTP connection are also queued.
25170 This is a deliberate choice; even though the load average may fall below the
25171 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
25172 connection when not delivering earlier ones. However, there are special
25173 circumstances such as very long-lived connections from scanning appliances
25174 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25175 should be set false. This causes the value of the load average to be
25176 re-evaluated for each message.
25177 </para>
25178 <para>
25179 <indexterm role="option">
25180 <primary><option>queue_only_override</option></primary>
25181 </indexterm>
25182 </para>
25183 <informaltable frame="all">
25184 <tgroup cols="4" colsep="0" rowsep="0">
25185 <colspec colwidth="8*" align="left"/>
25186 <colspec colwidth="6*" align="center"/>
25187 <colspec colwidth="6*" align="center"/>
25188 <colspec colwidth="6*" align="right"/>
25189 <tbody>
25190 <row>
25191 <entry><option>queue_only_override</option></entry>
25192 <entry>Use: <emphasis>main</emphasis></entry>
25193 <entry>Type: <emphasis>boolean</emphasis></entry>
25194 <entry>Default: <emphasis>true</emphasis></entry>
25195 </row>
25196 </tbody>
25197 </tgroup>
25198 </informaltable>
25199 <para>
25200 <indexterm role="concept">
25201 <primary>queueing incoming messages</primary>
25202 </indexterm>
25203 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25204 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25205 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25206 to override; they are accepted, but ignored.
25207 </para>
25208 <para>
25209 <indexterm role="option">
25210 <primary><option>queue_run_in_order</option></primary>
25211 </indexterm>
25212 </para>
25213 <informaltable frame="all">
25214 <tgroup cols="4" colsep="0" rowsep="0">
25215 <colspec colwidth="8*" align="left"/>
25216 <colspec colwidth="6*" align="center"/>
25217 <colspec colwidth="6*" align="center"/>
25218 <colspec colwidth="6*" align="right"/>
25219 <tbody>
25220 <row>
25221 <entry><option>queue_run_in_order</option></entry>
25222 <entry>Use: <emphasis>main</emphasis></entry>
25223 <entry>Type: <emphasis>boolean</emphasis></entry>
25224 <entry>Default: <emphasis>false</emphasis></entry>
25225 </row>
25226 </tbody>
25227 </tgroup>
25228 </informaltable>
25229 <para>
25230 <indexterm role="concept">
25231 <primary>queue runner</primary>
25232 <secondary>processing messages in order</secondary>
25233 </indexterm>
25234 If this option is set, queue runs happen in order of message arrival instead of
25235 in an arbitrary order. For this to happen, a complete list of the entire queue
25236 must be set up before the deliveries start. When the queue is all held in a
25237 single directory (the default), a single list is created for both the ordered
25238 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25239 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25240 the sub-directories are processed one at a time (in a random order), and this
25241 avoids setting up one huge list for the whole queue. Thus, setting
25242 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25243 when the queue is large, because of the extra work in setting up the single,
25244 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25245 </para>
25246 <para>
25247 <indexterm role="option">
25248 <primary><option>queue_run_max</option></primary>
25249 </indexterm>
25250 </para>
25251 <informaltable frame="all">
25252 <tgroup cols="4" colsep="0" rowsep="0">
25253 <colspec colwidth="8*" align="left"/>
25254 <colspec colwidth="6*" align="center"/>
25255 <colspec colwidth="6*" align="center"/>
25256 <colspec colwidth="6*" align="right"/>
25257 <tbody>
25258 <row>
25259 <entry><option>queue_run_max</option></entry>
25260 <entry>Use: <emphasis>main</emphasis></entry>
25261 <entry>Type: <emphasis>integer</emphasis></entry>
25262 <entry>Default: <emphasis>5</emphasis></entry>
25263 </row>
25264 </tbody>
25265 </tgroup>
25266 </informaltable>
25267 <para>
25268 <indexterm role="concept">
25269 <primary>queue runner</primary>
25270 <secondary>maximum number of</secondary>
25271 </indexterm>
25272 This controls the maximum number of queue runner processes that an Exim daemon
25273 can run simultaneously. This does not mean that it starts them all at once,
25274 but rather that if the maximum number are still running when the time comes to
25275 start another one, it refrains from starting another one. This can happen with
25276 very large queues and/or very sluggish deliveries. This option does not,
25277 however, interlock with other processes, so additional queue runners can be
25278 started by other means, or by killing and restarting the daemon.
25279 </para>
25280 <para>
25281 Setting this option to zero does not suppress queue runs; rather, it disables
25282 the limit, allowing any number of simultaneous queue runner processes to be
25283 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25284 the daemon&#x2019;s command line.
25285 </para>
25286 <para>
25287 <indexterm role="option">
25288 <primary><option>queue_smtp_domains</option></primary>
25289 </indexterm>
25290 </para>
25291 <informaltable frame="all">
25292 <tgroup cols="4" colsep="0" rowsep="0">
25293 <colspec colwidth="8*" align="left"/>
25294 <colspec colwidth="6*" align="center"/>
25295 <colspec colwidth="6*" align="center"/>
25296 <colspec colwidth="6*" align="right"/>
25297 <tbody>
25298 <row>
25299 <entry><option>queue_smtp_domains</option></entry>
25300 <entry>Use: <emphasis>main</emphasis></entry>
25301 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25302 <entry>Default: <emphasis>unset</emphasis></entry>
25303 </row>
25304 </tbody>
25305 </tgroup>
25306 </informaltable>
25307 <para>
25308 <indexterm role="concept">
25309 <primary>queueing incoming messages</primary>
25310 </indexterm>
25311 <indexterm role="concept">
25312 <primary>message</primary>
25313 <secondary>queueing remote deliveries</secondary>
25314 </indexterm>
25315 When this option is set, a delivery process is started whenever a message is
25316 received, routing is performed, and local deliveries take place.
25317 However, if any SMTP deliveries are required for domains that match
25318 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25319 message waits on the queue for the next queue run. Since routing of the message
25320 has taken place, Exim knows to which remote hosts it must be delivered, and so
25321 when the queue run happens, multiple messages for the same host are delivered
25322 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25323 SMTP deliveries to be queued in this way, and is equivalent to setting
25324 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25325 <option>queue_domains</option>.
25326 </para>
25327 <para>
25328 <indexterm role="option">
25329 <primary><option>receive_timeout</option></primary>
25330 </indexterm>
25331 </para>
25332 <informaltable frame="all">
25333 <tgroup cols="4" colsep="0" rowsep="0">
25334 <colspec colwidth="8*" align="left"/>
25335 <colspec colwidth="6*" align="center"/>
25336 <colspec colwidth="6*" align="center"/>
25337 <colspec colwidth="6*" align="right"/>
25338 <tbody>
25339 <row>
25340 <entry><option>receive_timeout</option></entry>
25341 <entry>Use: <emphasis>main</emphasis></entry>
25342 <entry>Type: <emphasis>time</emphasis></entry>
25343 <entry>Default: <emphasis>0s</emphasis></entry>
25344 </row>
25345 </tbody>
25346 </tgroup>
25347 </informaltable>
25348 <para>
25349 <indexterm role="concept">
25350 <primary>timeout</primary>
25351 <secondary>for non-SMTP input</secondary>
25352 </indexterm>
25353 This option sets the timeout for accepting a non-SMTP message, that is, the
25354 maximum time that Exim waits when reading a message on the standard input. If
25355 the value is zero, it will wait for ever. This setting is overridden by the
25356 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25357 controlled by <option>smtp_receive_timeout</option>.
25358 </para>
25359 <para>
25360 <indexterm role="option">
25361 <primary><option>received_header_text</option></primary>
25362 </indexterm>
25363 </para>
25364 <informaltable frame="all">
25365 <tgroup cols="4" colsep="0" rowsep="0">
25366 <colspec colwidth="8*" align="left"/>
25367 <colspec colwidth="6*" align="center"/>
25368 <colspec colwidth="6*" align="center"/>
25369 <colspec colwidth="6*" align="right"/>
25370 <tbody>
25371 <row>
25372 <entry><option>received_header_text</option></entry>
25373 <entry>Use: <emphasis>main</emphasis></entry>
25374 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25375 <entry>Default: <emphasis>see below</emphasis></entry>
25376 </row>
25377 </tbody>
25378 </tgroup>
25379 </informaltable>
25380 <para>
25381 <indexterm role="concept">
25382 <primary>customizing</primary>
25383 <secondary><emphasis>Received:</emphasis> header</secondary>
25384 </indexterm>
25385 <indexterm role="concept">
25386 <primary><emphasis>Received:</emphasis> header line</primary>
25387 <secondary>customizing</secondary>
25388 </indexterm>
25389 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25390 added to each message, except for the timestamp, which is automatically added
25391 on at the end (preceded by a semicolon). The string is expanded each time it is
25392 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25393 added to the message. Otherwise, the string should start with the text
25394 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25395 header lines. The default setting is:
25396 </para>
25397 <literallayout class="monospaced">
25398 received_header_text = Received: \
25399   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25400   {${if def:sender_ident \
25401   {from ${quote_local_part:$sender_ident} }}\
25402   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25403   by $primary_hostname \
25404   ${if def:received_protocol {with $received_protocol}} \
25405   ${if def:tls_cipher {($tls_cipher)\n\t}}\
25406   (Exim $version_number)\n\t\
25407   ${if def:sender_address \
25408   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
25409   id $message_exim_id\
25410   ${if def:received_for {\n\tfor $received_for}}
25411 </literallayout>
25412 <para>
25413 The reference to the TLS cipher is omitted when Exim is built without TLS
25414 support. The use of conditional expansions ensures that this works for both
25415 locally generated messages and messages received from remote hosts, giving
25416 header lines such as the following:
25417 </para>
25418 <literallayout class="monospaced">
25419 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25420 by marley.carol.example with esmtp (Exim 4.00)
25421 (envelope-from &lt;bob@carol.example&gt;)
25422 id 16IOWa-00019l-00
25423 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25424 Received: by scrooge.carol.example with local (Exim 4.00)
25425 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25426 </literallayout>
25427 <para>
25428 Until the body of the message has been received, the timestamp is the time when
25429 the message started to be received. Once the body has arrived, and all policy
25430 checks have taken place, the timestamp is updated to the time at which the
25431 message was accepted.
25432 </para>
25433 <para>
25434 <indexterm role="option">
25435 <primary><option>received_headers_max</option></primary>
25436 </indexterm>
25437 </para>
25438 <informaltable frame="all">
25439 <tgroup cols="4" colsep="0" rowsep="0">
25440 <colspec colwidth="8*" align="left"/>
25441 <colspec colwidth="6*" align="center"/>
25442 <colspec colwidth="6*" align="center"/>
25443 <colspec colwidth="6*" align="right"/>
25444 <tbody>
25445 <row>
25446 <entry><option>received_headers_max</option></entry>
25447 <entry>Use: <emphasis>main</emphasis></entry>
25448 <entry>Type: <emphasis>integer</emphasis></entry>
25449 <entry>Default: <emphasis>30</emphasis></entry>
25450 </row>
25451 </tbody>
25452 </tgroup>
25453 </informaltable>
25454 <para>
25455 <indexterm role="concept">
25456 <primary>loop</primary>
25457 <secondary>prevention</secondary>
25458 </indexterm>
25459 <indexterm role="concept">
25460 <primary>mail loop prevention</primary>
25461 </indexterm>
25462 <indexterm role="concept">
25463 <primary><emphasis>Received:</emphasis> header line</primary>
25464 <secondary>counting</secondary>
25465 </indexterm>
25466 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25467 counted, and if it is greater than this parameter, a mail loop is assumed to
25468 have occurred, the delivery is abandoned, and an error message is generated.
25469 This applies to both local and remote deliveries.
25470 </para>
25471 <para>
25472 <indexterm role="option">
25473 <primary><option>recipient_unqualified_hosts</option></primary>
25474 </indexterm>
25475 </para>
25476 <informaltable frame="all">
25477 <tgroup cols="4" colsep="0" rowsep="0">
25478 <colspec colwidth="8*" align="left"/>
25479 <colspec colwidth="6*" align="center"/>
25480 <colspec colwidth="6*" align="center"/>
25481 <colspec colwidth="6*" align="right"/>
25482 <tbody>
25483 <row>
25484 <entry><option>recipient_unqualified_hosts</option></entry>
25485 <entry>Use: <emphasis>main</emphasis></entry>
25486 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25487 <entry>Default: <emphasis>unset</emphasis></entry>
25488 </row>
25489 </tbody>
25490 </tgroup>
25491 </informaltable>
25492 <para>
25493 <indexterm role="concept">
25494 <primary>unqualified addresses</primary>
25495 </indexterm>
25496 <indexterm role="concept">
25497 <primary>host</primary>
25498 <secondary>unqualified addresses from</secondary>
25499 </indexterm>
25500 This option lists those hosts from which Exim is prepared to accept unqualified
25501 recipient addresses in message envelopes. The addresses are made fully
25502 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25503 affects message header lines. Exim does not reject unqualified recipient
25504 addresses in headers, but it qualifies them only if the message came from a
25505 host that matches <option>recipient_unqualified_hosts</option>,
25506 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25507 option was not set.
25508 </para>
25509 <para>
25510 <indexterm role="option">
25511 <primary><option>recipients_max</option></primary>
25512 </indexterm>
25513 </para>
25514 <informaltable frame="all">
25515 <tgroup cols="4" colsep="0" rowsep="0">
25516 <colspec colwidth="8*" align="left"/>
25517 <colspec colwidth="6*" align="center"/>
25518 <colspec colwidth="6*" align="center"/>
25519 <colspec colwidth="6*" align="right"/>
25520 <tbody>
25521 <row>
25522 <entry><option>recipients_max</option></entry>
25523 <entry>Use: <emphasis>main</emphasis></entry>
25524 <entry>Type: <emphasis>integer</emphasis></entry>
25525 <entry>Default: <emphasis>0</emphasis></entry>
25526 </row>
25527 </tbody>
25528 </tgroup>
25529 </informaltable>
25530 <para>
25531 <indexterm role="concept">
25532 <primary>limit</primary>
25533 <secondary>number of recipients</secondary>
25534 </indexterm>
25535 <indexterm role="concept">
25536 <primary>recipient</primary>
25537 <secondary>maximum number</secondary>
25538 </indexterm>
25539 If this option is set greater than zero, it specifies the maximum number of
25540 original recipients for any message. Additional recipients that are generated
25541 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25542 all recipients over the limit; earlier recipients are delivered as normal.
25543 Non-SMTP messages with too many recipients are failed, and no deliveries are
25544 done.
25545 </para>
25546 <para>
25547 <indexterm role="concept">
25548 <primary>RCPT</primary>
25549 <secondary>maximum number of incoming</secondary>
25550 </indexterm>
25551 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25552 RCPT commands in a single message.
25553 </para>
25554 <para>
25555 <indexterm role="option">
25556 <primary><option>recipients_max_reject</option></primary>
25557 </indexterm>
25558 </para>
25559 <informaltable frame="all">
25560 <tgroup cols="4" colsep="0" rowsep="0">
25561 <colspec colwidth="8*" align="left"/>
25562 <colspec colwidth="6*" align="center"/>
25563 <colspec colwidth="6*" align="center"/>
25564 <colspec colwidth="6*" align="right"/>
25565 <tbody>
25566 <row>
25567 <entry><option>recipients_max_reject</option></entry>
25568 <entry>Use: <emphasis>main</emphasis></entry>
25569 <entry>Type: <emphasis>boolean</emphasis></entry>
25570 <entry>Default: <emphasis>false</emphasis></entry>
25571 </row>
25572 </tbody>
25573 </tgroup>
25574 </informaltable>
25575 <para>
25576 If this option is set true, Exim rejects SMTP messages containing too many
25577 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25578 error to the eventual DATA command. Otherwise (the default) it gives a 452
25579 error to the surplus RCPT commands and accepts the message on behalf of the
25580 initial set of recipients. The remote server should then re-send the message
25581 for the remaining recipients at a later time.
25582 </para>
25583 <para>
25584 <indexterm role="option">
25585 <primary><option>remote_max_parallel</option></primary>
25586 </indexterm>
25587 </para>
25588 <informaltable frame="all">
25589 <tgroup cols="4" colsep="0" rowsep="0">
25590 <colspec colwidth="8*" align="left"/>
25591 <colspec colwidth="6*" align="center"/>
25592 <colspec colwidth="6*" align="center"/>
25593 <colspec colwidth="6*" align="right"/>
25594 <tbody>
25595 <row>
25596 <entry><option>remote_max_parallel</option></entry>
25597 <entry>Use: <emphasis>main</emphasis></entry>
25598 <entry>Type: <emphasis>integer</emphasis></entry>
25599 <entry>Default: <emphasis>2</emphasis></entry>
25600 </row>
25601 </tbody>
25602 </tgroup>
25603 </informaltable>
25604 <para>
25605 <indexterm role="concept">
25606 <primary>delivery</primary>
25607 <secondary>parallelism for remote</secondary>
25608 </indexterm>
25609 This option controls parallel delivery of one message to a number of remote
25610 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25611 does all the remote deliveries for a message one by one. Otherwise, if a single
25612 message has to be delivered to more than one remote host, or if several copies
25613 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25614 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25615 deliveries are required, the maximum number of processes are started, and as
25616 each one finishes, another is begun. The order of starting processes is the
25617 same as if sequential delivery were being done, and can be controlled by the
25618 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25619 with debugging turned on, the debugging output from each delivery process is
25620 tagged with its process id.
25621 </para>
25622 <para>
25623 This option controls only the maximum number of parallel deliveries for one
25624 message in one Exim delivery process. Because Exim has no central queue
25625 manager, there is no way of controlling the total number of simultaneous
25626 deliveries if the configuration allows a delivery attempt as soon as a message
25627 is received.
25628 </para>
25629 <para>
25630 <indexterm role="concept">
25631 <primary>number of deliveries</primary>
25632 </indexterm>
25633 <indexterm role="concept">
25634 <primary>delivery</primary>
25635 <secondary>maximum number of</secondary>
25636 </indexterm>
25637 If you want to control the total number of deliveries on the system, you
25638 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25639 are added to the queue without starting a delivery process. Then set up an Exim
25640 daemon to start queue runner processes at appropriate intervals (probably
25641 fairly often, for example, every minute), and limit the total number of queue
25642 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25643 delivers only one message at a time, the maximum number of deliveries that can
25644 then take place at once is <option>queue_run_max</option> multiplied by
25645 <option>remote_max_parallel</option>.
25646 </para>
25647 <para>
25648 If it is purely remote deliveries you want to control, use
25649 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25650 doing the SMTP routing before queueing, so that several messages for the same
25651 host will eventually get delivered down the same connection.
25652 </para>
25653 <para>
25654 <indexterm role="option">
25655 <primary><option>remote_sort_domains</option></primary>
25656 </indexterm>
25657 </para>
25658 <informaltable frame="all">
25659 <tgroup cols="4" colsep="0" rowsep="0">
25660 <colspec colwidth="8*" align="left"/>
25661 <colspec colwidth="6*" align="center"/>
25662 <colspec colwidth="6*" align="center"/>
25663 <colspec colwidth="6*" align="right"/>
25664 <tbody>
25665 <row>
25666 <entry><option>remote_sort_domains</option></entry>
25667 <entry>Use: <emphasis>main</emphasis></entry>
25668 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25669 <entry>Default: <emphasis>unset</emphasis></entry>
25670 </row>
25671 </tbody>
25672 </tgroup>
25673 </informaltable>
25674 <para>
25675 <indexterm role="concept">
25676 <primary>sorting remote deliveries</primary>
25677 </indexterm>
25678 <indexterm role="concept">
25679 <primary>delivery</primary>
25680 <secondary>sorting remote</secondary>
25681 </indexterm>
25682 When there are a number of remote deliveries for a message, they are sorted by
25683 domain into the order given by this list. For example,
25684 </para>
25685 <literallayout class="monospaced">
25686 remote_sort_domains = *.cam.ac.uk:*.uk
25687 </literallayout>
25688 <para>
25689 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25690 then to those in the <option>uk</option> domain, then to any others.
25691 </para>
25692 <para>
25693 <indexterm role="option">
25694 <primary><option>retry_data_expire</option></primary>
25695 </indexterm>
25696 </para>
25697 <informaltable frame="all">
25698 <tgroup cols="4" colsep="0" rowsep="0">
25699 <colspec colwidth="8*" align="left"/>
25700 <colspec colwidth="6*" align="center"/>
25701 <colspec colwidth="6*" align="center"/>
25702 <colspec colwidth="6*" align="right"/>
25703 <tbody>
25704 <row>
25705 <entry><option>retry_data_expire</option></entry>
25706 <entry>Use: <emphasis>main</emphasis></entry>
25707 <entry>Type: <emphasis>time</emphasis></entry>
25708 <entry>Default: <emphasis>7d</emphasis></entry>
25709 </row>
25710 </tbody>
25711 </tgroup>
25712 </informaltable>
25713 <para>
25714 <indexterm role="concept">
25715 <primary>hints database</primary>
25716 <secondary>data expiry</secondary>
25717 </indexterm>
25718 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
25719 database. Any older retry data is ignored. This means that, for example, once a
25720 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25721 past failures.
25722 </para>
25723 <para>
25724 <indexterm role="option">
25725 <primary><option>retry_interval_max</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>retry_interval_max</option></entry>
25737 <entry>Use: <emphasis>main</emphasis></entry>
25738 <entry>Type: <emphasis>time</emphasis></entry>
25739 <entry>Default: <emphasis>24h</emphasis></entry>
25740 </row>
25741 </tbody>
25742 </tgroup>
25743 </informaltable>
25744 <para>
25745 <indexterm role="concept">
25746 <primary>retry</primary>
25747 <secondary>limit on interval</secondary>
25748 </indexterm>
25749 <indexterm role="concept">
25750 <primary>limit</primary>
25751 <secondary>on retry interval</secondary>
25752 </indexterm>
25753 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
25754 intervals between delivery attempts for messages that cannot be delivered
25755 straight away. This option sets an overall limit to the length of time between
25756 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25757 the default value.
25758 </para>
25759 <para>
25760 <indexterm role="option">
25761 <primary><option>return_path_remove</option></primary>
25762 </indexterm>
25763 </para>
25764 <informaltable frame="all">
25765 <tgroup cols="4" colsep="0" rowsep="0">
25766 <colspec colwidth="8*" align="left"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="center"/>
25769 <colspec colwidth="6*" align="right"/>
25770 <tbody>
25771 <row>
25772 <entry><option>return_path_remove</option></entry>
25773 <entry>Use: <emphasis>main</emphasis></entry>
25774 <entry>Type: <emphasis>boolean</emphasis></entry>
25775 <entry>Default: <emphasis>true</emphasis></entry>
25776 </row>
25777 </tbody>
25778 </tgroup>
25779 </informaltable>
25780 <para>
25781 <indexterm role="concept">
25782 <primary><emphasis>Return-path:</emphasis> header line</primary>
25783 <secondary>removing</secondary>
25784 </indexterm>
25785 RFC 2821, section 4.4, states that an SMTP server must insert a
25786 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25787 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25788 MAIL command. This description implies that this header should not be present
25789 in an incoming message. If <option>return_path_remove</option> is true, any existing
25790 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25791 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25792 the time of delivery. They are normally used only for final local deliveries.
25793 </para>
25794 <para>
25795 <indexterm role="option">
25796 <primary><option>return_size_limit</option></primary>
25797 </indexterm>
25798 </para>
25799 <informaltable frame="all">
25800 <tgroup cols="4" colsep="0" rowsep="0">
25801 <colspec colwidth="8*" align="left"/>
25802 <colspec colwidth="6*" align="center"/>
25803 <colspec colwidth="6*" align="center"/>
25804 <colspec colwidth="6*" align="right"/>
25805 <tbody>
25806 <row>
25807 <entry><option>return_size_limit</option></entry>
25808 <entry>Use: <emphasis>main</emphasis></entry>
25809 <entry>Type: <emphasis>integer</emphasis></entry>
25810 <entry>Default: <emphasis>100K</emphasis></entry>
25811 </row>
25812 </tbody>
25813 </tgroup>
25814 </informaltable>
25815 <para>
25816 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25817 </para>
25818 <para>
25819 <indexterm role="option">
25820 <primary><option>rfc1413_hosts</option></primary>
25821 </indexterm>
25822 </para>
25823 <informaltable frame="all">
25824 <tgroup cols="4" colsep="0" rowsep="0">
25825 <colspec colwidth="8*" align="left"/>
25826 <colspec colwidth="6*" align="center"/>
25827 <colspec colwidth="6*" align="center"/>
25828 <colspec colwidth="6*" align="right"/>
25829 <tbody>
25830 <row>
25831 <entry><option>rfc1413_hosts</option></entry>
25832 <entry>Use: <emphasis>main</emphasis></entry>
25833 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25834 <entry>Default: <emphasis>*</emphasis></entry>
25835 </row>
25836 </tbody>
25837 </tgroup>
25838 </informaltable>
25839 <para>
25840 <indexterm role="concept">
25841 <primary>RFC 1413</primary>
25842 </indexterm>
25843 <indexterm role="concept">
25844 <primary>host</primary>
25845 <secondary>for RFC 1413 calls</secondary>
25846 </indexterm>
25847 RFC 1413 identification calls are made to any client host which matches an item
25848 in the list.
25849 </para>
25850 <para>
25851 <indexterm role="option">
25852 <primary><option>rfc1413_query_timeout</option></primary>
25853 </indexterm>
25854 </para>
25855 <informaltable frame="all">
25856 <tgroup cols="4" colsep="0" rowsep="0">
25857 <colspec colwidth="8*" align="left"/>
25858 <colspec colwidth="6*" align="center"/>
25859 <colspec colwidth="6*" align="center"/>
25860 <colspec colwidth="6*" align="right"/>
25861 <tbody>
25862 <row>
25863 <entry><option>rfc1413_query_timeout</option></entry>
25864 <entry>Use: <emphasis>main</emphasis></entry>
25865 <entry>Type: <emphasis>time</emphasis></entry>
25866 <entry>Default: <emphasis>5s</emphasis></entry>
25867 </row>
25868 </tbody>
25869 </tgroup>
25870 </informaltable>
25871 <para>
25872 <indexterm role="concept">
25873 <primary>RFC 1413</primary>
25874 <secondary>query timeout</secondary>
25875 </indexterm>
25876 <indexterm role="concept">
25877 <primary>timeout</primary>
25878 <secondary>for RFC 1413 call</secondary>
25879 </indexterm>
25880 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25881 no RFC 1413 calls are ever made.
25882 </para>
25883 <para>
25884 <indexterm role="option">
25885 <primary><option>sender_unqualified_hosts</option></primary>
25886 </indexterm>
25887 </para>
25888 <informaltable frame="all">
25889 <tgroup cols="4" colsep="0" rowsep="0">
25890 <colspec colwidth="8*" align="left"/>
25891 <colspec colwidth="6*" align="center"/>
25892 <colspec colwidth="6*" align="center"/>
25893 <colspec colwidth="6*" align="right"/>
25894 <tbody>
25895 <row>
25896 <entry><option>sender_unqualified_hosts</option></entry>
25897 <entry>Use: <emphasis>main</emphasis></entry>
25898 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25899 <entry>Default: <emphasis>unset</emphasis></entry>
25900 </row>
25901 </tbody>
25902 </tgroup>
25903 </informaltable>
25904 <para>
25905 <indexterm role="concept">
25906 <primary>unqualified addresses</primary>
25907 </indexterm>
25908 <indexterm role="concept">
25909 <primary>host</primary>
25910 <secondary>unqualified addresses from</secondary>
25911 </indexterm>
25912 This option lists those hosts from which Exim is prepared to accept unqualified
25913 sender addresses. The addresses are made fully qualified by the addition of
25914 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25915 not reject unqualified addresses in headers that contain sender addresses, but
25916 it qualifies them only if the message came from a host that matches
25917 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25918 using TCP/IP), and the <option>-bnq</option> option was not set.
25919 </para>
25920 <para>
25921 <indexterm role="option">
25922 <primary><option>smtp_accept_keepalive</option></primary>
25923 </indexterm>
25924 </para>
25925 <informaltable frame="all">
25926 <tgroup cols="4" colsep="0" rowsep="0">
25927 <colspec colwidth="8*" align="left"/>
25928 <colspec colwidth="6*" align="center"/>
25929 <colspec colwidth="6*" align="center"/>
25930 <colspec colwidth="6*" align="right"/>
25931 <tbody>
25932 <row>
25933 <entry><option>smtp_accept_keepalive</option></entry>
25934 <entry>Use: <emphasis>main</emphasis></entry>
25935 <entry>Type: <emphasis>boolean</emphasis></entry>
25936 <entry>Default: <emphasis>true</emphasis></entry>
25937 </row>
25938 </tbody>
25939 </tgroup>
25940 </informaltable>
25941 <para>
25942 <indexterm role="concept">
25943 <primary>keepalive</primary>
25944 <secondary>on incoming connection</secondary>
25945 </indexterm>
25946 This option controls the setting of the SO_KEEPALIVE option on incoming
25947 TCP/IP socket connections. When set, it causes the kernel to probe idle
25948 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25949 other end of the connection should send an acknowledgment if the connection is
25950 still okay or a reset if the connection has been aborted. The reason for doing
25951 this is that it has the beneficial effect of freeing up certain types of
25952 connection that can get stuck when the remote host is disconnected without
25953 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25954 hours to detect unreachable hosts.
25955 </para>
25956 <para>
25957 <indexterm role="option">
25958 <primary><option>smtp_accept_max</option></primary>
25959 </indexterm>
25960 </para>
25961 <informaltable frame="all">
25962 <tgroup cols="4" colsep="0" rowsep="0">
25963 <colspec colwidth="8*" align="left"/>
25964 <colspec colwidth="6*" align="center"/>
25965 <colspec colwidth="6*" align="center"/>
25966 <colspec colwidth="6*" align="right"/>
25967 <tbody>
25968 <row>
25969 <entry><option>smtp_accept_max</option></entry>
25970 <entry>Use: <emphasis>main</emphasis></entry>
25971 <entry>Type: <emphasis>integer</emphasis></entry>
25972 <entry>Default: <emphasis>20</emphasis></entry>
25973 </row>
25974 </tbody>
25975 </tgroup>
25976 </informaltable>
25977 <para>
25978 <indexterm role="concept">
25979 <primary>limit</primary>
25980 <secondary>incoming SMTP connections</secondary>
25981 </indexterm>
25982 <indexterm role="concept">
25983 <primary>SMTP</primary>
25984 <secondary>incoming connection count</secondary>
25985 </indexterm>
25986 <indexterm role="concept">
25987 <primary>inetd</primary>
25988 </indexterm>
25989 This option specifies the maximum number of simultaneous incoming SMTP calls
25990 that Exim will accept. It applies only to the listening daemon; there is no
25991 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
25992 value is set to zero, no limit is applied. However, it is required to be
25993 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
25994 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
25995 </para>
25996 <para>
25997 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
25998 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
25999 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26000 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26001 </para>
26002 <para>
26003 <indexterm role="option">
26004 <primary><option>smtp_accept_max_nonmail</option></primary>
26005 </indexterm>
26006 </para>
26007 <informaltable frame="all">
26008 <tgroup cols="4" colsep="0" rowsep="0">
26009 <colspec colwidth="8*" align="left"/>
26010 <colspec colwidth="6*" align="center"/>
26011 <colspec colwidth="6*" align="center"/>
26012 <colspec colwidth="6*" align="right"/>
26013 <tbody>
26014 <row>
26015 <entry><option>smtp_accept_max_nonmail</option></entry>
26016 <entry>Use: <emphasis>main</emphasis></entry>
26017 <entry>Type: <emphasis>integer</emphasis></entry>
26018 <entry>Default: <emphasis>10</emphasis></entry>
26019 </row>
26020 </tbody>
26021 </tgroup>
26022 </informaltable>
26023 <para>
26024 <indexterm role="concept">
26025 <primary>limit</primary>
26026 <secondary>non-mail SMTP commands</secondary>
26027 </indexterm>
26028 <indexterm role="concept">
26029 <primary>SMTP</primary>
26030 <secondary>limiting non-mail commands</secondary>
26031 </indexterm>
26032 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26033 the connection if there are too many. This option defines <quote>too many</quote>. The
26034 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26035 client looping sending EHLO, for example. The check is applied only if the
26036 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26037 </para>
26038 <para>
26039 When a new message is expected, one occurrence of RSET is not counted. This
26040 allows a client to send one RSET between messages (this is not necessary,
26041 but some clients do it). Exim also allows one uncounted occurrence of HELO
26042 or EHLO, and one occurrence of STARTTLS between messages. After
26043 starting up a TLS session, another EHLO is expected, and so it too is not
26044 counted. The first occurrence of AUTH in a connection, or immediately
26045 following STARTTLS is not counted. Otherwise, all commands other than
26046 MAIL, RCPT, DATA, and QUIT are counted.
26047 </para>
26048 <para>
26049 <indexterm role="option">
26050 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26051 </indexterm>
26052 </para>
26053 <informaltable frame="all">
26054 <tgroup cols="4" colsep="0" rowsep="0">
26055 <colspec colwidth="8*" align="left"/>
26056 <colspec colwidth="6*" align="center"/>
26057 <colspec colwidth="6*" align="center"/>
26058 <colspec colwidth="6*" align="right"/>
26059 <tbody>
26060 <row>
26061 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26062 <entry>Use: <emphasis>main</emphasis></entry>
26063 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26064 <entry>Default: <emphasis>*</emphasis></entry>
26065 </row>
26066 </tbody>
26067 </tgroup>
26068 </informaltable>
26069 <para>
26070 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26071 check by setting this option. The default value makes it apply to all hosts. By
26072 changing the value, you can exclude any badly-behaved hosts that you have to
26073 live with.
26074 </para>
26075 <para>
26076 <indexterm role="option">
26077 <primary><option>smtp_accept_max_per_connection</option></primary>
26078 </indexterm>
26079 </para>
26080 <informaltable frame="all">
26081 <tgroup cols="4" colsep="0" rowsep="0">
26082 <colspec colwidth="8*" align="left"/>
26083 <colspec colwidth="6*" align="center"/>
26084 <colspec colwidth="6*" align="center"/>
26085 <colspec colwidth="6*" align="right"/>
26086 <tbody>
26087 <row>
26088 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26089 <entry>Use: <emphasis>main</emphasis></entry>
26090 <entry>Type: <emphasis>integer</emphasis></entry>
26091 <entry>Default: <emphasis>1000</emphasis></entry>
26092 </row>
26093 </tbody>
26094 </tgroup>
26095 </informaltable>
26096 <para>
26097 <indexterm role="concept">
26098 <primary>SMTP</primary>
26099 <secondary>limiting incoming message count</secondary>
26100 </indexterm>
26101 <indexterm role="concept">
26102 <primary>limit</primary>
26103 <secondary>messages per SMTP connection</secondary>
26104 </indexterm>
26105 The value of this option limits the number of MAIL commands that Exim is
26106 prepared to accept over a single SMTP connection, whether or not each command
26107 results in the transfer of a message. After the limit is reached, a 421
26108 response is given to subsequent MAIL commands. This limit is a safety
26109 precaution against a client that goes mad (incidents of this type have been
26110 seen).
26111 </para>
26112 <para>
26113 <indexterm role="option">
26114 <primary><option>smtp_accept_max_per_host</option></primary>
26115 </indexterm>
26116 </para>
26117 <informaltable frame="all">
26118 <tgroup cols="4" colsep="0" rowsep="0">
26119 <colspec colwidth="8*" align="left"/>
26120 <colspec colwidth="6*" align="center"/>
26121 <colspec colwidth="6*" align="center"/>
26122 <colspec colwidth="6*" align="right"/>
26123 <tbody>
26124 <row>
26125 <entry><option>smtp_accept_max_per_host</option></entry>
26126 <entry>Use: <emphasis>main</emphasis></entry>
26127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26128 <entry>Default: <emphasis>unset</emphasis></entry>
26129 </row>
26130 </tbody>
26131 </tgroup>
26132 </informaltable>
26133 <para>
26134 <indexterm role="concept">
26135 <primary>limit</primary>
26136 <secondary>SMTP connections from one host</secondary>
26137 </indexterm>
26138 <indexterm role="concept">
26139 <primary>host</primary>
26140 <secondary>limiting SMTP connections from</secondary>
26141 </indexterm>
26142 This option restricts the number of simultaneous IP connections from a single
26143 host (strictly, from a single IP address) to the Exim daemon. The option is
26144 expanded, to enable different limits to be applied to different hosts by
26145 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26146 connection attempts from the same host are rejected with error code 421. This
26147 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
26148 of zero imposes no limit. If this option is set greater than zero, it is
26149 required that <option>smtp_accept_max</option> be non-zero.
26150 </para>
26151 <para>
26152 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26153 constructions that take an appreciable amount of time. The expansion and test
26154 happen in the main daemon loop, in order to reject additional connections
26155 without forking additional processes (otherwise a denial-of-service attack
26156 could cause a vast number or processes to be created). While the daemon is
26157 doing this processing, it cannot accept any other incoming connections.
26158 </para>
26159 <para>
26160 <indexterm role="option">
26161 <primary><option>smtp_accept_queue</option></primary>
26162 </indexterm>
26163 </para>
26164 <informaltable frame="all">
26165 <tgroup cols="4" colsep="0" rowsep="0">
26166 <colspec colwidth="8*" align="left"/>
26167 <colspec colwidth="6*" align="center"/>
26168 <colspec colwidth="6*" align="center"/>
26169 <colspec colwidth="6*" align="right"/>
26170 <tbody>
26171 <row>
26172 <entry><option>smtp_accept_queue</option></entry>
26173 <entry>Use: <emphasis>main</emphasis></entry>
26174 <entry>Type: <emphasis>integer</emphasis></entry>
26175 <entry>Default: <emphasis>0</emphasis></entry>
26176 </row>
26177 </tbody>
26178 </tgroup>
26179 </informaltable>
26180 <para>
26181 <indexterm role="concept">
26182 <primary>SMTP</primary>
26183 <secondary>incoming connection count</secondary>
26184 </indexterm>
26185 <indexterm role="concept">
26186 <primary>queueing incoming messages</primary>
26187 </indexterm>
26188 <indexterm role="concept">
26189 <primary>message</primary>
26190 <secondary>queueing by SMTP connection count</secondary>
26191 </indexterm>
26192 If the number of simultaneous incoming SMTP connections being handled via the
26193 listening daemon exceeds this value, messages received by SMTP are just placed
26194 on the queue; no delivery processes are started automatically. The count is
26195 fixed at the start of an SMTP connection. It cannot be updated in the
26196 subprocess that receives messages, and so the queueing or not queueing applies
26197 to all messages received in the same connection.
26198 </para>
26199 <para>
26200 A value of zero implies no limit, and clearly any non-zero value is useful only
26201 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26202 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26203 various <option>-od</option><emphasis>x</emphasis> command line options.
26204 </para>
26205 <para>
26206 <indexterm role="option">
26207 <primary><option>smtp_accept_queue_per_connection</option></primary>
26208 </indexterm>
26209 </para>
26210 <informaltable frame="all">
26211 <tgroup cols="4" colsep="0" rowsep="0">
26212 <colspec colwidth="8*" align="left"/>
26213 <colspec colwidth="6*" align="center"/>
26214 <colspec colwidth="6*" align="center"/>
26215 <colspec colwidth="6*" align="right"/>
26216 <tbody>
26217 <row>
26218 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
26219 <entry>Use: <emphasis>main</emphasis></entry>
26220 <entry>Type: <emphasis>integer</emphasis></entry>
26221 <entry>Default: <emphasis>10</emphasis></entry>
26222 </row>
26223 </tbody>
26224 </tgroup>
26225 </informaltable>
26226 <para>
26227 <indexterm role="concept">
26228 <primary>queueing incoming messages</primary>
26229 </indexterm>
26230 <indexterm role="concept">
26231 <primary>message</primary>
26232 <secondary>queueing by message count</secondary>
26233 </indexterm>
26234 This option limits the number of delivery processes that Exim starts
26235 automatically when receiving messages via SMTP, whether via the daemon or by
26236 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26237 and the number of messages received in a single SMTP session exceeds this
26238 number, subsequent messages are placed on the queue, but no delivery processes
26239 are started. This helps to limit the number of Exim processes when a server
26240 restarts after downtime and there is a lot of mail waiting for it on other
26241 systems. On large systems, the default should probably be increased, and on
26242 dial-in client systems it should probably be set to zero (that is, disabled).
26243 </para>
26244 <para>
26245 <indexterm role="option">
26246 <primary><option>smtp_accept_reserve</option></primary>
26247 </indexterm>
26248 </para>
26249 <informaltable frame="all">
26250 <tgroup cols="4" colsep="0" rowsep="0">
26251 <colspec colwidth="8*" align="left"/>
26252 <colspec colwidth="6*" align="center"/>
26253 <colspec colwidth="6*" align="center"/>
26254 <colspec colwidth="6*" align="right"/>
26255 <tbody>
26256 <row>
26257 <entry><option>smtp_accept_reserve</option></entry>
26258 <entry>Use: <emphasis>main</emphasis></entry>
26259 <entry>Type: <emphasis>integer</emphasis></entry>
26260 <entry>Default: <emphasis>0</emphasis></entry>
26261 </row>
26262 </tbody>
26263 </tgroup>
26264 </informaltable>
26265 <para>
26266 <indexterm role="concept">
26267 <primary>SMTP</primary>
26268 <secondary>incoming call count</secondary>
26269 </indexterm>
26270 <indexterm role="concept">
26271 <primary>host</primary>
26272 <secondary>reserved</secondary>
26273 </indexterm>
26274 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26275 number of SMTP connections that are reserved for connections from the hosts
26276 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26277 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26278 restricted to this number of connections; the option specifies a minimum number
26279 of connection slots for them, not a maximum. It is a guarantee that this group
26280 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26281 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26282 individual host.
26283 </para>
26284 <para>
26285 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26286 set to 5, once there are 45 active connections (from any hosts), new
26287 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26288 provided the other criteria for acceptance are met.
26289 </para>
26290 <para>
26291 <indexterm role="option">
26292 <primary><option>smtp_active_hostname</option></primary>
26293 </indexterm>
26294 </para>
26295 <informaltable frame="all">
26296 <tgroup cols="4" colsep="0" rowsep="0">
26297 <colspec colwidth="8*" align="left"/>
26298 <colspec colwidth="6*" align="center"/>
26299 <colspec colwidth="6*" align="center"/>
26300 <colspec colwidth="6*" align="right"/>
26301 <tbody>
26302 <row>
26303 <entry><option>smtp_active_hostname</option></entry>
26304 <entry>Use: <emphasis>main</emphasis></entry>
26305 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26306 <entry>Default: <emphasis>unset</emphasis></entry>
26307 </row>
26308 </tbody>
26309 </tgroup>
26310 </informaltable>
26311 <para>
26312 <indexterm role="concept">
26313 <primary>host</primary>
26314 <secondary>name in SMTP responses</secondary>
26315 </indexterm>
26316 <indexterm role="concept">
26317 <primary>SMTP</primary>
26318 <secondary>host name in responses</secondary>
26319 </indexterm>
26320 <indexterm role="variable">
26321 <primary><varname>$primary_hostname</varname></primary>
26322 </indexterm>
26323 This option is provided for multi-homed servers that want to masquerade as
26324 several different hosts. At the start of an incoming SMTP connection, its value
26325 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26326 responses. For example, it is used as domain name in the response to an
26327 incoming HELO or EHLO command.
26328 </para>
26329 <para>
26330 <indexterm role="variable">
26331 <primary><varname>$smtp_active_hostname</varname></primary>
26332 </indexterm>
26333 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26334 is saved with any messages that are received. It is therefore available for use
26335 in routers and transports when the message is later delivered.
26336 </para>
26337 <para>
26338 If this option is unset, or if its expansion is forced to fail, or if the
26339 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26340 used. Other expansion failures cause a message to be written to the main and
26341 panic logs, and the SMTP command receives a temporary error. Typically, the
26342 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26343 For example:
26344 </para>
26345 <literallayout class="monospaced">
26346 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26347   {cox.mydomain}{box.mydomain}}
26348 </literallayout>
26349 <para>
26350 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26351 messages, it is also used as the default for HELO commands in callout
26352 verification if there is no remote transport from which to obtain a
26353 <option>helo_data</option> value.
26354 </para>
26355 <para>
26356 <indexterm role="option">
26357 <primary><option>smtp_banner</option></primary>
26358 </indexterm>
26359 </para>
26360 <informaltable frame="all">
26361 <tgroup cols="4" colsep="0" rowsep="0">
26362 <colspec colwidth="8*" align="left"/>
26363 <colspec colwidth="6*" align="center"/>
26364 <colspec colwidth="6*" align="center"/>
26365 <colspec colwidth="6*" align="right"/>
26366 <tbody>
26367 <row>
26368 <entry><option>smtp_banner</option></entry>
26369 <entry>Use: <emphasis>main</emphasis></entry>
26370 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26371 <entry>Default: <emphasis>see below</emphasis></entry>
26372 </row>
26373 </tbody>
26374 </tgroup>
26375 </informaltable>
26376 <para>
26377 <indexterm role="concept">
26378 <primary>SMTP</primary>
26379 <secondary>welcome banner</secondary>
26380 </indexterm>
26381 <indexterm role="concept">
26382 <primary>banner for SMTP</primary>
26383 </indexterm>
26384 <indexterm role="concept">
26385 <primary>welcome banner for SMTP</primary>
26386 </indexterm>
26387 <indexterm role="concept">
26388 <primary>customizing</primary>
26389 <secondary>SMTP banner</secondary>
26390 </indexterm>
26391 This string, which is expanded every time it is used, is output as the initial
26392 positive response to an SMTP connection. The default setting is:
26393 </para>
26394 <literallayout class="monospaced">
26395 smtp_banner = $smtp_active_hostname ESMTP Exim \
26396   $version_number $tod_full
26397 </literallayout>
26398 <para>
26399 Failure to expand the string causes a panic error. If you want to create a
26400 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26401 appropriate points, but not at the end. Note that the 220 code is not included
26402 in this string. Exim adds it automatically (several times in the case of a
26403 multiline response).
26404 </para>
26405 <para>
26406 <indexterm role="option">
26407 <primary><option>smtp_check_spool_space</option></primary>
26408 </indexterm>
26409 </para>
26410 <informaltable frame="all">
26411 <tgroup cols="4" colsep="0" rowsep="0">
26412 <colspec colwidth="8*" align="left"/>
26413 <colspec colwidth="6*" align="center"/>
26414 <colspec colwidth="6*" align="center"/>
26415 <colspec colwidth="6*" align="right"/>
26416 <tbody>
26417 <row>
26418 <entry><option>smtp_check_spool_space</option></entry>
26419 <entry>Use: <emphasis>main</emphasis></entry>
26420 <entry>Type: <emphasis>boolean</emphasis></entry>
26421 <entry>Default: <emphasis>true</emphasis></entry>
26422 </row>
26423 </tbody>
26424 </tgroup>
26425 </informaltable>
26426 <para>
26427 <indexterm role="concept">
26428 <primary>checking disk space</primary>
26429 </indexterm>
26430 <indexterm role="concept">
26431 <primary>disk space, checking</primary>
26432 </indexterm>
26433 <indexterm role="concept">
26434 <primary>spool directory</primary>
26435 <secondary>checking space</secondary>
26436 </indexterm>
26437 When this option is set, if an incoming SMTP session encounters the SIZE
26438 option on a MAIL command, it checks that there is enough space in the
26439 spool directory&#x2019;s partition to accept a message of that size, while still
26440 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26441 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
26442 </para>
26443 <para>
26444 <indexterm role="option">
26445 <primary><option>smtp_connect_backlog</option></primary>
26446 </indexterm>
26447 </para>
26448 <informaltable frame="all">
26449 <tgroup cols="4" colsep="0" rowsep="0">
26450 <colspec colwidth="8*" align="left"/>
26451 <colspec colwidth="6*" align="center"/>
26452 <colspec colwidth="6*" align="center"/>
26453 <colspec colwidth="6*" align="right"/>
26454 <tbody>
26455 <row>
26456 <entry><option>smtp_connect_backlog</option></entry>
26457 <entry>Use: <emphasis>main</emphasis></entry>
26458 <entry>Type: <emphasis>integer</emphasis></entry>
26459 <entry>Default: <emphasis>20</emphasis></entry>
26460 </row>
26461 </tbody>
26462 </tgroup>
26463 </informaltable>
26464 <para>
26465 <indexterm role="concept">
26466 <primary>connection backlog</primary>
26467 </indexterm>
26468 <indexterm role="concept">
26469 <primary>SMTP</primary>
26470 <secondary>connection backlog</secondary>
26471 </indexterm>
26472 <indexterm role="concept">
26473 <primary>backlog of connections</primary>
26474 </indexterm>
26475 This option specifies a maximum number of waiting SMTP connections. Exim passes
26476 this value to the TCP/IP system when it sets up its listener. Once this number
26477 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
26478 attempts are refused at the TCP/IP level. At least, that is what the manuals
26479 say; in some circumstances such connection attempts have been observed to time
26480 out instead. For large systems it is probably a good idea to increase the
26481 value (to 50, say). It also gives some protection against denial-of-service
26482 attacks by SYN flooding.
26483 </para>
26484 <para>
26485 <indexterm role="option">
26486 <primary><option>smtp_enforce_sync</option></primary>
26487 </indexterm>
26488 </para>
26489 <informaltable frame="all">
26490 <tgroup cols="4" colsep="0" rowsep="0">
26491 <colspec colwidth="8*" align="left"/>
26492 <colspec colwidth="6*" align="center"/>
26493 <colspec colwidth="6*" align="center"/>
26494 <colspec colwidth="6*" align="right"/>
26495 <tbody>
26496 <row>
26497 <entry><option>smtp_enforce_sync</option></entry>
26498 <entry>Use: <emphasis>main</emphasis></entry>
26499 <entry>Type: <emphasis>boolean</emphasis></entry>
26500 <entry>Default: <emphasis>true</emphasis></entry>
26501 </row>
26502 </tbody>
26503 </tgroup>
26504 </informaltable>
26505 <para>
26506 <indexterm role="concept">
26507 <primary>SMTP</primary>
26508 <secondary>synchronization checking</secondary>
26509 </indexterm>
26510 <indexterm role="concept">
26511 <primary>synchronization checking in SMTP</primary>
26512 </indexterm>
26513 The SMTP protocol specification requires the client to wait for a response from
26514 the server at certain points in the dialogue. Without PIPELINING these
26515 synchronization points are after every command; with PIPELINING they are
26516 fewer, but they still exist.
26517 </para>
26518 <para>
26519 Some spamming sites send out a complete set of SMTP commands without waiting
26520 for any response. Exim protects against this by rejecting a message if the
26521 client has sent further input when it should not have. The error response <quote>554
26522 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26523 for this error cannot be perfect because of transmission delays (unexpected
26524 input may be on its way but not yet received when Exim checks). However, it
26525 does detect many instances.
26526 </para>
26527 <para>
26528 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26529 If you want to disable the check selectively (for example, only for certain
26530 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26531 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26532 </para>
26533 <para>
26534 <indexterm role="option">
26535 <primary><option>smtp_etrn_command</option></primary>
26536 </indexterm>
26537 </para>
26538 <informaltable frame="all">
26539 <tgroup cols="4" colsep="0" rowsep="0">
26540 <colspec colwidth="8*" align="left"/>
26541 <colspec colwidth="6*" align="center"/>
26542 <colspec colwidth="6*" align="center"/>
26543 <colspec colwidth="6*" align="right"/>
26544 <tbody>
26545 <row>
26546 <entry><option>smtp_etrn_command</option></entry>
26547 <entry>Use: <emphasis>main</emphasis></entry>
26548 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26549 <entry>Default: <emphasis>unset</emphasis></entry>
26550 </row>
26551 </tbody>
26552 </tgroup>
26553 </informaltable>
26554 <para>
26555 <indexterm role="concept">
26556 <primary>ETRN</primary>
26557 <secondary>command to be run</secondary>
26558 </indexterm>
26559 <indexterm role="variable">
26560 <primary><varname>$domain</varname></primary>
26561 </indexterm>
26562 If this option is set, the given command is run whenever an SMTP ETRN
26563 command is received from a host that is permitted to issue such commands (see
26564 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26565 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26566 argument of the ETRN command, and no syntax checking is done on it. For
26567 example:
26568 </para>
26569 <literallayout class="monospaced">
26570 smtp_etrn_command = /etc/etrn_command $domain \
26571                     $sender_host_address
26572 </literallayout>
26573 <para>
26574 A new process is created to run the command, but Exim does not wait for it to
26575 complete. Consequently, its status cannot be checked. If the command cannot be
26576 run, a line is written to the panic log, but the ETRN caller still receives
26577 a 250 success response. Exim is normally running under its own uid when
26578 receiving SMTP, so it is not possible for it to change the uid before running
26579 the command.
26580 </para>
26581 <para>
26582 <indexterm role="option">
26583 <primary><option>smtp_etrn_serialize</option></primary>
26584 </indexterm>
26585 </para>
26586 <informaltable frame="all">
26587 <tgroup cols="4" colsep="0" rowsep="0">
26588 <colspec colwidth="8*" align="left"/>
26589 <colspec colwidth="6*" align="center"/>
26590 <colspec colwidth="6*" align="center"/>
26591 <colspec colwidth="6*" align="right"/>
26592 <tbody>
26593 <row>
26594 <entry><option>smtp_etrn_serialize</option></entry>
26595 <entry>Use: <emphasis>main</emphasis></entry>
26596 <entry>Type: <emphasis>boolean</emphasis></entry>
26597 <entry>Default: <emphasis>true</emphasis></entry>
26598 </row>
26599 </tbody>
26600 </tgroup>
26601 </informaltable>
26602 <para>
26603 <indexterm role="concept">
26604 <primary>ETRN</primary>
26605 <secondary>serializing</secondary>
26606 </indexterm>
26607 When this option is set, it prevents the simultaneous execution of more than
26608 one identical command as a result of ETRN in an SMTP connection. See
26609 section <xref linkend="SECTETRN"/> for details.
26610 </para>
26611 <para>
26612 <indexterm role="option">
26613 <primary><option>smtp_load_reserve</option></primary>
26614 </indexterm>
26615 </para>
26616 <informaltable frame="all">
26617 <tgroup cols="4" colsep="0" rowsep="0">
26618 <colspec colwidth="8*" align="left"/>
26619 <colspec colwidth="6*" align="center"/>
26620 <colspec colwidth="6*" align="center"/>
26621 <colspec colwidth="6*" align="right"/>
26622 <tbody>
26623 <row>
26624 <entry><option>smtp_load_reserve</option></entry>
26625 <entry>Use: <emphasis>main</emphasis></entry>
26626 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26627 <entry>Default: <emphasis>unset</emphasis></entry>
26628 </row>
26629 </tbody>
26630 </tgroup>
26631 </informaltable>
26632 <para>
26633 <indexterm role="concept">
26634 <primary>load average</primary>
26635 </indexterm>
26636 If the system load average ever gets higher than this, incoming SMTP calls are
26637 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26638 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26639 the load is over the limit. The option has no effect on ancient operating
26640 systems on which Exim cannot determine the load average. See also
26641 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26642 </para>
26643 <para>
26644 <indexterm role="option">
26645 <primary><option>smtp_max_synprot_errors</option></primary>
26646 </indexterm>
26647 </para>
26648 <informaltable frame="all">
26649 <tgroup cols="4" colsep="0" rowsep="0">
26650 <colspec colwidth="8*" align="left"/>
26651 <colspec colwidth="6*" align="center"/>
26652 <colspec colwidth="6*" align="center"/>
26653 <colspec colwidth="6*" align="right"/>
26654 <tbody>
26655 <row>
26656 <entry><option>smtp_max_synprot_errors</option></entry>
26657 <entry>Use: <emphasis>main</emphasis></entry>
26658 <entry>Type: <emphasis>integer</emphasis></entry>
26659 <entry>Default: <emphasis>3</emphasis></entry>
26660 </row>
26661 </tbody>
26662 </tgroup>
26663 </informaltable>
26664 <para>
26665 <indexterm role="concept">
26666 <primary>SMTP</primary>
26667 <secondary>limiting syntax and protocol errors</secondary>
26668 </indexterm>
26669 <indexterm role="concept">
26670 <primary>limit</primary>
26671 <secondary>SMTP syntax and protocol errors</secondary>
26672 </indexterm>
26673 Exim rejects SMTP commands that contain syntax or protocol errors. In
26674 particular, a syntactically invalid email address, as in this command:
26675 </para>
26676 <literallayout class="monospaced">
26677 RCPT TO:&lt;abc xyz@a.b.c&gt;
26678 </literallayout>
26679 <para>
26680 causes immediate rejection of the command, before any other tests are done.
26681 (The ACL cannot be run if there is no valid address to set up for it.) An
26682 example of a protocol error is receiving RCPT before MAIL. If there are
26683 too many syntax or protocol errors in one SMTP session, the connection is
26684 dropped. The limit is set by this option.
26685 </para>
26686 <para>
26687 <indexterm role="concept">
26688 <primary>PIPELINING</primary>
26689 <secondary>expected errors</secondary>
26690 </indexterm>
26691 When the PIPELINING extension to SMTP is in use, some protocol errors are
26692 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26693 Exim assumes that PIPELINING will be used if it advertises it (see
26694 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26695 not count towards the limit.
26696 </para>
26697 <para>
26698 <indexterm role="option">
26699 <primary><option>smtp_max_unknown_commands</option></primary>
26700 </indexterm>
26701 </para>
26702 <informaltable frame="all">
26703 <tgroup cols="4" colsep="0" rowsep="0">
26704 <colspec colwidth="8*" align="left"/>
26705 <colspec colwidth="6*" align="center"/>
26706 <colspec colwidth="6*" align="center"/>
26707 <colspec colwidth="6*" align="right"/>
26708 <tbody>
26709 <row>
26710 <entry><option>smtp_max_unknown_commands</option></entry>
26711 <entry>Use: <emphasis>main</emphasis></entry>
26712 <entry>Type: <emphasis>integer</emphasis></entry>
26713 <entry>Default: <emphasis>3</emphasis></entry>
26714 </row>
26715 </tbody>
26716 </tgroup>
26717 </informaltable>
26718 <para>
26719 <indexterm role="concept">
26720 <primary>SMTP</primary>
26721 <secondary>limiting unknown commands</secondary>
26722 </indexterm>
26723 <indexterm role="concept">
26724 <primary>limit</primary>
26725 <secondary>unknown SMTP commands</secondary>
26726 </indexterm>
26727 If there are too many unrecognized commands in an incoming SMTP session, an
26728 Exim server drops the connection. This is a defence against some kinds of abuse
26729 that subvert web
26730 clients
26731 into making connections to SMTP ports; in these circumstances, a number of
26732 non-SMTP command lines are sent first.
26733 </para>
26734 <para>
26735 <indexterm role="option">
26736 <primary><option>smtp_ratelimit_hosts</option></primary>
26737 </indexterm>
26738 </para>
26739 <informaltable frame="all">
26740 <tgroup cols="4" colsep="0" rowsep="0">
26741 <colspec colwidth="8*" align="left"/>
26742 <colspec colwidth="6*" align="center"/>
26743 <colspec colwidth="6*" align="center"/>
26744 <colspec colwidth="6*" align="right"/>
26745 <tbody>
26746 <row>
26747 <entry><option>smtp_ratelimit_hosts</option></entry>
26748 <entry>Use: <emphasis>main</emphasis></entry>
26749 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26750 <entry>Default: <emphasis>unset</emphasis></entry>
26751 </row>
26752 </tbody>
26753 </tgroup>
26754 </informaltable>
26755 <para>
26756 <indexterm role="concept">
26757 <primary>SMTP</primary>
26758 <secondary>rate limiting</secondary>
26759 </indexterm>
26760 <indexterm role="concept">
26761 <primary>limit</primary>
26762 <secondary>rate of message arrival</secondary>
26763 </indexterm>
26764 <indexterm role="concept">
26765 <primary>RCPT</primary>
26766 <secondary>rate limiting</secondary>
26767 </indexterm>
26768 Some sites find it helpful to be able to limit the rate at which certain hosts
26769 can send them messages, and the rate at which an individual message can specify
26770 recipients.
26771 </para>
26772 <para>
26773 Exim has two rate-limiting facilities. This section describes the older
26774 facility, which can limit rates within a single connection. The newer
26775 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26776 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26777 </para>
26778 <para>
26779 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26780 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26781 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26782 respectively. Each option, if set, must contain a set of four comma-separated
26783 values:
26784 </para>
26785 <itemizedlist>
26786 <listitem>
26787 <para>
26788 A threshold, before which there is no rate limiting.
26789 </para>
26790 </listitem>
26791 <listitem>
26792 <para>
26793 An initial time delay. Unlike other times in Exim, numbers with decimal
26794 fractional parts are allowed here.
26795 </para>
26796 </listitem>
26797 <listitem>
26798 <para>
26799 A factor by which to increase the delay each time.
26800 </para>
26801 </listitem>
26802 <listitem>
26803 <para>
26804 A maximum value for the delay. This should normally be less than 5 minutes,
26805 because after that time, the client is liable to timeout the SMTP command.
26806 </para>
26807 </listitem>
26808 </itemizedlist>
26809 <para>
26810 For example, these settings have been used successfully at the site which
26811 first suggested this feature, for controlling mail from their customers:
26812 </para>
26813 <literallayout class="monospaced">
26814 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26815 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26816 </literallayout>
26817 <para>
26818 The first setting specifies delays that are applied to MAIL commands after
26819 two have been received over a single connection. The initial delay is 0.5
26820 seconds, increasing by a factor of 1.05 each time. The second setting applies
26821 delays to RCPT commands when more than four occur in a single message.
26822 </para>
26823 <para>
26824 <indexterm role="option">
26825 <primary><option>smtp_ratelimit_mail</option></primary>
26826 </indexterm>
26827 </para>
26828 <informaltable frame="all">
26829 <tgroup cols="4" colsep="0" rowsep="0">
26830 <colspec colwidth="8*" align="left"/>
26831 <colspec colwidth="6*" align="center"/>
26832 <colspec colwidth="6*" align="center"/>
26833 <colspec colwidth="6*" align="right"/>
26834 <tbody>
26835 <row>
26836 <entry><option>smtp_ratelimit_mail</option></entry>
26837 <entry>Use: <emphasis>main</emphasis></entry>
26838 <entry>Type: <emphasis>string</emphasis></entry>
26839 <entry>Default: <emphasis>unset</emphasis></entry>
26840 </row>
26841 </tbody>
26842 </tgroup>
26843 </informaltable>
26844 <para>
26845 See <option>smtp_ratelimit_hosts</option> above.
26846 </para>
26847 <para>
26848 <indexterm role="option">
26849 <primary><option>smtp_ratelimit_rcpt</option></primary>
26850 </indexterm>
26851 </para>
26852 <informaltable frame="all">
26853 <tgroup cols="4" colsep="0" rowsep="0">
26854 <colspec colwidth="8*" align="left"/>
26855 <colspec colwidth="6*" align="center"/>
26856 <colspec colwidth="6*" align="center"/>
26857 <colspec colwidth="6*" align="right"/>
26858 <tbody>
26859 <row>
26860 <entry><option>smtp_ratelimit_rcpt</option></entry>
26861 <entry>Use: <emphasis>main</emphasis></entry>
26862 <entry>Type: <emphasis>string</emphasis></entry>
26863 <entry>Default: <emphasis>unset</emphasis></entry>
26864 </row>
26865 </tbody>
26866 </tgroup>
26867 </informaltable>
26868 <para>
26869 See <option>smtp_ratelimit_hosts</option> above.
26870 </para>
26871 <para>
26872 <indexterm role="option">
26873 <primary><option>smtp_receive_timeout</option></primary>
26874 </indexterm>
26875 </para>
26876 <informaltable frame="all">
26877 <tgroup cols="4" colsep="0" rowsep="0">
26878 <colspec colwidth="8*" align="left"/>
26879 <colspec colwidth="6*" align="center"/>
26880 <colspec colwidth="6*" align="center"/>
26881 <colspec colwidth="6*" align="right"/>
26882 <tbody>
26883 <row>
26884 <entry><option>smtp_receive_timeout</option></entry>
26885 <entry>Use: <emphasis>main</emphasis></entry>
26886 <entry>Type: <emphasis>time</emphasis></entry>
26887 <entry>Default: <emphasis>5m</emphasis></entry>
26888 </row>
26889 </tbody>
26890 </tgroup>
26891 </informaltable>
26892 <para>
26893 <indexterm role="concept">
26894 <primary>timeout</primary>
26895 <secondary>for SMTP input</secondary>
26896 </indexterm>
26897 <indexterm role="concept">
26898 <primary>SMTP</primary>
26899 <secondary>input timeout</secondary>
26900 </indexterm>
26901 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26902 input, including batch SMTP. If a line of input (either an SMTP command or a
26903 data line) is not received within this time, the SMTP connection is dropped and
26904 the message is abandoned.
26905 A line is written to the log containing one of the following messages:
26906 </para>
26907 <literallayout class="monospaced">
26908 SMTP command timeout on connection from...
26909 SMTP data timeout on connection from...
26910 </literallayout>
26911 <para>
26912 The former means that Exim was expecting to read an SMTP command; the latter
26913 means that it was in the DATA phase, reading the contents of a message.
26914 </para>
26915 <para>
26916 <indexterm role="option">
26917 <primary><option>-os</option></primary>
26918 </indexterm>
26919 The value set by this option can be overridden by the
26920 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26921 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26922 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26923 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26924 </para>
26925 <para>
26926 <indexterm role="option">
26927 <primary><option>smtp_reserve_hosts</option></primary>
26928 </indexterm>
26929 </para>
26930 <informaltable frame="all">
26931 <tgroup cols="4" colsep="0" rowsep="0">
26932 <colspec colwidth="8*" align="left"/>
26933 <colspec colwidth="6*" align="center"/>
26934 <colspec colwidth="6*" align="center"/>
26935 <colspec colwidth="6*" align="right"/>
26936 <tbody>
26937 <row>
26938 <entry><option>smtp_reserve_hosts</option></entry>
26939 <entry>Use: <emphasis>main</emphasis></entry>
26940 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26941 <entry>Default: <emphasis>unset</emphasis></entry>
26942 </row>
26943 </tbody>
26944 </tgroup>
26945 </informaltable>
26946 <para>
26947 This option defines hosts for which SMTP connections are reserved; see
26948 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26949 </para>
26950 <para>
26951 <indexterm role="option">
26952 <primary><option>smtp_return_error_details</option></primary>
26953 </indexterm>
26954 </para>
26955 <informaltable frame="all">
26956 <tgroup cols="4" colsep="0" rowsep="0">
26957 <colspec colwidth="8*" align="left"/>
26958 <colspec colwidth="6*" align="center"/>
26959 <colspec colwidth="6*" align="center"/>
26960 <colspec colwidth="6*" align="right"/>
26961 <tbody>
26962 <row>
26963 <entry><option>smtp_return_error_details</option></entry>
26964 <entry>Use: <emphasis>main</emphasis></entry>
26965 <entry>Type: <emphasis>boolean</emphasis></entry>
26966 <entry>Default: <emphasis>false</emphasis></entry>
26967 </row>
26968 </tbody>
26969 </tgroup>
26970 </informaltable>
26971 <para>
26972 <indexterm role="concept">
26973 <primary>SMTP</primary>
26974 <secondary>details policy failures</secondary>
26975 </indexterm>
26976 <indexterm role="concept">
26977 <primary>policy control</primary>
26978 <secondary>rejection, returning details</secondary>
26979 </indexterm>
26980 In the default state, Exim uses bland messages such as
26981 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26982 reasons. Many sysadmins like this because it gives away little information
26983 to spammers. However, some other sysadmins who are applying strict checking
26984 policies want to give out much fuller information about failures. Setting
26985 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
26986 example, instead of <quote>Administrative prohibition</quote>, it might give:
26987 </para>
26988 <literallayout class="monospaced">
26989 550-Rejected after DATA: '&gt;' missing at end of address:
26990 550 failing address in "From" header is: &lt;user@dom.ain
26991 </literallayout>
26992 <para>
26993 <indexterm role="option">
26994 <primary><option>spamd_address</option></primary>
26995 </indexterm>
26996 </para>
26997 <informaltable frame="all">
26998 <tgroup cols="4" colsep="0" rowsep="0">
26999 <colspec colwidth="8*" align="left"/>
27000 <colspec colwidth="6*" align="center"/>
27001 <colspec colwidth="6*" align="center"/>
27002 <colspec colwidth="6*" align="right"/>
27003 <tbody>
27004 <row>
27005 <entry><option>spamd_address</option></entry>
27006 <entry>Use: <emphasis>main</emphasis></entry>
27007 <entry>Type: <emphasis>string</emphasis></entry>
27008 <entry>Default: <emphasis>see below</emphasis></entry>
27009 </row>
27010 </tbody>
27011 </tgroup>
27012 </informaltable>
27013 <para>
27014 This option is available when Exim is compiled with the content-scanning
27015 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
27016 The default value is
27017 </para>
27018 <literallayout class="monospaced">
27019 127.0.0.1 783
27020 </literallayout>
27021 <para>
27022 See section <xref linkend="SECTscanspamass"/> for more details.
27023 </para>
27024 <para>
27025 <indexterm role="option">
27026 <primary><option>split_spool_directory</option></primary>
27027 </indexterm>
27028 </para>
27029 <informaltable frame="all">
27030 <tgroup cols="4" colsep="0" rowsep="0">
27031 <colspec colwidth="8*" align="left"/>
27032 <colspec colwidth="6*" align="center"/>
27033 <colspec colwidth="6*" align="center"/>
27034 <colspec colwidth="6*" align="right"/>
27035 <tbody>
27036 <row>
27037 <entry><option>split_spool_directory</option></entry>
27038 <entry>Use: <emphasis>main</emphasis></entry>
27039 <entry>Type: <emphasis>boolean</emphasis></entry>
27040 <entry>Default: <emphasis>false</emphasis></entry>
27041 </row>
27042 </tbody>
27043 </tgroup>
27044 </informaltable>
27045 <para>
27046 <indexterm role="concept">
27047 <primary>multiple spool directories</primary>
27048 </indexterm>
27049 <indexterm role="concept">
27050 <primary>spool directory</primary>
27051 <secondary>split</secondary>
27052 </indexterm>
27053 <indexterm role="concept">
27054 <primary>directories, multiple</primary>
27055 </indexterm>
27056 If this option is set, it causes Exim to split its input directory into 62
27057 subdirectories, each with a single alphanumeric character as its name. The
27058 sixth character of the message id is used to allocate messages to
27059 subdirectories; this is the least significant base-62 digit of the time of
27060 arrival of the message.
27061 </para>
27062 <para>
27063 Splitting up the spool in this way may provide better performance on systems
27064 where there are long mail queues, by reducing the number of files in any one
27065 directory. The msglog directory is also split up in a similar way to the input
27066 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27067 are still placed in the single directory <filename>msglog.OLD</filename>.
27068 </para>
27069 <para>
27070 It is not necessary to take any special action for existing messages when
27071 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27072 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27073 after a period of being on, the subdirectories will eventually empty and be
27074 automatically deleted.
27075 </para>
27076 <para>
27077 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27078 changes. Instead of creating a list of all messages in the queue, and then
27079 trying to deliver each one in turn, it constructs a list of those in one
27080 sub-directory and tries to deliver them, before moving on to the next
27081 sub-directory. The sub-directories are processed in a random order. This
27082 spreads out the scanning of the input directories, and uses less memory. It is
27083 particularly beneficial when there are lots of messages on the queue. However,
27084 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27085 entire queue has to be scanned and sorted before any deliveries can start.
27086 </para>
27087 <para>
27088 <indexterm role="option">
27089 <primary><option>spool_directory</option></primary>
27090 </indexterm>
27091 </para>
27092 <informaltable frame="all">
27093 <tgroup cols="4" colsep="0" rowsep="0">
27094 <colspec colwidth="8*" align="left"/>
27095 <colspec colwidth="6*" align="center"/>
27096 <colspec colwidth="6*" align="center"/>
27097 <colspec colwidth="6*" align="right"/>
27098 <tbody>
27099 <row>
27100 <entry><option>spool_directory</option></entry>
27101 <entry>Use: <emphasis>main</emphasis></entry>
27102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27103 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27104 </row>
27105 </tbody>
27106 </tgroup>
27107 </informaltable>
27108 <para>
27109 <indexterm role="concept">
27110 <primary>spool directory</primary>
27111 <secondary>path to</secondary>
27112 </indexterm>
27113 This defines the directory in which Exim keeps its spool, that is, the messages
27114 it is waiting to deliver. The default value is taken from the compile-time
27115 configuration setting, if there is one. If not, this option must be set. The
27116 string is expanded, so it can contain, for example, a reference to
27117 <varname>$primary_hostname</varname>.
27118 </para>
27119 <para>
27120 If the spool directory name is fixed on your installation, it is recommended
27121 that you set it at build time rather than from this option, particularly if the
27122 log files are being written to the spool directory (see <option>log_file_path</option>).
27123 Otherwise log files cannot be used for errors that are detected early on, such
27124 as failures in the configuration file.
27125 </para>
27126 <para>
27127 By using this option to override the compiled-in path, it is possible to run
27128 tests of Exim without using the standard spool.
27129 </para>
27130 <para>
27131 <indexterm role="option">
27132 <primary><option>sqlite_lock_timeout</option></primary>
27133 </indexterm>
27134 </para>
27135 <informaltable frame="all">
27136 <tgroup cols="4" colsep="0" rowsep="0">
27137 <colspec colwidth="8*" align="left"/>
27138 <colspec colwidth="6*" align="center"/>
27139 <colspec colwidth="6*" align="center"/>
27140 <colspec colwidth="6*" align="right"/>
27141 <tbody>
27142 <row>
27143 <entry><option>sqlite_lock_timeout</option></entry>
27144 <entry>Use: <emphasis>main</emphasis></entry>
27145 <entry>Type: <emphasis>time</emphasis></entry>
27146 <entry>Default: <emphasis>5s</emphasis></entry>
27147 </row>
27148 </tbody>
27149 </tgroup>
27150 </informaltable>
27151 <para>
27152 <indexterm role="concept">
27153 <primary>sqlite lookup type</primary>
27154 <secondary>lock timeout</secondary>
27155 </indexterm>
27156 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27157 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27158 </para>
27159 <para>
27160 <indexterm role="option">
27161 <primary><option>strict_acl_vars</option></primary>
27162 </indexterm>
27163 </para>
27164 <informaltable frame="all">
27165 <tgroup cols="4" colsep="0" rowsep="0">
27166 <colspec colwidth="8*" align="left"/>
27167 <colspec colwidth="6*" align="center"/>
27168 <colspec colwidth="6*" align="center"/>
27169 <colspec colwidth="6*" align="right"/>
27170 <tbody>
27171 <row>
27172 <entry><option>strict_acl_vars</option></entry>
27173 <entry>Use: <emphasis>main</emphasis></entry>
27174 <entry>Type: <emphasis>boolean</emphasis></entry>
27175 <entry>Default: <emphasis>false</emphasis></entry>
27176 </row>
27177 </tbody>
27178 </tgroup>
27179 </informaltable>
27180 <para>
27181 <indexterm role="concept">
27182 <primary>access control lists (ACLs)</primary>
27183 <secondary>variables, handling unset</secondary>
27184 </indexterm>
27185 This option controls what happens if a syntactically valid but undefined ACL
27186 variable is referenced. If it is false (the default), an empty string
27187 is substituted; if it is true, an error is generated. See section
27188 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27189 </para>
27190 <para>
27191 <indexterm role="option">
27192 <primary><option>strip_excess_angle_brackets</option></primary>
27193 </indexterm>
27194 </para>
27195 <informaltable frame="all">
27196 <tgroup cols="4" colsep="0" rowsep="0">
27197 <colspec colwidth="8*" align="left"/>
27198 <colspec colwidth="6*" align="center"/>
27199 <colspec colwidth="6*" align="center"/>
27200 <colspec colwidth="6*" align="right"/>
27201 <tbody>
27202 <row>
27203 <entry><option>strip_excess_angle_brackets</option></entry>
27204 <entry>Use: <emphasis>main</emphasis></entry>
27205 <entry>Type: <emphasis>boolean</emphasis></entry>
27206 <entry>Default: <emphasis>false</emphasis></entry>
27207 </row>
27208 </tbody>
27209 </tgroup>
27210 </informaltable>
27211 <para>
27212 <indexterm role="concept">
27213 <primary>angle brackets, excess</primary>
27214 </indexterm>
27215 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27216 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
27217 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
27218 passed on to another MTA, the excess angle brackets are not passed on. If this
27219 option is not set, multiple pairs of angle brackets cause a syntax error.
27220 </para>
27221 <para>
27222 <indexterm role="option">
27223 <primary><option>strip_trailing_dot</option></primary>
27224 </indexterm>
27225 </para>
27226 <informaltable frame="all">
27227 <tgroup cols="4" colsep="0" rowsep="0">
27228 <colspec colwidth="8*" align="left"/>
27229 <colspec colwidth="6*" align="center"/>
27230 <colspec colwidth="6*" align="center"/>
27231 <colspec colwidth="6*" align="right"/>
27232 <tbody>
27233 <row>
27234 <entry><option>strip_trailing_dot</option></entry>
27235 <entry>Use: <emphasis>main</emphasis></entry>
27236 <entry>Type: <emphasis>boolean</emphasis></entry>
27237 <entry>Default: <emphasis>false</emphasis></entry>
27238 </row>
27239 </tbody>
27240 </tgroup>
27241 </informaltable>
27242 <para>
27243 <indexterm role="concept">
27244 <primary>trailing dot on domain</primary>
27245 </indexterm>
27246 <indexterm role="concept">
27247 <primary>dot</primary>
27248 <secondary>trailing on domain</secondary>
27249 </indexterm>
27250 If this option is set, a trailing dot at the end of a domain in an address is
27251 ignored. If this is in the envelope and the message is passed on to another
27252 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27253 domain causes a syntax error.
27254 However, addresses in header lines are checked only when an ACL requests header
27255 syntax checking.
27256 </para>
27257 <para>
27258 <indexterm role="option">
27259 <primary><option>syslog_duplication</option></primary>
27260 </indexterm>
27261 </para>
27262 <informaltable frame="all">
27263 <tgroup cols="4" colsep="0" rowsep="0">
27264 <colspec colwidth="8*" align="left"/>
27265 <colspec colwidth="6*" align="center"/>
27266 <colspec colwidth="6*" align="center"/>
27267 <colspec colwidth="6*" align="right"/>
27268 <tbody>
27269 <row>
27270 <entry><option>syslog_duplication</option></entry>
27271 <entry>Use: <emphasis>main</emphasis></entry>
27272 <entry>Type: <emphasis>boolean</emphasis></entry>
27273 <entry>Default: <emphasis>true</emphasis></entry>
27274 </row>
27275 </tbody>
27276 </tgroup>
27277 </informaltable>
27278 <para>
27279 <indexterm role="concept">
27280 <primary>syslog</primary>
27281 <secondary>duplicate log lines; suppressing</secondary>
27282 </indexterm>
27283 When Exim is logging to syslog, it writes the log lines for its three
27284 separate logs at different syslog priorities so that they can in principle
27285 be separated on the logging hosts. Some installations do not require this
27286 separation, and in those cases, the duplication of certain log lines is a
27287 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27288 particular log line is written to syslog. For lines that normally go to
27289 both the main log and the reject log, the reject log version (possibly
27290 containing message header lines) is written, at LOG_NOTICE priority.
27291 Lines that normally go to both the main and the panic log are written at
27292 the LOG_ALERT priority.
27293 </para>
27294 <para>
27295 <indexterm role="option">
27296 <primary><option>syslog_facility</option></primary>
27297 </indexterm>
27298 </para>
27299 <informaltable frame="all">
27300 <tgroup cols="4" colsep="0" rowsep="0">
27301 <colspec colwidth="8*" align="left"/>
27302 <colspec colwidth="6*" align="center"/>
27303 <colspec colwidth="6*" align="center"/>
27304 <colspec colwidth="6*" align="right"/>
27305 <tbody>
27306 <row>
27307 <entry><option>syslog_facility</option></entry>
27308 <entry>Use: <emphasis>main</emphasis></entry>
27309 <entry>Type: <emphasis>string</emphasis></entry>
27310 <entry>Default: <emphasis>unset</emphasis></entry>
27311 </row>
27312 </tbody>
27313 </tgroup>
27314 </informaltable>
27315 <para>
27316 <indexterm role="concept">
27317 <primary>syslog</primary>
27318 <secondary>facility; setting</secondary>
27319 </indexterm>
27320 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27321 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27322 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27323 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27324 details of Exim&#x2019;s logging.
27325 </para>
27326 <para>
27327 <indexterm role="option">
27328 <primary><option>syslog_processname</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>syslog_processname</option></entry>
27340 <entry>Use: <emphasis>main</emphasis></entry>
27341 <entry>Type: <emphasis>string</emphasis></entry>
27342 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27343 </row>
27344 </tbody>
27345 </tgroup>
27346 </informaltable>
27347 <para>
27348 <indexterm role="concept">
27349 <primary>syslog</primary>
27350 <secondary>process name; setting</secondary>
27351 </indexterm>
27352 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27353 syslog. The value must be no longer than 32 characters. See chapter
27354 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
27355 </para>
27356 <para>
27357 <indexterm role="option">
27358 <primary><option>syslog_timestamp</option></primary>
27359 </indexterm>
27360 </para>
27361 <informaltable frame="all">
27362 <tgroup cols="4" colsep="0" rowsep="0">
27363 <colspec colwidth="8*" align="left"/>
27364 <colspec colwidth="6*" align="center"/>
27365 <colspec colwidth="6*" align="center"/>
27366 <colspec colwidth="6*" align="right"/>
27367 <tbody>
27368 <row>
27369 <entry><option>syslog_timestamp</option></entry>
27370 <entry>Use: <emphasis>main</emphasis></entry>
27371 <entry>Type: <emphasis>boolean</emphasis></entry>
27372 <entry>Default: <emphasis>true</emphasis></entry>
27373 </row>
27374 </tbody>
27375 </tgroup>
27376 </informaltable>
27377 <para>
27378 <indexterm role="concept">
27379 <primary>syslog</primary>
27380 <secondary>timestamps</secondary>
27381 </indexterm>
27382 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
27383 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27384 details of Exim&#x2019;s logging.
27385 </para>
27386 <para>
27387 <indexterm role="option">
27388 <primary><option>system_filter</option></primary>
27389 </indexterm>
27390 </para>
27391 <informaltable frame="all">
27392 <tgroup cols="4" colsep="0" rowsep="0">
27393 <colspec colwidth="8*" align="left"/>
27394 <colspec colwidth="6*" align="center"/>
27395 <colspec colwidth="6*" align="center"/>
27396 <colspec colwidth="6*" align="right"/>
27397 <tbody>
27398 <row>
27399 <entry><option>system_filter</option></entry>
27400 <entry>Use: <emphasis>main</emphasis></entry>
27401 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27402 <entry>Default: <emphasis>unset</emphasis></entry>
27403 </row>
27404 </tbody>
27405 </tgroup>
27406 </informaltable>
27407 <para>
27408 <indexterm role="concept">
27409 <primary>filter</primary>
27410 <secondary>system filter</secondary>
27411 </indexterm>
27412 <indexterm role="concept">
27413 <primary>system filter</primary>
27414 <secondary>specifying</secondary>
27415 </indexterm>
27416 <indexterm role="concept">
27417 <primary>Sieve filter</primary>
27418 <secondary>not available for system filter</secondary>
27419 </indexterm>
27420 This option specifies an Exim filter file that is applied to all messages at
27421 the start of each delivery attempt, before any routing is done. System filters
27422 must be Exim filters; they cannot be Sieve filters. If the system filter
27423 generates any deliveries to files or pipes, or any new mail messages, the
27424 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27425 which transports are to be used. Details of this facility are given in chapter
27426 <xref linkend="CHAPsystemfilter"/>.
27427 </para>
27428 <para>
27429 <indexterm role="option">
27430 <primary><option>system_filter_directory_transport</option></primary>
27431 </indexterm>
27432 </para>
27433 <informaltable frame="all">
27434 <tgroup cols="4" colsep="0" rowsep="0">
27435 <colspec colwidth="8*" align="left"/>
27436 <colspec colwidth="6*" align="center"/>
27437 <colspec colwidth="6*" align="center"/>
27438 <colspec colwidth="6*" align="right"/>
27439 <tbody>
27440 <row>
27441 <entry><option>system_filter_directory_transport</option></entry>
27442 <entry>Use: <emphasis>main</emphasis></entry>
27443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27444 <entry>Default: <emphasis>unset</emphasis></entry>
27445 </row>
27446 </tbody>
27447 </tgroup>
27448 </informaltable>
27449 <para>
27450 <indexterm role="variable">
27451 <primary><varname>$address_file</varname></primary>
27452 </indexterm>
27453 This sets the name of the transport driver that is to be used when the
27454 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27455 implying delivery of each message into a separate file in some directory.
27456 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27457 </para>
27458 <para>
27459 <indexterm role="option">
27460 <primary><option>system_filter_file_transport</option></primary>
27461 </indexterm>
27462 </para>
27463 <informaltable frame="all">
27464 <tgroup cols="4" colsep="0" rowsep="0">
27465 <colspec colwidth="8*" align="left"/>
27466 <colspec colwidth="6*" align="center"/>
27467 <colspec colwidth="6*" align="center"/>
27468 <colspec colwidth="6*" align="right"/>
27469 <tbody>
27470 <row>
27471 <entry><option>system_filter_file_transport</option></entry>
27472 <entry>Use: <emphasis>main</emphasis></entry>
27473 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27474 <entry>Default: <emphasis>unset</emphasis></entry>
27475 </row>
27476 </tbody>
27477 </tgroup>
27478 </informaltable>
27479 <para>
27480 <indexterm role="concept">
27481 <primary>file</primary>
27482 <secondary>transport for system filter</secondary>
27483 </indexterm>
27484 This sets the name of the transport driver that is to be used when the <option>save</option>
27485 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27486 the delivery, the variable <varname>$address_file</varname> contains the path name.
27487 </para>
27488 <para>
27489 <indexterm role="option">
27490 <primary><option>system_filter_group</option></primary>
27491 </indexterm>
27492 </para>
27493 <informaltable frame="all">
27494 <tgroup cols="4" colsep="0" rowsep="0">
27495 <colspec colwidth="8*" align="left"/>
27496 <colspec colwidth="6*" align="center"/>
27497 <colspec colwidth="6*" align="center"/>
27498 <colspec colwidth="6*" align="right"/>
27499 <tbody>
27500 <row>
27501 <entry><option>system_filter_group</option></entry>
27502 <entry>Use: <emphasis>main</emphasis></entry>
27503 <entry>Type: <emphasis>string</emphasis></entry>
27504 <entry>Default: <emphasis>unset</emphasis></entry>
27505 </row>
27506 </tbody>
27507 </tgroup>
27508 </informaltable>
27509 <para>
27510 <indexterm role="concept">
27511 <primary>gid (group id)</primary>
27512 <secondary>system filter</secondary>
27513 </indexterm>
27514 This option is used only when <option>system_filter_user</option> is also set. It sets the
27515 gid under which the system filter is run, overriding any gid that is associated
27516 with the user. The value may be numerical or symbolic.
27517 </para>
27518 <para>
27519 <indexterm role="option">
27520 <primary><option>system_filter_pipe_transport</option></primary>
27521 </indexterm>
27522 </para>
27523 <informaltable frame="all">
27524 <tgroup cols="4" colsep="0" rowsep="0">
27525 <colspec colwidth="8*" align="left"/>
27526 <colspec colwidth="6*" align="center"/>
27527 <colspec colwidth="6*" align="center"/>
27528 <colspec colwidth="6*" align="right"/>
27529 <tbody>
27530 <row>
27531 <entry><option>system_filter_pipe_transport</option></entry>
27532 <entry>Use: <emphasis>main</emphasis></entry>
27533 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27534 <entry>Default: <emphasis>unset</emphasis></entry>
27535 </row>
27536 </tbody>
27537 </tgroup>
27538 </informaltable>
27539 <para>
27540 <indexterm role="concept">
27541 <primary><command>pipe</command> transport</primary>
27542 <secondary>for system filter</secondary>
27543 </indexterm>
27544 <indexterm role="variable">
27545 <primary><varname>$address_pipe</varname></primary>
27546 </indexterm>
27547 This specifies the transport driver that is to be used when a <option>pipe</option> command
27548 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27549 contains the pipe command.
27550 </para>
27551 <para>
27552 <indexterm role="option">
27553 <primary><option>system_filter_reply_transport</option></primary>
27554 </indexterm>
27555 </para>
27556 <informaltable frame="all">
27557 <tgroup cols="4" colsep="0" rowsep="0">
27558 <colspec colwidth="8*" align="left"/>
27559 <colspec colwidth="6*" align="center"/>
27560 <colspec colwidth="6*" align="center"/>
27561 <colspec colwidth="6*" align="right"/>
27562 <tbody>
27563 <row>
27564 <entry><option>system_filter_reply_transport</option></entry>
27565 <entry>Use: <emphasis>main</emphasis></entry>
27566 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27567 <entry>Default: <emphasis>unset</emphasis></entry>
27568 </row>
27569 </tbody>
27570 </tgroup>
27571 </informaltable>
27572 <para>
27573 <indexterm role="concept">
27574 <primary><command>autoreply</command> transport</primary>
27575 <secondary>for system filter</secondary>
27576 </indexterm>
27577 This specifies the transport driver that is to be used when a <option>mail</option> command
27578 is used in a system filter.
27579 </para>
27580 <para>
27581 <indexterm role="option">
27582 <primary><option>system_filter_user</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>system_filter_user</option></entry>
27594 <entry>Use: <emphasis>main</emphasis></entry>
27595 <entry>Type: <emphasis>string</emphasis></entry>
27596 <entry>Default: <emphasis>unset</emphasis></entry>
27597 </row>
27598 </tbody>
27599 </tgroup>
27600 </informaltable>
27601 <para>
27602 <indexterm role="concept">
27603 <primary>uid (user id)</primary>
27604 <secondary>system filter</secondary>
27605 </indexterm>
27606 If this option is not set, the system filter is run in the main Exim delivery
27607 process, as root. When the option is set, the system filter runs in a separate
27608 process, as the given user. Unless the string consists entirely of digits, it
27609 is looked up in the password data. Failure to find the named user causes a
27610 configuration error. The gid is either taken from the password data, or
27611 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27612 <option>system_filter_group</option> is required to be set.
27613 </para>
27614 <para>
27615 If the system filter generates any pipe, file, or reply deliveries, the uid
27616 under which the filter is run is used when transporting them, unless a
27617 transport option overrides. Normally you should set <option>system_filter_user</option> if
27618 your system filter generates these kinds of delivery.
27619 </para>
27620 <para>
27621 <indexterm role="option">
27622 <primary><option>tcp_nodelay</option></primary>
27623 </indexterm>
27624 </para>
27625 <informaltable frame="all">
27626 <tgroup cols="4" colsep="0" rowsep="0">
27627 <colspec colwidth="8*" align="left"/>
27628 <colspec colwidth="6*" align="center"/>
27629 <colspec colwidth="6*" align="center"/>
27630 <colspec colwidth="6*" align="right"/>
27631 <tbody>
27632 <row>
27633 <entry><option>tcp_nodelay</option></entry>
27634 <entry>Use: <emphasis>main</emphasis></entry>
27635 <entry>Type: <emphasis>boolean</emphasis></entry>
27636 <entry>Default: <emphasis>true</emphasis></entry>
27637 </row>
27638 </tbody>
27639 </tgroup>
27640 </informaltable>
27641 <para>
27642 <indexterm role="concept">
27643 <primary>daemon</primary>
27644 <secondary>TCP_NODELAY on sockets</secondary>
27645 </indexterm>
27646 <indexterm role="concept">
27647 <primary>Nagle algorithm</primary>
27648 </indexterm>
27649 <indexterm role="concept">
27650 <primary>TCP_NODELAY on listening sockets</primary>
27651 </indexterm>
27652 If this option is set false, it stops the Exim daemon setting the
27653 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27654 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27655 performance in interactive (character-by-character) situations. Turning it off
27656 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
27657 However, it appears that some broken clients cannot cope, and time out. Hence
27658 this option. It affects only those sockets that are set up for listening by the
27659 daemon. Sockets created by the smtp transport for delivering mail always set
27660 TCP_NODELAY.
27661 </para>
27662 <para>
27663 <indexterm role="option">
27664 <primary><option>timeout_frozen_after</option></primary>
27665 </indexterm>
27666 </para>
27667 <informaltable frame="all">
27668 <tgroup cols="4" colsep="0" rowsep="0">
27669 <colspec colwidth="8*" align="left"/>
27670 <colspec colwidth="6*" align="center"/>
27671 <colspec colwidth="6*" align="center"/>
27672 <colspec colwidth="6*" align="right"/>
27673 <tbody>
27674 <row>
27675 <entry><option>timeout_frozen_after</option></entry>
27676 <entry>Use: <emphasis>main</emphasis></entry>
27677 <entry>Type: <emphasis>time</emphasis></entry>
27678 <entry>Default: <emphasis>0s</emphasis></entry>
27679 </row>
27680 </tbody>
27681 </tgroup>
27682 </informaltable>
27683 <para>
27684 <indexterm role="concept">
27685 <primary>frozen messages</primary>
27686 <secondary>timing out</secondary>
27687 </indexterm>
27688 <indexterm role="concept">
27689 <primary>timeout</primary>
27690 <secondary>frozen messages</secondary>
27691 </indexterm>
27692 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27693 message of any kind that has been on the queue for longer than the given time
27694 is automatically cancelled at the next queue run. If the frozen message is a
27695 bounce message, it is just discarded; otherwise, a bounce is sent to the
27696 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27697 If you want to timeout frozen bounce messages earlier than other kinds of
27698 frozen message, see <option>ignore_bounce_errors_after</option>.
27699 </para>
27700 <para>
27701 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27702 frozen messages remain on the queue forever (except for any frozen bounce
27703 messages that are released by <option>ignore_bounce_errors_after</option>).
27704 </para>
27705 <para>
27706 <indexterm role="option">
27707 <primary><option>timezone</option></primary>
27708 </indexterm>
27709 </para>
27710 <informaltable frame="all">
27711 <tgroup cols="4" colsep="0" rowsep="0">
27712 <colspec colwidth="8*" align="left"/>
27713 <colspec colwidth="6*" align="center"/>
27714 <colspec colwidth="6*" align="center"/>
27715 <colspec colwidth="6*" align="right"/>
27716 <tbody>
27717 <row>
27718 <entry><option>timezone</option></entry>
27719 <entry>Use: <emphasis>main</emphasis></entry>
27720 <entry>Type: <emphasis>string</emphasis></entry>
27721 <entry>Default: <emphasis>unset</emphasis></entry>
27722 </row>
27723 </tbody>
27724 </tgroup>
27725 </informaltable>
27726 <para>
27727 <indexterm role="concept">
27728 <primary>timezone, setting</primary>
27729 </indexterm>
27730 The value of <option>timezone</option> is used to set the environment variable TZ while
27731 running Exim (if it is different on entry). This ensures that all timestamps
27732 created by Exim are in the required timezone. If you want all your timestamps
27733 to be in UTC (aka GMT) you should set
27734 </para>
27735 <literallayout class="monospaced">
27736 timezone = UTC
27737 </literallayout>
27738 <para>
27739 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27740 or, if that is not set, from the value of the TZ environment variable when Exim
27741 is built. If <option>timezone</option> is set to the empty string, either at build or run
27742 time, any existing TZ variable is removed from the environment when Exim
27743 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27744 unfortunately not all, operating systems.
27745 </para>
27746 <para>
27747 <indexterm role="option">
27748 <primary><option>tls_advertise_hosts</option></primary>
27749 </indexterm>
27750 </para>
27751 <informaltable frame="all">
27752 <tgroup cols="4" colsep="0" rowsep="0">
27753 <colspec colwidth="8*" align="left"/>
27754 <colspec colwidth="6*" align="center"/>
27755 <colspec colwidth="6*" align="center"/>
27756 <colspec colwidth="6*" align="right"/>
27757 <tbody>
27758 <row>
27759 <entry><option>tls_advertise_hosts</option></entry>
27760 <entry>Use: <emphasis>main</emphasis></entry>
27761 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27762 <entry>Default: <emphasis>unset</emphasis></entry>
27763 </row>
27764 </tbody>
27765 </tgroup>
27766 </informaltable>
27767 <para>
27768 <indexterm role="concept">
27769 <primary>TLS</primary>
27770 <secondary>advertising</secondary>
27771 </indexterm>
27772 <indexterm role="concept">
27773 <primary>encryption</primary>
27774 <secondary>on SMTP connection</secondary>
27775 </indexterm>
27776 <indexterm role="concept">
27777 <primary>SMTP</primary>
27778 <secondary>encrypted connection</secondary>
27779 </indexterm>
27780 When Exim is built with support for TLS encrypted connections, the availability
27781 of the STARTTLS command to set up an encrypted session is advertised in
27782 response to EHLO only to those client hosts that match this option. See
27783 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
27784 </para>
27785 <para>
27786 <indexterm role="option">
27787 <primary><option>tls_certificate</option></primary>
27788 </indexterm>
27789 </para>
27790 <informaltable frame="all">
27791 <tgroup cols="4" colsep="0" rowsep="0">
27792 <colspec colwidth="8*" align="left"/>
27793 <colspec colwidth="6*" align="center"/>
27794 <colspec colwidth="6*" align="center"/>
27795 <colspec colwidth="6*" align="right"/>
27796 <tbody>
27797 <row>
27798 <entry><option>tls_certificate</option></entry>
27799 <entry>Use: <emphasis>main</emphasis></entry>
27800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27801 <entry>Default: <emphasis>unset</emphasis></entry>
27802 </row>
27803 </tbody>
27804 </tgroup>
27805 </informaltable>
27806 <para>
27807 <indexterm role="concept">
27808 <primary>TLS</primary>
27809 <secondary>server certificate; location of</secondary>
27810 </indexterm>
27811 <indexterm role="concept">
27812 <primary>certificate</primary>
27813 <secondary>server, location of</secondary>
27814 </indexterm>
27815 The value of this option is expanded, and must then be the absolute path to a
27816 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
27817 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27818 <xref linkend="CHAPTLS"/> for further details.
27819 </para>
27820 <para>
27821 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27822 receiving incoming messages as a server. If you want to supply certificates for
27823 use when sending messages as a client, you must set the <option>tls_certificate</option>
27824 option in the relevant <command>smtp</command> transport.
27825 </para>
27826 <para>
27827 <indexterm role="option">
27828 <primary><option>tls_crl</option></primary>
27829 </indexterm>
27830 </para>
27831 <informaltable frame="all">
27832 <tgroup cols="4" colsep="0" rowsep="0">
27833 <colspec colwidth="8*" align="left"/>
27834 <colspec colwidth="6*" align="center"/>
27835 <colspec colwidth="6*" align="center"/>
27836 <colspec colwidth="6*" align="right"/>
27837 <tbody>
27838 <row>
27839 <entry><option>tls_crl</option></entry>
27840 <entry>Use: <emphasis>main</emphasis></entry>
27841 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27842 <entry>Default: <emphasis>unset</emphasis></entry>
27843 </row>
27844 </tbody>
27845 </tgroup>
27846 </informaltable>
27847 <para>
27848 <indexterm role="concept">
27849 <primary>TLS</primary>
27850 <secondary>server certificate revocation list</secondary>
27851 </indexterm>
27852 <indexterm role="concept">
27853 <primary>certificate</primary>
27854 <secondary>revocation list for server</secondary>
27855 </indexterm>
27856 This option specifies a certificate revocation list. The expanded value must
27857 be the name of a file that contains a CRL in PEM format.
27858 </para>
27859 <para>
27860 <indexterm role="option">
27861 <primary><option>tls_dhparam</option></primary>
27862 </indexterm>
27863 </para>
27864 <informaltable frame="all">
27865 <tgroup cols="4" colsep="0" rowsep="0">
27866 <colspec colwidth="8*" align="left"/>
27867 <colspec colwidth="6*" align="center"/>
27868 <colspec colwidth="6*" align="center"/>
27869 <colspec colwidth="6*" align="right"/>
27870 <tbody>
27871 <row>
27872 <entry><option>tls_dhparam</option></entry>
27873 <entry>Use: <emphasis>main</emphasis></entry>
27874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27875 <entry>Default: <emphasis>unset</emphasis></entry>
27876 </row>
27877 </tbody>
27878 </tgroup>
27879 </informaltable>
27880 <para>
27881 <indexterm role="concept">
27882 <primary>TLS</primary>
27883 <secondary>D-H parameters for server</secondary>
27884 </indexterm>
27885 The value of this option is expanded, and must then be the absolute path to
27886 a file which contains the server&#x2019;s DH parameter values.
27887 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27888 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27889 </para>
27890 <para>
27891 <indexterm role="option">
27892 <primary><option>tls_on_connect_ports</option></primary>
27893 </indexterm>
27894 </para>
27895 <informaltable frame="all">
27896 <tgroup cols="4" colsep="0" rowsep="0">
27897 <colspec colwidth="8*" align="left"/>
27898 <colspec colwidth="6*" align="center"/>
27899 <colspec colwidth="6*" align="center"/>
27900 <colspec colwidth="6*" align="right"/>
27901 <tbody>
27902 <row>
27903 <entry><option>tls_on_connect_ports</option></entry>
27904 <entry>Use: <emphasis>main</emphasis></entry>
27905 <entry>Type: <emphasis>string list</emphasis></entry>
27906 <entry>Default: <emphasis>unset</emphasis></entry>
27907 </row>
27908 </tbody>
27909 </tgroup>
27910 </informaltable>
27911 <para>
27912 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27913 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27914 set up without waiting for the client to issue a STARTTLS command. For
27915 further details, see section <xref linkend="SECTsupobssmt"/>.
27916 </para>
27917 <para>
27918 <indexterm role="option">
27919 <primary><option>tls_privatekey</option></primary>
27920 </indexterm>
27921 </para>
27922 <informaltable frame="all">
27923 <tgroup cols="4" colsep="0" rowsep="0">
27924 <colspec colwidth="8*" align="left"/>
27925 <colspec colwidth="6*" align="center"/>
27926 <colspec colwidth="6*" align="center"/>
27927 <colspec colwidth="6*" align="right"/>
27928 <tbody>
27929 <row>
27930 <entry><option>tls_privatekey</option></entry>
27931 <entry>Use: <emphasis>main</emphasis></entry>
27932 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27933 <entry>Default: <emphasis>unset</emphasis></entry>
27934 </row>
27935 </tbody>
27936 </tgroup>
27937 </informaltable>
27938 <para>
27939 <indexterm role="concept">
27940 <primary>TLS</primary>
27941 <secondary>server private key; location of</secondary>
27942 </indexterm>
27943 The value of this option is expanded, and must then be the absolute path to a
27944 file which contains the server&#x2019;s private key. If this option is unset, or if
27945 the expansion is forced to fail, or the result is an empty string, the private
27946 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
27947 <xref linkend="CHAPTLS"/> for further details.
27948 </para>
27949 <para>
27950 <indexterm role="option">
27951 <primary><option>tls_remember_esmtp</option></primary>
27952 </indexterm>
27953 </para>
27954 <informaltable frame="all">
27955 <tgroup cols="4" colsep="0" rowsep="0">
27956 <colspec colwidth="8*" align="left"/>
27957 <colspec colwidth="6*" align="center"/>
27958 <colspec colwidth="6*" align="center"/>
27959 <colspec colwidth="6*" align="right"/>
27960 <tbody>
27961 <row>
27962 <entry><option>tls_remember_esmtp</option></entry>
27963 <entry>Use: <emphasis>main</emphasis></entry>
27964 <entry>Type: <emphasis>boolean</emphasis></entry>
27965 <entry>Default: <emphasis>false</emphasis></entry>
27966 </row>
27967 </tbody>
27968 </tgroup>
27969 </informaltable>
27970 <para>
27971 <indexterm role="concept">
27972 <primary>TLS</primary>
27973 <secondary>esmtp state; remembering</secondary>
27974 </indexterm>
27975 <indexterm role="concept">
27976 <primary>TLS</primary>
27977 <secondary>broken clients</secondary>
27978 </indexterm>
27979 If this option is set true, Exim violates the RFCs by remembering that it is in
27980 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27981 support for broken clients that fail to send a new EHLO after starting a
27982 TLS session.
27983 </para>
27984 <para>
27985 <indexterm role="option">
27986 <primary><option>tls_require_ciphers</option></primary>
27987 </indexterm>
27988 </para>
27989 <informaltable frame="all">
27990 <tgroup cols="4" colsep="0" rowsep="0">
27991 <colspec colwidth="8*" align="left"/>
27992 <colspec colwidth="6*" align="center"/>
27993 <colspec colwidth="6*" align="center"/>
27994 <colspec colwidth="6*" align="right"/>
27995 <tbody>
27996 <row>
27997 <entry><option>tls_require_ciphers</option></entry>
27998 <entry>Use: <emphasis>main</emphasis></entry>
27999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28000 <entry>Default: <emphasis>unset</emphasis></entry>
28001 </row>
28002 </tbody>
28003 </tgroup>
28004 </informaltable>
28005 <para>
28006 <indexterm role="concept">
28007 <primary>TLS</primary>
28008 <secondary>requiring specific ciphers</secondary>
28009 </indexterm>
28010 <indexterm role="concept">
28011 <primary>cipher</primary>
28012 <secondary>requiring specific</secondary>
28013 </indexterm>
28014 This option controls which ciphers can be used for incoming TLS connections.
28015 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28016 connections. This option is expanded for each connection, so can be varied for
28017 different clients if required. The value of this option must be a list of
28018 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28019 in somewhat different ways. If GnuTLS is being used, the client controls the
28020 preference order of the available ciphers. Details are given in sections
28021 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28022 </para>
28023 <para>
28024 <indexterm role="option">
28025 <primary><option>tls_try_verify_hosts</option></primary>
28026 </indexterm>
28027 </para>
28028 <informaltable frame="all">
28029 <tgroup cols="4" colsep="0" rowsep="0">
28030 <colspec colwidth="8*" align="left"/>
28031 <colspec colwidth="6*" align="center"/>
28032 <colspec colwidth="6*" align="center"/>
28033 <colspec colwidth="6*" align="right"/>
28034 <tbody>
28035 <row>
28036 <entry><option>tls_try_verify_hosts</option></entry>
28037 <entry>Use: <emphasis>main</emphasis></entry>
28038 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28039 <entry>Default: <emphasis>unset</emphasis></entry>
28040 </row>
28041 </tbody>
28042 </tgroup>
28043 </informaltable>
28044 <para>
28045 <indexterm role="concept">
28046 <primary>TLS</primary>
28047 <secondary>client certificate verification</secondary>
28048 </indexterm>
28049 <indexterm role="concept">
28050 <primary>certificate</primary>
28051 <secondary>verification of client</secondary>
28052 </indexterm>
28053 See <option>tls_verify_hosts</option> below.
28054 </para>
28055 <para>
28056 <indexterm role="option">
28057 <primary><option>tls_verify_certificates</option></primary>
28058 </indexterm>
28059 </para>
28060 <informaltable frame="all">
28061 <tgroup cols="4" colsep="0" rowsep="0">
28062 <colspec colwidth="8*" align="left"/>
28063 <colspec colwidth="6*" align="center"/>
28064 <colspec colwidth="6*" align="center"/>
28065 <colspec colwidth="6*" align="right"/>
28066 <tbody>
28067 <row>
28068 <entry><option>tls_verify_certificates</option></entry>
28069 <entry>Use: <emphasis>main</emphasis></entry>
28070 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28071 <entry>Default: <emphasis>unset</emphasis></entry>
28072 </row>
28073 </tbody>
28074 </tgroup>
28075 </informaltable>
28076 <para>
28077 <indexterm role="concept">
28078 <primary>TLS</primary>
28079 <secondary>client certificate verification</secondary>
28080 </indexterm>
28081 <indexterm role="concept">
28082 <primary>certificate</primary>
28083 <secondary>verification of client</secondary>
28084 </indexterm>
28085 The value of this option is expanded, and must then be the absolute path to
28086 a file containing permitted certificates for clients that
28087 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28088 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28089 directory containing certificate files. This does not work with GnuTLS; the
28090 option must be set to the name of a single file if you are using GnuTLS.
28091 </para>
28092 <para>
28093 <indexterm role="option">
28094 <primary><option>tls_verify_hosts</option></primary>
28095 </indexterm>
28096 </para>
28097 <informaltable frame="all">
28098 <tgroup cols="4" colsep="0" rowsep="0">
28099 <colspec colwidth="8*" align="left"/>
28100 <colspec colwidth="6*" align="center"/>
28101 <colspec colwidth="6*" align="center"/>
28102 <colspec colwidth="6*" align="right"/>
28103 <tbody>
28104 <row>
28105 <entry><option>tls_verify_hosts</option></entry>
28106 <entry>Use: <emphasis>main</emphasis></entry>
28107 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28108 <entry>Default: <emphasis>unset</emphasis></entry>
28109 </row>
28110 </tbody>
28111 </tgroup>
28112 </informaltable>
28113 <para>
28114 <indexterm role="concept">
28115 <primary>TLS</primary>
28116 <secondary>client certificate verification</secondary>
28117 </indexterm>
28118 <indexterm role="concept">
28119 <primary>certificate</primary>
28120 <secondary>verification of client</secondary>
28121 </indexterm>
28122 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28123 certificates from clients. The expected certificates are defined by
28124 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28125 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28126 <option>tls_verify_certificates</option> is not set.
28127 </para>
28128 <para>
28129 Any client that matches <option>tls_verify_hosts</option> is constrained by
28130 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28131 present one of the listed certificates. If it does not, the connection is
28132 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28133 the host to use TLS. It can still send SMTP commands through unencrypted
28134 connections. Forcing a client to use TLS has to be done separately using an
28135 ACL to reject inappropriate commands when the connection is not encrypted.
28136 </para>
28137 <para>
28138 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28139 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28140 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28141 abort the connection if there is no certificate or if it does not match. This
28142 state can be detected in an ACL, which makes it possible to implement policies
28143 such as <quote>accept for relay only if a verified certificate has been received,
28144 but accept for local delivery if encrypted, even without a verified
28145 certificate</quote>.
28146 </para>
28147 <para>
28148 Client hosts that match neither of these lists are not asked to present
28149 certificates.
28150 </para>
28151 <para>
28152 <indexterm role="option">
28153 <primary><option>trusted_groups</option></primary>
28154 </indexterm>
28155 </para>
28156 <informaltable frame="all">
28157 <tgroup cols="4" colsep="0" rowsep="0">
28158 <colspec colwidth="8*" align="left"/>
28159 <colspec colwidth="6*" align="center"/>
28160 <colspec colwidth="6*" align="center"/>
28161 <colspec colwidth="6*" align="right"/>
28162 <tbody>
28163 <row>
28164 <entry><option>trusted_groups</option></entry>
28165 <entry>Use: <emphasis>main</emphasis></entry>
28166 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28167 <entry>Default: <emphasis>unset</emphasis></entry>
28168 </row>
28169 </tbody>
28170 </tgroup>
28171 </informaltable>
28172 <para>
28173 <indexterm role="concept">
28174 <primary>trusted groups</primary>
28175 </indexterm>
28176 <indexterm role="concept">
28177 <primary>groups</primary>
28178 <secondary>trusted</secondary>
28179 </indexterm>
28180 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28181 option is set, any process that is running in one of the listed groups, or
28182 which has one of them as a supplementary group, is trusted. The groups can be
28183 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28184 details of what trusted callers are permitted to do. If neither
28185 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28186 are trusted.
28187 </para>
28188 <para>
28189 <indexterm role="option">
28190 <primary><option>trusted_users</option></primary>
28191 </indexterm>
28192 </para>
28193 <informaltable frame="all">
28194 <tgroup cols="4" colsep="0" rowsep="0">
28195 <colspec colwidth="8*" align="left"/>
28196 <colspec colwidth="6*" align="center"/>
28197 <colspec colwidth="6*" align="center"/>
28198 <colspec colwidth="6*" align="right"/>
28199 <tbody>
28200 <row>
28201 <entry><option>trusted_users</option></entry>
28202 <entry>Use: <emphasis>main</emphasis></entry>
28203 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28204 <entry>Default: <emphasis>unset</emphasis></entry>
28205 </row>
28206 </tbody>
28207 </tgroup>
28208 </informaltable>
28209 <para>
28210 <indexterm role="concept">
28211 <primary>trusted users</primary>
28212 </indexterm>
28213 <indexterm role="concept">
28214 <primary>user</primary>
28215 <secondary>trusted</secondary>
28216 </indexterm>
28217 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28218 option is set, any process that is running as one of the listed users is
28219 trusted. The users can be specified numerically or by name. See section
28220 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28221 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28222 Exim user are trusted.
28223 </para>
28224 <para>
28225 <indexterm role="option">
28226 <primary><option>unknown_login</option></primary>
28227 </indexterm>
28228 </para>
28229 <informaltable frame="all">
28230 <tgroup cols="4" colsep="0" rowsep="0">
28231 <colspec colwidth="8*" align="left"/>
28232 <colspec colwidth="6*" align="center"/>
28233 <colspec colwidth="6*" align="center"/>
28234 <colspec colwidth="6*" align="right"/>
28235 <tbody>
28236 <row>
28237 <entry><option>unknown_login</option></entry>
28238 <entry>Use: <emphasis>main</emphasis></entry>
28239 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28240 <entry>Default: <emphasis>unset</emphasis></entry>
28241 </row>
28242 </tbody>
28243 </tgroup>
28244 </informaltable>
28245 <para>
28246 <indexterm role="concept">
28247 <primary>uid (user id)</primary>
28248 <secondary>unknown caller</secondary>
28249 </indexterm>
28250 <indexterm role="variable">
28251 <primary><varname>$caller_uid</varname></primary>
28252 </indexterm>
28253 This is a specialized feature for use in unusual configurations. By default, if
28254 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28255 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28256 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28257 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28258 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
28259 <option>-F</option> option.
28260 </para>
28261 <para>
28262 <indexterm role="option">
28263 <primary><option>unknown_username</option></primary>
28264 </indexterm>
28265 </para>
28266 <informaltable frame="all">
28267 <tgroup cols="4" colsep="0" rowsep="0">
28268 <colspec colwidth="8*" align="left"/>
28269 <colspec colwidth="6*" align="center"/>
28270 <colspec colwidth="6*" align="center"/>
28271 <colspec colwidth="6*" align="right"/>
28272 <tbody>
28273 <row>
28274 <entry><option>unknown_username</option></entry>
28275 <entry>Use: <emphasis>main</emphasis></entry>
28276 <entry>Type: <emphasis>string</emphasis></entry>
28277 <entry>Default: <emphasis>unset</emphasis></entry>
28278 </row>
28279 </tbody>
28280 </tgroup>
28281 </informaltable>
28282 <para>
28283 See <option>unknown_login</option>.
28284 </para>
28285 <para>
28286 <indexterm role="option">
28287 <primary><option>untrusted_set_sender</option></primary>
28288 </indexterm>
28289 </para>
28290 <informaltable frame="all">
28291 <tgroup cols="4" colsep="0" rowsep="0">
28292 <colspec colwidth="8*" align="left"/>
28293 <colspec colwidth="6*" align="center"/>
28294 <colspec colwidth="6*" align="center"/>
28295 <colspec colwidth="6*" align="right"/>
28296 <tbody>
28297 <row>
28298 <entry><option>untrusted_set_sender</option></entry>
28299 <entry>Use: <emphasis>main</emphasis></entry>
28300 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
28301 <entry>Default: <emphasis>unset</emphasis></entry>
28302 </row>
28303 </tbody>
28304 </tgroup>
28305 </informaltable>
28306 <para>
28307 <indexterm role="concept">
28308 <primary>trusted users</primary>
28309 </indexterm>
28310 <indexterm role="concept">
28311 <primary>sender</primary>
28312 <secondary>setting by untrusted user</secondary>
28313 </indexterm>
28314 <indexterm role="concept">
28315 <primary>untrusted user setting sender</primary>
28316 </indexterm>
28317 <indexterm role="concept">
28318 <primary>user</primary>
28319 <secondary>untrusted setting sender</secondary>
28320 </indexterm>
28321 <indexterm role="concept">
28322 <primary>envelope sender</primary>
28323 </indexterm>
28324 When an untrusted user submits a message to Exim using the standard input, Exim
28325 normally creates an envelope sender address from the user&#x2019;s login and the
28326 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28327 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28328 is used) is ignored.
28329 </para>
28330 <para>
28331 However, untrusted users are permitted to set an empty envelope sender address,
28332 to declare that a message should never generate any bounces. For example:
28333 </para>
28334 <literallayout class="monospaced">
28335 exim -f '&lt;&gt;' user@domain.example
28336 </literallayout>
28337 <para>
28338 <indexterm role="variable">
28339 <primary><varname>$sender_ident</varname></primary>
28340 </indexterm>
28341 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28342 other envelope sender addresses in a controlled way. When it is set, untrusted
28343 users are allowed to set envelope sender addresses that match any of the
28344 patterns in the list. Like all address lists, the string is expanded. The
28345 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28346 users to setting senders that start with their login ids
28347 followed by a hyphen
28348 by a setting like this:
28349 </para>
28350 <literallayout class="monospaced">
28351 untrusted_set_sender = ^$sender_ident-
28352 </literallayout>
28353 <para>
28354 If you want to allow untrusted users to set envelope sender addresses without
28355 restriction, you can use
28356 </para>
28357 <literallayout class="monospaced">
28358 untrusted_set_sender = *
28359 </literallayout>
28360 <para>
28361 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28362 only to the setting of the envelope sender. It does not permit untrusted users
28363 to use the other options which trusted user can use to override message
28364 parameters. Furthermore, it does not stop Exim from removing an existing
28365 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28366 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28367 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28368 described in section <xref linkend="SECTthesenhea"/>.
28369 </para>
28370 <para>
28371 The log line for a message&#x2019;s arrival shows the envelope sender following
28372 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
28373 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28374 envelope sender address, the user&#x2019;s login is shown in parentheses after the
28375 sender address.
28376 </para>
28377 <para>
28378 <indexterm role="option">
28379 <primary><option>uucp_from_pattern</option></primary>
28380 </indexterm>
28381 </para>
28382 <informaltable frame="all">
28383 <tgroup cols="4" colsep="0" rowsep="0">
28384 <colspec colwidth="8*" align="left"/>
28385 <colspec colwidth="6*" align="center"/>
28386 <colspec colwidth="6*" align="center"/>
28387 <colspec colwidth="6*" align="right"/>
28388 <tbody>
28389 <row>
28390 <entry><option>uucp_from_pattern</option></entry>
28391 <entry>Use: <emphasis>main</emphasis></entry>
28392 <entry>Type: <emphasis>string</emphasis></entry>
28393 <entry>Default: <emphasis>see below</emphasis></entry>
28394 </row>
28395 </tbody>
28396 </tgroup>
28397 </informaltable>
28398 <para>
28399 <indexterm role="concept">
28400 <primary><quote>From</quote> line</primary>
28401 </indexterm>
28402 <indexterm role="concept">
28403 <primary>UUCP</primary>
28404 <secondary><quote>From</quote> line</secondary>
28405 </indexterm>
28406 Some applications that pass messages to an MTA via a command line interface use
28407 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
28408 particular, this is used by UUCP software. Exim recognizes such a line by means
28409 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28410 matches, the sender address is constructed by expanding the contents of
28411 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28412 default pattern recognizes lines in the following two forms:
28413 </para>
28414 <literallayout class="monospaced">
28415 From ph10 Fri Jan  5 12:35 GMT 1996
28416 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28417 </literallayout>
28418 <para>
28419 The pattern can be seen by running
28420 </para>
28421 <literallayout class="monospaced">
28422 exim -bP uucp_from_pattern
28423 </literallayout>
28424 <para>
28425 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28426 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
28427 regular expression by a parenthesized subpattern. The default value for
28428 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28429 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
28430 <option>ignore_fromline_hosts</option>.
28431 </para>
28432 <para>
28433 <indexterm role="option">
28434 <primary><option>uucp_from_sender</option></primary>
28435 </indexterm>
28436 </para>
28437 <informaltable frame="all">
28438 <tgroup cols="4" colsep="0" rowsep="0">
28439 <colspec colwidth="8*" align="left"/>
28440 <colspec colwidth="6*" align="center"/>
28441 <colspec colwidth="6*" align="center"/>
28442 <colspec colwidth="6*" align="right"/>
28443 <tbody>
28444 <row>
28445 <entry><option>uucp_from_sender</option></entry>
28446 <entry>Use: <emphasis>main</emphasis></entry>
28447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28448 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28449 </row>
28450 </tbody>
28451 </tgroup>
28452 </informaltable>
28453 <para>
28454 See <option>uucp_from_pattern</option> above.
28455 </para>
28456 <para>
28457 <indexterm role="option">
28458 <primary><option>warn_message_file</option></primary>
28459 </indexterm>
28460 </para>
28461 <informaltable frame="all">
28462 <tgroup cols="4" colsep="0" rowsep="0">
28463 <colspec colwidth="8*" align="left"/>
28464 <colspec colwidth="6*" align="center"/>
28465 <colspec colwidth="6*" align="center"/>
28466 <colspec colwidth="6*" align="right"/>
28467 <tbody>
28468 <row>
28469 <entry><option>warn_message_file</option></entry>
28470 <entry>Use: <emphasis>main</emphasis></entry>
28471 <entry>Type: <emphasis>string</emphasis></entry>
28472 <entry>Default: <emphasis>unset</emphasis></entry>
28473 </row>
28474 </tbody>
28475 </tgroup>
28476 </informaltable>
28477 <para>
28478 <indexterm role="concept">
28479 <primary>warning of delay</primary>
28480 <secondary>customizing the message</secondary>
28481 </indexterm>
28482 <indexterm role="concept">
28483 <primary>customizing</primary>
28484 <secondary>warning message</secondary>
28485 </indexterm>
28486 This option defines a template file containing paragraphs of text to be used
28487 for constructing the warning message which is sent by Exim when a message has
28488 been on the queue for a specified amount of time, as specified by
28489 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
28490 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28491 </para>
28492 <para>
28493 <indexterm role="option">
28494 <primary><option>write_rejectlog</option></primary>
28495 </indexterm>
28496 </para>
28497 <informaltable frame="all">
28498 <tgroup cols="4" colsep="0" rowsep="0">
28499 <colspec colwidth="8*" align="left"/>
28500 <colspec colwidth="6*" align="center"/>
28501 <colspec colwidth="6*" align="center"/>
28502 <colspec colwidth="6*" align="right"/>
28503 <tbody>
28504 <row>
28505 <entry><option>write_rejectlog</option></entry>
28506 <entry>Use: <emphasis>main</emphasis></entry>
28507 <entry>Type: <emphasis>boolean</emphasis></entry>
28508 <entry>Default: <emphasis>true</emphasis></entry>
28509 </row>
28510 </tbody>
28511 </tgroup>
28512 </informaltable>
28513 <para>
28514 <indexterm role="concept">
28515 <primary>reject log</primary>
28516 <secondary>disabling</secondary>
28517 </indexterm>
28518 If this option is set false, Exim no longer writes anything to the reject log.
28519 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28520 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28521 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28522 </para>
28523 </section>
28524 </chapter>
28525
28526 <chapter id="CHAProutergeneric">
28527 <title>Generic options for routers</title>
28528 <para>
28529 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28530 <primary>options</primary>
28531 <secondary>generic; for routers</secondary>
28532 </indexterm>
28533 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28534 <primary>generic options</primary>
28535 <secondary>router</secondary>
28536 </indexterm>
28537 This chapter describes the generic options that apply to all routers.
28538 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
28539 </para>
28540 <para>
28541 For a general description of how a router operates, see sections
28542 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28543 which the preconditions are tested. The order of expansion of the options that
28544 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28545 <option>headers_remove</option>, <option>transport</option>.
28546 </para>
28547 <para>
28548 <indexterm role="option">
28549 <primary><option>address_data</option></primary>
28550 </indexterm>
28551 </para>
28552 <informaltable frame="all">
28553 <tgroup cols="4" colsep="0" rowsep="0">
28554 <colspec colwidth="8*" align="left"/>
28555 <colspec colwidth="6*" align="center"/>
28556 <colspec colwidth="6*" align="center"/>
28557 <colspec colwidth="6*" align="right"/>
28558 <tbody>
28559 <row>
28560 <entry><option>address_data</option></entry>
28561 <entry>Use: <emphasis>routers</emphasis></entry>
28562 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28563 <entry>Default: <emphasis>unset</emphasis></entry>
28564 </row>
28565 </tbody>
28566 </tgroup>
28567 </informaltable>
28568 <para>
28569 <indexterm role="concept">
28570 <primary>router</primary>
28571 <secondary>data attached to address</secondary>
28572 </indexterm>
28573 The string is expanded just before the router is run, that is, after all the
28574 precondition tests have succeeded. If the expansion is forced to fail, the
28575 router declines, the value of <option>address_data</option> remains unchanged, and the
28576 <option>more</option> option controls what happens next. Other expansion failures cause
28577 delivery of the address to be deferred.
28578 </para>
28579 <para>
28580 <indexterm role="variable">
28581 <primary><varname>$address_data</varname></primary>
28582 </indexterm>
28583 When the expansion succeeds, the value is retained with the address, and can be
28584 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28585 routers, and the eventual transport.
28586 </para>
28587 <para>
28588 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28589 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
28590 in the filter. This is not normally a problem, because such data is usually
28591 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28592 put confidential data into <varname>$address_data</varname> you need to remember this point.
28593 </para>
28594 <para>
28595 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28596 with the address, though it can be changed by another <option>address_data</option> setting
28597 on a subsequent router. If a router generates child addresses, the value of
28598 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28599 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28600 </para>
28601 <para>
28602 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28603 for the address once, and then pick out parts of the data later. For example,
28604 you could use a single LDAP lookup to return a string of the form
28605 </para>
28606 <literallayout class="monospaced">
28607 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28608 </literallayout>
28609 <para>
28610 In the transport you could pick out the mailbox by a setting such as
28611 </para>
28612 <literallayout class="monospaced">
28613 file = ${extract{mailbox}{$address_data}}
28614 </literallayout>
28615 <para>
28616 This makes the configuration file less messy, and also reduces the number of
28617 lookups (though Exim does cache lookups).
28618 </para>
28619 <para>
28620 <indexterm role="variable">
28621 <primary><varname>$sender_address_data</varname></primary>
28622 </indexterm>
28623 <indexterm role="variable">
28624 <primary><varname>$address_data</varname></primary>
28625 </indexterm>
28626 The <option>address_data</option> facility is also useful as a means of passing information
28627 from one router to another, and from a router to a transport. In addition, if
28628 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28629 ACL, it remains available for use in the rest of the ACL statement. After
28630 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28631 </para>
28632 <para>
28633 <indexterm role="option">
28634 <primary><option>address_test</option></primary>
28635 </indexterm>
28636 </para>
28637 <informaltable frame="all">
28638 <tgroup cols="4" colsep="0" rowsep="0">
28639 <colspec colwidth="8*" align="left"/>
28640 <colspec colwidth="6*" align="center"/>
28641 <colspec colwidth="6*" align="center"/>
28642 <colspec colwidth="6*" align="right"/>
28643 <tbody>
28644 <row>
28645 <entry><option>address_test</option></entry>
28646 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28647 <entry>Type: <emphasis>boolean</emphasis></entry>
28648 <entry>Default: <emphasis>true</emphasis></entry>
28649 </row>
28650 </tbody>
28651 </tgroup>
28652 </informaltable>
28653 <para>
28654 <indexterm role="option">
28655 <primary><option>-bt</option></primary>
28656 </indexterm>
28657 <indexterm role="concept">
28658 <primary>router</primary>
28659 <secondary>skipping when address testing</secondary>
28660 </indexterm>
28661 If this option is set false, the router is skipped when routing is being tested
28662 by means of the <option>-bt</option> command line option. This can be a convenience when
28663 your first router sends messages to an external scanner, because it saves you
28664 having to set the <quote>already scanned</quote> indicator when testing real address
28665 routing.
28666 </para>
28667 <para>
28668 <indexterm role="option">
28669 <primary><option>cannot_route_message</option></primary>
28670 </indexterm>
28671 </para>
28672 <informaltable frame="all">
28673 <tgroup cols="4" colsep="0" rowsep="0">
28674 <colspec colwidth="8*" align="left"/>
28675 <colspec colwidth="6*" align="center"/>
28676 <colspec colwidth="6*" align="center"/>
28677 <colspec colwidth="6*" align="right"/>
28678 <tbody>
28679 <row>
28680 <entry><option>cannot_route_message</option></entry>
28681 <entry>Use: <emphasis>routers</emphasis></entry>
28682 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28683 <entry>Default: <emphasis>unset</emphasis></entry>
28684 </row>
28685 </tbody>
28686 </tgroup>
28687 </informaltable>
28688 <para>
28689 <indexterm role="concept">
28690 <primary>router</primary>
28691 <secondary>customizing <quote>cannot route</quote> message</secondary>
28692 </indexterm>
28693 <indexterm role="concept">
28694 <primary>customizing</primary>
28695 <secondary><quote>cannot route</quote> message</secondary>
28696 </indexterm>
28697 This option specifies a text message that is used when an address cannot be
28698 routed because Exim has run out of routers. The default message is
28699 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28700 <option>more</option> set false, or on the very last router in a configuration, because the
28701 value that is used is taken from the last router that is considered. This
28702 includes a router that is skipped because its preconditions are not met, as
28703 well as a router that declines. For example, using the default configuration,
28704 you could put:
28705 </para>
28706 <literallayout class="monospaced">
28707 cannot_route_message = Remote domain not found in DNS
28708 </literallayout>
28709 <para>
28710 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28711 and
28712 </para>
28713 <literallayout class="monospaced">
28714 cannot_route_message = Unknown local user
28715 </literallayout>
28716 <para>
28717 on the final router that checks for local users. If string expansion fails for
28718 this option, the default message is used. Unless the expansion failure was
28719 explicitly forced, a message about the failure is written to the main and panic
28720 logs, in addition to the normal message about the routing failure.
28721 </para>
28722 <para>
28723 <indexterm role="option">
28724 <primary><option>caseful_local_part</option></primary>
28725 </indexterm>
28726 </para>
28727 <informaltable frame="all">
28728 <tgroup cols="4" colsep="0" rowsep="0">
28729 <colspec colwidth="8*" align="left"/>
28730 <colspec colwidth="6*" align="center"/>
28731 <colspec colwidth="6*" align="center"/>
28732 <colspec colwidth="6*" align="right"/>
28733 <tbody>
28734 <row>
28735 <entry><option>caseful_local_part</option></entry>
28736 <entry>Use: <emphasis>routers</emphasis></entry>
28737 <entry>Type: <emphasis>boolean</emphasis></entry>
28738 <entry>Default: <emphasis>false</emphasis></entry>
28739 </row>
28740 </tbody>
28741 </tgroup>
28742 </informaltable>
28743 <para>
28744 <indexterm role="concept">
28745 <primary>case of local parts</primary>
28746 </indexterm>
28747 <indexterm role="concept">
28748 <primary>router</primary>
28749 <secondary>case of local parts</secondary>
28750 </indexterm>
28751 By default, routers handle the local parts of addresses in a case-insensitive
28752 manner, though the actual case is preserved for transmission with the message.
28753 If you want the case of letters to be significant in a router, you must set
28754 this option true. For individual router options that contain address or local
28755 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28756 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28757 more details.
28758 </para>
28759 <para>
28760 <indexterm role="variable">
28761 <primary><varname>$local_part</varname></primary>
28762 </indexterm>
28763 <indexterm role="variable">
28764 <primary><varname>$original_local_part</varname></primary>
28765 </indexterm>
28766 <indexterm role="variable">
28767 <primary><varname>$parent_local_part</varname></primary>
28768 </indexterm>
28769 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28770 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28771 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28772 is the same as it was in the router. Similarly, when a router generates child
28773 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28774 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28775 </para>
28776 <para>
28777 This option applies to the processing of an address by a router. When a
28778 recipient address is being processed in an ACL, there is a separate <option>control</option>
28779 modifier that can be used to specify case-sensitive processing within the ACL
28780 (see section <xref linkend="SECTcontrols"/>).
28781 </para>
28782 <para>
28783 <indexterm role="option">
28784 <primary><option>check_local_user</option></primary>
28785 </indexterm>
28786 </para>
28787 <informaltable frame="all">
28788 <tgroup cols="4" colsep="0" rowsep="0">
28789 <colspec colwidth="8*" align="left"/>
28790 <colspec colwidth="6*" align="center"/>
28791 <colspec colwidth="6*" align="center"/>
28792 <colspec colwidth="6*" align="right"/>
28793 <tbody>
28794 <row>
28795 <entry><option>check_local_user</option></entry>
28796 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28797 <entry>Type: <emphasis>boolean</emphasis></entry>
28798 <entry>Default: <emphasis>false</emphasis></entry>
28799 </row>
28800 </tbody>
28801 </tgroup>
28802 </informaltable>
28803 <para>
28804 <indexterm role="concept">
28805 <primary>local user, checking in router</primary>
28806 </indexterm>
28807 <indexterm role="concept">
28808 <primary>router</primary>
28809 <secondary>checking for local user</secondary>
28810 </indexterm>
28811 <indexterm role="concept">
28812 <primary><filename>/etc/passwd</filename></primary>
28813 </indexterm>
28814 <indexterm role="variable">
28815 <primary><varname>$home</varname></primary>
28816 </indexterm>
28817 When this option is true, Exim checks that the local part of the recipient
28818 address (with affixes removed if relevant) is the name of an account on the
28819 local system. The check is done by calling the <function>getpwnam()</function> function rather
28820 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28821 holding password data (such as NIS) are supported. If the local part is a local
28822 user, <varname>$home</varname> is set from the password data, and can be tested in other
28823 preconditions that are evaluated after this one (the order of evaluation is
28824 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28825 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28826 the router is skipped.
28827 </para>
28828 <para>
28829 If you want to check that the local part is either the name of a local user
28830 or matches something else, you cannot combine <option>check_local_user</option> with a
28831 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28832 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28833 setting to achieve this. For example:
28834 </para>
28835 <literallayout class="monospaced">
28836 local_parts = passwd;$local_part : lsearch;/etc/other/users
28837 </literallayout>
28838 <para>
28839 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28840 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28841 <option>local_parts</option> (or any other) precondition.
28842 </para>
28843 <para>
28844 <indexterm role="option">
28845 <primary><option>condition</option></primary>
28846 </indexterm>
28847 </para>
28848 <informaltable frame="all">
28849 <tgroup cols="4" colsep="0" rowsep="0">
28850 <colspec colwidth="8*" align="left"/>
28851 <colspec colwidth="6*" align="center"/>
28852 <colspec colwidth="6*" align="center"/>
28853 <colspec colwidth="6*" align="right"/>
28854 <tbody>
28855 <row>
28856 <entry><option>condition</option></entry>
28857 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28858 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28859 <entry>Default: <emphasis>unset</emphasis></entry>
28860 </row>
28861 </tbody>
28862 </tgroup>
28863 </informaltable>
28864 <para>
28865 <indexterm role="concept">
28866 <primary>router</primary>
28867 <secondary>customized precondition</secondary>
28868 </indexterm>
28869 This option specifies a general precondition test that has to succeed for the
28870 router to be called. The <option>condition</option> option is the last precondition to be
28871 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28872 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28873 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28874 router is skipped, and the address is offered to the next one.
28875 </para>
28876 <para>
28877 If the result is any other value, the router is run (as this is the last
28878 precondition to be evaluated, all the other preconditions must be true).
28879 </para>
28880 <para>
28881 The <option>condition</option> option provides a means of applying custom conditions to the
28882 running of routers. Note that in the case of a simple conditional expansion,
28883 the default expansion values are exactly what is wanted. For example:
28884 </para>
28885 <literallayout class="monospaced">
28886 condition = ${if &gt;{$message_age}{600}}
28887 </literallayout>
28888 <para>
28889 Because of the default behaviour of the string expansion, this is equivalent to
28890 </para>
28891 <literallayout class="monospaced">
28892 condition = ${if &gt;{$message_age}{600}{true}{}}
28893 </literallayout>
28894 <para>
28895 If the expansion fails (other than forced failure) delivery is deferred. Some
28896 of the other precondition options are common special cases that could in fact
28897 be specified using <option>condition</option>.
28898 </para>
28899 <para>
28900 <indexterm role="option">
28901 <primary><option>debug_print</option></primary>
28902 </indexterm>
28903 </para>
28904 <informaltable frame="all">
28905 <tgroup cols="4" colsep="0" rowsep="0">
28906 <colspec colwidth="8*" align="left"/>
28907 <colspec colwidth="6*" align="center"/>
28908 <colspec colwidth="6*" align="center"/>
28909 <colspec colwidth="6*" align="right"/>
28910 <tbody>
28911 <row>
28912 <entry><option>debug_print</option></entry>
28913 <entry>Use: <emphasis>routers</emphasis></entry>
28914 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28915 <entry>Default: <emphasis>unset</emphasis></entry>
28916 </row>
28917 </tbody>
28918 </tgroup>
28919 </informaltable>
28920 <para>
28921 <indexterm role="concept">
28922 <primary>testing</primary>
28923 <secondary>variables in drivers</secondary>
28924 </indexterm>
28925 If this option is set and debugging is enabled (see the <option>-d</option> command line
28926 option), the string is expanded and included in the debugging output.
28927 If expansion of the string fails, the error message is written to the debugging
28928 output, and Exim carries on processing.
28929 This option is provided to help with checking out the values of variables and
28930 so on when debugging router configurations. For example, if a <option>condition</option>
28931 option appears not to be working, <option>debug_print</option> can be used to output the
28932 variables it references. The output happens after checks for <option>domains</option>,
28933 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28934 are tested. A newline is added to the text if it does not end with one.
28935 </para>
28936 <para>
28937 <indexterm role="option">
28938 <primary><option>disable_logging</option></primary>
28939 </indexterm>
28940 </para>
28941 <informaltable frame="all">
28942 <tgroup cols="4" colsep="0" rowsep="0">
28943 <colspec colwidth="8*" align="left"/>
28944 <colspec colwidth="6*" align="center"/>
28945 <colspec colwidth="6*" align="center"/>
28946 <colspec colwidth="6*" align="right"/>
28947 <tbody>
28948 <row>
28949 <entry><option>disable_logging</option></entry>
28950 <entry>Use: <emphasis>routers</emphasis></entry>
28951 <entry>Type: <emphasis>boolean</emphasis></entry>
28952 <entry>Default: <emphasis>false</emphasis></entry>
28953 </row>
28954 </tbody>
28955 </tgroup>
28956 </informaltable>
28957 <para>
28958 If this option is set true, nothing is logged for any routing errors
28959 or for any deliveries caused by this router. You should not set this option
28960 unless you really, really know what you are doing. See also the generic
28961 transport option of the same name.
28962 </para>
28963 <para>
28964 <indexterm role="option">
28965 <primary><option>domains</option></primary>
28966 </indexterm>
28967 </para>
28968 <informaltable frame="all">
28969 <tgroup cols="4" colsep="0" rowsep="0">
28970 <colspec colwidth="8*" align="left"/>
28971 <colspec colwidth="6*" align="center"/>
28972 <colspec colwidth="6*" align="center"/>
28973 <colspec colwidth="6*" align="right"/>
28974 <tbody>
28975 <row>
28976 <entry><option>domains</option></entry>
28977 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28978 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28979 <entry>Default: <emphasis>unset</emphasis></entry>
28980 </row>
28981 </tbody>
28982 </tgroup>
28983 </informaltable>
28984 <para>
28985 <indexterm role="concept">
28986 <primary>router</primary>
28987 <secondary>restricting to specific domains</secondary>
28988 </indexterm>
28989 <indexterm role="variable">
28990 <primary><varname>$domain_data</varname></primary>
28991 </indexterm>
28992 If this option is set, the router is skipped unless the current domain matches
28993 the list. If the match is achieved by means of a file lookup, the data that the
28994 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
28995 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
28996 a list of the order in which preconditions are evaluated.
28997 </para>
28998 <para>
28999 <indexterm role="option">
29000 <primary><option>driver</option></primary>
29001 </indexterm>
29002 </para>
29003 <informaltable frame="all">
29004 <tgroup cols="4" colsep="0" rowsep="0">
29005 <colspec colwidth="8*" align="left"/>
29006 <colspec colwidth="6*" align="center"/>
29007 <colspec colwidth="6*" align="center"/>
29008 <colspec colwidth="6*" align="right"/>
29009 <tbody>
29010 <row>
29011 <entry><option>driver</option></entry>
29012 <entry>Use: <emphasis>routers</emphasis></entry>
29013 <entry>Type: <emphasis>string</emphasis></entry>
29014 <entry>Default: <emphasis>unset</emphasis></entry>
29015 </row>
29016 </tbody>
29017 </tgroup>
29018 </informaltable>
29019 <para>
29020 This option must always be set. It specifies which of the available routers is
29021 to be used.
29022 </para>
29023 <para>
29024 <indexterm role="option">
29025 <primary><option>errors_to</option></primary>
29026 </indexterm>
29027 </para>
29028 <informaltable frame="all">
29029 <tgroup cols="4" colsep="0" rowsep="0">
29030 <colspec colwidth="8*" align="left"/>
29031 <colspec colwidth="6*" align="center"/>
29032 <colspec colwidth="6*" align="center"/>
29033 <colspec colwidth="6*" align="right"/>
29034 <tbody>
29035 <row>
29036 <entry><option>errors_to</option></entry>
29037 <entry>Use: <emphasis>routers</emphasis></entry>
29038 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29039 <entry>Default: <emphasis>unset</emphasis></entry>
29040 </row>
29041 </tbody>
29042 </tgroup>
29043 </informaltable>
29044 <para>
29045 <indexterm role="concept">
29046 <primary>envelope sender</primary>
29047 </indexterm>
29048 <indexterm role="concept">
29049 <primary>router</primary>
29050 <secondary>changing address for errors</secondary>
29051 </indexterm>
29052 If a router successfully handles an address, it may assign the address to a
29053 transport for delivery or it may generate child addresses. In both cases, if
29054 there is a delivery problem during later processing, the resulting bounce
29055 message is sent to the address that results from expanding this string,
29056 provided that the address verifies successfully. The <option>errors_to</option> option is
29057 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29058 </para>
29059 <para>
29060 The <option>errors_to</option> setting associated with an address can be overridden if it
29061 subsequently passes through other routers that have their own <option>errors_to</option>
29062 settings, or if the message is delivered by a transport with a <option>return_path</option>
29063 setting.
29064 </para>
29065 <para>
29066 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29067 the expansion fails to verify, the errors address associated with the incoming
29068 address is used. At top level, this is the envelope sender. A non-forced
29069 expansion failure causes delivery to be deferred.
29070 </para>
29071 <para>
29072 If an address for which <option>errors_to</option> has been set ends up being delivered over
29073 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29074 any bounces that are generated by other MTAs on the delivery route are also
29075 sent there. You can set <option>errors_to</option> to the empty string by either of these
29076 settings:
29077 </para>
29078 <literallayout class="monospaced">
29079 errors_to =
29080 errors_to = ""
29081 </literallayout>
29082 <para>
29083 An expansion item that yields an empty string has the same effect. If you do
29084 this, a locally detected delivery error for addresses processed by this router
29085 no longer gives rise to a bounce message; the error is discarded. If the
29086 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
29087 overridden by the <option>return_path</option> option on the transport.
29088 </para>
29089 <para>
29090 <indexterm role="variable">
29091 <primary><varname>$address_data</varname></primary>
29092 </indexterm>
29093 If for some reason you want to discard local errors, but use a non-empty
29094 MAIL command for remote delivery, you can preserve the original return
29095 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29096 setting <option>return_path</option>.
29097 </para>
29098 <para>
29099 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29100 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29101 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29102 </para>
29103 <para>
29104 <indexterm role="option">
29105 <primary><option>expn</option></primary>
29106 </indexterm>
29107 </para>
29108 <informaltable frame="all">
29109 <tgroup cols="4" colsep="0" rowsep="0">
29110 <colspec colwidth="8*" align="left"/>
29111 <colspec colwidth="6*" align="center"/>
29112 <colspec colwidth="6*" align="center"/>
29113 <colspec colwidth="6*" align="right"/>
29114 <tbody>
29115 <row>
29116 <entry><option>expn</option></entry>
29117 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29118 <entry>Type: <emphasis>boolean</emphasis></entry>
29119 <entry>Default: <emphasis>true</emphasis></entry>
29120 </row>
29121 </tbody>
29122 </tgroup>
29123 </informaltable>
29124 <para>
29125 <indexterm role="concept">
29126 <primary>address</primary>
29127 <secondary>testing</secondary>
29128 </indexterm>
29129 <indexterm role="concept">
29130 <primary>testing</primary>
29131 <secondary>addresses</secondary>
29132 </indexterm>
29133 <indexterm role="concept">
29134 <primary>EXPN</primary>
29135 <secondary>router skipping</secondary>
29136 </indexterm>
29137 <indexterm role="concept">
29138 <primary>router</primary>
29139 <secondary>skipping for EXPN</secondary>
29140 </indexterm>
29141 If this option is turned off, the router is skipped when testing an address
29142 as a result of processing an SMTP EXPN command. You might, for example,
29143 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
29144 on for the system alias file.
29145 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29146 are evaluated.
29147 </para>
29148 <para>
29149 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29150 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29151 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29152 </para>
29153 <para>
29154 <indexterm role="option">
29155 <primary><option>fail_verify</option></primary>
29156 </indexterm>
29157 </para>
29158 <informaltable frame="all">
29159 <tgroup cols="4" colsep="0" rowsep="0">
29160 <colspec colwidth="8*" align="left"/>
29161 <colspec colwidth="6*" align="center"/>
29162 <colspec colwidth="6*" align="center"/>
29163 <colspec colwidth="6*" align="right"/>
29164 <tbody>
29165 <row>
29166 <entry><option>fail_verify</option></entry>
29167 <entry>Use: <emphasis>routers</emphasis></entry>
29168 <entry>Type: <emphasis>boolean</emphasis></entry>
29169 <entry>Default: <emphasis>false</emphasis></entry>
29170 </row>
29171 </tbody>
29172 </tgroup>
29173 </informaltable>
29174 <para>
29175 <indexterm role="concept">
29176 <primary>router</primary>
29177 <secondary>forcing verification failure</secondary>
29178 </indexterm>
29179 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29180 <option>fail_verify_recipient</option> to the same value.
29181 </para>
29182 <para>
29183 <indexterm role="option">
29184 <primary><option>fail_verify_recipient</option></primary>
29185 </indexterm>
29186 </para>
29187 <informaltable frame="all">
29188 <tgroup cols="4" colsep="0" rowsep="0">
29189 <colspec colwidth="8*" align="left"/>
29190 <colspec colwidth="6*" align="center"/>
29191 <colspec colwidth="6*" align="center"/>
29192 <colspec colwidth="6*" align="right"/>
29193 <tbody>
29194 <row>
29195 <entry><option>fail_verify_recipient</option></entry>
29196 <entry>Use: <emphasis>routers</emphasis></entry>
29197 <entry>Type: <emphasis>boolean</emphasis></entry>
29198 <entry>Default: <emphasis>false</emphasis></entry>
29199 </row>
29200 </tbody>
29201 </tgroup>
29202 </informaltable>
29203 <para>
29204 If this option is true and an address is accepted by this router when
29205 verifying a recipient, verification fails.
29206 </para>
29207 <para>
29208 <indexterm role="option">
29209 <primary><option>fail_verify_sender</option></primary>
29210 </indexterm>
29211 </para>
29212 <informaltable frame="all">
29213 <tgroup cols="4" colsep="0" rowsep="0">
29214 <colspec colwidth="8*" align="left"/>
29215 <colspec colwidth="6*" align="center"/>
29216 <colspec colwidth="6*" align="center"/>
29217 <colspec colwidth="6*" align="right"/>
29218 <tbody>
29219 <row>
29220 <entry><option>fail_verify_sender</option></entry>
29221 <entry>Use: <emphasis>routers</emphasis></entry>
29222 <entry>Type: <emphasis>boolean</emphasis></entry>
29223 <entry>Default: <emphasis>false</emphasis></entry>
29224 </row>
29225 </tbody>
29226 </tgroup>
29227 </informaltable>
29228 <para>
29229 If this option is true and an address is accepted by this router when
29230 verifying a sender, verification fails.
29231 </para>
29232 <para>
29233 <indexterm role="option">
29234 <primary><option>fallback_hosts</option></primary>
29235 </indexterm>
29236 </para>
29237 <informaltable frame="all">
29238 <tgroup cols="4" colsep="0" rowsep="0">
29239 <colspec colwidth="8*" align="left"/>
29240 <colspec colwidth="6*" align="center"/>
29241 <colspec colwidth="6*" align="center"/>
29242 <colspec colwidth="6*" align="right"/>
29243 <tbody>
29244 <row>
29245 <entry><option>fallback_hosts</option></entry>
29246 <entry>Use: <emphasis>routers</emphasis></entry>
29247 <entry>Type: <emphasis>string list</emphasis></entry>
29248 <entry>Default: <emphasis>unset</emphasis></entry>
29249 </row>
29250 </tbody>
29251 </tgroup>
29252 </informaltable>
29253 <para>
29254 <indexterm role="concept">
29255 <primary>router</primary>
29256 <secondary>fallback hosts</secondary>
29257 </indexterm>
29258 <indexterm role="concept">
29259 <primary>fallback</primary>
29260 <secondary>hosts specified on router</secondary>
29261 </indexterm>
29262 String expansion is not applied to this option. The argument must be a
29263 colon-separated list of host names or IP addresses. The list separator can be
29264 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29265 each name or address. In fact, the format of each item is exactly the same as
29266 defined for the list of hosts in a <command>manualroute</command> router (see section
29267 <xref linkend="SECTformatonehostitem"/>).
29268 </para>
29269 <para>
29270 If a router queues an address for a remote transport, this host list is
29271 associated with the address, and used instead of the transport&#x2019;s fallback host
29272 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29273 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29274 transport for further details.
29275 </para>
29276 <para>
29277 <indexterm role="option">
29278 <primary><option>group</option></primary>
29279 </indexterm>
29280 </para>
29281 <informaltable frame="all">
29282 <tgroup cols="4" colsep="0" rowsep="0">
29283 <colspec colwidth="8*" align="left"/>
29284 <colspec colwidth="6*" align="center"/>
29285 <colspec colwidth="6*" align="center"/>
29286 <colspec colwidth="6*" align="right"/>
29287 <tbody>
29288 <row>
29289 <entry><option>group</option></entry>
29290 <entry>Use: <emphasis>routers</emphasis></entry>
29291 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29292 <entry>Default: <emphasis>see below</emphasis></entry>
29293 </row>
29294 </tbody>
29295 </tgroup>
29296 </informaltable>
29297 <para>
29298 <indexterm role="concept">
29299 <primary>gid (group id)</primary>
29300 <secondary>local delivery</secondary>
29301 </indexterm>
29302 <indexterm role="concept">
29303 <primary>local transports</primary>
29304 <secondary>uid and gid</secondary>
29305 </indexterm>
29306 <indexterm role="concept">
29307 <primary>transport</primary>
29308 <secondary>local</secondary>
29309 </indexterm>
29310 <indexterm role="concept">
29311 <primary>router</primary>
29312 <secondary>setting group</secondary>
29313 </indexterm>
29314 When a router queues an address for a transport, and the transport does not
29315 specify a group, the group given here is used when running the delivery
29316 process.
29317 The group may be specified numerically or by name. If expansion fails, the
29318 error is logged and delivery is deferred.
29319 The default is unset, unless <option>check_local_user</option> is set, when the default
29320 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29321 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29322 </para>
29323 <para>
29324 <indexterm role="option">
29325 <primary><option>headers_add</option></primary>
29326 </indexterm>
29327 </para>
29328 <informaltable frame="all">
29329 <tgroup cols="4" colsep="0" rowsep="0">
29330 <colspec colwidth="8*" align="left"/>
29331 <colspec colwidth="6*" align="center"/>
29332 <colspec colwidth="6*" align="center"/>
29333 <colspec colwidth="6*" align="right"/>
29334 <tbody>
29335 <row>
29336 <entry><option>headers_add</option></entry>
29337 <entry>Use: <emphasis>routers</emphasis></entry>
29338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29339 <entry>Default: <emphasis>unset</emphasis></entry>
29340 </row>
29341 </tbody>
29342 </tgroup>
29343 </informaltable>
29344 <para>
29345 <indexterm role="concept">
29346 <primary>header lines</primary>
29347 <secondary>adding</secondary>
29348 </indexterm>
29349 <indexterm role="concept">
29350 <primary>router</primary>
29351 <secondary>adding header lines</secondary>
29352 </indexterm>
29353 This option specifies a string of text that is expanded at routing time, and
29354 associated with any addresses that are accepted by the router. However, this
29355 option has no effect when an address is just being verified. The way in which
29356 the text is used to add header lines at transport time is described in section
29357 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29358 message is in the process of being transported. This means that references to
29359 header lines in string expansions in the transport&#x2019;s configuration do not
29360 <quote>see</quote> the added header lines.
29361 </para>
29362 <para>
29363 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29364 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29365 the expansion is forced to fail, the option has no effect. Other expansion
29366 failures are treated as configuration errors.
29367 </para>
29368 <para>
29369 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29370 router that has the <option>one_time</option> option set.
29371 </para>
29372 <para>
29373 <indexterm role="concept">
29374 <primary>duplicate addresses</primary>
29375 </indexterm>
29376 <indexterm role="option">
29377 <primary><option>unseen</option></primary>
29378 </indexterm>
29379 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29380 additions are deleted when the address is passed on to subsequent routers.
29381 For a <option>redirect</option> router, if a generated address is the same as the incoming
29382 address, this can lead to duplicate addresses with different header
29383 modifications. Exim does not do duplicate deliveries (except, in certain
29384 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29385 which of the duplicates is discarded, so this ambiguous situation should be
29386 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29387 </para>
29388 <para>
29389 <indexterm role="option">
29390 <primary><option>headers_remove</option></primary>
29391 </indexterm>
29392 </para>
29393 <informaltable frame="all">
29394 <tgroup cols="4" colsep="0" rowsep="0">
29395 <colspec colwidth="8*" align="left"/>
29396 <colspec colwidth="6*" align="center"/>
29397 <colspec colwidth="6*" align="center"/>
29398 <colspec colwidth="6*" align="right"/>
29399 <tbody>
29400 <row>
29401 <entry><option>headers_remove</option></entry>
29402 <entry>Use: <emphasis>routers</emphasis></entry>
29403 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29404 <entry>Default: <emphasis>unset</emphasis></entry>
29405 </row>
29406 </tbody>
29407 </tgroup>
29408 </informaltable>
29409 <para>
29410 <indexterm role="concept">
29411 <primary>header lines</primary>
29412 <secondary>removing</secondary>
29413 </indexterm>
29414 <indexterm role="concept">
29415 <primary>router</primary>
29416 <secondary>removing header lines</secondary>
29417 </indexterm>
29418 This option specifies a string of text that is expanded at routing time, and
29419 associated with any addresses that are accepted by the router. However, this
29420 option has no effect when an address is just being verified. The way in which
29421 the text is used to remove header lines at transport time is described in
29422 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29423 the message is in the process of being transported. This means that references
29424 to header lines in string expansions in the transport&#x2019;s configuration still
29425 <quote>see</quote> the original header lines.
29426 </para>
29427 <para>
29428 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29429 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29430 the option has no effect. Other expansion failures are treated as configuration
29431 errors.
29432 </para>
29433 <para>
29434 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29435 router that has the <option>one_time</option> option set.
29436 </para>
29437 <para>
29438 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29439 removal requests are deleted when the address is passed on to subsequent
29440 routers, and this can lead to problems with duplicates -- see the similar
29441 warning for <option>headers_add</option> above.
29442 </para>
29443 <para>
29444 <indexterm role="option">
29445 <primary><option>ignore_target_hosts</option></primary>
29446 </indexterm>
29447 </para>
29448 <informaltable frame="all">
29449 <tgroup cols="4" colsep="0" rowsep="0">
29450 <colspec colwidth="8*" align="left"/>
29451 <colspec colwidth="6*" align="center"/>
29452 <colspec colwidth="6*" align="center"/>
29453 <colspec colwidth="6*" align="right"/>
29454 <tbody>
29455 <row>
29456 <entry><option>ignore_target_hosts</option></entry>
29457 <entry>Use: <emphasis>routers</emphasis></entry>
29458 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29459 <entry>Default: <emphasis>unset</emphasis></entry>
29460 </row>
29461 </tbody>
29462 </tgroup>
29463 </informaltable>
29464 <para>
29465 <indexterm role="concept">
29466 <primary>IP address</primary>
29467 <secondary>discarding</secondary>
29468 </indexterm>
29469 <indexterm role="concept">
29470 <primary>router</primary>
29471 <secondary>discarding IP addresses</secondary>
29472 </indexterm>
29473 Although this option is a host list, it should normally contain IP address
29474 entries rather than names. If any host that is looked up by the router has an
29475 IP address that matches an item in this list, Exim behaves as if that IP
29476 address did not exist. This option allows you to cope with rogue DNS entries
29477 like
29478 </para>
29479 <literallayout class="monospaced">
29480 remote.domain.example.  A  127.0.0.1
29481 </literallayout>
29482 <para>
29483 by setting
29484 </para>
29485 <literallayout class="monospaced">
29486 ignore_target_hosts = 127.0.0.1
29487 </literallayout>
29488 <para>
29489 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29490 discarded in this way, the router declines. In a conventional configuration, an
29491 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29492 domain</quote> error, and an attempt to verify an address in the domain would fail.
29493 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29494 router declines if presented with one of the listed addresses.
29495 </para>
29496 <para>
29497 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29498 means of the first or the second of the following settings, respectively:
29499 </para>
29500 <literallayout class="monospaced">
29501 ignore_target_hosts = 0.0.0.0/0
29502 ignore_target_hosts = &lt;; 0::0/0
29503 </literallayout>
29504 <para>
29505 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29506 in the second line matches all IPv6 addresses.
29507 </para>
29508 <para>
29509 This option may also be useful for ignoring link-local and site-local IPv6
29510 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29511 is expanded before use as a list, it is possible to make it dependent on the
29512 domain that is being routed.
29513 </para>
29514 <para>
29515 <indexterm role="variable">
29516 <primary><varname>$host_address</varname></primary>
29517 </indexterm>
29518 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29519 checked.
29520 </para>
29521 <para>
29522 <indexterm role="option">
29523 <primary><option>initgroups</option></primary>
29524 </indexterm>
29525 </para>
29526 <informaltable frame="all">
29527 <tgroup cols="4" colsep="0" rowsep="0">
29528 <colspec colwidth="8*" align="left"/>
29529 <colspec colwidth="6*" align="center"/>
29530 <colspec colwidth="6*" align="center"/>
29531 <colspec colwidth="6*" align="right"/>
29532 <tbody>
29533 <row>
29534 <entry><option>initgroups</option></entry>
29535 <entry>Use: <emphasis>routers</emphasis></entry>
29536 <entry>Type: <emphasis>boolean</emphasis></entry>
29537 <entry>Default: <emphasis>false</emphasis></entry>
29538 </row>
29539 </tbody>
29540 </tgroup>
29541 </informaltable>
29542 <para>
29543 <indexterm role="concept">
29544 <primary>additional groups</primary>
29545 </indexterm>
29546 <indexterm role="concept">
29547 <primary>groups</primary>
29548 <secondary>additional</secondary>
29549 </indexterm>
29550 <indexterm role="concept">
29551 <primary>local transports</primary>
29552 <secondary>uid and gid</secondary>
29553 </indexterm>
29554 <indexterm role="concept">
29555 <primary>transport</primary>
29556 <secondary>local</secondary>
29557 </indexterm>
29558 If the router queues an address for a transport, and this option is true, and
29559 the uid supplied by the router is not overridden by the transport, the
29560 <function>initgroups()</function> function is called when running the transport to ensure that
29561 any additional groups associated with the uid are set up. See also <option>group</option>
29562 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29563 </para>
29564 <para>
29565 <indexterm role="option">
29566 <primary><option>local_part_prefix</option></primary>
29567 </indexterm>
29568 </para>
29569 <informaltable frame="all">
29570 <tgroup cols="4" colsep="0" rowsep="0">
29571 <colspec colwidth="8*" align="left"/>
29572 <colspec colwidth="6*" align="center"/>
29573 <colspec colwidth="6*" align="center"/>
29574 <colspec colwidth="6*" align="right"/>
29575 <tbody>
29576 <row>
29577 <entry><option>local_part_prefix</option></entry>
29578 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29579 <entry>Type: <emphasis>string list</emphasis></entry>
29580 <entry>Default: <emphasis>unset</emphasis></entry>
29581 </row>
29582 </tbody>
29583 </tgroup>
29584 </informaltable>
29585 <para>
29586 <indexterm role="concept">
29587 <primary>router</primary>
29588 <secondary>prefix for local part</secondary>
29589 </indexterm>
29590 <indexterm role="concept">
29591 <primary>prefix</primary>
29592 <secondary>for local part, used in router</secondary>
29593 </indexterm>
29594 If this option is set, the router is skipped unless the local part starts with
29595 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29596 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29597 evaluated.
29598 </para>
29599 <para>
29600 The list is scanned from left to right, and the first prefix that matches is
29601 used. A limited form of wildcard is available; if the prefix begins with an
29602 asterisk, it matches the longest possible sequence of arbitrary characters at
29603 the start of the local part. An asterisk should therefore always be followed by
29604 some character that does not occur in normal local parts.
29605 <indexterm role="concept">
29606 <primary>multiple mailboxes</primary>
29607 </indexterm>
29608 <indexterm role="concept">
29609 <primary>mailbox</primary>
29610 <secondary>multiple</secondary>
29611 </indexterm>
29612 Wildcarding can be used to set up multiple user mailboxes, as described in
29613 section <xref linkend="SECTmulbox"/>.
29614 </para>
29615 <para>
29616 <indexterm role="variable">
29617 <primary><varname>$local_part</varname></primary>
29618 </indexterm>
29619 <indexterm role="variable">
29620 <primary><varname>$local_part_prefix</varname></primary>
29621 </indexterm>
29622 During the testing of the <option>local_parts</option> option, and while the router is
29623 running, the prefix is removed from the local part, and is available in the
29624 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29625 the router accepts the address, this remains true during subsequent delivery by
29626 a transport. In particular, the local part that is transmitted in the RCPT
29627 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29628 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29629 the relevant transport.
29630 </para>
29631 <para>
29632 When an address is being verified, <option>local_part_prefix</option> affects only the
29633 behaviour of the router. If the callout feature of verification is in use, this
29634 means that the full address, including the prefix, will be used during the
29635 callout.
29636 </para>
29637 <para>
29638 The prefix facility is commonly used to handle local parts of the form
29639 <option>owner-something</option>. Another common use is to support local parts of the form
29640 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
29641 to tell a user their forwarding is broken &ndash; by placing a router like this one
29642 immediately before the router that handles <filename>.forward</filename> files:
29643 </para>
29644 <literallayout class="monospaced">
29645 real_localuser:
29646   driver = accept
29647   local_part_prefix = real-
29648   check_local_user
29649   transport = local_delivery
29650 </literallayout>
29651 <para>
29652 For security, it would probably be a good idea to restrict the use of this
29653 router to locally-generated messages, using a condition such as this:
29654 </para>
29655 <literallayout class="monospaced">
29656   condition = ${if match {$sender_host_address}\
29657                          {\N^(|127\.0\.0\.1)$\N}}
29658 </literallayout>
29659 <para>
29660 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29661 both conditions must be met if not optional. Care must be taken if wildcards
29662 are used in both a prefix and a suffix on the same router. Different
29663 separator characters must be used to avoid ambiguity.
29664 </para>
29665 <para>
29666 <indexterm role="option">
29667 <primary><option>local_part_prefix_optional</option></primary>
29668 </indexterm>
29669 </para>
29670 <informaltable frame="all">
29671 <tgroup cols="4" colsep="0" rowsep="0">
29672 <colspec colwidth="8*" align="left"/>
29673 <colspec colwidth="6*" align="center"/>
29674 <colspec colwidth="6*" align="center"/>
29675 <colspec colwidth="6*" align="right"/>
29676 <tbody>
29677 <row>
29678 <entry><option>local_part_prefix_optional</option></entry>
29679 <entry>Use: <emphasis>routers</emphasis></entry>
29680 <entry>Type: <emphasis>boolean</emphasis></entry>
29681 <entry>Default: <emphasis>false</emphasis></entry>
29682 </row>
29683 </tbody>
29684 </tgroup>
29685 </informaltable>
29686 <para>
29687 See <option>local_part_prefix</option> above.
29688 </para>
29689 <para>
29690 <indexterm role="option">
29691 <primary><option>local_part_suffix</option></primary>
29692 </indexterm>
29693 </para>
29694 <informaltable frame="all">
29695 <tgroup cols="4" colsep="0" rowsep="0">
29696 <colspec colwidth="8*" align="left"/>
29697 <colspec colwidth="6*" align="center"/>
29698 <colspec colwidth="6*" align="center"/>
29699 <colspec colwidth="6*" align="right"/>
29700 <tbody>
29701 <row>
29702 <entry><option>local_part_suffix</option></entry>
29703 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29704 <entry>Type: <emphasis>string list</emphasis></entry>
29705 <entry>Default: <emphasis>unset</emphasis></entry>
29706 </row>
29707 </tbody>
29708 </tgroup>
29709 </informaltable>
29710 <para>
29711 <indexterm role="concept">
29712 <primary>router</primary>
29713 <secondary>suffix for local part</secondary>
29714 </indexterm>
29715 <indexterm role="concept">
29716 <primary>suffix for local part</primary>
29717 <secondary>used in router</secondary>
29718 </indexterm>
29719 This option operates in the same way as <option>local_part_prefix</option>, except that the
29720 local part must end (rather than start) with the given string, the
29721 <option>local_part_suffix_optional</option> option determines whether the suffix is
29722 mandatory, and the wildcard * character, if present, must be the last
29723 character of the suffix. This option facility is commonly used to handle local
29724 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29725 <option>username-foo</option>.
29726 </para>
29727 <para>
29728 <indexterm role="option">
29729 <primary><option>local_part_suffix_optional</option></primary>
29730 </indexterm>
29731 </para>
29732 <informaltable frame="all">
29733 <tgroup cols="4" colsep="0" rowsep="0">
29734 <colspec colwidth="8*" align="left"/>
29735 <colspec colwidth="6*" align="center"/>
29736 <colspec colwidth="6*" align="center"/>
29737 <colspec colwidth="6*" align="right"/>
29738 <tbody>
29739 <row>
29740 <entry><option>local_part_suffix_optional</option></entry>
29741 <entry>Use: <emphasis>routers</emphasis></entry>
29742 <entry>Type: <emphasis>boolean</emphasis></entry>
29743 <entry>Default: <emphasis>false</emphasis></entry>
29744 </row>
29745 </tbody>
29746 </tgroup>
29747 </informaltable>
29748 <para>
29749 See <option>local_part_suffix</option> above.
29750 </para>
29751 <para>
29752 <indexterm role="option">
29753 <primary><option>local_parts</option></primary>
29754 </indexterm>
29755 </para>
29756 <informaltable frame="all">
29757 <tgroup cols="4" colsep="0" rowsep="0">
29758 <colspec colwidth="8*" align="left"/>
29759 <colspec colwidth="6*" align="center"/>
29760 <colspec colwidth="6*" align="center"/>
29761 <colspec colwidth="6*" align="right"/>
29762 <tbody>
29763 <row>
29764 <entry><option>local_parts</option></entry>
29765 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29766 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
29767 <entry>Default: <emphasis>unset</emphasis></entry>
29768 </row>
29769 </tbody>
29770 </tgroup>
29771 </informaltable>
29772 <para>
29773 <indexterm role="concept">
29774 <primary>router</primary>
29775 <secondary>restricting to specific local parts</secondary>
29776 </indexterm>
29777 <indexterm role="concept">
29778 <primary>local part</primary>
29779 <secondary>checking in router</secondary>
29780 </indexterm>
29781 The router is run only if the local part of the address matches the list.
29782 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29783 are evaluated, and
29784 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
29785 string is expanded, it is possible to make it depend on the domain, for
29786 example:
29787 </para>
29788 <literallayout class="monospaced">
29789 local_parts = dbm;/usr/local/specials/$domain
29790 </literallayout>
29791 <para>
29792 <indexterm role="variable">
29793 <primary><varname>$local_part_data</varname></primary>
29794 </indexterm>
29795 If the match is achieved by a lookup, the data that the lookup returned
29796 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
29797 expansions of the router&#x2019;s private options. You might use this option, for
29798 example, if you have a large number of local virtual domains, and you want to
29799 send all postmaster mail to the same place without having to set up an alias in
29800 each virtual domain:
29801 </para>
29802 <literallayout class="monospaced">
29803 postmaster:
29804   driver = redirect
29805   local_parts = postmaster
29806   data = postmaster@real.domain.example
29807 </literallayout>
29808 <para>
29809 <indexterm role="option">
29810 <primary><option>log_as_local</option></primary>
29811 </indexterm>
29812 </para>
29813 <informaltable frame="all">
29814 <tgroup cols="4" colsep="0" rowsep="0">
29815 <colspec colwidth="8*" align="left"/>
29816 <colspec colwidth="6*" align="center"/>
29817 <colspec colwidth="6*" align="center"/>
29818 <colspec colwidth="6*" align="right"/>
29819 <tbody>
29820 <row>
29821 <entry><option>log_as_local</option></entry>
29822 <entry>Use: <emphasis>routers</emphasis></entry>
29823 <entry>Type: <emphasis>boolean</emphasis></entry>
29824 <entry>Default: <emphasis>see below</emphasis></entry>
29825 </row>
29826 </tbody>
29827 </tgroup>
29828 </informaltable>
29829 <para>
29830 <indexterm role="concept">
29831 <primary>log</primary>
29832 <secondary>delivery line</secondary>
29833 </indexterm>
29834 <indexterm role="concept">
29835 <primary>delivery</primary>
29836 <secondary>log line format</secondary>
29837 </indexterm>
29838 Exim has two logging styles for delivery, the idea being to make local
29839 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29840 recipient address is given just as the local part, without a domain. The use of
29841 this style is controlled by this option. It defaults to true for the <command>accept</command>
29842 router, and false for all the others. This option applies only when a
29843 router assigns an address to a transport. It has no effect on routers that
29844 redirect addresses.
29845 </para>
29846 <para>
29847 <indexterm role="option">
29848 <primary><option>more</option></primary>
29849 </indexterm>
29850 </para>
29851 <informaltable frame="all">
29852 <tgroup cols="4" colsep="0" rowsep="0">
29853 <colspec colwidth="8*" align="left"/>
29854 <colspec colwidth="6*" align="center"/>
29855 <colspec colwidth="6*" align="center"/>
29856 <colspec colwidth="6*" align="right"/>
29857 <tbody>
29858 <row>
29859 <entry><option>more</option></entry>
29860 <entry>Use: <emphasis>routers</emphasis></entry>
29861 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29862 <entry>Default: <emphasis>true</emphasis></entry>
29863 </row>
29864 </tbody>
29865 </tgroup>
29866 </informaltable>
29867 <para>
29868 The result of string expansion for this option must be a valid boolean value,
29869 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29870 result causes an error, and delivery is deferred. If the expansion is forced to
29871 fail, the default value for the option (true) is used. Other failures cause
29872 delivery to be deferred.
29873 </para>
29874 <para>
29875 If this option is set false, and the router declines to handle the address, no
29876 further routers are tried, routing fails, and the address is bounced.
29877 <indexterm role="option">
29878 <primary><option>self</option></primary>
29879 </indexterm>
29880 However, if the router explicitly passes an address to the following router by
29881 means of the setting
29882 </para>
29883 <literallayout class="monospaced">
29884 self = pass
29885 </literallayout>
29886 <para>
29887 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29888 does not affect the behaviour if one of the precondition tests fails. In that
29889 case, the address is always passed to the next router.
29890 </para>
29891 <para>
29892 Note that <option>address_data</option> is not considered to be a precondition. If its
29893 expansion is forced to fail, the router declines, and the value of <option>more</option>
29894 controls what happens next.
29895 </para>
29896 <para>
29897 <indexterm role="option">
29898 <primary><option>pass_on_timeout</option></primary>
29899 </indexterm>
29900 </para>
29901 <informaltable frame="all">
29902 <tgroup cols="4" colsep="0" rowsep="0">
29903 <colspec colwidth="8*" align="left"/>
29904 <colspec colwidth="6*" align="center"/>
29905 <colspec colwidth="6*" align="center"/>
29906 <colspec colwidth="6*" align="right"/>
29907 <tbody>
29908 <row>
29909 <entry><option>pass_on_timeout</option></entry>
29910 <entry>Use: <emphasis>routers</emphasis></entry>
29911 <entry>Type: <emphasis>boolean</emphasis></entry>
29912 <entry>Default: <emphasis>false</emphasis></entry>
29913 </row>
29914 </tbody>
29915 </tgroup>
29916 </informaltable>
29917 <para>
29918 <indexterm role="concept">
29919 <primary>timeout</primary>
29920 <secondary>of router</secondary>
29921 </indexterm>
29922 <indexterm role="concept">
29923 <primary>router</primary>
29924 <secondary>timeout</secondary>
29925 </indexterm>
29926 If a router times out during a host lookup, it normally causes deferral of the
29927 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29928 router, overriding <option>no_more</option>. This may be helpful for systems that are
29929 intermittently connected to the Internet, or those that want to pass to a smart
29930 host any messages that cannot immediately be delivered.
29931 </para>
29932 <para>
29933 There are occasional other temporary errors that can occur while doing DNS
29934 lookups. They are treated in the same way as a timeout, and this option
29935 applies to all of them.
29936 </para>
29937 <para>
29938 <indexterm role="option">
29939 <primary><option>pass_router</option></primary>
29940 </indexterm>
29941 </para>
29942 <informaltable frame="all">
29943 <tgroup cols="4" colsep="0" rowsep="0">
29944 <colspec colwidth="8*" align="left"/>
29945 <colspec colwidth="6*" align="center"/>
29946 <colspec colwidth="6*" align="center"/>
29947 <colspec colwidth="6*" align="right"/>
29948 <tbody>
29949 <row>
29950 <entry><option>pass_router</option></entry>
29951 <entry>Use: <emphasis>routers</emphasis></entry>
29952 <entry>Type: <emphasis>string</emphasis></entry>
29953 <entry>Default: <emphasis>unset</emphasis></entry>
29954 </row>
29955 </tbody>
29956 </tgroup>
29957 </informaltable>
29958 <para>
29959 <indexterm role="concept">
29960 <primary>router</primary>
29961 <secondary>go to after <quote>pass</quote></secondary>
29962 </indexterm>
29963 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
29964 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
29965 routing to continue, and overriding a false setting of <option>more</option>. When one of
29966 these routers returns <quote>pass</quote>, the address is normally handed on to the next
29967 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29968 of another router. However (unlike <option>redirect_router</option>) the named router must
29969 be below the current router, to avoid loops. Note that this option applies only
29970 to the special case of <quote>pass</quote>. It does not apply when a router returns
29971 <quote>decline</quote> because it cannot handle an address.
29972 </para>
29973 <para>
29974 <indexterm role="option">
29975 <primary><option>redirect_router</option></primary>
29976 </indexterm>
29977 </para>
29978 <informaltable frame="all">
29979 <tgroup cols="4" colsep="0" rowsep="0">
29980 <colspec colwidth="8*" align="left"/>
29981 <colspec colwidth="6*" align="center"/>
29982 <colspec colwidth="6*" align="center"/>
29983 <colspec colwidth="6*" align="right"/>
29984 <tbody>
29985 <row>
29986 <entry><option>redirect_router</option></entry>
29987 <entry>Use: <emphasis>routers</emphasis></entry>
29988 <entry>Type: <emphasis>string</emphasis></entry>
29989 <entry>Default: <emphasis>unset</emphasis></entry>
29990 </row>
29991 </tbody>
29992 </tgroup>
29993 </informaltable>
29994 <para>
29995 <indexterm role="concept">
29996 <primary>router</primary>
29997 <secondary>start at after redirection</secondary>
29998 </indexterm>
29999 Sometimes an administrator knows that it is pointless to reprocess addresses
30000 generated from alias or forward files with the same router again. For
30001 example, if an alias file translates real names into login ids there is no
30002 point searching the alias file a second time, especially if it is a large file.
30003 </para>
30004 <para>
30005 The <option>redirect_router</option> option can be set to the name of any router instance.
30006 It causes the routing of any generated addresses to start at the named router
30007 instead of at the first router. This option has no effect if the router in
30008 which it is set does not generate new addresses.
30009 </para>
30010 <para>
30011 <indexterm role="option">
30012 <primary><option>require_files</option></primary>
30013 </indexterm>
30014 </para>
30015 <informaltable frame="all">
30016 <tgroup cols="4" colsep="0" rowsep="0">
30017 <colspec colwidth="8*" align="left"/>
30018 <colspec colwidth="6*" align="center"/>
30019 <colspec colwidth="6*" align="center"/>
30020 <colspec colwidth="6*" align="right"/>
30021 <tbody>
30022 <row>
30023 <entry><option>require_files</option></entry>
30024 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30025 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30026 <entry>Default: <emphasis>unset</emphasis></entry>
30027 </row>
30028 </tbody>
30029 </tgroup>
30030 </informaltable>
30031 <para>
30032 <indexterm role="concept">
30033 <primary>file</primary>
30034 <secondary>requiring for router</secondary>
30035 </indexterm>
30036 <indexterm role="concept">
30037 <primary>router</primary>
30038 <secondary>requiring file existence</secondary>
30039 </indexterm>
30040 This option provides a general mechanism for predicating the running of a
30041 router on the existence or non-existence of certain files or directories.
30042 Before running a router, as one of its precondition tests, Exim works its way
30043 through the <option>require_files</option> list, expanding each item separately.
30044 </para>
30045 <para>
30046 Because the list is split before expansion, any colons in expansion items must
30047 be doubled, or the facility for using a different list separator must be used.
30048 If any expansion is forced to fail, the item is ignored. Other expansion
30049 failures cause routing of the address to be deferred.
30050 </para>
30051 <para>
30052 If any expanded string is empty, it is ignored. Otherwise, except as described
30053 below, each string must be a fully qualified file path, optionally preceded by
30054 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30055 existence of the files or directories. The router is skipped if any paths not
30056 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30057 </para>
30058 <para>
30059 <indexterm role="concept">
30060 <primary>NFS</primary>
30061 </indexterm>
30062 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30063 the message is deferred. This can happen when NFS-mounted filesystems are
30064 unavailable.
30065 </para>
30066 <para>
30067 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30068 options, so you cannot use it to check for the existence of a file in which to
30069 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30070 full list of the order in which preconditions are evaluated.) However, as
30071 these options are all expanded, you can use the <option>exists</option> expansion condition
30072 to make such tests. The <option>require_files</option> option is intended for checking files
30073 that the router may be going to use internally, or which are needed by a
30074 transport (for example <filename>.procmailrc</filename>).
30075 </para>
30076 <para>
30077 During delivery, the <function>stat()</function> function is run as root, but there is a
30078 facility for some checking of the accessibility of a file by another user.
30079 This is not a proper permissions check, but just a <quote>rough</quote> check that
30080 operates as follows:
30081 </para>
30082 <para>
30083 If an item in a <option>require_files</option> list does not contain any forward slash
30084 characters, it is taken to be the user (and optional group, separated by a
30085 comma) to be checked for subsequent files in the list. If no group is specified
30086 but the user is specified symbolically, the gid associated with the uid is
30087 used. For example:
30088 </para>
30089 <literallayout class="monospaced">
30090 require_files = mail:/some/file
30091 require_files = $local_part:$home/.procmailrc
30092 </literallayout>
30093 <para>
30094 If a user or group name in a <option>require_files</option> list does not exist, the
30095 <option>require_files</option> condition fails.
30096 </para>
30097 <para>
30098 Exim performs the check by scanning along the components of the file path, and
30099 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30100 directories, and <quote>r</quote> access on the final file. Note that this means that file
30101 access control lists, if the operating system has them, are ignored.
30102 </para>
30103 <para>
30104 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30105 incoming SMTP message, Exim is not running as root, but under its own uid. This
30106 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30107 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30108 user is not permitted to read one of the directories on the file&#x2019;s path.
30109 </para>
30110 <para>
30111 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30112 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30113 without root access. In this case, if a check for access by a particular user
30114 is requested, Exim creates a subprocess that runs as that user, and tries the
30115 check again in that process.
30116 </para>
30117 <para>
30118 The default action for handling an unresolved EACCES is to consider it to
30119 be caused by a configuration error, and routing is deferred because the
30120 existence or non-existence of the file cannot be determined. However, in some
30121 circumstances it may be desirable to treat this condition as if the file did
30122 not exist. If the file name (or the exclamation mark that precedes the file
30123 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30124 as if the file did not exist. For example:
30125 </para>
30126 <literallayout class="monospaced">
30127 require_files = +/some/file
30128 </literallayout>
30129 <para>
30130 If the router is not an essential part of verification (for example, it
30131 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30132 option false so that the router is skipped when verifying.
30133 </para>
30134 <para>
30135 <indexterm role="option">
30136 <primary><option>retry_use_local_part</option></primary>
30137 </indexterm>
30138 </para>
30139 <informaltable frame="all">
30140 <tgroup cols="4" colsep="0" rowsep="0">
30141 <colspec colwidth="8*" align="left"/>
30142 <colspec colwidth="6*" align="center"/>
30143 <colspec colwidth="6*" align="center"/>
30144 <colspec colwidth="6*" align="right"/>
30145 <tbody>
30146 <row>
30147 <entry><option>retry_use_local_part</option></entry>
30148 <entry>Use: <emphasis>routers</emphasis></entry>
30149 <entry>Type: <emphasis>boolean</emphasis></entry>
30150 <entry>Default: <emphasis>see below</emphasis></entry>
30151 </row>
30152 </tbody>
30153 </tgroup>
30154 </informaltable>
30155 <para>
30156 <indexterm role="concept">
30157 <primary>hints database</primary>
30158 <secondary>retry keys</secondary>
30159 </indexterm>
30160 <indexterm role="concept">
30161 <primary>local part</primary>
30162 <secondary>in retry keys</secondary>
30163 </indexterm>
30164 When a delivery suffers a temporary routing failure, a retry record is created
30165 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
30166 domain, the key for the retry record should not involve the local part, but for
30167 other addresses, both the domain and the local part should be included.
30168 Usually, remote routing is of the former kind, and local routing is of the
30169 latter kind.
30170 </para>
30171 <para>
30172 This option controls whether the local part is used to form the key for retry
30173 hints for addresses that suffer temporary errors while being handled by this
30174 router. The default value is true for any router that has <option>check_local_user</option>
30175 set, and false otherwise. Note that this option does not apply to hints keys
30176 for transport delays; they are controlled by a generic transport option of the
30177 same name.
30178 </para>
30179 <para>
30180 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30181 appears. If the router generates child addresses, they are routed
30182 independently; this setting does not become attached to them.
30183 </para>
30184 <para>
30185 <indexterm role="option">
30186 <primary><option>router_home_directory</option></primary>
30187 </indexterm>
30188 </para>
30189 <informaltable frame="all">
30190 <tgroup cols="4" colsep="0" rowsep="0">
30191 <colspec colwidth="8*" align="left"/>
30192 <colspec colwidth="6*" align="center"/>
30193 <colspec colwidth="6*" align="center"/>
30194 <colspec colwidth="6*" align="right"/>
30195 <tbody>
30196 <row>
30197 <entry><option>router_home_directory</option></entry>
30198 <entry>Use: <emphasis>routers</emphasis></entry>
30199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30200 <entry>Default: <emphasis>unset</emphasis></entry>
30201 </row>
30202 </tbody>
30203 </tgroup>
30204 </informaltable>
30205 <para>
30206 <indexterm role="concept">
30207 <primary>router</primary>
30208 <secondary>home directory for</secondary>
30209 </indexterm>
30210 <indexterm role="concept">
30211 <primary>home directory</primary>
30212 <secondary>for router</secondary>
30213 </indexterm>
30214 <indexterm role="variable">
30215 <primary><varname>$home</varname></primary>
30216 </indexterm>
30217 This option sets a home directory for use while the router is running. (Compare
30218 <option>transport_home_directory</option>, which sets a home directory for later
30219 transporting.) In particular, if used on a <command>redirect</command> router, this option
30220 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30221 forced expansion failure causes the option to be ignored &ndash; other failures
30222 cause the router to defer.
30223 </para>
30224 <para>
30225 Expansion of <option>router_home_directory</option> happens immediately after the
30226 <option>check_local_user</option> test (if configured), before any further expansions take
30227 place.
30228 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30229 are evaluated.)
30230 While the router is running, <option>router_home_directory</option> overrides the value of
30231 <varname>$home</varname> that came from <option>check_local_user</option>.
30232 </para>
30233 <para>
30234 When a router accepts an address and assigns it to a local transport (including
30235 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30236 delivery), the home directory setting for the transport is taken from the first
30237 of these values that is set:
30238 </para>
30239 <itemizedlist>
30240 <listitem>
30241 <para>
30242 The <option>home_directory</option> option on the transport;
30243 </para>
30244 </listitem>
30245 <listitem>
30246 <para>
30247 The <option>transport_home_directory</option> option on the router;
30248 </para>
30249 </listitem>
30250 <listitem>
30251 <para>
30252 The password data if <option>check_local_user</option> is set on the router;
30253 </para>
30254 </listitem>
30255 <listitem>
30256 <para>
30257 The <option>router_home_directory</option> option on the router.
30258 </para>
30259 </listitem>
30260 </itemizedlist>
30261 <para>
30262 In other words, <option>router_home_directory</option> overrides the password data for the
30263 router, but not for the transport.
30264 </para>
30265 <para>
30266 <indexterm role="option">
30267 <primary><option>self</option></primary>
30268 </indexterm>
30269 </para>
30270 <informaltable frame="all">
30271 <tgroup cols="4" colsep="0" rowsep="0">
30272 <colspec colwidth="8*" align="left"/>
30273 <colspec colwidth="6*" align="center"/>
30274 <colspec colwidth="6*" align="center"/>
30275 <colspec colwidth="6*" align="right"/>
30276 <tbody>
30277 <row>
30278 <entry><option>self</option></entry>
30279 <entry>Use: <emphasis>routers</emphasis></entry>
30280 <entry>Type: <emphasis>string</emphasis></entry>
30281 <entry>Default: <emphasis>freeze</emphasis></entry>
30282 </row>
30283 </tbody>
30284 </tgroup>
30285 </informaltable>
30286 <para>
30287 <indexterm role="concept">
30288 <primary>MX record</primary>
30289 <secondary>pointing to local host</secondary>
30290 </indexterm>
30291 <indexterm role="concept">
30292 <primary>local host</primary>
30293 <secondary>MX pointing to</secondary>
30294 </indexterm>
30295 This option applies to those routers that use a recipient address to find a
30296 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30297 and <command>manualroute</command> routers.
30298 Certain configurations of the <command>queryprogram</command> router can also specify a list
30299 of remote hosts.
30300 Usually such routers are configured to send the message to a remote host via an
30301 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30302 host on the list turns out to be the local host.
30303 The way in which Exim checks for the local host is described in section
30304 <xref linkend="SECTreclocipadd"/>.
30305 </para>
30306 <para>
30307 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
30308 example, the router should be configured not to process this domain), or an
30309 error in the DNS (for example, the MX should not point to this host). For this
30310 reason, the default action is to log the incident, defer the address, and
30311 freeze the message. The following alternatives are provided for use in special
30312 cases:
30313 </para>
30314 <variablelist>
30315 <varlistentry>
30316 <term><option>defer</option></term>
30317 <listitem>
30318 <para>
30319 Delivery of the message is tried again later, but the message is not frozen.
30320 </para>
30321 </listitem></varlistentry>
30322 <varlistentry>
30323 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
30324 <listitem>
30325 <para>
30326 The domain is changed to the given domain, and the address is passed back to
30327 be reprocessed by the routers. No rewriting of headers takes place. This
30328 behaviour is essentially a redirection.
30329 </para>
30330 </listitem></varlistentry>
30331 <varlistentry>
30332 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
30333 <listitem>
30334 <para>
30335 The domain is changed to the given domain, and the address is passed back to be
30336 reprocessed by the routers. Any headers that contain the original domain are
30337 rewritten.
30338 </para>
30339 </listitem></varlistentry>
30340 <varlistentry>
30341 <term><option>pass</option></term>
30342 <listitem>
30343 <para>
30344 <indexterm role="option">
30345 <primary><option>more</option></primary>
30346 </indexterm>
30347 <indexterm role="variable">
30348 <primary><varname>$self_hostname</varname></primary>
30349 </indexterm>
30350 The router passes the address to the next router, or to the router named in the
30351 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30352 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30353 name of the local host that the router encountered. This can be used to
30354 distinguish between different cases for hosts with multiple names. The
30355 combination
30356 </para>
30357 <literallayout class="monospaced">
30358 self = pass
30359 no_more
30360 </literallayout>
30361 <para>
30362 ensures that only those addresses that routed to the local host are passed on.
30363 Without <option>no_more</option>, addresses that were declined for other reasons would also
30364 be passed to the next router.
30365 </para>
30366 </listitem></varlistentry>
30367 <varlistentry>
30368 <term><option>fail</option></term>
30369 <listitem>
30370 <para>
30371 Delivery fails and an error report is generated.
30372 </para>
30373 </listitem></varlistentry>
30374 <varlistentry>
30375 <term><option>send</option></term>
30376 <listitem>
30377 <para>
30378 <indexterm role="concept">
30379 <primary>local host</primary>
30380 <secondary>sending to</secondary>
30381 </indexterm>
30382 The anomaly is ignored and the address is queued for the transport. This
30383 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30384 makes sense only in cases where the program that is listening on the SMTP port
30385 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30386 different configuration file that handles the domain in another way.
30387 </para>
30388 </listitem></varlistentry>
30389 </variablelist>
30390 <para>
30391 <indexterm role="option">
30392 <primary><option>senders</option></primary>
30393 </indexterm>
30394 </para>
30395 <informaltable frame="all">
30396 <tgroup cols="4" colsep="0" rowsep="0">
30397 <colspec colwidth="8*" align="left"/>
30398 <colspec colwidth="6*" align="center"/>
30399 <colspec colwidth="6*" align="center"/>
30400 <colspec colwidth="6*" align="right"/>
30401 <tbody>
30402 <row>
30403 <entry><option>senders</option></entry>
30404 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30405 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30406 <entry>Default: <emphasis>unset</emphasis></entry>
30407 </row>
30408 </tbody>
30409 </tgroup>
30410 </informaltable>
30411 <para>
30412 <indexterm role="concept">
30413 <primary>router</primary>
30414 <secondary>checking senders</secondary>
30415 </indexterm>
30416 If this option is set, the router is skipped unless the message&#x2019;s sender
30417 address matches something on the list.
30418 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30419 are evaluated.
30420 </para>
30421 <para>
30422 There are issues concerning verification when the running of routers is
30423 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30424 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30425 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30426 set an appropriate sender. For incoming mail, the sender is unset when
30427 verifying the sender, but is available when verifying any recipients. If the
30428 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30429 matters.
30430 </para>
30431 <para>
30432 <indexterm role="option">
30433 <primary><option>translate_ip_address</option></primary>
30434 </indexterm>
30435 </para>
30436 <informaltable frame="all">
30437 <tgroup cols="4" colsep="0" rowsep="0">
30438 <colspec colwidth="8*" align="left"/>
30439 <colspec colwidth="6*" align="center"/>
30440 <colspec colwidth="6*" align="center"/>
30441 <colspec colwidth="6*" align="right"/>
30442 <tbody>
30443 <row>
30444 <entry><option>translate_ip_address</option></entry>
30445 <entry>Use: <emphasis>routers</emphasis></entry>
30446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30447 <entry>Default: <emphasis>unset</emphasis></entry>
30448 </row>
30449 </tbody>
30450 </tgroup>
30451 </informaltable>
30452 <para>
30453 <indexterm role="concept">
30454 <primary>IP address</primary>
30455 <secondary>translating</secondary>
30456 </indexterm>
30457 <indexterm role="concept">
30458 <primary>packet radio</primary>
30459 </indexterm>
30460 <indexterm role="concept">
30461 <primary>router</primary>
30462 <secondary>IP address translation</secondary>
30463 </indexterm>
30464 There exist some rare networking situations (for example, packet radio) where
30465 it is helpful to be able to translate IP addresses generated by normal routing
30466 mechanisms into other IP addresses, thus performing a kind of manual IP
30467 routing. This should be done only if the normal IP routing of the TCP/IP stack
30468 is inadequate or broken. Because this is an extremely uncommon requirement, the
30469 code to support this option is not included in the Exim binary unless
30470 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30471 </para>
30472 <para>
30473 <indexterm role="variable">
30474 <primary><varname>$host_address</varname></primary>
30475 </indexterm>
30476 The <option>translate_ip_address</option> string is expanded for every IP address generated
30477 by the router, with the generated address set in <varname>$host_address</varname>. If the
30478 expansion is forced to fail, no action is taken.
30479 For any other expansion error, delivery of the message is deferred.
30480 If the result of the expansion is an IP address, that replaces the original
30481 address; otherwise the result is assumed to be a host name &ndash; this is looked
30482 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30483 produce one or more replacement IP addresses. For example, to subvert all IP
30484 addresses in some specific networks, this could be added to a router:
30485 </para>
30486 <literallayout class="monospaced">
30487 translate_ip_address = \
30488   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30489     {$value}fail}}
30490 </literallayout>
30491 <para>
30492 The file would contain lines like
30493 </para>
30494 <literallayout class="monospaced">
30495 10.2.3.128/26    some.host
30496 10.8.4.34/26     10.44.8.15
30497 </literallayout>
30498 <para>
30499 You should not make use of this facility unless you really understand what you
30500 are doing.
30501 </para>
30502 <para>
30503 <indexterm role="option">
30504 <primary><option>transport</option></primary>
30505 </indexterm>
30506 </para>
30507 <informaltable frame="all">
30508 <tgroup cols="4" colsep="0" rowsep="0">
30509 <colspec colwidth="8*" align="left"/>
30510 <colspec colwidth="6*" align="center"/>
30511 <colspec colwidth="6*" align="center"/>
30512 <colspec colwidth="6*" align="right"/>
30513 <tbody>
30514 <row>
30515 <entry><option>transport</option></entry>
30516 <entry>Use: <emphasis>routers</emphasis></entry>
30517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30518 <entry>Default: <emphasis>unset</emphasis></entry>
30519 </row>
30520 </tbody>
30521 </tgroup>
30522 </informaltable>
30523 <para>
30524 This option specifies the transport to be used when a router accepts an address
30525 and sets it up for delivery. A transport is never needed if a router is used
30526 only for verification. The value of the option is expanded at routing time,
30527 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30528 and result must be the name of one of the configured transports. If it is not,
30529 delivery is deferred.
30530 </para>
30531 <para>
30532 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30533 have some private options that set up transports for pipe and file deliveries
30534 (see chapter <xref linkend="CHAPredirect"/>).
30535 </para>
30536 <para>
30537 <indexterm role="option">
30538 <primary><option>transport_current_directory</option></primary>
30539 </indexterm>
30540 </para>
30541 <informaltable frame="all">
30542 <tgroup cols="4" colsep="0" rowsep="0">
30543 <colspec colwidth="8*" align="left"/>
30544 <colspec colwidth="6*" align="center"/>
30545 <colspec colwidth="6*" align="center"/>
30546 <colspec colwidth="6*" align="right"/>
30547 <tbody>
30548 <row>
30549 <entry><option>transport_current_directory</option></entry>
30550 <entry>Use: <emphasis>routers</emphasis></entry>
30551 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30552 <entry>Default: <emphasis>unset</emphasis></entry>
30553 </row>
30554 </tbody>
30555 </tgroup>
30556 </informaltable>
30557 <para>
30558 <indexterm role="concept">
30559 <primary>current directory for local transport</primary>
30560 </indexterm>
30561 This option associates a current directory with any address that is routed
30562 to a local transport. This can happen either because a transport is
30563 explicitly configured for the router, or because it generates a delivery to a
30564 file or a pipe. During the delivery process (that is, at transport time), this
30565 option string is expanded and is set as the current directory, unless
30566 overridden by a setting on the transport.
30567 If the expansion fails for any reason, including forced failure, an error is
30568 logged, and delivery is deferred.
30569 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30570 environment.
30571 </para>
30572 <para>
30573 <indexterm role="option">
30574 <primary><option>transport_home_directory</option></primary>
30575 </indexterm>
30576 </para>
30577 <informaltable frame="all">
30578 <tgroup cols="4" colsep="0" rowsep="0">
30579 <colspec colwidth="8*" align="left"/>
30580 <colspec colwidth="6*" align="center"/>
30581 <colspec colwidth="6*" align="center"/>
30582 <colspec colwidth="6*" align="right"/>
30583 <tbody>
30584 <row>
30585 <entry><option>transport_home_directory</option></entry>
30586 <entry>Use: <emphasis>routers</emphasis></entry>
30587 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30588 <entry>Default: <emphasis>see below</emphasis></entry>
30589 </row>
30590 </tbody>
30591 </tgroup>
30592 </informaltable>
30593 <para>
30594 <indexterm role="concept">
30595 <primary>home directory</primary>
30596 <secondary>for local transport</secondary>
30597 </indexterm>
30598 This option associates a home directory with any address that is routed to a
30599 local transport. This can happen either because a transport is explicitly
30600 configured for the router, or because it generates a delivery to a file or a
30601 pipe. During the delivery process (that is, at transport time), the option
30602 string is expanded and is set as the home directory, unless overridden by a
30603 setting of <option>home_directory</option> on the transport.
30604 If the expansion fails for any reason, including forced failure, an error is
30605 logged, and delivery is deferred.
30606 </para>
30607 <para>
30608 If the transport does not specify a home directory, and
30609 <option>transport_home_directory</option> is not set for the router, the home directory for
30610 the transport is taken from the password data if <option>check_local_user</option> is set for
30611 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30612 is set; if not, no home directory is set for the transport.
30613 </para>
30614 <para>
30615 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30616 environment.
30617 </para>
30618 <para>
30619 <indexterm role="option">
30620 <primary><option>unseen</option></primary>
30621 </indexterm>
30622 </para>
30623 <informaltable frame="all">
30624 <tgroup cols="4" colsep="0" rowsep="0">
30625 <colspec colwidth="8*" align="left"/>
30626 <colspec colwidth="6*" align="center"/>
30627 <colspec colwidth="6*" align="center"/>
30628 <colspec colwidth="6*" align="right"/>
30629 <tbody>
30630 <row>
30631 <entry><option>unseen</option></entry>
30632 <entry>Use: <emphasis>routers</emphasis></entry>
30633 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30634 <entry>Default: <emphasis>false</emphasis></entry>
30635 </row>
30636 </tbody>
30637 </tgroup>
30638 </informaltable>
30639 <para>
30640 <indexterm role="concept">
30641 <primary>router</primary>
30642 <secondary>carrying on after success</secondary>
30643 </indexterm>
30644 The result of string expansion for this option must be a valid boolean value,
30645 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30646 result causes an error, and delivery is deferred. If the expansion is forced to
30647 fail, the default value for the option (false) is used. Other failures cause
30648 delivery to be deferred.
30649 </para>
30650 <para>
30651 When this option is set true, routing does not cease if the router accepts the
30652 address. Instead, a copy of the incoming address is passed to the next router,
30653 overriding a false setting of <option>more</option>. There is little point in setting
30654 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30655 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30656 sometimes true and sometimes false).
30657 </para>
30658 <para>
30659 <indexterm role="concept">
30660 <primary>copy of message (<option>unseen</option> option)</primary>
30661 </indexterm>
30662 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30663 qualifier in filter files. It can be used to cause copies of messages to be
30664 delivered to some other destination, while also carrying out a normal delivery.
30665 In effect, the current address is made into a <quote>parent</quote> that has two children
30666 &ndash; one that is delivered as specified by this router, and a clone that goes on
30667 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30668 <option>one_time</option> option in a <command>redirect</command> router.
30669 </para>
30670 <para>
30671 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30672 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30673 only. The clone that continues to be processed by further routers starts with
30674 no added headers and none specified for removal. For a <option>redirect</option> router, if
30675 a generated address is the same as the incoming address, this can lead to
30676 duplicate addresses with different header modifications. Exim does not do
30677 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30678 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30679 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30680 <option>redirect</option> router may be of help.
30681 </para>
30682 <para>
30683 Unlike the handling of header modifications, any data that was set by the
30684 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30685 subsequent routers.
30686 </para>
30687 <para>
30688 <indexterm role="option">
30689 <primary><option>user</option></primary>
30690 </indexterm>
30691 </para>
30692 <informaltable frame="all">
30693 <tgroup cols="4" colsep="0" rowsep="0">
30694 <colspec colwidth="8*" align="left"/>
30695 <colspec colwidth="6*" align="center"/>
30696 <colspec colwidth="6*" align="center"/>
30697 <colspec colwidth="6*" align="right"/>
30698 <tbody>
30699 <row>
30700 <entry><option>user</option></entry>
30701 <entry>Use: <emphasis>routers</emphasis></entry>
30702 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30703 <entry>Default: <emphasis>see below</emphasis></entry>
30704 </row>
30705 </tbody>
30706 </tgroup>
30707 </informaltable>
30708 <para>
30709 <indexterm role="concept">
30710 <primary>uid (user id)</primary>
30711 <secondary>local delivery</secondary>
30712 </indexterm>
30713 <indexterm role="concept">
30714 <primary>local transports</primary>
30715 <secondary>uid and gid</secondary>
30716 </indexterm>
30717 <indexterm role="concept">
30718 <primary>transport</primary>
30719 <secondary>local</secondary>
30720 </indexterm>
30721 <indexterm role="concept">
30722 <primary>router</primary>
30723 <secondary>user for filter processing</secondary>
30724 </indexterm>
30725 <indexterm role="concept">
30726 <primary>filter</primary>
30727 <secondary>user for processing</secondary>
30728 </indexterm>
30729 When a router queues an address for a transport, and the transport does not
30730 specify a user, the user given here is used when running the delivery process.
30731 The user may be specified numerically or by name. If expansion fails, the
30732 error is logged and delivery is deferred.
30733 This user is also used by the <command>redirect</command> router when running a filter file.
30734 The default is unset, except when <option>check_local_user</option> is set. In this case,
30735 the default is taken from the password information. If the user is specified as
30736 a name, and <option>group</option> is not set, the group associated with the user is used.
30737 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30738 <xref linkend="CHAPenvironment"/>.
30739 </para>
30740 <para>
30741 <indexterm role="option">
30742 <primary><option>verify</option></primary>
30743 </indexterm>
30744 </para>
30745 <informaltable frame="all">
30746 <tgroup cols="4" colsep="0" rowsep="0">
30747 <colspec colwidth="8*" align="left"/>
30748 <colspec colwidth="6*" align="center"/>
30749 <colspec colwidth="6*" align="center"/>
30750 <colspec colwidth="6*" align="right"/>
30751 <tbody>
30752 <row>
30753 <entry><option>verify</option></entry>
30754 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30755 <entry>Type: <emphasis>boolean</emphasis></entry>
30756 <entry>Default: <emphasis>true</emphasis></entry>
30757 </row>
30758 </tbody>
30759 </tgroup>
30760 </informaltable>
30761 <para>
30762 Setting this option has the effect of setting <option>verify_sender</option> and
30763 <option>verify_recipient</option> to the same value.
30764 </para>
30765 <para>
30766 <indexterm role="option">
30767 <primary><option>verify_only</option></primary>
30768 </indexterm>
30769 </para>
30770 <informaltable frame="all">
30771 <tgroup cols="4" colsep="0" rowsep="0">
30772 <colspec colwidth="8*" align="left"/>
30773 <colspec colwidth="6*" align="center"/>
30774 <colspec colwidth="6*" align="center"/>
30775 <colspec colwidth="6*" align="right"/>
30776 <tbody>
30777 <row>
30778 <entry><option>verify_only</option></entry>
30779 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30780 <entry>Type: <emphasis>boolean</emphasis></entry>
30781 <entry>Default: <emphasis>false</emphasis></entry>
30782 </row>
30783 </tbody>
30784 </tgroup>
30785 </informaltable>
30786 <para>
30787 <indexterm role="concept">
30788 <primary>EXPN</primary>
30789 <secondary>with <option>verify_only</option></secondary>
30790 </indexterm>
30791 <indexterm role="option">
30792 <primary><option>-bv</option></primary>
30793 </indexterm>
30794 <indexterm role="concept">
30795 <primary>router</primary>
30796 <secondary>used only when verifying</secondary>
30797 </indexterm>
30798 If this option is set, the router is used only when verifying an address or
30799 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
30800 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
30801 restricted to verifying only senders or recipients by means of
30802 <option>verify_sender</option> and <option>verify_recipient</option>.
30803 </para>
30804 <para>
30805 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
30806 SMTP message, Exim is not running as root, but under its own uid. If the router
30807 accesses any files, you need to make sure that they are accessible to the Exim
30808 user or group.
30809 </para>
30810 <para>
30811 <indexterm role="option">
30812 <primary><option>verify_recipient</option></primary>
30813 </indexterm>
30814 </para>
30815 <informaltable frame="all">
30816 <tgroup cols="4" colsep="0" rowsep="0">
30817 <colspec colwidth="8*" align="left"/>
30818 <colspec colwidth="6*" align="center"/>
30819 <colspec colwidth="6*" align="center"/>
30820 <colspec colwidth="6*" align="right"/>
30821 <tbody>
30822 <row>
30823 <entry><option>verify_recipient</option></entry>
30824 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30825 <entry>Type: <emphasis>boolean</emphasis></entry>
30826 <entry>Default: <emphasis>true</emphasis></entry>
30827 </row>
30828 </tbody>
30829 </tgroup>
30830 </informaltable>
30831 <para>
30832 If this option is false, the router is skipped when verifying recipient
30833 addresses
30834 or testing recipient verification using <option>-bv</option>.
30835 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30836 are evaluated.
30837 </para>
30838 <para>
30839 <indexterm role="option">
30840 <primary><option>verify_sender</option></primary>
30841 </indexterm>
30842 </para>
30843 <informaltable frame="all">
30844 <tgroup cols="4" colsep="0" rowsep="0">
30845 <colspec colwidth="8*" align="left"/>
30846 <colspec colwidth="6*" align="center"/>
30847 <colspec colwidth="6*" align="center"/>
30848 <colspec colwidth="6*" align="right"/>
30849 <tbody>
30850 <row>
30851 <entry><option>verify_sender</option></entry>
30852 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30853 <entry>Type: <emphasis>boolean</emphasis></entry>
30854 <entry>Default: <emphasis>true</emphasis></entry>
30855 </row>
30856 </tbody>
30857 </tgroup>
30858 </informaltable>
30859 <para>
30860 If this option is false, the router is skipped when verifying sender addresses
30861 or testing sender verification using <option>-bvs</option>.
30862 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30863 are evaluated.
30864 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30865 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30866 </para>
30867 </chapter>
30868
30869 <chapter id="CHID4">
30870 <title>The accept router</title>
30871 <para>
30872 <indexterm role="concept">
30873 <primary><command>accept</command> router</primary>
30874 </indexterm>
30875 <indexterm role="concept">
30876 <primary>routers</primary>
30877 <secondary><command>accept</command></secondary>
30878 </indexterm>
30879 The <command>accept</command> router has no private options of its own. Unless it is being
30880 used purely for verification (see <option>verify_only</option>) a transport is required to
30881 be defined by the generic <option>transport</option> option. If the preconditions that are
30882 specified by generic options are met, the router accepts the address and queues
30883 it for the given transport. The most common use of this router is for setting
30884 up deliveries to local mailboxes. For example:
30885 </para>
30886 <literallayout class="monospaced">
30887 localusers:
30888   driver = accept
30889   domains = mydomain.example
30890   check_local_user
30891   transport = local_delivery
30892 </literallayout>
30893 <para>
30894 The <option>domains</option> condition in this example checks the domain of the address, and
30895 <option>check_local_user</option> checks that the local part is the login of a local user.
30896 When both preconditions are met, the <command>accept</command> router runs, and queues the
30897 address for the <command>local_delivery</command> transport.
30898 </para>
30899 </chapter>
30900
30901 <chapter id="CHAPdnslookup">
30902 <title>The dnslookup router</title>
30903 <para>
30904 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30905 <primary><command>dnslookup</command> router</primary>
30906 </indexterm>
30907 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30908 <primary>routers</primary>
30909 <secondary><command>dnslookup</command></secondary>
30910 </indexterm>
30911 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30912 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
30913 unless <option>verify_only</option> is set.
30914 </para>
30915 <para>
30916 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30917 SRV records. If none are found, or if SRV support is not configured,
30918 MX records are looked up. If no MX records exist, address records are sought.
30919 However, <option>mx_domains</option> can be set to disable the direct use of address
30920 records.
30921 </para>
30922 <para>
30923 MX records of equal priority are sorted by Exim into a random order. Exim then
30924 looks for address records for the host names obtained from MX or SRV records.
30925 When a host has more than one IP address, they are sorted into a random order,
30926 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30927 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30928 generic option, the router declines.
30929 </para>
30930 <para>
30931 Unless they have the highest priority (lowest MX value), MX records that point
30932 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30933 are discarded, together with any other MX records of equal or lower priority.
30934 </para>
30935 <para>
30936 <indexterm role="concept">
30937 <primary>MX record</primary>
30938 <secondary>pointing to local host</secondary>
30939 </indexterm>
30940 <indexterm role="concept">
30941 <primary>local host</primary>
30942 <secondary>MX pointing to</secondary>
30943 </indexterm>
30944 <indexterm role="option">
30945 <primary><option>self</option></primary>
30946 <secondary>in <command>dnslookup</command> router</secondary>
30947 </indexterm>
30948 If the host pointed to by the highest priority MX record, or looked up as an
30949 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30950 happens is controlled by the generic <option>self</option> option.
30951 </para>
30952 <section id="SECTprowitdnsloo">
30953 <title>Problems with DNS lookups</title>
30954 <para>
30955 There have been problems with DNS servers when SRV records are looked up.
30956 Some mis-behaving servers return a DNS error or timeout when a non-existent
30957 SRV record is sought. Similar problems have in the past been reported for
30958 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30959 problem, but it is heavy-handed because it is a global option.
30960 </para>
30961 <para>
30962 For this reason, there are two options, <option>srv_fail_domains</option> and
30963 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30964 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30965 an attempt to look up an SRV or MX record causes one of these results, and the
30966 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30967 such record</quote>. In the case of an SRV lookup, this means that the router
30968 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30969 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30970 case routing fails.
30971 </para>
30972 </section>
30973 <section id="SECID118">
30974 <title>Private options for dnslookup</title>
30975 <para>
30976 <indexterm role="concept">
30977 <primary>options</primary>
30978 <secondary><command>dnslookup</command> router</secondary>
30979 </indexterm>
30980 The private options for the <command>dnslookup</command> router are as follows:
30981 </para>
30982 <para>
30983 <indexterm role="option">
30984 <primary><option>check_secondary_mx</option></primary>
30985 </indexterm>
30986 </para>
30987 <informaltable frame="all">
30988 <tgroup cols="4" colsep="0" rowsep="0">
30989 <colspec colwidth="8*" align="left"/>
30990 <colspec colwidth="6*" align="center"/>
30991 <colspec colwidth="6*" align="center"/>
30992 <colspec colwidth="6*" align="right"/>
30993 <tbody>
30994 <row>
30995 <entry><option>check_secondary_mx</option></entry>
30996 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30997 <entry>Type: <emphasis>boolean</emphasis></entry>
30998 <entry>Default: <emphasis>false</emphasis></entry>
30999 </row>
31000 </tbody>
31001 </tgroup>
31002 </informaltable>
31003 <para>
31004 <indexterm role="concept">
31005 <primary>MX record</primary>
31006 <secondary>checking for secondary</secondary>
31007 </indexterm>
31008 If this option is set, the router declines unless the local host is found in
31009 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31010 process domains for which the local host is a secondary mail exchanger
31011 differently to other domains. The way in which Exim decides whether a host is
31012 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31013 </para>
31014 <para>
31015 <indexterm role="option">
31016 <primary><option>check_srv</option></primary>
31017 </indexterm>
31018 </para>
31019 <informaltable frame="all">
31020 <tgroup cols="4" colsep="0" rowsep="0">
31021 <colspec colwidth="8*" align="left"/>
31022 <colspec colwidth="6*" align="center"/>
31023 <colspec colwidth="6*" align="center"/>
31024 <colspec colwidth="6*" align="right"/>
31025 <tbody>
31026 <row>
31027 <entry><option>check_srv</option></entry>
31028 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31030 <entry>Default: <emphasis>unset</emphasis></entry>
31031 </row>
31032 </tbody>
31033 </tgroup>
31034 </informaltable>
31035 <para>
31036 <indexterm role="concept">
31037 <primary>SRV record</primary>
31038 <secondary>enabling use of</secondary>
31039 </indexterm>
31040 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31041 addition to MX and address records. The support is disabled by default. To
31042 enable SRV support, set the <option>check_srv</option> option to the name of the service
31043 required. For example,
31044 </para>
31045 <literallayout class="monospaced">
31046 check_srv = smtp
31047 </literallayout>
31048 <para>
31049 looks for SRV records that refer to the normal smtp service. The option is
31050 expanded, so the service name can vary from message to message or address
31051 to address. This might be helpful if SRV records are being used for a
31052 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31053 option is ignored, and the router proceeds to look for MX records in the
31054 normal way.
31055 </para>
31056 <para>
31057 When the expansion succeeds, the router searches first for SRV records for
31058 the given service (it assumes TCP protocol). A single SRV record with a
31059 host name that consists of just a single dot indicates <quote>no such service for
31060 this domain</quote>; if this is encountered, the router declines. If other kinds of
31061 SRV record are found, they are used to construct a host list for delivery
31062 according to the rules of RFC 2782. MX records are not sought in this case.
31063 </para>
31064 <para>
31065 When no SRV records are found, MX records (and address records) are sought in
31066 the traditional way. In other words, SRV records take precedence over MX
31067 records, just as MX records take precedence over address records. Note that
31068 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31069 defined it. It is apparently believed that MX records are sufficient for email
31070 and that SRV records should not be used for this purpose. However, SRV records
31071 have an additional <quote>weight</quote> feature which some people might find useful when
31072 trying to split an SMTP load between hosts of different power.
31073 </para>
31074 <para>
31075 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
31076 when there is a DNS lookup error.
31077 </para>
31078 <para>
31079 <indexterm role="option">
31080 <primary><option>mx_domains</option></primary>
31081 </indexterm>
31082 </para>
31083 <informaltable frame="all">
31084 <tgroup cols="4" colsep="0" rowsep="0">
31085 <colspec colwidth="8*" align="left"/>
31086 <colspec colwidth="6*" align="center"/>
31087 <colspec colwidth="6*" align="center"/>
31088 <colspec colwidth="6*" align="right"/>
31089 <tbody>
31090 <row>
31091 <entry><option>mx_domains</option></entry>
31092 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31093 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31094 <entry>Default: <emphasis>unset</emphasis></entry>
31095 </row>
31096 </tbody>
31097 </tgroup>
31098 </informaltable>
31099 <para>
31100 <indexterm role="concept">
31101 <primary>MX record</primary>
31102 <secondary>required to exist</secondary>
31103 </indexterm>
31104 <indexterm role="concept">
31105 <primary>SRV record</primary>
31106 <secondary>required to exist</secondary>
31107 </indexterm>
31108 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31109 record in order to be recognized. (The name of this option could be improved.)
31110 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31111 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31112 setting:
31113 </para>
31114 <literallayout class="monospaced">
31115 mx_domains = ! *.discworld.fict.example : *.fict.example
31116 </literallayout>
31117 <para>
31118 This specifies that messages addressed to a domain that matches the list but
31119 has no MX record should be bounced immediately instead of being routed using
31120 the address record.
31121 </para>
31122 <para>
31123 <indexterm role="option">
31124 <primary><option>mx_fail_domains</option></primary>
31125 </indexterm>
31126 </para>
31127 <informaltable frame="all">
31128 <tgroup cols="4" colsep="0" rowsep="0">
31129 <colspec colwidth="8*" align="left"/>
31130 <colspec colwidth="6*" align="center"/>
31131 <colspec colwidth="6*" align="center"/>
31132 <colspec colwidth="6*" align="right"/>
31133 <tbody>
31134 <row>
31135 <entry><option>mx_fail_domains</option></entry>
31136 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31137 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31138 <entry>Default: <emphasis>unset</emphasis></entry>
31139 </row>
31140 </tbody>
31141 </tgroup>
31142 </informaltable>
31143 <para>
31144 If the DNS lookup for MX records for one of the domains in this list causes a
31145 DNS lookup error, Exim behaves as if no MX records were found. See section
31146 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31147 </para>
31148 <para>
31149 <indexterm role="option">
31150 <primary><option>qualify_single</option></primary>
31151 </indexterm>
31152 </para>
31153 <informaltable frame="all">
31154 <tgroup cols="4" colsep="0" rowsep="0">
31155 <colspec colwidth="8*" align="left"/>
31156 <colspec colwidth="6*" align="center"/>
31157 <colspec colwidth="6*" align="center"/>
31158 <colspec colwidth="6*" align="right"/>
31159 <tbody>
31160 <row>
31161 <entry><option>qualify_single</option></entry>
31162 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31163 <entry>Type: <emphasis>boolean</emphasis></entry>
31164 <entry>Default: <emphasis>true</emphasis></entry>
31165 </row>
31166 </tbody>
31167 </tgroup>
31168 </informaltable>
31169 <para>
31170 <indexterm role="concept">
31171 <primary>DNS</primary>
31172 <secondary>resolver options</secondary>
31173 </indexterm>
31174 <indexterm role="concept">
31175 <primary>DNS</primary>
31176 <secondary>qualifying single-component names</secondary>
31177 </indexterm>
31178 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31179 lookups. Typically, but not standardly, this causes the resolver to qualify
31180 single-component names with the default domain. For example, on a machine
31181 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31182 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31183 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31184 <emphasis>resolv.conf</emphasis>.
31185 </para>
31186 <para>
31187 <indexterm role="option">
31188 <primary><option>rewrite_headers</option></primary>
31189 </indexterm>
31190 </para>
31191 <informaltable frame="all">
31192 <tgroup cols="4" colsep="0" rowsep="0">
31193 <colspec colwidth="8*" align="left"/>
31194 <colspec colwidth="6*" align="center"/>
31195 <colspec colwidth="6*" align="center"/>
31196 <colspec colwidth="6*" align="right"/>
31197 <tbody>
31198 <row>
31199 <entry><option>rewrite_headers</option></entry>
31200 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31201 <entry>Type: <emphasis>boolean</emphasis></entry>
31202 <entry>Default: <emphasis>true</emphasis></entry>
31203 </row>
31204 </tbody>
31205 </tgroup>
31206 </informaltable>
31207 <para>
31208 <indexterm role="concept">
31209 <primary>rewriting</primary>
31210 <secondary>header lines</secondary>
31211 </indexterm>
31212 <indexterm role="concept">
31213 <primary>header lines</primary>
31214 <secondary>rewriting</secondary>
31215 </indexterm>
31216 If the domain name in the address that is being processed is not fully
31217 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31218 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31219 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31220 occur as a result of setting the <option>widen_domains</option> option. If
31221 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31222 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31223 header lines of the message are rewritten with the full domain name.
31224 </para>
31225 <para>
31226 This option should be turned off only when it is known that no message is
31227 ever going to be sent outside an environment where the abbreviation makes
31228 sense.
31229 </para>
31230 <para>
31231 When an MX record is looked up in the DNS and matches a wildcard record, name
31232 servers normally return a record containing the name that has been looked up,
31233 making it impossible to detect whether a wildcard was present or not. However,
31234 some name servers have recently been seen to return the wildcard entry. If the
31235 name returned by a DNS lookup begins with an asterisk, it is not used for
31236 header rewriting.
31237 </para>
31238 <para>
31239 <indexterm role="option">
31240 <primary><option>same_domain_copy_routing</option></primary>
31241 </indexterm>
31242 </para>
31243 <informaltable frame="all">
31244 <tgroup cols="4" colsep="0" rowsep="0">
31245 <colspec colwidth="8*" align="left"/>
31246 <colspec colwidth="6*" align="center"/>
31247 <colspec colwidth="6*" align="center"/>
31248 <colspec colwidth="6*" align="right"/>
31249 <tbody>
31250 <row>
31251 <entry><option>same_domain_copy_routing</option></entry>
31252 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31253 <entry>Type: <emphasis>boolean</emphasis></entry>
31254 <entry>Default: <emphasis>false</emphasis></entry>
31255 </row>
31256 </tbody>
31257 </tgroup>
31258 </informaltable>
31259 <para>
31260 <indexterm role="concept">
31261 <primary>address</primary>
31262 <secondary>copying routing</secondary>
31263 </indexterm>
31264 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31265 to the same list of hosts. However, this cannot be presumed, because the router
31266 options and preconditions may refer to the local part of the address. By
31267 default, therefore, Exim routes each address in a message independently. DNS
31268 servers run caches, so repeated DNS lookups are not normally expensive, and in
31269 any case, personal messages rarely have more than a few recipients.
31270 </para>
31271 <para>
31272 If you are running mailing lists with large numbers of subscribers at the same
31273 domain, and you are using a <command>dnslookup</command> router which is independent of the
31274 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31275 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31276 routes an address to a remote transport, any other unrouted addresses in the
31277 message that have the same domain are automatically given the same routing
31278 without processing them independently,
31279 provided the following conditions are met:
31280 </para>
31281 <itemizedlist>
31282 <listitem>
31283 <para>
31284 No router that processed the address specified <option>headers_add</option> or
31285 <option>headers_remove</option>.
31286 </para>
31287 </listitem>
31288 <listitem>
31289 <para>
31290 The router did not change the address in any way, for example, by <quote>widening</quote>
31291 the domain.
31292 </para>
31293 </listitem>
31294 </itemizedlist>
31295 <para>
31296 <indexterm role="option">
31297 <primary><option>search_parents</option></primary>
31298 </indexterm>
31299 </para>
31300 <informaltable frame="all">
31301 <tgroup cols="4" colsep="0" rowsep="0">
31302 <colspec colwidth="8*" align="left"/>
31303 <colspec colwidth="6*" align="center"/>
31304 <colspec colwidth="6*" align="center"/>
31305 <colspec colwidth="6*" align="right"/>
31306 <tbody>
31307 <row>
31308 <entry><option>search_parents</option></entry>
31309 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31310 <entry>Type: <emphasis>boolean</emphasis></entry>
31311 <entry>Default: <emphasis>false</emphasis></entry>
31312 </row>
31313 </tbody>
31314 </tgroup>
31315 </informaltable>
31316 <para>
31317 <indexterm role="concept">
31318 <primary>DNS</primary>
31319 <secondary>resolver options</secondary>
31320 </indexterm>
31321 When this option is true, the resolver option RES_DNSRCH is set for DNS
31322 lookups. This is different from the <option>qualify_single</option> option in that it
31323 applies to domains containing dots. Typically, but not standardly, it causes
31324 the resolver to search for the name in the current domain and in parent
31325 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31326 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31327 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31328 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31329 </para>
31330 <para>
31331 Setting this option true can cause problems in domains that have a wildcard MX
31332 record, because any domain that does not have its own MX record matches the
31333 local wildcard.
31334 </para>
31335 <para>
31336 <indexterm role="option">
31337 <primary><option>srv_fail_domains</option></primary>
31338 </indexterm>
31339 </para>
31340 <informaltable frame="all">
31341 <tgroup cols="4" colsep="0" rowsep="0">
31342 <colspec colwidth="8*" align="left"/>
31343 <colspec colwidth="6*" align="center"/>
31344 <colspec colwidth="6*" align="center"/>
31345 <colspec colwidth="6*" align="right"/>
31346 <tbody>
31347 <row>
31348 <entry><option>srv_fail_domains</option></entry>
31349 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31350 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31351 <entry>Default: <emphasis>unset</emphasis></entry>
31352 </row>
31353 </tbody>
31354 </tgroup>
31355 </informaltable>
31356 <para>
31357 If the DNS lookup for SRV records for one of the domains in this list causes a
31358 DNS lookup error, Exim behaves as if no SRV records were found. See section
31359 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31360 </para>
31361 <para>
31362 <indexterm role="option">
31363 <primary><option>widen_domains</option></primary>
31364 </indexterm>
31365 </para>
31366 <informaltable frame="all">
31367 <tgroup cols="4" colsep="0" rowsep="0">
31368 <colspec colwidth="8*" align="left"/>
31369 <colspec colwidth="6*" align="center"/>
31370 <colspec colwidth="6*" align="center"/>
31371 <colspec colwidth="6*" align="right"/>
31372 <tbody>
31373 <row>
31374 <entry><option>widen_domains</option></entry>
31375 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31376 <entry>Type: <emphasis>string list</emphasis></entry>
31377 <entry>Default: <emphasis>unset</emphasis></entry>
31378 </row>
31379 </tbody>
31380 </tgroup>
31381 </informaltable>
31382 <para>
31383 <indexterm role="concept">
31384 <primary>domain</primary>
31385 <secondary>partial; widening</secondary>
31386 </indexterm>
31387 If a DNS lookup fails and this option is set, each of its strings in turn is
31388 added onto the end of the domain, and the lookup is tried again. For example,
31389 if
31390 </para>
31391 <literallayout class="monospaced">
31392 widen_domains = fict.example:ref.example
31393 </literallayout>
31394 <para>
31395 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31396 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31397 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31398 and <option>search_parents</option> options can cause some widening to be undertaken inside
31399 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31400 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31401 </para>
31402 </section>
31403 <section id="SECID119">
31404 <title>Effect of qualify_single and search_parents</title>
31405 <para>
31406 When a domain from an envelope recipient is changed by the resolver as a result
31407 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31408 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
31409 is set false. Exim then re-routes the address, using the full domain.
31410 </para>
31411 <para>
31412 These two options affect only the DNS lookup that takes place inside the router
31413 for the domain of the address that is being routed. They do not affect lookups
31414 such as that implied by
31415 </para>
31416 <literallayout class="monospaced">
31417 domains = @mx_any
31418 </literallayout>
31419 <para>
31420 that may happen while processing a router precondition before the router is
31421 entered. No widening ever takes place for these lookups.
31422 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31423 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31424 </para>
31425 </section>
31426 </chapter>
31427
31428 <chapter id="CHID5">
31429 <title>The ipliteral router</title>
31430 <para>
31431 <indexterm role="concept">
31432 <primary><command>ipliteral</command> router</primary>
31433 </indexterm>
31434 <indexterm role="concept">
31435 <primary>domain literal</primary>
31436 <secondary>routing</secondary>
31437 </indexterm>
31438 <indexterm role="concept">
31439 <primary>routers</primary>
31440 <secondary><command>ipliteral</command></secondary>
31441 </indexterm>
31442 This router has no private options. Unless it is being used purely for
31443 verification (see <option>verify_only</option>) a transport is required to be defined by the
31444 generic <option>transport</option> option. The router accepts the address if its domain part
31445 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31446 router handles the address
31447 </para>
31448 <literallayout class="monospaced">
31449 root@[192.168.1.1]
31450 </literallayout>
31451 <para>
31452 by setting up delivery to the host with that IP address. IPv4 domain literals
31453 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31454 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31455 </para>
31456 <literallayout class="monospaced">
31457 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31458 </literallayout>
31459 <para>
31460 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31461 grounds that sooner or later somebody will try it.
31462 </para>
31463 <para>
31464 <indexterm role="option">
31465 <primary><option>self</option></primary>
31466 <secondary>in <command>ipliteral</command> router</secondary>
31467 </indexterm>
31468 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31469 declines. If an IP literal turns out to refer to the local host, the generic
31470 <option>self</option> option determines what happens.
31471 </para>
31472 <para>
31473 The RFCs require support for domain literals; however, their use is
31474 controversial in today&#x2019;s Internet. If you want to use this router, you must
31475 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31476 Exim will not recognize the domain literal syntax in addresses.
31477 </para>
31478 </chapter>
31479
31480 <chapter id="CHID6">
31481 <title>The iplookup router</title>
31482 <para>
31483 <indexterm role="concept">
31484 <primary><command>iplookup</command> router</primary>
31485 </indexterm>
31486 <indexterm role="concept">
31487 <primary>routers</primary>
31488 <secondary><command>iplookup</command></secondary>
31489 </indexterm>
31490 The <command>iplookup</command> router was written to fulfil a specific requirement in
31491 Cambridge University (which in fact no longer exists). For this reason, it is
31492 not included in the binary of Exim by default. If you want to include it, you
31493 must set
31494 </para>
31495 <literallayout class="monospaced">
31496 ROUTER_IPLOOKUP=yes
31497 </literallayout>
31498 <para>
31499 in your <filename>Local/Makefile</filename> configuration file.
31500 </para>
31501 <para>
31502 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31503 connection to one or more specific hosts. The host can then return the same or
31504 a different address &ndash; in effect rewriting the recipient address in the
31505 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
31506 this process fails, the address can be passed on to other routers, or delivery
31507 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31508 must not be specified for it.
31509 </para>
31510 <para>
31511 <indexterm role="concept">
31512 <primary>options</primary>
31513 <secondary><command>iplookup</command> router</secondary>
31514 </indexterm>
31515 <indexterm role="option">
31516 <primary><option>hosts</option></primary>
31517 </indexterm>
31518 </para>
31519 <informaltable frame="all">
31520 <tgroup cols="4" colsep="0" rowsep="0">
31521 <colspec colwidth="8*" align="left"/>
31522 <colspec colwidth="6*" align="center"/>
31523 <colspec colwidth="6*" align="center"/>
31524 <colspec colwidth="6*" align="right"/>
31525 <tbody>
31526 <row>
31527 <entry><option>hosts</option></entry>
31528 <entry>Use: <emphasis>iplookup</emphasis></entry>
31529 <entry>Type: <emphasis>string</emphasis></entry>
31530 <entry>Default: <emphasis>unset</emphasis></entry>
31531 </row>
31532 </tbody>
31533 </tgroup>
31534 </informaltable>
31535 <para>
31536 This option must be supplied. Its value is a colon-separated list of host
31537 names. The hosts are looked up using <function>gethostbyname()</function>
31538 (or <function>getipnodebyname()</function> when available)
31539 and are tried in order until one responds to the query. If none respond, what
31540 happens is controlled by <option>optional</option>.
31541 </para>
31542 <para>
31543 <indexterm role="option">
31544 <primary><option>optional</option></primary>
31545 </indexterm>
31546 </para>
31547 <informaltable frame="all">
31548 <tgroup cols="4" colsep="0" rowsep="0">
31549 <colspec colwidth="8*" align="left"/>
31550 <colspec colwidth="6*" align="center"/>
31551 <colspec colwidth="6*" align="center"/>
31552 <colspec colwidth="6*" align="right"/>
31553 <tbody>
31554 <row>
31555 <entry><option>optional</option></entry>
31556 <entry>Use: <emphasis>iplookup</emphasis></entry>
31557 <entry>Type: <emphasis>boolean</emphasis></entry>
31558 <entry>Default: <emphasis>false</emphasis></entry>
31559 </row>
31560 </tbody>
31561 </tgroup>
31562 </informaltable>
31563 <para>
31564 If <option>optional</option> is true, if no response is obtained from any host, the address
31565 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31566 delivery to the address is deferred.
31567 </para>
31568 <para>
31569 <indexterm role="option">
31570 <primary><option>port</option></primary>
31571 </indexterm>
31572 </para>
31573 <informaltable frame="all">
31574 <tgroup cols="4" colsep="0" rowsep="0">
31575 <colspec colwidth="8*" align="left"/>
31576 <colspec colwidth="6*" align="center"/>
31577 <colspec colwidth="6*" align="center"/>
31578 <colspec colwidth="6*" align="right"/>
31579 <tbody>
31580 <row>
31581 <entry><option>port</option></entry>
31582 <entry>Use: <emphasis>iplookup</emphasis></entry>
31583 <entry>Type: <emphasis>integer</emphasis></entry>
31584 <entry>Default: <emphasis>0</emphasis></entry>
31585 </row>
31586 </tbody>
31587 </tgroup>
31588 </informaltable>
31589 <para>
31590 <indexterm role="concept">
31591 <primary>port</primary>
31592 <secondary><command>iplookup</command> router</secondary>
31593 </indexterm>
31594 This option must be supplied. It specifies the port number for the TCP or UDP
31595 call.
31596 </para>
31597 <para>
31598 <indexterm role="option">
31599 <primary><option>protocol</option></primary>
31600 </indexterm>
31601 </para>
31602 <informaltable frame="all">
31603 <tgroup cols="4" colsep="0" rowsep="0">
31604 <colspec colwidth="8*" align="left"/>
31605 <colspec colwidth="6*" align="center"/>
31606 <colspec colwidth="6*" align="center"/>
31607 <colspec colwidth="6*" align="right"/>
31608 <tbody>
31609 <row>
31610 <entry><option>protocol</option></entry>
31611 <entry>Use: <emphasis>iplookup</emphasis></entry>
31612 <entry>Type: <emphasis>string</emphasis></entry>
31613 <entry>Default: <emphasis>udp</emphasis></entry>
31614 </row>
31615 </tbody>
31616 </tgroup>
31617 </informaltable>
31618 <para>
31619 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31620 protocols is to be used.
31621 </para>
31622 <para>
31623 <indexterm role="option">
31624 <primary><option>query</option></primary>
31625 </indexterm>
31626 </para>
31627 <informaltable frame="all">
31628 <tgroup cols="4" colsep="0" rowsep="0">
31629 <colspec colwidth="8*" align="left"/>
31630 <colspec colwidth="6*" align="center"/>
31631 <colspec colwidth="6*" align="center"/>
31632 <colspec colwidth="6*" align="right"/>
31633 <tbody>
31634 <row>
31635 <entry><option>query</option></entry>
31636 <entry>Use: <emphasis>iplookup</emphasis></entry>
31637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31638 <entry>Default: <emphasis>see below</emphasis></entry>
31639 </row>
31640 </tbody>
31641 </tgroup>
31642 </informaltable>
31643 <para>
31644 This defines the content of the query that is sent to the remote hosts. The
31645 default value is:
31646 </para>
31647 <literallayout class="monospaced">
31648 $local_part@$domain $local_part@$domain
31649 </literallayout>
31650 <para>
31651 The repetition serves as a way of checking that a response is to the correct
31652 query in the default case (see <option>response_pattern</option> below).
31653 </para>
31654 <para>
31655 <indexterm role="option">
31656 <primary><option>reroute</option></primary>
31657 </indexterm>
31658 </para>
31659 <informaltable frame="all">
31660 <tgroup cols="4" colsep="0" rowsep="0">
31661 <colspec colwidth="8*" align="left"/>
31662 <colspec colwidth="6*" align="center"/>
31663 <colspec colwidth="6*" align="center"/>
31664 <colspec colwidth="6*" align="right"/>
31665 <tbody>
31666 <row>
31667 <entry><option>reroute</option></entry>
31668 <entry>Use: <emphasis>iplookup</emphasis></entry>
31669 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31670 <entry>Default: <emphasis>unset</emphasis></entry>
31671 </row>
31672 </tbody>
31673 </tgroup>
31674 </informaltable>
31675 <para>
31676 If this option is not set, the rerouted address is precisely the byte string
31677 returned by the remote host, up to the first white space, if any. If set, the
31678 string is expanded to form the rerouted address. It can include parts matched
31679 in the response by <option>response_pattern</option> by means of numeric variables such as
31680 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31681 whether or not a pattern is in use. In all cases, the rerouted address must end
31682 up in the form <emphasis>local_part@domain</emphasis>.
31683 </para>
31684 <para>
31685 <indexterm role="option">
31686 <primary><option>response_pattern</option></primary>
31687 </indexterm>
31688 </para>
31689 <informaltable frame="all">
31690 <tgroup cols="4" colsep="0" rowsep="0">
31691 <colspec colwidth="8*" align="left"/>
31692 <colspec colwidth="6*" align="center"/>
31693 <colspec colwidth="6*" align="center"/>
31694 <colspec colwidth="6*" align="right"/>
31695 <tbody>
31696 <row>
31697 <entry><option>response_pattern</option></entry>
31698 <entry>Use: <emphasis>iplookup</emphasis></entry>
31699 <entry>Type: <emphasis>string</emphasis></entry>
31700 <entry>Default: <emphasis>unset</emphasis></entry>
31701 </row>
31702 </tbody>
31703 </tgroup>
31704 </informaltable>
31705 <para>
31706 This option can be set to a regular expression that is applied to the string
31707 returned from the remote host. If the pattern does not match the response, the
31708 router declines. If <option>response_pattern</option> is not set, no checking of the
31709 response is done, unless the query was defaulted, in which case there is a
31710 check that the text returned after the first white space is the original
31711 address. This checks that the answer that has been received is in response to
31712 the correct question. For example, if the response is just a new domain, the
31713 following could be used:
31714 </para>
31715 <literallayout class="monospaced">
31716 response_pattern = ^([^@]+)$
31717 reroute = $local_part@$1
31718 </literallayout>
31719 <para>
31720 <indexterm role="option">
31721 <primary><option>timeout</option></primary>
31722 </indexterm>
31723 </para>
31724 <informaltable frame="all">
31725 <tgroup cols="4" colsep="0" rowsep="0">
31726 <colspec colwidth="8*" align="left"/>
31727 <colspec colwidth="6*" align="center"/>
31728 <colspec colwidth="6*" align="center"/>
31729 <colspec colwidth="6*" align="right"/>
31730 <tbody>
31731 <row>
31732 <entry><option>timeout</option></entry>
31733 <entry>Use: <emphasis>iplookup</emphasis></entry>
31734 <entry>Type: <emphasis>time</emphasis></entry>
31735 <entry>Default: <emphasis>5s</emphasis></entry>
31736 </row>
31737 </tbody>
31738 </tgroup>
31739 </informaltable>
31740 <para>
31741 This specifies the amount of time to wait for a response from the remote
31742 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31743 call. It does not apply to UDP.
31744 </para>
31745 </chapter>
31746
31747 <chapter id="CHID7">
31748 <title>The manualroute router</title>
31749 <para>
31750 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31751 <primary><command>manualroute</command> router</primary>
31752 </indexterm>
31753 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31754 <primary>routers</primary>
31755 <secondary><command>manualroute</command></secondary>
31756 </indexterm>
31757 <indexterm role="concept">
31758 <primary>domain</primary>
31759 <secondary>manually routing</secondary>
31760 </indexterm>
31761 The <command>manualroute</command> router is so-called because it provides a way of manually
31762 routing an address according to its domain. It is mainly used when you want to
31763 route addresses to remote hosts according to your own rules, bypassing the
31764 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31765 route to local transports, a facility that may be useful if you want to save
31766 messages for dial-in hosts in local files.
31767 </para>
31768 <para>
31769 The <command>manualroute</command> router compares a list of domain patterns with the domain
31770 it is trying to route. If there is no match, the router declines. Each pattern
31771 has associated with it a list of hosts and some other optional data, which may
31772 include a transport. The combination of a pattern and its data is called a
31773 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31774 generic <option>transport</option> option must specify a transport, unless the router is
31775 being used purely for verification (see <option>verify_only</option>).
31776 </para>
31777 <para>
31778 <indexterm role="variable">
31779 <primary><varname>$host</varname></primary>
31780 </indexterm>
31781 In the case of verification, matching the domain pattern is sufficient for the
31782 router to accept the address. When actually routing an address for delivery,
31783 an address that matches a domain pattern is queued for the associated
31784 transport. If the transport is not a local one, a host list must be associated
31785 with the pattern; IP addresses are looked up for the hosts, and these are
31786 passed to the transport along with the mail address. For local transports, a
31787 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
31788 text string.
31789 </para>
31790 <para>
31791 The list of routing rules can be provided as an inline string in
31792 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
31793 or database by setting <option>route_data</option>. Only one of these settings may appear in
31794 any one instance of <command>manualroute</command>. The format of routing rules is described
31795 below, following the list of private options.
31796 </para>
31797 <section id="SECTprioptman">
31798 <title>Private options for manualroute</title>
31799 <para>
31800 <indexterm role="concept">
31801 <primary>options</primary>
31802 <secondary><command>manualroute</command> router</secondary>
31803 </indexterm>
31804 The private options for the <command>manualroute</command> router are as follows:
31805 </para>
31806 <para>
31807 <indexterm role="option">
31808 <primary><option>host_all_ignored</option></primary>
31809 </indexterm>
31810 </para>
31811 <informaltable frame="all">
31812 <tgroup cols="4" colsep="0" rowsep="0">
31813 <colspec colwidth="8*" align="left"/>
31814 <colspec colwidth="6*" align="center"/>
31815 <colspec colwidth="6*" align="center"/>
31816 <colspec colwidth="6*" align="right"/>
31817 <tbody>
31818 <row>
31819 <entry><option>host_all_ignored</option></entry>
31820 <entry>Use: <emphasis>manualroute</emphasis></entry>
31821 <entry>Type: <emphasis>string</emphasis></entry>
31822 <entry>Default: <emphasis>defer</emphasis></entry>
31823 </row>
31824 </tbody>
31825 </tgroup>
31826 </informaltable>
31827 <para>
31828 See <option>host_find_failed</option>.
31829 </para>
31830 <para>
31831 <indexterm role="option">
31832 <primary><option>host_find_failed</option></primary>
31833 </indexterm>
31834 </para>
31835 <informaltable frame="all">
31836 <tgroup cols="4" colsep="0" rowsep="0">
31837 <colspec colwidth="8*" align="left"/>
31838 <colspec colwidth="6*" align="center"/>
31839 <colspec colwidth="6*" align="center"/>
31840 <colspec colwidth="6*" align="right"/>
31841 <tbody>
31842 <row>
31843 <entry><option>host_find_failed</option></entry>
31844 <entry>Use: <emphasis>manualroute</emphasis></entry>
31845 <entry>Type: <emphasis>string</emphasis></entry>
31846 <entry>Default: <emphasis>freeze</emphasis></entry>
31847 </row>
31848 </tbody>
31849 </tgroup>
31850 </informaltable>
31851 <para>
31852 This option controls what happens when <command>manualroute</command> tries to find an IP
31853 address for a host, and the host does not exist. The option can be set to one
31854 of the following values:
31855 </para>
31856 <literallayout class="monospaced">
31857 decline
31858 defer
31859 fail
31860 freeze
31861 ignore
31862 pass
31863 </literallayout>
31864 <para>
31865 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
31866 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
31867 forces the address to be passed to the next router (or the router defined by
31868 <option>pass_router</option>),
31869 <indexterm role="option">
31870 <primary><option>more</option></primary>
31871 </indexterm>
31872 overriding <option>no_more</option>, whereas the latter passes the address to the next
31873 router only if <option>more</option> is true.
31874 </para>
31875 <para>
31876 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
31877 cannot be found. If all the hosts in the list are ignored, the behaviour is
31878 controlled by the <option>host_all_ignored</option> option. This takes the same values
31879 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
31880 </para>
31881 <para>
31882 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
31883 state; if a host lookup gets a temporary error, delivery is deferred unless the
31884 generic <option>pass_on_timeout</option> option is set.
31885 </para>
31886 <para>
31887 <indexterm role="option">
31888 <primary><option>hosts_randomize</option></primary>
31889 </indexterm>
31890 </para>
31891 <informaltable frame="all">
31892 <tgroup cols="4" colsep="0" rowsep="0">
31893 <colspec colwidth="8*" align="left"/>
31894 <colspec colwidth="6*" align="center"/>
31895 <colspec colwidth="6*" align="center"/>
31896 <colspec colwidth="6*" align="right"/>
31897 <tbody>
31898 <row>
31899 <entry><option>hosts_randomize</option></entry>
31900 <entry>Use: <emphasis>manualroute</emphasis></entry>
31901 <entry>Type: <emphasis>boolean</emphasis></entry>
31902 <entry>Default: <emphasis>false</emphasis></entry>
31903 </row>
31904 </tbody>
31905 </tgroup>
31906 </informaltable>
31907 <para>
31908 <indexterm role="concept">
31909 <primary>randomized host list</primary>
31910 </indexterm>
31911 <indexterm role="concept">
31912 <primary>host</primary>
31913 <secondary>list of; randomized</secondary>
31914 </indexterm>
31915 If this option is set, the order of the items in a host list in a routing rule
31916 is randomized each time the list is used, unless an option in the routing rule
31917 overrides (see below). Randomizing the order of a host list can be used to do
31918 crude load sharing. However, if more than one mail address is routed by the
31919 same router to the same host list, the host lists are considered to be the same
31920 (even though they may be randomized into different orders) for the purpose of
31921 deciding whether to batch the deliveries into a single SMTP transaction.
31922 </para>
31923 <para>
31924 When <option>hosts_randomize</option> is true, a host list may be split
31925 into groups whose order is separately randomized. This makes it possible to
31926 set up MX-like behaviour. The boundaries between groups are indicated by an
31927 item that is just <literal>+</literal> in the host list. For example:
31928 </para>
31929 <literallayout class="monospaced">
31930 route_list = * host1:host2:host3:+:host4:host5
31931 </literallayout>
31932 <para>
31933 The order of the first three hosts and the order of the last two hosts is
31934 randomized for each use, but the first three always end up before the last two.
31935 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31936 randomized host list is passed to an <command>smtp</command> transport that also has
31937 <option>hosts_randomize set</option>, the list is not re-randomized.
31938 </para>
31939 <para>
31940 <indexterm role="option">
31941 <primary><option>route_data</option></primary>
31942 </indexterm>
31943 </para>
31944 <informaltable frame="all">
31945 <tgroup cols="4" colsep="0" rowsep="0">
31946 <colspec colwidth="8*" align="left"/>
31947 <colspec colwidth="6*" align="center"/>
31948 <colspec colwidth="6*" align="center"/>
31949 <colspec colwidth="6*" align="right"/>
31950 <tbody>
31951 <row>
31952 <entry><option>route_data</option></entry>
31953 <entry>Use: <emphasis>manualroute</emphasis></entry>
31954 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31955 <entry>Default: <emphasis>unset</emphasis></entry>
31956 </row>
31957 </tbody>
31958 </tgroup>
31959 </informaltable>
31960 <para>
31961 If this option is set, it must expand to yield the data part of a routing rule.
31962 Typically, the expansion string includes a lookup based on the domain. For
31963 example:
31964 </para>
31965 <literallayout class="monospaced">
31966 route_data = ${lookup{$domain}dbm{/etc/routes}}
31967 </literallayout>
31968 <para>
31969 If the expansion is forced to fail, or the result is an empty string, the
31970 router declines. Other kinds of expansion failure cause delivery to be
31971 deferred.
31972 </para>
31973 <para>
31974 <indexterm role="option">
31975 <primary><option>route_list</option></primary>
31976 </indexterm>
31977 </para>
31978 <informaltable frame="all">
31979 <tgroup cols="4" colsep="0" rowsep="0">
31980 <colspec colwidth="8*" align="left"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="center"/>
31983 <colspec colwidth="6*" align="right"/>
31984 <tbody>
31985 <row>
31986 <entry><option>route_list</option></entry>
31987 <entry>Use: <emphasis>manualroute</emphasis></entry>
31988 <entry>Type: <emphasis>string list</emphasis></entry>
31989 <entry>Default: <emphasis>unset</emphasis></entry>
31990 </row>
31991 </tbody>
31992 </tgroup>
31993 </informaltable>
31994 <para>
31995 This string is a list of routing rules, in the form defined below. Note that,
31996 unlike most string lists, the items are separated by semicolons. This is so
31997 that they may contain colon-separated host lists.
31998 </para>
31999 <para>
32000 <indexterm role="option">
32001 <primary><option>same_domain_copy_routing</option></primary>
32002 </indexterm>
32003 </para>
32004 <informaltable frame="all">
32005 <tgroup cols="4" colsep="0" rowsep="0">
32006 <colspec colwidth="8*" align="left"/>
32007 <colspec colwidth="6*" align="center"/>
32008 <colspec colwidth="6*" align="center"/>
32009 <colspec colwidth="6*" align="right"/>
32010 <tbody>
32011 <row>
32012 <entry><option>same_domain_copy_routing</option></entry>
32013 <entry>Use: <emphasis>manualroute</emphasis></entry>
32014 <entry>Type: <emphasis>boolean</emphasis></entry>
32015 <entry>Default: <emphasis>false</emphasis></entry>
32016 </row>
32017 </tbody>
32018 </tgroup>
32019 </informaltable>
32020 <para>
32021 <indexterm role="concept">
32022 <primary>address</primary>
32023 <secondary>copying routing</secondary>
32024 </indexterm>
32025 Addresses with the same domain are normally routed by the <command>manualroute</command>
32026 router to the same list of hosts. However, this cannot be presumed, because the
32027 router options and preconditions may refer to the local part of the address. By
32028 default, therefore, Exim routes each address in a message independently. DNS
32029 servers run caches, so repeated DNS lookups are not normally expensive, and in
32030 any case, personal messages rarely have more than a few recipients.
32031 </para>
32032 <para>
32033 If you are running mailing lists with large numbers of subscribers at the same
32034 domain, and you are using a <command>manualroute</command> router which is independent of the
32035 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32036 lookups for identical domains in one message. In this case, when
32037 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32038 addresses in the message that have the same domain are automatically given the
32039 same routing without processing them independently. However, this is only done
32040 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32041 </para>
32042 </section>
32043 <section id="SECID120">
32044 <title>Routing rules in route_list</title>
32045 <para>
32046 The value of <option>route_list</option> is a string consisting of a sequence of routing
32047 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32048 entered as two semicolons. Alternatively, the list separator can be changed as
32049 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32050 Empty rules are ignored. The format of each rule is
32051 </para>
32052 <literallayout>
32053 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
32054 </literallayout>
32055 <para>
32056 The following example contains two rules, each with a simple domain pattern and
32057 no options:
32058 </para>
32059 <literallayout class="monospaced">
32060 route_list = \
32061   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
32062   thes.ref.example  mail-3.ref.example:mail-4.ref.example
32063 </literallayout>
32064 <para>
32065 The three parts of a rule are separated by white space. The pattern and the
32066 list of hosts can be enclosed in quotes if necessary, and if they are, the
32067 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32068 single domain pattern, which is the only mandatory item in the rule. The
32069 pattern is in the same format as one item in a domain list (see section
32070 <xref linkend="SECTdomainlist"/>),
32071 except that it may not be the name of an interpolated file.
32072 That is, it may be wildcarded, or a regular expression, or a file or database
32073 lookup (with semicolons doubled, because of the use of semicolon as a separator
32074 in a <option>route_list</option>).
32075 </para>
32076 <para>
32077 The rules in <option>route_list</option> are searched in order until one of the patterns
32078 matches the domain that is being routed. The list of hosts and then options are
32079 then used as described below. If there is no match, the router declines. When
32080 <option>route_list</option> is set, <option>route_data</option> must not be set.
32081 </para>
32082 </section>
32083 <section id="SECID121">
32084 <title>Routing rules in route_data</title>
32085 <para>
32086 The use of <option>route_list</option> is convenient when there are only a small number of
32087 routing rules. For larger numbers, it is easier to use a file or database to
32088 hold the routing information, and use the <option>route_data</option> option instead.
32089 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32090 Most commonly, <option>route_data</option> is set as a string that contains an
32091 expansion lookup. For example, suppose we place two routing rules in a file
32092 like this:
32093 </para>
32094 <literallayout class="monospaced">
32095 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
32096 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
32097 </literallayout>
32098 <para>
32099 This data can be accessed by setting
32100 </para>
32101 <literallayout class="monospaced">
32102 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32103 </literallayout>
32104 <para>
32105 Failure of the lookup results in an empty string, causing the router to
32106 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32107 requirement is that the result of expanding the string is a list of hosts,
32108 possibly followed by options, separated by white space. The list of hosts must
32109 be enclosed in quotes if it contains white space.
32110 </para>
32111 </section>
32112 <section id="SECID122">
32113 <title>Format of the list of hosts</title>
32114 <para>
32115 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32116 always separately expanded before use. If the expansion fails, the router
32117 declines. The result of the expansion must be a colon-separated list of names
32118 and/or IP addresses, optionally also including ports. The format of each item
32119 in the list is described in the next section. The list separator can be changed
32120 as described in section <xref linkend="SECTlistconstruct"/>.
32121 </para>
32122 <para>
32123 If the list of hosts was obtained from a <option>route_list</option> item, the following
32124 variables are set during its expansion:
32125 </para>
32126 <itemizedlist>
32127 <listitem>
32128 <para>
32129 <indexterm role="concept">
32130 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
32131 <secondary>in <command>manualroute</command> router</secondary>
32132 </indexterm>
32133 If the domain was matched against a regular expression, the numeric variables
32134 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32135 </para>
32136 <literallayout class="monospaced">
32137 route_list = ^domain(\d+)   host-$1.text.example
32138 </literallayout>
32139 </listitem>
32140 <listitem>
32141 <para>
32142 <varname>$0</varname> is always set to the entire domain.
32143 </para>
32144 </listitem>
32145 <listitem>
32146 <para>
32147 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32148 </para>
32149 </listitem>
32150 <listitem>
32151 <para>
32152 <indexterm role="variable">
32153 <primary><varname>$value</varname></primary>
32154 </indexterm>
32155 If the pattern that matched the domain was a lookup item, the data that was
32156 looked up is available in the expansion variable <varname>$value</varname>. For example:
32157 </para>
32158 <literallayout class="monospaced">
32159 route_list = lsearch;;/some/file.routes  $value
32160 </literallayout>
32161 </listitem>
32162 </itemizedlist>
32163 <para>
32164 Note the doubling of the semicolon in the pattern that is necessary because
32165 semicolon is the default route list separator.
32166 </para>
32167 </section>
32168 <section id="SECTformatonehostitem">
32169 <title>Format of one host item</title>
32170 <para>
32171 Each item in the list of hosts is either a host name or an IP address,
32172 optionally with an attached port number. When no port is given, an IP address
32173 is not enclosed in brackets. When a port is specified, it overrides the port
32174 specification on the transport. The port is separated from the name or address
32175 by a colon. This leads to some complications:
32176 </para>
32177 <itemizedlist>
32178 <listitem>
32179 <para>
32180 Because colon is the default separator for the list of hosts, either
32181 the colon that specifies a port must be doubled, or the list separator must
32182 be changed. The following two examples have the same effect:
32183 </para>
32184 <literallayout class="monospaced">
32185 route_list = * "host1.tld::1225 : host2.tld::1226"
32186 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
32187 </literallayout>
32188 </listitem>
32189 <listitem>
32190 <para>
32191 When IPv6 addresses are involved, it gets worse, because they contain
32192 colons of their own. To make this case easier, it is permitted to
32193 enclose an IP address (either v4 or v6) in square brackets if a port
32194 number follows. For example:
32195 </para>
32196 <literallayout class="monospaced">
32197 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
32198 </literallayout>
32199 </listitem>
32200 </itemizedlist>
32201 </section>
32202 <section id="SECThostshowused">
32203 <title>How the list of hosts is used</title>
32204 <para>
32205 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32206 the hosts is tried, in the order specified, when carrying out the SMTP
32207 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32208 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32209 transport.
32210 </para>
32211 <para>
32212 Hosts may be listed by name or by IP address. An unadorned name in the list of
32213 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32214 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32215 records in the DNS. For example:
32216 </para>
32217 <literallayout class="monospaced">
32218 route_list = *  x.y.z:p.q.r/MX:e.f.g
32219 </literallayout>
32220 <para>
32221 If this feature is used with a port specifier, the port must come last. For
32222 example:
32223 </para>
32224 <literallayout class="monospaced">
32225 route_list = *  dom1.tld/mx::1225
32226 </literallayout>
32227 <para>
32228 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32229 randomized before any lookups are done. Exim then scans the list; for any name
32230 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32231 be an interface on the local host and the item is not the first in the list,
32232 Exim discards it and any subsequent items. If it is the first item, what
32233 happens is controlled by the
32234 <indexterm role="option">
32235 <primary><option>self</option></primary>
32236 <secondary>in <command>manualroute</command> router</secondary>
32237 </indexterm>
32238 <option>self</option> option of the router.
32239 </para>
32240 <para>
32241 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32242 hosts obtained by looking up MX records for the name. This is always a DNS
32243 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32244 below) are not relevant here. The order of these hosts is determined by the
32245 preference values in the MX records, according to the usual rules. Because
32246 randomizing happens before the MX lookup, it does not affect the order that is
32247 defined by MX preferences.
32248 </para>
32249 <para>
32250 If the local host is present in the sublist obtained from MX records, but is
32251 not the most preferred host in that list, it and any equally or less
32252 preferred hosts are removed before the sublist is inserted into the main list.
32253 </para>
32254 <para>
32255 If the local host is the most preferred host in the MX list, what happens
32256 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32257 is not the first item (that is, there are previous hosts in the main list),
32258 Exim discards this name and any subsequent items in the main list.
32259 </para>
32260 <para>
32261 If the MX item is first in the list of hosts, and the local host is the
32262 most preferred host, what happens is controlled by the <option>self</option> option of the
32263 router.
32264 </para>
32265 <para>
32266 DNS failures when lookup up the MX records are treated in the same way as DNS
32267 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32268 <option>host_find_failed</option> are used when relevant.
32269 </para>
32270 <para>
32271 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32272 whether obtained from an MX lookup or not.
32273 </para>
32274 </section>
32275 <section id="SECThowoptused">
32276 <title>How the options are used</title>
32277 <para>
32278 The options are a sequence of words; in practice no more than three are ever
32279 present. One of the words can be the name of a transport; this overrides the
32280 <option>transport</option> option on the router for this particular routing rule only. The
32281 other words (if present) control randomization of the list of hosts on a
32282 per-rule basis, and how the IP addresses of the hosts are to be found when
32283 routing to a remote transport. These options are as follows:
32284 </para>
32285 <itemizedlist>
32286 <listitem>
32287 <para>
32288 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32289 setting of <option>hosts_randomize</option> for this routing rule only.
32290 </para>
32291 </listitem>
32292 <listitem>
32293 <para>
32294 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32295 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32296 </para>
32297 </listitem>
32298 <listitem>
32299 <para>
32300 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32301 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32302 also look in <filename>/etc/hosts</filename> or other sources of information.
32303 </para>
32304 </listitem>
32305 <listitem>
32306 <para>
32307 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32308 no address records are found. If there is a temporary DNS error (such as a
32309 timeout), delivery is deferred.
32310 </para>
32311 </listitem>
32312 </itemizedlist>
32313 <para>
32314 For example:
32315 </para>
32316 <literallayout class="monospaced">
32317 route_list = domain1  host1:host2:host3  randomize bydns;\
32318              domain2  host4:host5
32319 </literallayout>
32320 <para>
32321 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32322 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32323 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32324 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32325 call.
32326 </para>
32327 <para>
32328 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32329 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32330 instead of TRY_AGAIN. That is why the default action is to try a DNS
32331 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32332 function called.
32333 </para>
32334 <para>
32335 If no IP address for a host can be found, what happens is controlled by the
32336 <option>host_find_failed</option> option.
32337 </para>
32338 <para>
32339 <indexterm role="variable">
32340 <primary><varname>$host</varname></primary>
32341 </indexterm>
32342 When an address is routed to a local transport, IP addresses are not looked up.
32343 The host list is passed to the transport in the <varname>$host</varname> variable.
32344 </para>
32345 </section>
32346 <section id="SECID123">
32347 <title>Manualroute examples</title>
32348 <para>
32349 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32350 transport, as defined in the default configuration file, is assumed:
32351 </para>
32352 <itemizedlist>
32353 <listitem>
32354 <para>
32355 <indexterm role="concept">
32356 <primary>smart host</primary>
32357 <secondary>example router</secondary>
32358 </indexterm>
32359 The <command>manualroute</command> router can be used to forward all external mail to a
32360 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32361 named domain list that contains your local domains, for example:
32362 </para>
32363 <literallayout class="monospaced">
32364 domainlist local_domains = my.domain.example
32365 </literallayout>
32366 <para>
32367 You can arrange for all other domains to be routed to a smart host by making
32368 your first router something like this:
32369 </para>
32370 <literallayout class="monospaced">
32371 smart_route:
32372   driver = manualroute
32373   domains = !+local_domains
32374   transport = remote_smtp
32375   route_list = * smarthost.ref.example
32376 </literallayout>
32377 <para>
32378 This causes all non-local addresses to be sent to the single host
32379 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32380 they are tried in order
32381 (but you can use <option>hosts_randomize</option> to vary the order each time).
32382 Another way of configuring the same thing is this:
32383 </para>
32384 <literallayout class="monospaced">
32385 smart_route:
32386   driver = manualroute
32387   transport = remote_smtp
32388   route_list = !+local_domains  smarthost.ref.example
32389 </literallayout>
32390 <para>
32391 There is no difference in behaviour between these two routers as they stand.
32392 However, they behave differently if <option>no_more</option> is added to them. In the first
32393 example, the router is skipped if the domain does not match the <option>domains</option>
32394 precondition; the following router is always tried. If the router runs, it
32395 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32396 would have no effect. In the second case, the router is never skipped; it
32397 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
32398 <option>no_more</option> would prevent subsequent routers from running.
32399 </para>
32400 </listitem>
32401 <listitem>
32402 <para>
32403 <indexterm role="concept">
32404 <primary>mail hub example</primary>
32405 </indexterm>
32406 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32407 records in the DNS and delivers it via its own private routing mechanism. Often
32408 the final destinations are behind a firewall, with the mail hub being the one
32409 machine that can connect to machines both inside and outside the firewall. The
32410 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32411 to the correct hosts. For a small number of domains, the routing can be inline,
32412 using the <option>route_list</option> option, but for a larger number a file or database
32413 lookup is easier to manage.
32414 </para>
32415 <para>
32416 If the domain names are in fact the names of the machines to which the mail is
32417 to be sent by the mail hub, the configuration can be quite simple. For
32418 example:
32419 </para>
32420 <literallayout class="monospaced">
32421 hub_route:
32422   driver = manualroute
32423   transport = remote_smtp
32424   route_list = *.rhodes.tvs.example  $domain
32425 </literallayout>
32426 <para>
32427 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32428 whose names are the same as the mail domains. A similar approach can be taken
32429 if the host name can be obtained from the domain name by a string manipulation
32430 that the expansion facilities can handle. Otherwise, a lookup based on the
32431 domain can be used to find the host:
32432 </para>
32433 <literallayout class="monospaced">
32434 through_firewall:
32435   driver = manualroute
32436   transport = remote_smtp
32437   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32438 </literallayout>
32439 <para>
32440 The result of the lookup must be the name or IP address of the host (or
32441 hosts) to which the address is to be routed. If the lookup fails, the route
32442 data is empty, causing the router to decline. The address then passes to the
32443 next router.
32444 </para>
32445 </listitem>
32446 <listitem>
32447 <para>
32448 <indexterm role="concept">
32449 <primary>batched SMTP output example</primary>
32450 </indexterm>
32451 <indexterm role="concept">
32452 <primary>SMTP</primary>
32453 <secondary>batched outgoing; example</secondary>
32454 </indexterm>
32455 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32456 SMTP format for onward transportation by some other means. This is one way of
32457 storing mail for a dial-up host when it is not connected. The route list entry
32458 can be as simple as a single domain name in a configuration like this:
32459 </para>
32460 <literallayout class="monospaced">
32461 save_in_file:
32462   driver = manualroute
32463   transport = batchsmtp_appendfile
32464   route_list = saved.domain.example
32465 </literallayout>
32466 <para>
32467 though often a pattern is used to pick up more than one domain. If there are
32468 several domains or groups of domains with different transport requirements,
32469 different transports can be listed in the routing information:
32470 </para>
32471 <literallayout class="monospaced">
32472 save_in_file:
32473   driver = manualroute
32474   route_list = \
32475     *.saved.domain1.example  $domain  batch_appendfile; \
32476     *.saved.domain2.example  \
32477       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32478       batch_pipe
32479 </literallayout>
32480 <para>
32481 <indexterm role="variable">
32482 <primary><varname>$domain</varname></primary>
32483 </indexterm>
32484 <indexterm role="variable">
32485 <primary><varname>$host</varname></primary>
32486 </indexterm>
32487 The first of these just passes the domain in the <varname>$host</varname> variable, which
32488 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32489 file lookup to find a value to pass, causing the router to decline to handle
32490 the address if the lookup fails.
32491 </para>
32492 </listitem>
32493 <listitem>
32494 <para>
32495 <indexterm role="concept">
32496 <primary>UUCP</primary>
32497 <secondary>example of router for</secondary>
32498 </indexterm>
32499 Routing mail directly to UUCP software is a specific case of the use of
32500 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32501 one way it can be done:
32502 </para>
32503 <literallayout class="monospaced">
32504 # Transport
32505 uucp:
32506   driver = pipe
32507   user = nobody
32508   command = /usr/local/bin/uux -r - \
32509     ${substr_-5:$host}!rmail ${local_part}
32510   return_fail_output = true
32511
32512 # Router
32513 uucphost:
32514   transport = uucp
32515   driver = manualroute
32516   route_data = \
32517     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32518 </literallayout>
32519 <para>
32520 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32521 </para>
32522 <literallayout class="monospaced">
32523 darksite.ethereal.example:           darksite.UUCP
32524 </literallayout>
32525 <para>
32526 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32527 makes clear the distinction between the domain name
32528 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32529 </para>
32530 </listitem>
32531 </itemizedlist>
32532 <para>
32533 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32534 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32535 </para>
32536 </section>
32537 </chapter>
32538
32539 <chapter id="CHAPdriverlast">
32540 <title>The queryprogram router</title>
32541 <para>
32542 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32543 <primary><command>queryprogram</command> router</primary>
32544 </indexterm>
32545 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32546 <primary>routers</primary>
32547 <secondary><command>queryprogram</command></secondary>
32548 </indexterm>
32549 <indexterm role="concept">
32550 <primary>routing</primary>
32551 <secondary>by external program</secondary>
32552 </indexterm>
32553 The <command>queryprogram</command> router routes an address by running an external command
32554 and acting on its output. This is an expensive way to route, and is intended
32555 mainly for use in lightly-loaded systems, or for performing experiments.
32556 However, if it is possible to use the precondition options (<option>domains</option>,
32557 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32558 be used in special cases, even on a busy host. There are the following private
32559 options:
32560 <indexterm role="concept">
32561 <primary>options</primary>
32562 <secondary><command>queryprogram</command> router</secondary>
32563 </indexterm>
32564 </para>
32565 <para>
32566 <indexterm role="option">
32567 <primary><option>command</option></primary>
32568 </indexterm>
32569 </para>
32570 <informaltable frame="all">
32571 <tgroup cols="4" colsep="0" rowsep="0">
32572 <colspec colwidth="8*" align="left"/>
32573 <colspec colwidth="6*" align="center"/>
32574 <colspec colwidth="6*" align="center"/>
32575 <colspec colwidth="6*" align="right"/>
32576 <tbody>
32577 <row>
32578 <entry><option>command</option></entry>
32579 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32580 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32581 <entry>Default: <emphasis>unset</emphasis></entry>
32582 </row>
32583 </tbody>
32584 </tgroup>
32585 </informaltable>
32586 <para>
32587 This option must be set. It specifies the command that is to be run. The
32588 command is split up into a command name and arguments, and then each is
32589 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32590 <xref linkend="CHAPpipetransport"/>).
32591 </para>
32592 <para>
32593 <indexterm role="option">
32594 <primary><option>command_group</option></primary>
32595 </indexterm>
32596 </para>
32597 <informaltable frame="all">
32598 <tgroup cols="4" colsep="0" rowsep="0">
32599 <colspec colwidth="8*" align="left"/>
32600 <colspec colwidth="6*" align="center"/>
32601 <colspec colwidth="6*" align="center"/>
32602 <colspec colwidth="6*" align="right"/>
32603 <tbody>
32604 <row>
32605 <entry><option>command_group</option></entry>
32606 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32607 <entry>Type: <emphasis>string</emphasis></entry>
32608 <entry>Default: <emphasis>unset</emphasis></entry>
32609 </row>
32610 </tbody>
32611 </tgroup>
32612 </informaltable>
32613 <para>
32614 <indexterm role="concept">
32615 <primary>gid (group id)</primary>
32616 <secondary>in <command>queryprogram</command> router</secondary>
32617 </indexterm>
32618 This option specifies a gid to be set when running the command while routing an
32619 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32620 uid. If it begins with a digit, it is interpreted as the numerical value of the
32621 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32622 </para>
32623 <para>
32624 <indexterm role="option">
32625 <primary><option>command_user</option></primary>
32626 </indexterm>
32627 </para>
32628 <informaltable frame="all">
32629 <tgroup cols="4" colsep="0" rowsep="0">
32630 <colspec colwidth="8*" align="left"/>
32631 <colspec colwidth="6*" align="center"/>
32632 <colspec colwidth="6*" align="center"/>
32633 <colspec colwidth="6*" align="right"/>
32634 <tbody>
32635 <row>
32636 <entry><option>command_user</option></entry>
32637 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32638 <entry>Type: <emphasis>string</emphasis></entry>
32639 <entry>Default: <emphasis>unset</emphasis></entry>
32640 </row>
32641 </tbody>
32642 </tgroup>
32643 </informaltable>
32644 <para>
32645 <indexterm role="concept">
32646 <primary>uid (user id)</primary>
32647 <secondary>for <command>queryprogram</command></secondary>
32648 </indexterm>
32649 This option must be set. It specifies the uid which is set when running the
32650 command while routing an address for delivery. If the value begins with a digit,
32651 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32652 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32653 not set, a value for the gid also.
32654 </para>
32655 <para>
32656 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32657 root, which it does during a normal delivery in a conventional configuration.
32658 However, when an address is being verified during message reception, Exim is
32659 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32660 is called from a non-root process, Exim cannot change uid or gid before running
32661 the command. In this circumstance the command runs under the current uid and
32662 gid.
32663 </para>
32664 <para>
32665 <indexterm role="option">
32666 <primary><option>current_directory</option></primary>
32667 </indexterm>
32668 </para>
32669 <informaltable frame="all">
32670 <tgroup cols="4" colsep="0" rowsep="0">
32671 <colspec colwidth="8*" align="left"/>
32672 <colspec colwidth="6*" align="center"/>
32673 <colspec colwidth="6*" align="center"/>
32674 <colspec colwidth="6*" align="right"/>
32675 <tbody>
32676 <row>
32677 <entry><option>current_directory</option></entry>
32678 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32679 <entry>Type: <emphasis>string</emphasis></entry>
32680 <entry>Default: <emphasis>/</emphasis></entry>
32681 </row>
32682 </tbody>
32683 </tgroup>
32684 </informaltable>
32685 <para>
32686 This option specifies an absolute path which is made the current directory
32687 before running the command.
32688 </para>
32689 <para>
32690 <indexterm role="option">
32691 <primary><option>timeout</option></primary>
32692 </indexterm>
32693 </para>
32694 <informaltable frame="all">
32695 <tgroup cols="4" colsep="0" rowsep="0">
32696 <colspec colwidth="8*" align="left"/>
32697 <colspec colwidth="6*" align="center"/>
32698 <colspec colwidth="6*" align="center"/>
32699 <colspec colwidth="6*" align="right"/>
32700 <tbody>
32701 <row>
32702 <entry><option>timeout</option></entry>
32703 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32704 <entry>Type: <emphasis>time</emphasis></entry>
32705 <entry>Default: <emphasis>1h</emphasis></entry>
32706 </row>
32707 </tbody>
32708 </tgroup>
32709 </informaltable>
32710 <para>
32711 If the command does not complete within the timeout period, its process group
32712 is killed and the message is frozen. A value of zero time specifies no
32713 timeout.
32714 </para>
32715 <para>
32716 The standard output of the command is connected to a pipe, which is read when
32717 the command terminates. It should consist of a single line of output,
32718 containing up to five fields, separated by white space. The maximum length of
32719 the line is 1023 characters. Longer lines are silently truncated. The first
32720 field is one of the following words (case-insensitive):
32721 </para>
32722 <itemizedlist>
32723 <listitem>
32724 <para>
32725 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32726 below).
32727 </para>
32728 </listitem>
32729 <listitem>
32730 <para>
32731 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32732 <option>no_more</option> is set.
32733 </para>
32734 </listitem>
32735 <listitem>
32736 <para>
32737 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32738 subsequent text on the line is an error message. If the router is run as part
32739 of address verification during an incoming SMTP message, the message is
32740 included in the SMTP response.
32741 </para>
32742 </listitem>
32743 <listitem>
32744 <para>
32745 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32746 subsequent text on the line is an error message which is logged. It is not
32747 included in any SMTP response.
32748 </para>
32749 </listitem>
32750 <listitem>
32751 <para>
32752 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32753 </para>
32754 </listitem>
32755 <listitem>
32756 <para>
32757 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32758 <option>pass_router</option>), overriding <option>no_more</option>.
32759 </para>
32760 </listitem>
32761 <listitem>
32762 <para>
32763 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32764 new addresses, which are routed independently, starting with the first router,
32765 or the router specified by <option>redirect_router</option>, if set.
32766 </para>
32767 </listitem>
32768 </itemizedlist>
32769 <para>
32770 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32771 number of keyed data values, as follows (split into two lines here, to fit on
32772 the page):
32773 </para>
32774 <literallayout class="monospaced">
32775 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
32776 LOOKUP=byname|bydns DATA=&lt;text&gt;
32777 </literallayout>
32778 <para>
32779 The data items can be given in any order, and all are optional. If no transport
32780 is included, the transport specified by the generic <option>transport</option> option is
32781 used. The list of hosts and the lookup type are needed only if the transport is
32782 an <command>smtp</command> transport that does not itself supply a list of hosts.
32783 </para>
32784 <para>
32785 The format of the list of hosts is the same as for the <command>manualroute</command> router.
32786 As well as host names and IP addresses with optional port numbers, as described
32787 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
32788 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
32789 (see section <xref linkend="SECThostshowused"/>).
32790 </para>
32791 <para>
32792 If the lookup type is not specified, Exim behaves as follows when trying to
32793 find an IP address for each host: First, a DNS lookup is done. If this yields
32794 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
32795 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
32796 result of the lookup is the result of that call.
32797 </para>
32798 <para>
32799 <indexterm role="variable">
32800 <primary><varname>$address_data</varname></primary>
32801 </indexterm>
32802 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
32803 variable. For example, this return line
32804 </para>
32805 <literallayout class="monospaced">
32806 accept hosts=x1.y.example:x2.y.example data="rule1"
32807 </literallayout>
32808 <para>
32809 routes the address to the default transport, passing a list of two hosts. When
32810 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
32811 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
32812 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
32813 </para>
32814 </chapter>
32815
32816 <chapter id="CHAPredirect">
32817 <title>The redirect router</title>
32818 <para>
32819 <indexterm role="concept" id="IIDredrou1" class="startofrange">
32820 <primary><command>redirect</command> router</primary>
32821 </indexterm>
32822 <indexterm role="concept" id="IIDredrou2" class="startofrange">
32823 <primary>routers</primary>
32824 <secondary><command>redirect</command></secondary>
32825 </indexterm>
32826 <indexterm role="concept">
32827 <primary>alias file</primary>
32828 <secondary>in a <command>redirect</command> router</secondary>
32829 </indexterm>
32830 <indexterm role="concept">
32831 <primary>address redirection</primary>
32832 <secondary><command>redirect</command> router</secondary>
32833 </indexterm>
32834 The <command>redirect</command> router handles several kinds of address redirection. Its most
32835 common uses are for resolving local part aliases from a central alias file
32836 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
32837 files, but it has many other potential uses. The incoming address can be
32838 redirected in several different ways:
32839 </para>
32840 <itemizedlist>
32841 <listitem>
32842 <para>
32843 It can be replaced by one or more new addresses which are themselves routed
32844 independently.
32845 </para>
32846 </listitem>
32847 <listitem>
32848 <para>
32849 It can be routed to be delivered to a given file or directory.
32850 </para>
32851 </listitem>
32852 <listitem>
32853 <para>
32854 It can be routed to be delivered to a specified pipe command.
32855 </para>
32856 </listitem>
32857 <listitem>
32858 <para>
32859 It can cause an automatic reply to be generated.
32860 </para>
32861 </listitem>
32862 <listitem>
32863 <para>
32864 It can be forced to fail, optionally with a custom error message.
32865 </para>
32866 </listitem>
32867 <listitem>
32868 <para>
32869 It can be temporarily deferred, optionally with a custom message.
32870 </para>
32871 </listitem>
32872 <listitem>
32873 <para>
32874 It can be discarded.
32875 </para>
32876 </listitem>
32877 </itemizedlist>
32878 <para>
32879 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32880 However, there are some private options which define transports for delivery to
32881 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32882 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32883 </para>
32884 <section id="SECID124">
32885 <title>Redirection data</title>
32886 <para>
32887 The router operates by interpreting a text string which it obtains either by
32888 expanding the contents of the <option>data</option> option, or by reading the entire
32889 contents of a file whose name is given in the <option>file</option> option. These two
32890 options are mutually exclusive. The first is commonly used for handling system
32891 aliases, in a configuration like this:
32892 </para>
32893 <literallayout class="monospaced">
32894 system_aliases:
32895   driver = redirect
32896   data = ${lookup{$local_part}lsearch{/etc/aliases}}
32897 </literallayout>
32898 <para>
32899 If the lookup fails, the expanded string in this example is empty. When the
32900 expansion of <option>data</option> results in an empty string, the router declines. A forced
32901 expansion failure also causes the router to decline; other expansion failures
32902 cause delivery to be deferred.
32903 </para>
32904 <para>
32905 A configuration using <option>file</option> is commonly used for handling users&#x2019;
32906 <filename>.forward</filename> files, like this:
32907 </para>
32908 <literallayout class="monospaced">
32909 userforward:
32910   driver = redirect
32911   check_local_user
32912   file = $home/.forward
32913   no_verify
32914 </literallayout>
32915 <para>
32916 If the file does not exist, or causes no action to be taken (for example, it is
32917 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32918 is not the case when the file contains syntactically valid items that happen to
32919 yield empty addresses, for example, items containing only RFC 2822 address
32920 comments.
32921 </para>
32922 </section>
32923 <section id="SECID125">
32924 <title>Forward files and address verification</title>
32925 <para>
32926 <indexterm role="concept">
32927 <primary>address redirection</primary>
32928 <secondary>while verifying</secondary>
32929 </indexterm>
32930 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
32931 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32932 </para>
32933 <itemizedlist>
32934 <listitem>
32935 <para>
32936 When Exim is receiving an incoming SMTP message from a remote host, it is
32937 running under the Exim uid, not as root. Exim is unable to change uid to read
32938 the file as the user, and it may not be able to read it as the Exim user. So in
32939 practice the router may not be able to operate.
32940 </para>
32941 </listitem>
32942 <listitem>
32943 <para>
32944 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32945 is unimportant when verifying an address. What should be checked is whether the
32946 local part is a valid user name or not. Cutting out the redirection processing
32947 saves some resources.
32948 </para>
32949 </listitem>
32950 </itemizedlist>
32951 </section>
32952 <section id="SECID126">
32953 <title>Interpreting redirection data</title>
32954 <para>
32955 <indexterm role="concept">
32956 <primary>Sieve filter</primary>
32957 <secondary>specifying in redirection data</secondary>
32958 </indexterm>
32959 <indexterm role="concept">
32960 <primary>filter</primary>
32961 <secondary>specifying in redirection data</secondary>
32962 </indexterm>
32963 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32964 can be interpreted in two different ways:
32965 </para>
32966 <itemizedlist>
32967 <listitem>
32968 <para>
32969 If the <option>allow_filter</option> option is set true, and the data begins with the text
32970 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32971 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32972 respectively. Details of the syntax and semantics of filter files are described
32973 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
32974 document is intended for use by end users.
32975 </para>
32976 </listitem>
32977 <listitem>
32978 <para>
32979 Otherwise, the data must be a comma-separated list of redirection items, as
32980 described in the next section.
32981 </para>
32982 </listitem>
32983 </itemizedlist>
32984 <para>
32985 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
32986 in a non-filter redirection list must always be an absolute path. A filter may
32987 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
32988 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
32989 for the <command>appendfile</command> transport.
32990 </para>
32991 </section>
32992 <section id="SECTitenonfilred">
32993 <title>Items in a non-filter redirection list</title>
32994 <para>
32995 <indexterm role="concept">
32996 <primary>address redirection</primary>
32997 <secondary>non-filter list items</secondary>
32998 </indexterm>
32999 When the redirection data is not an Exim or Sieve filter, for example, if it
33000 comes from a conventional alias or forward file, it consists of a list of
33001 addresses, file names, pipe commands, or certain special items (see section
33002 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33003 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33004 depending on their default values. The items in the list are separated by
33005 commas or newlines.
33006 If a comma is required in an item, the entire item must be enclosed in double
33007 quotes.
33008 </para>
33009 <para>
33010 Lines starting with a # character are comments, and are ignored, and # may
33011 also appear following a comma, in which case everything between the # and the
33012 next newline character is ignored.
33013 </para>
33014 <para>
33015 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33016 double quotes are retained because some forms of mail address require their use
33017 (but never to enclose the entire address). In the following description,
33018 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33019 removed.
33020 </para>
33021 <para>
33022 <indexterm role="variable">
33023 <primary><varname>$local_part</varname></primary>
33024 </indexterm>
33025 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33026 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33027 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33028 special characters. For example, to redirect all mail for the domain
33029 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33030 setting:
33031 </para>
33032 <literallayout class="monospaced">
33033 data = ${quote_local_part:$local_part}@newdomain.example
33034 </literallayout>
33035 </section>
33036 <section id="SECTredlocmai">
33037 <title>Redirecting to a local mailbox</title>
33038 <para>
33039 <indexterm role="concept">
33040 <primary>routing</primary>
33041 <secondary>loops in</secondary>
33042 </indexterm>
33043 <indexterm role="concept">
33044 <primary>loop</primary>
33045 <secondary>while routing, avoidance of</secondary>
33046 </indexterm>
33047 <indexterm role="concept">
33048 <primary>address redirection</primary>
33049 <secondary>to local mailbox</secondary>
33050 </indexterm>
33051 A redirection item may safely be the same as the address currently under
33052 consideration. This does not cause a routing loop, because a router is
33053 automatically skipped if any ancestor of the address that is being processed
33054 is the same as the current address and was processed by the current router.
33055 Such an address is therefore passed to the following routers, so it is handled
33056 as if there were no redirection. When making this loop-avoidance test, the
33057 complete local part, including any prefix or suffix, is used.
33058 </para>
33059 <para>
33060 <indexterm role="concept">
33061 <primary>address redirection</primary>
33062 <secondary>local part without domain</secondary>
33063 </indexterm>
33064 Specifying the same local part without a domain is a common usage in personal
33065 filter files when the user wants to have messages delivered to the local
33066 mailbox and also forwarded elsewhere. For example, the user whose login is
33067 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33068 </para>
33069 <literallayout class="monospaced">
33070 cleo, cleopatra@egypt.example
33071 </literallayout>
33072 <para>
33073 <indexterm role="concept">
33074 <primary>backslash in alias file</primary>
33075 </indexterm>
33076 <indexterm role="concept">
33077 <primary>alias file</primary>
33078 <secondary>backslash in</secondary>
33079 </indexterm>
33080 For compatibility with other MTAs, such unqualified local parts may be
33081 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33082 it does make a difference if more than one domain is being handled
33083 synonymously.
33084 </para>
33085 <para>
33086 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33087 2822 address that does not include a domain, the item is qualified using the
33088 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33089 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33090 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33091 </para>
33092 <para>
33093 Care must be taken if there are alias names for local users.
33094 Consider an MTA handling a single local domain where the system alias file
33095 contains:
33096 </para>
33097 <literallayout class="monospaced">
33098 Sam.Reman: spqr
33099 </literallayout>
33100 <para>
33101 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33102 messages in the local mailbox, and also forward copies elsewhere. He creates
33103 this forward file:
33104 </para>
33105 <literallayout class="monospaced">
33106 Sam.Reman, spqr@reme.elsewhere.example
33107 </literallayout>
33108 <para>
33109 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33110 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33111 second time round, because it has previously routed it,
33112 and the following routers presumably cannot handle the alias. The forward file
33113 should really contain
33114 </para>
33115 <literallayout class="monospaced">
33116 spqr, spqr@reme.elsewhere.example
33117 </literallayout>
33118 <para>
33119 but because this is such a common error, the <option>check_ancestor</option> option (see
33120 below) exists to provide a way to get round it. This is normally set on a
33121 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
33122 </para>
33123 </section>
33124 <section id="SECTspecitredli">
33125 <title>Special items in redirection lists</title>
33126 <para>
33127 In addition to addresses, the following types of item may appear in redirection
33128 lists (that is, in non-filter redirection data):
33129 </para>
33130 <itemizedlist>
33131 <listitem>
33132 <para>
33133 <indexterm role="concept">
33134 <primary>pipe</primary>
33135 <secondary>in redirection list</secondary>
33136 </indexterm>
33137 <indexterm role="concept">
33138 <primary>address redirection</primary>
33139 <secondary>to pipe</secondary>
33140 </indexterm>
33141 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33142 as a valid RFC 2822 address that includes a domain. A transport for running the
33143 command must be specified by the <option>pipe_transport</option> option.
33144 Normally, either the router or the transport specifies a user and a group under
33145 which to run the delivery. The default is to use the Exim user and group.
33146 </para>
33147 <para>
33148 Single or double quotes can be used for enclosing the individual arguments of
33149 the pipe command; no interpretation of escapes is done for single quotes. If
33150 the command contains a comma character, it is necessary to put the whole item
33151 in double quotes, for example:
33152 </para>
33153 <literallayout class="monospaced">
33154 "|/some/command ready,steady,go"
33155 </literallayout>
33156 <para>
33157 since items in redirection lists are terminated by commas. Do not, however,
33158 quote just the command. An item such as
33159 </para>
33160 <literallayout class="monospaced">
33161 |"/some/command ready,steady,go"
33162 </literallayout>
33163 <para>
33164 is interpreted as a pipe with a rather strange command name, and no arguments.
33165 </para>
33166 </listitem>
33167 <listitem>
33168 <para>
33169 <indexterm role="concept">
33170 <primary>file</primary>
33171 <secondary>in redirection list</secondary>
33172 </indexterm>
33173 <indexterm role="concept">
33174 <primary>address redirection</primary>
33175 <secondary>to file</secondary>
33176 </indexterm>
33177 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33178 parse as a valid RFC 2822 address that includes a domain. For example,
33179 </para>
33180 <literallayout class="monospaced">
33181 /home/world/minbari
33182 </literallayout>
33183 <para>
33184 is treated as a file name, but
33185 </para>
33186 <literallayout class="monospaced">
33187 /s=molari/o=babylon/@x400gate.way
33188 </literallayout>
33189 <para>
33190 is treated as an address. For a file name, a transport must be specified using
33191 the <option>file_transport</option> option. However, if the generated path name ends with a
33192 forward slash character, it is interpreted as a directory name rather than a
33193 file name, and <option>directory_transport</option> is used instead.
33194 </para>
33195 <para>
33196 Normally, either the router or the transport specifies a user and a group under
33197 which to run the delivery. The default is to use the Exim user and group.
33198 </para>
33199 <para>
33200 <indexterm role="concept">
33201 <primary><filename>/dev/null</filename></primary>
33202 </indexterm>
33203 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33204 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33205 instead of a transport name. In this case the user and group are not used.
33206 </para>
33207 </listitem>
33208 <listitem>
33209 <para>
33210 <indexterm role="concept">
33211 <primary>included address list</primary>
33212 </indexterm>
33213 <indexterm role="concept">
33214 <primary>address redirection</primary>
33215 <secondary>included external list</secondary>
33216 </indexterm>
33217 If an item is of the form
33218 </para>
33219 <literallayout class="monospaced">
33220 :include:&lt;path name&gt;
33221 </literallayout>
33222 <para>
33223 a list of further items is taken from the given file and included at that
33224 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33225 out-of-line addition to the list. The items in the included list are separated
33226 by commas or newlines and are not subject to expansion. If this is the first
33227 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33228 the alias name. This example is incorrect:
33229 </para>
33230 <literallayout class="monospaced">
33231 list1    :include:/opt/lists/list1
33232 </literallayout>
33233 <para>
33234 It must be given as
33235 </para>
33236 <literallayout class="monospaced">
33237 list1:   :include:/opt/lists/list1
33238 </literallayout>
33239 </listitem>
33240 <listitem>
33241 <para>
33242 <indexterm role="concept">
33243 <primary>address redirection</primary>
33244 <secondary>to black hole</secondary>
33245 </indexterm>
33246 Sometimes you want to throw away mail to a particular local part. Making the
33247 <option>data</option> option expand to an empty string does not work, because that causes
33248 the router to decline. Instead, the alias item
33249 <indexterm role="concept">
33250 <primary>black hole</primary>
33251 </indexterm>
33252 <indexterm role="concept">
33253 <primary>abandoning mail</primary>
33254 </indexterm>
33255 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33256 done, and no error message is generated. This has the same effect as specifing
33257 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33258 </para>
33259 <para>
33260 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33261 delivery is done for the original local part, even if other redirection items
33262 are present. If you are generating a multi-item list (for example, by reading a
33263 database) and need the ability to provide a no-op item, you must use
33264 <filename>/dev/null</filename>.
33265 </para>
33266 </listitem>
33267 <listitem>
33268 <para>
33269 <indexterm role="concept">
33270 <primary>delivery</primary>
33271 <secondary>forcing failure</secondary>
33272 </indexterm>
33273 <indexterm role="concept">
33274 <primary>delivery</primary>
33275 <secondary>forcing deferral</secondary>
33276 </indexterm>
33277 <indexterm role="concept">
33278 <primary>failing delivery</primary>
33279 <secondary>forcing</secondary>
33280 </indexterm>
33281 <indexterm role="concept">
33282 <primary>deferred delivery, forcing</primary>
33283 </indexterm>
33284 <indexterm role="concept">
33285 <primary>customizing</primary>
33286 <secondary>failure message</secondary>
33287 </indexterm>
33288 An attempt to deliver a particular address can be deferred or forced to fail by
33289 redirection items of the form
33290 </para>
33291 <literallayout class="monospaced">
33292 :defer:
33293 :fail:
33294 </literallayout>
33295 <para revisionflag="changed">
33296 respectively. When a redirection list contains such an item, it applies
33297 to the entire redirection; any other items in the list are ignored. Any
33298 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33299 associated with the failure. For example, an alias file might contain:
33300 </para>
33301 <literallayout class="monospaced">
33302 X.Employee:  :fail: Gone away, no forwarding address
33303 </literallayout>
33304 <para>
33305 In the case of an address that is being verified from an ACL or as the subject
33306 of a
33307 <indexterm role="concept">
33308 <primary>VRFY</primary>
33309 <secondary>error text, display of</secondary>
33310 </indexterm>
33311 VRFY command, the text is included in the SMTP error response by
33312 default.
33313 <indexterm role="concept">
33314 <primary>EXPN</primary>
33315 <secondary>error text, display of</secondary>
33316 </indexterm>
33317 The text is not included in the response to an EXPN command. In non-SMTP cases
33318 the text is included in the error message that Exim generates.
33319 </para>
33320 <para>
33321 <indexterm role="concept">
33322 <primary>SMTP</primary>
33323 <secondary>error codes</secondary>
33324 </indexterm>
33325 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33326 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33327 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33328 followed by a space, and the very first digit is the same as the default error
33329 code, the code from the message is used instead. If the very first digit is
33330 incorrect, a panic error is logged, and the default code is used. You can
33331 suppress the use of the supplied code in a redirect router by setting the
33332 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33333 ignored.
33334 </para>
33335 <para>
33336 <indexterm role="variable">
33337 <primary><varname>$acl_verify_message</varname></primary>
33338 </indexterm>
33339 In an ACL, an explicitly provided message overrides the default, but the
33340 default message is available in the variable <varname>$acl_verify_message</varname> and can
33341 therefore be included in a custom message if this is desired.
33342 </para>
33343 <para>
33344 Normally the error text is the rest of the redirection list &ndash; a comma does
33345 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
33346 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33347 as part of the continuation process, but they may exist in other kinds of
33348 lookup and in <emphasis>:include:</emphasis> files.
33349 </para>
33350 <para>
33351 During routing for message delivery (as opposed to verification), a redirection
33352 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33353 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33354 subsequent delivery attempt can happen at a later time. If an address is
33355 deferred for too long, it will ultimately fail, because the normal retry
33356 rules still apply.
33357 </para>
33358 </listitem>
33359 <listitem>
33360 <para>
33361 <indexterm role="concept">
33362 <primary>alias file</primary>
33363 <secondary>exception to default</secondary>
33364 </indexterm>
33365 Sometimes it is useful to use a single-key search type with a default (see
33366 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33367 for exceptions to the default. These can be handled by aliasing them to
33368 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33369 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33370 results in an empty redirection list has the same effect.
33371 </para>
33372 </listitem>
33373 </itemizedlist>
33374 </section>
33375 <section id="SECTdupaddr">
33376 <title>Duplicate addresses</title>
33377 <para>
33378 <indexterm role="concept">
33379 <primary>duplicate addresses</primary>
33380 </indexterm>
33381 <indexterm role="concept">
33382 <primary>address duplicate, discarding</primary>
33383 </indexterm>
33384 <indexterm role="concept">
33385 <primary>pipe</primary>
33386 <secondary>duplicated</secondary>
33387 </indexterm>
33388 Exim removes duplicate addresses from the list to which it is delivering, so as
33389 to deliver just one copy to each address. This does not apply to deliveries
33390 routed to pipes by different immediate parent addresses, but an indirect
33391 aliasing scheme of the type
33392 </para>
33393 <literallayout class="monospaced">
33394 pipe:       |/some/command $local_part
33395 localpart1: pipe
33396 localpart2: pipe
33397 </literallayout>
33398 <para>
33399 does not work with a message that is addressed to both local parts, because
33400 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33401 discarded as being the same as a previously handled address. However, a scheme
33402 such as
33403 </para>
33404 <literallayout class="monospaced">
33405 localpart1: |/some/command $local_part
33406 localpart2: |/some/command $local_part
33407 </literallayout>
33408 <para>
33409 does result in two different pipe deliveries, because the immediate parents of
33410 the pipes are distinct.
33411 </para>
33412 </section>
33413 <section id="SECID128">
33414 <title>Repeated redirection expansion</title>
33415 <para>
33416 <indexterm role="concept">
33417 <primary>repeated redirection expansion</primary>
33418 </indexterm>
33419 <indexterm role="concept">
33420 <primary>address redirection</primary>
33421 <secondary>repeated for each delivery attempt</secondary>
33422 </indexterm>
33423 When a message cannot be delivered to all of its recipients immediately,
33424 leading to two or more delivery attempts, redirection expansion is carried out
33425 afresh each time for those addresses whose children were not all previously
33426 delivered. If redirection is being used as a mailing list, this can lead to new
33427 members of the list receiving copies of old messages. The <option>one_time</option> option
33428 can be used to avoid this.
33429 </para>
33430 </section>
33431 <section id="SECID129">
33432 <title>Errors in redirection lists</title>
33433 <para>
33434 <indexterm role="concept">
33435 <primary>address redirection</primary>
33436 <secondary>errors</secondary>
33437 </indexterm>
33438 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33439 error is skipped, and an entry is written to the main log. This may be useful
33440 for mailing lists that are automatically managed. Otherwise, if an error is
33441 detected while generating the list of new addresses, the original address is
33442 deferred. See also <option>syntax_errors_to</option>.
33443 </para>
33444 </section>
33445 <section id="SECID130">
33446 <title>Private options for the redirect router</title>
33447 <para>
33448 <indexterm role="concept">
33449 <primary>options</primary>
33450 <secondary><command>redirect</command> router</secondary>
33451 </indexterm>
33452 The private options for the <command>redirect</command> router are as follows:
33453 </para>
33454 <para>
33455 <indexterm role="option">
33456 <primary><option>allow_defer</option></primary>
33457 </indexterm>
33458 </para>
33459 <informaltable frame="all">
33460 <tgroup cols="4" colsep="0" rowsep="0">
33461 <colspec colwidth="8*" align="left"/>
33462 <colspec colwidth="6*" align="center"/>
33463 <colspec colwidth="6*" align="center"/>
33464 <colspec colwidth="6*" align="right"/>
33465 <tbody>
33466 <row>
33467 <entry><option>allow_defer</option></entry>
33468 <entry>Use: <emphasis>redirect</emphasis></entry>
33469 <entry>Type: <emphasis>boolean</emphasis></entry>
33470 <entry>Default: <emphasis>false</emphasis></entry>
33471 </row>
33472 </tbody>
33473 </tgroup>
33474 </informaltable>
33475 <para>
33476 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33477 data, or the <option>defer</option> command in an Exim filter file.
33478 </para>
33479 <para>
33480 <indexterm role="option">
33481 <primary><option>allow_fail</option></primary>
33482 </indexterm>
33483 </para>
33484 <informaltable frame="all">
33485 <tgroup cols="4" colsep="0" rowsep="0">
33486 <colspec colwidth="8*" align="left"/>
33487 <colspec colwidth="6*" align="center"/>
33488 <colspec colwidth="6*" align="center"/>
33489 <colspec colwidth="6*" align="right"/>
33490 <tbody>
33491 <row>
33492 <entry><option>allow_fail</option></entry>
33493 <entry>Use: <emphasis>redirect</emphasis></entry>
33494 <entry>Type: <emphasis>boolean</emphasis></entry>
33495 <entry>Default: <emphasis>false</emphasis></entry>
33496 </row>
33497 </tbody>
33498 </tgroup>
33499 </informaltable>
33500 <para>
33501 <indexterm role="concept">
33502 <primary>failing delivery</primary>
33503 <secondary>from filter</secondary>
33504 </indexterm>
33505 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33506 and the <option>fail</option> command may be used in an Exim filter file.
33507 </para>
33508 <para>
33509 <indexterm role="option">
33510 <primary><option>allow_filter</option></primary>
33511 </indexterm>
33512 </para>
33513 <informaltable frame="all">
33514 <tgroup cols="4" colsep="0" rowsep="0">
33515 <colspec colwidth="8*" align="left"/>
33516 <colspec colwidth="6*" align="center"/>
33517 <colspec colwidth="6*" align="center"/>
33518 <colspec colwidth="6*" align="right"/>
33519 <tbody>
33520 <row>
33521 <entry><option>allow_filter</option></entry>
33522 <entry>Use: <emphasis>redirect</emphasis></entry>
33523 <entry>Type: <emphasis>boolean</emphasis></entry>
33524 <entry>Default: <emphasis>false</emphasis></entry>
33525 </row>
33526 </tbody>
33527 </tgroup>
33528 </informaltable>
33529 <para>
33530 <indexterm role="concept">
33531 <primary>filter</primary>
33532 <secondary>enabling use of</secondary>
33533 </indexterm>
33534 <indexterm role="concept">
33535 <primary>Sieve filter</primary>
33536 <secondary>enabling use of</secondary>
33537 </indexterm>
33538 Setting this option allows Exim to interpret redirection data that starts with
33539 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33540 are some features of Exim filter files that some administrators may wish to
33541 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33542 </para>
33543 <para>
33544 It is also possible to lock out Exim filters or Sieve filters while allowing
33545 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33546 </para>
33547 <para>
33548 The filter is run using the uid and gid set by the generic <option>user</option> and
33549 <option>group</option> options. These take their defaults from the password data if
33550 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
33551 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33552 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33553 </para>
33554 <para>
33555 <indexterm role="option">
33556 <primary><option>allow_freeze</option></primary>
33557 </indexterm>
33558 </para>
33559 <informaltable frame="all">
33560 <tgroup cols="4" colsep="0" rowsep="0">
33561 <colspec colwidth="8*" align="left"/>
33562 <colspec colwidth="6*" align="center"/>
33563 <colspec colwidth="6*" align="center"/>
33564 <colspec colwidth="6*" align="right"/>
33565 <tbody>
33566 <row>
33567 <entry><option>allow_freeze</option></entry>
33568 <entry>Use: <emphasis>redirect</emphasis></entry>
33569 <entry>Type: <emphasis>boolean</emphasis></entry>
33570 <entry>Default: <emphasis>false</emphasis></entry>
33571 </row>
33572 </tbody>
33573 </tgroup>
33574 </informaltable>
33575 <para>
33576 <indexterm role="concept">
33577 <primary>freezing messages</primary>
33578 <secondary>allowing in filter</secondary>
33579 </indexterm>
33580 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33581 This command is more normally encountered in system filters, and is disabled by
33582 default for redirection filters because it isn&#x2019;t something you usually want to
33583 let ordinary users do.
33584 </para>
33585 <para>
33586 <indexterm role="option">
33587 <primary><option>check_ancestor</option></primary>
33588 </indexterm>
33589 </para>
33590 <informaltable frame="all">
33591 <tgroup cols="4" colsep="0" rowsep="0">
33592 <colspec colwidth="8*" align="left"/>
33593 <colspec colwidth="6*" align="center"/>
33594 <colspec colwidth="6*" align="center"/>
33595 <colspec colwidth="6*" align="right"/>
33596 <tbody>
33597 <row>
33598 <entry><option>check_ancestor</option></entry>
33599 <entry>Use: <emphasis>redirect</emphasis></entry>
33600 <entry>Type: <emphasis>boolean</emphasis></entry>
33601 <entry>Default: <emphasis>false</emphasis></entry>
33602 </row>
33603 </tbody>
33604 </tgroup>
33605 </informaltable>
33606 <para>
33607 This option is concerned with handling generated addresses that are the same
33608 as some address in the list of redirection ancestors of the current address.
33609 Although it is turned off by default in the code, it is set in the default
33610 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
33611 for this use of the <command>redirect</command> router.
33612 </para>
33613 <para>
33614 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33615 is the same as any ancestor of the current address, it is replaced by a copy of
33616 the current address. This helps in the case where local part A is aliased to B,
33617 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33618 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33619 <filename>&nbsp;jb/.forward</filename> contains:
33620 </para>
33621 <literallayout class="monospaced">
33622 \Joe.Bloggs, &lt;other item(s)&gt;
33623 </literallayout>
33624 <para>
33625 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33626 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33627 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33628 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33629 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33630 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33631 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33632 original address. See also the <option>repeat_use</option> option below.
33633 </para>
33634 <para>
33635 <indexterm role="option">
33636 <primary><option>check_group</option></primary>
33637 </indexterm>
33638 </para>
33639 <informaltable frame="all">
33640 <tgroup cols="4" colsep="0" rowsep="0">
33641 <colspec colwidth="8*" align="left"/>
33642 <colspec colwidth="6*" align="center"/>
33643 <colspec colwidth="6*" align="center"/>
33644 <colspec colwidth="6*" align="right"/>
33645 <tbody>
33646 <row>
33647 <entry><option>check_group</option></entry>
33648 <entry>Use: <emphasis>redirect</emphasis></entry>
33649 <entry>Type: <emphasis>boolean</emphasis></entry>
33650 <entry>Default: <emphasis>see below</emphasis></entry>
33651 </row>
33652 </tbody>
33653 </tgroup>
33654 </informaltable>
33655 <para>
33656 When the <option>file</option> option is used, the group owner of the file is checked only
33657 when this option is set. The permitted groups are those listed in the
33658 <option>owngroups</option> option, together with the user&#x2019;s default group if
33659 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33660 deferred. The default setting for this option is true if <option>check_local_user</option>
33661 is set and the <option>modemask</option> option permits the group write bit, or if the
33662 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33663 </para>
33664 <para>
33665 <indexterm role="option">
33666 <primary><option>check_owner</option></primary>
33667 </indexterm>
33668 </para>
33669 <informaltable frame="all">
33670 <tgroup cols="4" colsep="0" rowsep="0">
33671 <colspec colwidth="8*" align="left"/>
33672 <colspec colwidth="6*" align="center"/>
33673 <colspec colwidth="6*" align="center"/>
33674 <colspec colwidth="6*" align="right"/>
33675 <tbody>
33676 <row>
33677 <entry><option>check_owner</option></entry>
33678 <entry>Use: <emphasis>redirect</emphasis></entry>
33679 <entry>Type: <emphasis>boolean</emphasis></entry>
33680 <entry>Default: <emphasis>see below</emphasis></entry>
33681 </row>
33682 </tbody>
33683 </tgroup>
33684 </informaltable>
33685 <para>
33686 When the <option>file</option> option is used, the owner of the file is checked only when
33687 this option is set. If <option>check_local_user</option> is set, the local user is
33688 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33689 option. The default value for this option is true if <option>check_local_user</option> or
33690 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33691 </para>
33692 <para>
33693 <indexterm role="option">
33694 <primary><option>data</option></primary>
33695 </indexterm>
33696 </para>
33697 <informaltable frame="all">
33698 <tgroup cols="4" colsep="0" rowsep="0">
33699 <colspec colwidth="8*" align="left"/>
33700 <colspec colwidth="6*" align="center"/>
33701 <colspec colwidth="6*" align="center"/>
33702 <colspec colwidth="6*" align="right"/>
33703 <tbody>
33704 <row>
33705 <entry><option>data</option></entry>
33706 <entry>Use: <emphasis>redirect</emphasis></entry>
33707 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33708 <entry>Default: <emphasis>unset</emphasis></entry>
33709 </row>
33710 </tbody>
33711 </tgroup>
33712 </informaltable>
33713 <para>
33714 This option is mutually exclusive with <option>file</option>. One or other of them must be
33715 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33716 list of forwarding items, or as a set of filtering instructions. If the
33717 expansion is forced to fail, or the result is an empty string or a string that
33718 has no effect (consists entirely of comments), the router declines.
33719 </para>
33720 <para>
33721 When filtering instructions are used, the string must begin with <quote>#Exim
33722 filter</quote>, and all comments in the string, including this initial one, must be
33723 terminated with newline characters. For example:
33724 </para>
33725 <literallayout class="monospaced">
33726 data = #Exim filter\n\
33727        if $h_to: contains Exim then save $home/mail/exim endif
33728 </literallayout>
33729 <para>
33730 If you are reading the data from a database where newlines cannot be included,
33731 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33732 choice into a newline.
33733 </para>
33734 <para>
33735 <indexterm role="option">
33736 <primary><option>directory_transport</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>directory_transport</option></entry>
33748 <entry>Use: <emphasis>redirect</emphasis></entry>
33749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33750 <entry>Default: <emphasis>unset</emphasis></entry>
33751 </row>
33752 </tbody>
33753 </tgroup>
33754 </informaltable>
33755 <para>
33756 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33757 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33758 specified by this option, which, after expansion, must be the name of a
33759 configured transport. This should normally be an <command>appendfile</command> transport.
33760 </para>
33761 <para>
33762 <indexterm role="option">
33763 <primary><option>file</option></primary>
33764 </indexterm>
33765 </para>
33766 <informaltable frame="all">
33767 <tgroup cols="4" colsep="0" rowsep="0">
33768 <colspec colwidth="8*" align="left"/>
33769 <colspec colwidth="6*" align="center"/>
33770 <colspec colwidth="6*" align="center"/>
33771 <colspec colwidth="6*" align="right"/>
33772 <tbody>
33773 <row>
33774 <entry><option>file</option></entry>
33775 <entry>Use: <emphasis>redirect</emphasis></entry>
33776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33777 <entry>Default: <emphasis>unset</emphasis></entry>
33778 </row>
33779 </tbody>
33780 </tgroup>
33781 </informaltable>
33782 <para>
33783 This option specifies the name of a file that contains the redirection data. It
33784 is mutually exclusive with the <option>data</option> option. The string is expanded before
33785 use; if the expansion is forced to fail, the router declines. Other expansion
33786 failures cause delivery to be deferred. The result of a successful expansion
33787 must be an absolute path. The entire file is read and used as the redirection
33788 data. If the data is an empty string or a string that has no effect (consists
33789 entirely of comments), the router declines.
33790 </para>
33791 <para>
33792 <indexterm role="concept">
33793 <primary>NFS</primary>
33794 <secondary>checking for file existence</secondary>
33795 </indexterm>
33796 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
33797 runs a check on the containing directory,
33798 unless <option>ignore_enotdir</option> is true (see below).
33799 If the directory does not appear to exist, delivery is deferred. This can
33800 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
33801 is a mount problem. If the containing directory does exist, but the file does
33802 not, the router declines.
33803 </para>
33804 <para>
33805 <indexterm role="option">
33806 <primary><option>file_transport</option></primary>
33807 </indexterm>
33808 </para>
33809 <informaltable frame="all">
33810 <tgroup cols="4" colsep="0" rowsep="0">
33811 <colspec colwidth="8*" align="left"/>
33812 <colspec colwidth="6*" align="center"/>
33813 <colspec colwidth="6*" align="center"/>
33814 <colspec colwidth="6*" align="right"/>
33815 <tbody>
33816 <row>
33817 <entry><option>file_transport</option></entry>
33818 <entry>Use: <emphasis>redirect</emphasis></entry>
33819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33820 <entry>Default: <emphasis>unset</emphasis></entry>
33821 </row>
33822 </tbody>
33823 </tgroup>
33824 </informaltable>
33825 <para>
33826 <indexterm role="variable">
33827 <primary><varname>$address_file</varname></primary>
33828 </indexterm>
33829 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
33830 ending in a slash is specified as a new <quote>address</quote>. The transport used is
33831 specified by this option, which, after expansion, must be the name of a
33832 configured transport. This should normally be an <command>appendfile</command> transport. When
33833 it is running, the file name is in <varname>$address_file</varname>.
33834 </para>
33835 <para>
33836 <indexterm role="option">
33837 <primary><option>filter_prepend_home</option></primary>
33838 </indexterm>
33839 </para>
33840 <informaltable frame="all">
33841 <tgroup cols="4" colsep="0" rowsep="0">
33842 <colspec colwidth="8*" align="left"/>
33843 <colspec colwidth="6*" align="center"/>
33844 <colspec colwidth="6*" align="center"/>
33845 <colspec colwidth="6*" align="right"/>
33846 <tbody>
33847 <row>
33848 <entry><option>filter_prepend_home</option></entry>
33849 <entry>Use: <emphasis>redirect</emphasis></entry>
33850 <entry>Type: <emphasis>boolean</emphasis></entry>
33851 <entry>Default: <emphasis>true</emphasis></entry>
33852 </row>
33853 </tbody>
33854 </tgroup>
33855 </informaltable>
33856 <para>
33857 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33858 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33859 relative path. If this option is set false, this action does not happen. The
33860 relative path is then passed to the transport unmodified.
33861 </para>
33862 <para>
33863 <indexterm role="option">
33864 <primary><option>forbid_blackhole</option></primary>
33865 </indexterm>
33866 </para>
33867 <informaltable frame="all">
33868 <tgroup cols="4" colsep="0" rowsep="0">
33869 <colspec colwidth="8*" align="left"/>
33870 <colspec colwidth="6*" align="center"/>
33871 <colspec colwidth="6*" align="center"/>
33872 <colspec colwidth="6*" align="right"/>
33873 <tbody>
33874 <row>
33875 <entry><option>forbid_blackhole</option></entry>
33876 <entry>Use: <emphasis>redirect</emphasis></entry>
33877 <entry>Type: <emphasis>boolean</emphasis></entry>
33878 <entry>Default: <emphasis>false</emphasis></entry>
33879 </row>
33880 </tbody>
33881 </tgroup>
33882 </informaltable>
33883 <para>
33884 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33885 redirection list.
33886 </para>
33887 <para>
33888 <indexterm role="option">
33889 <primary><option>forbid_exim_filter</option></primary>
33890 </indexterm>
33891 </para>
33892 <informaltable frame="all">
33893 <tgroup cols="4" colsep="0" rowsep="0">
33894 <colspec colwidth="8*" align="left"/>
33895 <colspec colwidth="6*" align="center"/>
33896 <colspec colwidth="6*" align="center"/>
33897 <colspec colwidth="6*" align="right"/>
33898 <tbody>
33899 <row>
33900 <entry><option>forbid_exim_filter</option></entry>
33901 <entry>Use: <emphasis>redirect</emphasis></entry>
33902 <entry>Type: <emphasis>boolean</emphasis></entry>
33903 <entry>Default: <emphasis>false</emphasis></entry>
33904 </row>
33905 </tbody>
33906 </tgroup>
33907 </informaltable>
33908 <para>
33909 If this option is set true, only Sieve filters are permitted when
33910 <option>allow_filter</option> is true.
33911 </para>
33912 <para>
33913 <indexterm role="option">
33914 <primary><option>forbid_file</option></primary>
33915 </indexterm>
33916 </para>
33917 <informaltable frame="all">
33918 <tgroup cols="4" colsep="0" rowsep="0">
33919 <colspec colwidth="8*" align="left"/>
33920 <colspec colwidth="6*" align="center"/>
33921 <colspec colwidth="6*" align="center"/>
33922 <colspec colwidth="6*" align="right"/>
33923 <tbody>
33924 <row>
33925 <entry><option>forbid_file</option></entry>
33926 <entry>Use: <emphasis>redirect</emphasis></entry>
33927 <entry>Type: <emphasis>boolean</emphasis></entry>
33928 <entry>Default: <emphasis>false</emphasis></entry>
33929 </row>
33930 </tbody>
33931 </tgroup>
33932 </informaltable>
33933 <para>
33934 <indexterm role="concept">
33935 <primary>delivery</primary>
33936 <secondary>to file; forbidding</secondary>
33937 </indexterm>
33938 <indexterm role="concept">
33939 <primary>Sieve filter</primary>
33940 <secondary>forbidding delivery to a file</secondary>
33941 </indexterm>
33942 <indexterm role="concept">
33943 <primary>Sieve filter</primary>
33944 <secondary><quote>keep</quote> facility; disabling</secondary>
33945 </indexterm>
33946 If this option is true, this router may not generate a new address that
33947 specifies delivery to a local file or directory, either from a filter or from a
33948 conventional forward file. This option is forced to be true if <option>one_time</option> is
33949 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33950 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
33951 </para>
33952 <para>
33953 <indexterm role="option">
33954 <primary><option>forbid_filter_dlfunc</option></primary>
33955 </indexterm>
33956 </para>
33957 <informaltable frame="all">
33958 <tgroup cols="4" colsep="0" rowsep="0">
33959 <colspec colwidth="8*" align="left"/>
33960 <colspec colwidth="6*" align="center"/>
33961 <colspec colwidth="6*" align="center"/>
33962 <colspec colwidth="6*" align="right"/>
33963 <tbody>
33964 <row>
33965 <entry><option>forbid_filter_dlfunc</option></entry>
33966 <entry>Use: <emphasis>redirect</emphasis></entry>
33967 <entry>Type: <emphasis>boolean</emphasis></entry>
33968 <entry>Default: <emphasis>false</emphasis></entry>
33969 </row>
33970 </tbody>
33971 </tgroup>
33972 </informaltable>
33973 <para>
33974 <indexterm role="concept">
33975 <primary>filter</primary>
33976 <secondary>locking out certain features</secondary>
33977 </indexterm>
33978 If this option is true, string expansions in Exim filters are not allowed to
33979 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33980 functions.
33981 </para>
33982 <para>
33983 <indexterm role="option">
33984 <primary><option>forbid_filter_existstest</option></primary>
33985 </indexterm>
33986 </para>
33987 <informaltable frame="all">
33988 <tgroup cols="4" colsep="0" rowsep="0">
33989 <colspec colwidth="8*" align="left"/>
33990 <colspec colwidth="6*" align="center"/>
33991 <colspec colwidth="6*" align="center"/>
33992 <colspec colwidth="6*" align="right"/>
33993 <tbody>
33994 <row>
33995 <entry><option>forbid_filter_existstest</option></entry>
33996 <entry>Use: <emphasis>redirect</emphasis></entry>
33997 <entry>Type: <emphasis>boolean</emphasis></entry>
33998 <entry>Default: <emphasis>false</emphasis></entry>
33999 </row>
34000 </tbody>
34001 </tgroup>
34002 </informaltable>
34003 <para>
34004 <indexterm role="concept">
34005 <primary>expansion</primary>
34006 <secondary>statting a file</secondary>
34007 </indexterm>
34008 If this option is true, string expansions in Exim filters are not allowed to
34009 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34010 </para>
34011 <para>
34012 <indexterm role="option">
34013 <primary><option>forbid_filter_logwrite</option></primary>
34014 </indexterm>
34015 </para>
34016 <informaltable frame="all">
34017 <tgroup cols="4" colsep="0" rowsep="0">
34018 <colspec colwidth="8*" align="left"/>
34019 <colspec colwidth="6*" align="center"/>
34020 <colspec colwidth="6*" align="center"/>
34021 <colspec colwidth="6*" align="right"/>
34022 <tbody>
34023 <row>
34024 <entry><option>forbid_filter_logwrite</option></entry>
34025 <entry>Use: <emphasis>redirect</emphasis></entry>
34026 <entry>Type: <emphasis>boolean</emphasis></entry>
34027 <entry>Default: <emphasis>false</emphasis></entry>
34028 </row>
34029 </tbody>
34030 </tgroup>
34031 </informaltable>
34032 <para>
34033 If this option is true, use of the logging facility in Exim filters is not
34034 permitted. Logging is in any case available only if the filter is being run
34035 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
34036 <filename>.forward</filename> files).
34037 </para>
34038 <para>
34039 <indexterm role="option">
34040 <primary><option>forbid_filter_lookup</option></primary>
34041 </indexterm>
34042 </para>
34043 <informaltable frame="all">
34044 <tgroup cols="4" colsep="0" rowsep="0">
34045 <colspec colwidth="8*" align="left"/>
34046 <colspec colwidth="6*" align="center"/>
34047 <colspec colwidth="6*" align="center"/>
34048 <colspec colwidth="6*" align="right"/>
34049 <tbody>
34050 <row>
34051 <entry><option>forbid_filter_lookup</option></entry>
34052 <entry>Use: <emphasis>redirect</emphasis></entry>
34053 <entry>Type: <emphasis>boolean</emphasis></entry>
34054 <entry>Default: <emphasis>false</emphasis></entry>
34055 </row>
34056 </tbody>
34057 </tgroup>
34058 </informaltable>
34059 <para>
34060 If this option is true, string expansions in Exim filter files are not allowed
34061 to make use of <option>lookup</option> items.
34062 </para>
34063 <para>
34064 <indexterm role="option">
34065 <primary><option>forbid_filter_perl</option></primary>
34066 </indexterm>
34067 </para>
34068 <informaltable frame="all">
34069 <tgroup cols="4" colsep="0" rowsep="0">
34070 <colspec colwidth="8*" align="left"/>
34071 <colspec colwidth="6*" align="center"/>
34072 <colspec colwidth="6*" align="center"/>
34073 <colspec colwidth="6*" align="right"/>
34074 <tbody>
34075 <row>
34076 <entry><option>forbid_filter_perl</option></entry>
34077 <entry>Use: <emphasis>redirect</emphasis></entry>
34078 <entry>Type: <emphasis>boolean</emphasis></entry>
34079 <entry>Default: <emphasis>false</emphasis></entry>
34080 </row>
34081 </tbody>
34082 </tgroup>
34083 </informaltable>
34084 <para>
34085 This option has an effect only if Exim is built with embedded Perl support. If
34086 it is true, string expansions in Exim filter files are not allowed to make use
34087 of the embedded Perl support.
34088 </para>
34089 <para>
34090 <indexterm role="option">
34091 <primary><option>forbid_filter_readfile</option></primary>
34092 </indexterm>
34093 </para>
34094 <informaltable frame="all">
34095 <tgroup cols="4" colsep="0" rowsep="0">
34096 <colspec colwidth="8*" align="left"/>
34097 <colspec colwidth="6*" align="center"/>
34098 <colspec colwidth="6*" align="center"/>
34099 <colspec colwidth="6*" align="right"/>
34100 <tbody>
34101 <row>
34102 <entry><option>forbid_filter_readfile</option></entry>
34103 <entry>Use: <emphasis>redirect</emphasis></entry>
34104 <entry>Type: <emphasis>boolean</emphasis></entry>
34105 <entry>Default: <emphasis>false</emphasis></entry>
34106 </row>
34107 </tbody>
34108 </tgroup>
34109 </informaltable>
34110 <para>
34111 If this option is true, string expansions in Exim filter files are not allowed
34112 to make use of <option>readfile</option> items.
34113 </para>
34114 <para>
34115 <indexterm role="option">
34116 <primary><option>forbid_filter_readsocket</option></primary>
34117 </indexterm>
34118 </para>
34119 <informaltable frame="all">
34120 <tgroup cols="4" colsep="0" rowsep="0">
34121 <colspec colwidth="8*" align="left"/>
34122 <colspec colwidth="6*" align="center"/>
34123 <colspec colwidth="6*" align="center"/>
34124 <colspec colwidth="6*" align="right"/>
34125 <tbody>
34126 <row>
34127 <entry><option>forbid_filter_readsocket</option></entry>
34128 <entry>Use: <emphasis>redirect</emphasis></entry>
34129 <entry>Type: <emphasis>boolean</emphasis></entry>
34130 <entry>Default: <emphasis>false</emphasis></entry>
34131 </row>
34132 </tbody>
34133 </tgroup>
34134 </informaltable>
34135 <para>
34136 If this option is true, string expansions in Exim filter files are not allowed
34137 to make use of <option>readsocket</option> items.
34138 </para>
34139 <para>
34140 <indexterm role="option">
34141 <primary><option>forbid_filter_reply</option></primary>
34142 </indexterm>
34143 </para>
34144 <informaltable frame="all">
34145 <tgroup cols="4" colsep="0" rowsep="0">
34146 <colspec colwidth="8*" align="left"/>
34147 <colspec colwidth="6*" align="center"/>
34148 <colspec colwidth="6*" align="center"/>
34149 <colspec colwidth="6*" align="right"/>
34150 <tbody>
34151 <row>
34152 <entry><option>forbid_filter_reply</option></entry>
34153 <entry>Use: <emphasis>redirect</emphasis></entry>
34154 <entry>Type: <emphasis>boolean</emphasis></entry>
34155 <entry>Default: <emphasis>false</emphasis></entry>
34156 </row>
34157 </tbody>
34158 </tgroup>
34159 </informaltable>
34160 <para>
34161 If this option is true, this router may not generate an automatic reply
34162 message. Automatic replies can be generated only from Exim or Sieve filter
34163 files, not from traditional forward files. This option is forced to be true if
34164 <option>one_time</option> is set.
34165 </para>
34166 <para>
34167 <indexterm role="option">
34168 <primary><option>forbid_filter_run</option></primary>
34169 </indexterm>
34170 </para>
34171 <informaltable frame="all">
34172 <tgroup cols="4" colsep="0" rowsep="0">
34173 <colspec colwidth="8*" align="left"/>
34174 <colspec colwidth="6*" align="center"/>
34175 <colspec colwidth="6*" align="center"/>
34176 <colspec colwidth="6*" align="right"/>
34177 <tbody>
34178 <row>
34179 <entry><option>forbid_filter_run</option></entry>
34180 <entry>Use: <emphasis>redirect</emphasis></entry>
34181 <entry>Type: <emphasis>boolean</emphasis></entry>
34182 <entry>Default: <emphasis>false</emphasis></entry>
34183 </row>
34184 </tbody>
34185 </tgroup>
34186 </informaltable>
34187 <para>
34188 If this option is true, string expansions in Exim filter files are not allowed
34189 to make use of <option>run</option> items.
34190 </para>
34191 <para>
34192 <indexterm role="option">
34193 <primary><option>forbid_include</option></primary>
34194 </indexterm>
34195 </para>
34196 <informaltable frame="all">
34197 <tgroup cols="4" colsep="0" rowsep="0">
34198 <colspec colwidth="8*" align="left"/>
34199 <colspec colwidth="6*" align="center"/>
34200 <colspec colwidth="6*" align="center"/>
34201 <colspec colwidth="6*" align="right"/>
34202 <tbody>
34203 <row>
34204 <entry><option>forbid_include</option></entry>
34205 <entry>Use: <emphasis>redirect</emphasis></entry>
34206 <entry>Type: <emphasis>boolean</emphasis></entry>
34207 <entry>Default: <emphasis>false</emphasis></entry>
34208 </row>
34209 </tbody>
34210 </tgroup>
34211 </informaltable>
34212 <para>
34213 If this option is true, items of the form
34214 </para>
34215 <literallayout class="monospaced">
34216 :include:&lt;path name&gt;
34217 </literallayout>
34218 <para>
34219 are not permitted in non-filter redirection lists.
34220 </para>
34221 <para>
34222 <indexterm role="option">
34223 <primary><option>forbid_pipe</option></primary>
34224 </indexterm>
34225 </para>
34226 <informaltable frame="all">
34227 <tgroup cols="4" colsep="0" rowsep="0">
34228 <colspec colwidth="8*" align="left"/>
34229 <colspec colwidth="6*" align="center"/>
34230 <colspec colwidth="6*" align="center"/>
34231 <colspec colwidth="6*" align="right"/>
34232 <tbody>
34233 <row>
34234 <entry><option>forbid_pipe</option></entry>
34235 <entry>Use: <emphasis>redirect</emphasis></entry>
34236 <entry>Type: <emphasis>boolean</emphasis></entry>
34237 <entry>Default: <emphasis>false</emphasis></entry>
34238 </row>
34239 </tbody>
34240 </tgroup>
34241 </informaltable>
34242 <para>
34243 <indexterm role="concept">
34244 <primary>delivery</primary>
34245 <secondary>to pipe; forbidding</secondary>
34246 </indexterm>
34247 If this option is true, this router may not generate a new address which
34248 specifies delivery to a pipe, either from an Exim filter or from a conventional
34249 forward file. This option is forced to be true if <option>one_time</option> is set.
34250 </para>
34251 <para>
34252 <indexterm role="option">
34253 <primary><option>forbid_sieve_filter</option></primary>
34254 </indexterm>
34255 </para>
34256 <informaltable frame="all">
34257 <tgroup cols="4" colsep="0" rowsep="0">
34258 <colspec colwidth="8*" align="left"/>
34259 <colspec colwidth="6*" align="center"/>
34260 <colspec colwidth="6*" align="center"/>
34261 <colspec colwidth="6*" align="right"/>
34262 <tbody>
34263 <row>
34264 <entry><option>forbid_sieve_filter</option></entry>
34265 <entry>Use: <emphasis>redirect</emphasis></entry>
34266 <entry>Type: <emphasis>boolean</emphasis></entry>
34267 <entry>Default: <emphasis>false</emphasis></entry>
34268 </row>
34269 </tbody>
34270 </tgroup>
34271 </informaltable>
34272 <para>
34273 If this option is set true, only Exim filters are permitted when
34274 <option>allow_filter</option> is true.
34275 </para>
34276 <para>
34277 <indexterm role="concept">
34278 <primary>SMTP</primary>
34279 <secondary>error codes</secondary>
34280 </indexterm>
34281 <indexterm role="option">
34282 <primary><option>forbid_smtp_code</option></primary>
34283 </indexterm>
34284 </para>
34285 <informaltable frame="all">
34286 <tgroup cols="4" colsep="0" rowsep="0">
34287 <colspec colwidth="8*" align="left"/>
34288 <colspec colwidth="6*" align="center"/>
34289 <colspec colwidth="6*" align="center"/>
34290 <colspec colwidth="6*" align="right"/>
34291 <tbody>
34292 <row>
34293 <entry><option>forbid_smtp_code</option></entry>
34294 <entry>Use: <emphasis>redirect</emphasis></entry>
34295 <entry>Type: <emphasis>boolean</emphasis></entry>
34296 <entry>Default: <emphasis>false</emphasis></entry>
34297 </row>
34298 </tbody>
34299 </tgroup>
34300 </informaltable>
34301 <para>
34302 If this option is set true, any SMTP error codes that are present at the start
34303 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34304 the default codes (451 and 550, respectively) are always used.
34305 </para>
34306 <para>
34307 <indexterm role="option">
34308 <primary><option>hide_child_in_errmsg</option></primary>
34309 </indexterm>
34310 </para>
34311 <informaltable frame="all">
34312 <tgroup cols="4" colsep="0" rowsep="0">
34313 <colspec colwidth="8*" align="left"/>
34314 <colspec colwidth="6*" align="center"/>
34315 <colspec colwidth="6*" align="center"/>
34316 <colspec colwidth="6*" align="right"/>
34317 <tbody>
34318 <row>
34319 <entry><option>hide_child_in_errmsg</option></entry>
34320 <entry>Use: <emphasis>redirect</emphasis></entry>
34321 <entry>Type: <emphasis>boolean</emphasis></entry>
34322 <entry>Default: <emphasis>false</emphasis></entry>
34323 </row>
34324 </tbody>
34325 </tgroup>
34326 </informaltable>
34327 <para>
34328 <indexterm role="concept">
34329 <primary>bounce message</primary>
34330 <secondary>redirection details; suppressing</secondary>
34331 </indexterm>
34332 If this option is true, it prevents Exim from quoting a child address if it
34333 generates a bounce or delay message for it. Instead it says <quote>an address
34334 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
34335 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34336 bounce may well quote the generated address.
34337 </para>
34338 <para>
34339 <indexterm role="option">
34340 <primary><option>ignore_eacces</option></primary>
34341 </indexterm>
34342 </para>
34343 <informaltable frame="all">
34344 <tgroup cols="4" colsep="0" rowsep="0">
34345 <colspec colwidth="8*" align="left"/>
34346 <colspec colwidth="6*" align="center"/>
34347 <colspec colwidth="6*" align="center"/>
34348 <colspec colwidth="6*" align="right"/>
34349 <tbody>
34350 <row>
34351 <entry><option>ignore_eacces</option></entry>
34352 <entry>Use: <emphasis>redirect</emphasis></entry>
34353 <entry>Type: <emphasis>boolean</emphasis></entry>
34354 <entry>Default: <emphasis>false</emphasis></entry>
34355 </row>
34356 </tbody>
34357 </tgroup>
34358 </informaltable>
34359 <para>
34360 <indexterm role="concept">
34361 <primary>EACCES</primary>
34362 </indexterm>
34363 If this option is set and an attempt to open a redirection file yields the
34364 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34365 file did not exist.
34366 </para>
34367 <para>
34368 <indexterm role="option">
34369 <primary><option>ignore_enotdir</option></primary>
34370 </indexterm>
34371 </para>
34372 <informaltable frame="all">
34373 <tgroup cols="4" colsep="0" rowsep="0">
34374 <colspec colwidth="8*" align="left"/>
34375 <colspec colwidth="6*" align="center"/>
34376 <colspec colwidth="6*" align="center"/>
34377 <colspec colwidth="6*" align="right"/>
34378 <tbody>
34379 <row>
34380 <entry><option>ignore_enotdir</option></entry>
34381 <entry>Use: <emphasis>redirect</emphasis></entry>
34382 <entry>Type: <emphasis>boolean</emphasis></entry>
34383 <entry>Default: <emphasis>false</emphasis></entry>
34384 </row>
34385 </tbody>
34386 </tgroup>
34387 </informaltable>
34388 <para>
34389 <indexterm role="concept">
34390 <primary>ENOTDIR</primary>
34391 </indexterm>
34392 If this option is set and an attempt to open a redirection file yields the
34393 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34394 router behaves as if the file did not exist.
34395 </para>
34396 <para>
34397 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34398 router that has the <option>file</option> option set discovers that the file does not exist
34399 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34400 against unmounted NFS directories. If the parent can not be statted, delivery
34401 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34402 is set, because that option tells Exim to ignore <quote>something on the path is not
34403 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34404 that some operating systems give ENOENT where others give ENOTDIR.
34405 </para>
34406 <para>
34407 <indexterm role="option">
34408 <primary><option>include_directory</option></primary>
34409 </indexterm>
34410 </para>
34411 <informaltable frame="all">
34412 <tgroup cols="4" colsep="0" rowsep="0">
34413 <colspec colwidth="8*" align="left"/>
34414 <colspec colwidth="6*" align="center"/>
34415 <colspec colwidth="6*" align="center"/>
34416 <colspec colwidth="6*" align="right"/>
34417 <tbody>
34418 <row>
34419 <entry><option>include_directory</option></entry>
34420 <entry>Use: <emphasis>redirect</emphasis></entry>
34421 <entry>Type: <emphasis>string</emphasis></entry>
34422 <entry>Default: <emphasis>unset</emphasis></entry>
34423 </row>
34424 </tbody>
34425 </tgroup>
34426 </informaltable>
34427 <para>
34428 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34429 redirection list must start with this directory.
34430 </para>
34431 <para>
34432 <indexterm role="option">
34433 <primary><option>modemask</option></primary>
34434 </indexterm>
34435 </para>
34436 <informaltable frame="all">
34437 <tgroup cols="4" colsep="0" rowsep="0">
34438 <colspec colwidth="8*" align="left"/>
34439 <colspec colwidth="6*" align="center"/>
34440 <colspec colwidth="6*" align="center"/>
34441 <colspec colwidth="6*" align="right"/>
34442 <tbody>
34443 <row>
34444 <entry><option>modemask</option></entry>
34445 <entry>Use: <emphasis>redirect</emphasis></entry>
34446 <entry>Type: <emphasis>octal integer</emphasis></entry>
34447 <entry>Default: <emphasis>022</emphasis></entry>
34448 </row>
34449 </tbody>
34450 </tgroup>
34451 </informaltable>
34452 <para>
34453 This specifies mode bits which must not be set for a file specified by the
34454 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34455 </para>
34456 <para>
34457 <indexterm role="option">
34458 <primary><option>one_time</option></primary>
34459 </indexterm>
34460 </para>
34461 <informaltable frame="all">
34462 <tgroup cols="4" colsep="0" rowsep="0">
34463 <colspec colwidth="8*" align="left"/>
34464 <colspec colwidth="6*" align="center"/>
34465 <colspec colwidth="6*" align="center"/>
34466 <colspec colwidth="6*" align="right"/>
34467 <tbody>
34468 <row>
34469 <entry><option>one_time</option></entry>
34470 <entry>Use: <emphasis>redirect</emphasis></entry>
34471 <entry>Type: <emphasis>boolean</emphasis></entry>
34472 <entry>Default: <emphasis>false</emphasis></entry>
34473 </row>
34474 </tbody>
34475 </tgroup>
34476 </informaltable>
34477 <para>
34478 <indexterm role="concept">
34479 <primary>one-time aliasing/forwarding expansion</primary>
34480 </indexterm>
34481 <indexterm role="concept">
34482 <primary>alias file</primary>
34483 <secondary>one-time expansion</secondary>
34484 </indexterm>
34485 <indexterm role="concept">
34486 <primary>forward file</primary>
34487 <secondary>one-time expansion</secondary>
34488 </indexterm>
34489 <indexterm role="concept">
34490 <primary>mailing lists</primary>
34491 <secondary>one-time expansion</secondary>
34492 </indexterm>
34493 <indexterm role="concept">
34494 <primary>address redirection</primary>
34495 <secondary>one-time expansion</secondary>
34496 </indexterm>
34497 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34498 files each time it tries to deliver a message causes a problem when one or more
34499 of the generated addresses fails be delivered at the first attempt. The problem
34500 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
34501 but of what happens when the redirection list changes during the time that the
34502 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
34503 lists, where new subscribers might receive copies of messages that were posted
34504 before they subscribed.
34505 </para>
34506 <para>
34507 If <option>one_time</option> is set and any addresses generated by the router fail to
34508 deliver at the first attempt, the failing addresses are added to the message as
34509 <quote>top level</quote> addresses, and the parent address that generated them is marked
34510 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34511 attempt.
34512 </para>
34513 <para>
34514 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34515 router would be lost if delivery did not succeed at the first attempt. For this
34516 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34517 permitted when <option>one_time</option> is set.
34518 </para>
34519 <para>
34520 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34521 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34522 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34523 </para>
34524 <para>
34525 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34526 <option>one_time</option>.
34527 </para>
34528 <para>
34529 The original top-level address is remembered with each of the generated
34530 addresses, and is output in any log messages. However, any intermediate parent
34531 addresses are not recorded. This makes a difference to the log only if
34532 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34533 typically be used for mailing lists, where there is normally just one level of
34534 expansion.
34535 </para>
34536 <para>
34537 <indexterm role="option">
34538 <primary><option>owners</option></primary>
34539 </indexterm>
34540 </para>
34541 <informaltable frame="all">
34542 <tgroup cols="4" colsep="0" rowsep="0">
34543 <colspec colwidth="8*" align="left"/>
34544 <colspec colwidth="6*" align="center"/>
34545 <colspec colwidth="6*" align="center"/>
34546 <colspec colwidth="6*" align="right"/>
34547 <tbody>
34548 <row>
34549 <entry><option>owners</option></entry>
34550 <entry>Use: <emphasis>redirect</emphasis></entry>
34551 <entry>Type: <emphasis>string list</emphasis></entry>
34552 <entry>Default: <emphasis>unset</emphasis></entry>
34553 </row>
34554 </tbody>
34555 </tgroup>
34556 </informaltable>
34557 <para>
34558 <indexterm role="concept">
34559 <primary>ownership</primary>
34560 <secondary>alias file</secondary>
34561 </indexterm>
34562 <indexterm role="concept">
34563 <primary>ownership</primary>
34564 <secondary>forward file</secondary>
34565 </indexterm>
34566 <indexterm role="concept">
34567 <primary>alias file</primary>
34568 <secondary>ownership</secondary>
34569 </indexterm>
34570 <indexterm role="concept">
34571 <primary>forward file</primary>
34572 <secondary>ownership</secondary>
34573 </indexterm>
34574 This specifies a list of permitted owners for the file specified by <option>file</option>.
34575 This list is in addition to the local user when <option>check_local_user</option> is set.
34576 See <option>check_owner</option> above.
34577 </para>
34578 <para>
34579 <indexterm role="option">
34580 <primary><option>owngroups</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>owngroups</option></entry>
34592 <entry>Use: <emphasis>redirect</emphasis></entry>
34593 <entry>Type: <emphasis>string list</emphasis></entry>
34594 <entry>Default: <emphasis>unset</emphasis></entry>
34595 </row>
34596 </tbody>
34597 </tgroup>
34598 </informaltable>
34599 <para>
34600 This specifies a list of permitted groups for the file specified by <option>file</option>.
34601 The list is in addition to the local user&#x2019;s primary group when
34602 <option>check_local_user</option> is set. See <option>check_group</option> above.
34603 </para>
34604 <para>
34605 <indexterm role="option">
34606 <primary><option>pipe_transport</option></primary>
34607 </indexterm>
34608 </para>
34609 <informaltable frame="all">
34610 <tgroup cols="4" colsep="0" rowsep="0">
34611 <colspec colwidth="8*" align="left"/>
34612 <colspec colwidth="6*" align="center"/>
34613 <colspec colwidth="6*" align="center"/>
34614 <colspec colwidth="6*" align="right"/>
34615 <tbody>
34616 <row>
34617 <entry><option>pipe_transport</option></entry>
34618 <entry>Use: <emphasis>redirect</emphasis></entry>
34619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34620 <entry>Default: <emphasis>unset</emphasis></entry>
34621 </row>
34622 </tbody>
34623 </tgroup>
34624 </informaltable>
34625 <para>
34626 <indexterm role="variable">
34627 <primary><varname>$address_pipe</varname></primary>
34628 </indexterm>
34629 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34630 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34631 transport used is specified by this option, which, after expansion, must be the
34632 name of a configured transport. This should normally be a <command>pipe</command> transport.
34633 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34634 </para>
34635 <para>
34636 <indexterm role="option">
34637 <primary><option>qualify_domain</option></primary>
34638 </indexterm>
34639 </para>
34640 <informaltable frame="all">
34641 <tgroup cols="4" colsep="0" rowsep="0">
34642 <colspec colwidth="8*" align="left"/>
34643 <colspec colwidth="6*" align="center"/>
34644 <colspec colwidth="6*" align="center"/>
34645 <colspec colwidth="6*" align="right"/>
34646 <tbody>
34647 <row>
34648 <entry><option>qualify_domain</option></entry>
34649 <entry>Use: <emphasis>redirect</emphasis></entry>
34650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34651 <entry>Default: <emphasis>unset</emphasis></entry>
34652 </row>
34653 </tbody>
34654 </tgroup>
34655 </informaltable>
34656 <para>
34657 <indexterm role="variable">
34658 <primary><varname>$qualify_recipient</varname></primary>
34659 </indexterm>
34660 If this option is set, and an unqualified address (one without a domain) is
34661 generated, and that address would normally be qualified by the global setting
34662 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34663 expanding this string. If the expansion fails, the router declines. If you want
34664 to revert to the default, you can have the expansion generate
34665 <varname>$qualify_recipient</varname>.
34666 </para>
34667 <para>
34668 This option applies to all unqualified addresses generated by Exim filters,
34669 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34670 not preceded by a backslash. Sieve filters cannot generate unqualified
34671 addresses.
34672 </para>
34673 <para>
34674 <indexterm role="option">
34675 <primary><option>qualify_preserve_domain</option></primary>
34676 </indexterm>
34677 </para>
34678 <informaltable frame="all">
34679 <tgroup cols="4" colsep="0" rowsep="0">
34680 <colspec colwidth="8*" align="left"/>
34681 <colspec colwidth="6*" align="center"/>
34682 <colspec colwidth="6*" align="center"/>
34683 <colspec colwidth="6*" align="right"/>
34684 <tbody>
34685 <row>
34686 <entry><option>qualify_preserve_domain</option></entry>
34687 <entry>Use: <emphasis>redirect</emphasis></entry>
34688 <entry>Type: <emphasis>boolean</emphasis></entry>
34689 <entry>Default: <emphasis>false</emphasis></entry>
34690 </row>
34691 </tbody>
34692 </tgroup>
34693 </informaltable>
34694 <para>
34695 <indexterm role="concept">
34696 <primary>domain</primary>
34697 <secondary>in redirection; preserving</secondary>
34698 </indexterm>
34699 <indexterm role="concept">
34700 <primary>preserving domain in redirection</primary>
34701 </indexterm>
34702 <indexterm role="concept">
34703 <primary>address redirection</primary>
34704 <secondary>domain; preserving</secondary>
34705 </indexterm>
34706 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
34707 set (a configuration error occurs if it is). If an unqualified address (one
34708 without a domain) is generated, it is qualified with the domain of the parent
34709 address (the immediately preceding ancestor) instead of the global
34710 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34711 this applies whether or not the address is preceded by a backslash.
34712 </para>
34713 <para>
34714 <indexterm role="option">
34715 <primary><option>repeat_use</option></primary>
34716 </indexterm>
34717 </para>
34718 <informaltable frame="all">
34719 <tgroup cols="4" colsep="0" rowsep="0">
34720 <colspec colwidth="8*" align="left"/>
34721 <colspec colwidth="6*" align="center"/>
34722 <colspec colwidth="6*" align="center"/>
34723 <colspec colwidth="6*" align="right"/>
34724 <tbody>
34725 <row>
34726 <entry><option>repeat_use</option></entry>
34727 <entry>Use: <emphasis>redirect</emphasis></entry>
34728 <entry>Type: <emphasis>boolean</emphasis></entry>
34729 <entry>Default: <emphasis>true</emphasis></entry>
34730 </row>
34731 </tbody>
34732 </tgroup>
34733 </informaltable>
34734 <para>
34735 If this option is set false, the router is skipped for a child address that has
34736 any ancestor that was routed by this router. This test happens before any of
34737 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
34738 only when the ancestor is the same as the current address. See also
34739 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34740 </para>
34741 <para>
34742 <indexterm role="option">
34743 <primary><option>reply_transport</option></primary>
34744 </indexterm>
34745 </para>
34746 <informaltable frame="all">
34747 <tgroup cols="4" colsep="0" rowsep="0">
34748 <colspec colwidth="8*" align="left"/>
34749 <colspec colwidth="6*" align="center"/>
34750 <colspec colwidth="6*" align="center"/>
34751 <colspec colwidth="6*" align="right"/>
34752 <tbody>
34753 <row>
34754 <entry><option>reply_transport</option></entry>
34755 <entry>Use: <emphasis>redirect</emphasis></entry>
34756 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34757 <entry>Default: <emphasis>unset</emphasis></entry>
34758 </row>
34759 </tbody>
34760 </tgroup>
34761 </informaltable>
34762 <para>
34763 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34764 <option>vacation</option> command is used in a filter file. The transport used is specified
34765 by this option, which, after expansion, must be the name of a configured
34766 transport. This should normally be an <command>autoreply</command> transport. Other transports
34767 are unlikely to do anything sensible or useful.
34768 </para>
34769 <para>
34770 <indexterm role="option">
34771 <primary><option>rewrite</option></primary>
34772 </indexterm>
34773 </para>
34774 <informaltable frame="all">
34775 <tgroup cols="4" colsep="0" rowsep="0">
34776 <colspec colwidth="8*" align="left"/>
34777 <colspec colwidth="6*" align="center"/>
34778 <colspec colwidth="6*" align="center"/>
34779 <colspec colwidth="6*" align="right"/>
34780 <tbody>
34781 <row>
34782 <entry><option>rewrite</option></entry>
34783 <entry>Use: <emphasis>redirect</emphasis></entry>
34784 <entry>Type: <emphasis>boolean</emphasis></entry>
34785 <entry>Default: <emphasis>true</emphasis></entry>
34786 </row>
34787 </tbody>
34788 </tgroup>
34789 </informaltable>
34790 <para>
34791 <indexterm role="concept">
34792 <primary>address redirection</primary>
34793 <secondary>disabling rewriting</secondary>
34794 </indexterm>
34795 If this option is set false, addresses generated by the router are not
34796 subject to address rewriting. Otherwise, they are treated like new addresses
34797 and are rewritten according to the global rewriting rules.
34798 </para>
34799 <para>
34800 <indexterm role="option">
34801 <primary><option>sieve_subaddress</option></primary>
34802 </indexterm>
34803 </para>
34804 <informaltable frame="all">
34805 <tgroup cols="4" colsep="0" rowsep="0">
34806 <colspec colwidth="8*" align="left"/>
34807 <colspec colwidth="6*" align="center"/>
34808 <colspec colwidth="6*" align="center"/>
34809 <colspec colwidth="6*" align="right"/>
34810 <tbody>
34811 <row>
34812 <entry><option>sieve_subaddress</option></entry>
34813 <entry>Use: <emphasis>redirect</emphasis></entry>
34814 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34815 <entry>Default: <emphasis>unset</emphasis></entry>
34816 </row>
34817 </tbody>
34818 </tgroup>
34819 </informaltable>
34820 <para>
34821 The value of this option is passed to a Sieve filter to specify the
34822 :subaddress part of an address.
34823 </para>
34824 <para>
34825 <indexterm role="option">
34826 <primary><option>sieve_useraddress</option></primary>
34827 </indexterm>
34828 </para>
34829 <informaltable frame="all">
34830 <tgroup cols="4" colsep="0" rowsep="0">
34831 <colspec colwidth="8*" align="left"/>
34832 <colspec colwidth="6*" align="center"/>
34833 <colspec colwidth="6*" align="center"/>
34834 <colspec colwidth="6*" align="right"/>
34835 <tbody>
34836 <row>
34837 <entry><option>sieve_useraddress</option></entry>
34838 <entry>Use: <emphasis>redirect</emphasis></entry>
34839 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34840 <entry>Default: <emphasis>unset</emphasis></entry>
34841 </row>
34842 </tbody>
34843 </tgroup>
34844 </informaltable>
34845 <para>
34846 The value of this option is passed to a Sieve filter to specify the :user part
34847 of an address. However, if it is unset, the entire original local part
34848 (including any prefix or suffix) is used for :user.
34849 </para>
34850 <para>
34851 <indexterm role="option">
34852 <primary><option>sieve_vacation_directory</option></primary>
34853 </indexterm>
34854 </para>
34855 <informaltable frame="all">
34856 <tgroup cols="4" colsep="0" rowsep="0">
34857 <colspec colwidth="8*" align="left"/>
34858 <colspec colwidth="6*" align="center"/>
34859 <colspec colwidth="6*" align="center"/>
34860 <colspec colwidth="6*" align="right"/>
34861 <tbody>
34862 <row>
34863 <entry><option>sieve_vacation_directory</option></entry>
34864 <entry>Use: <emphasis>redirect</emphasis></entry>
34865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34866 <entry>Default: <emphasis>unset</emphasis></entry>
34867 </row>
34868 </tbody>
34869 </tgroup>
34870 </informaltable>
34871 <para>
34872 <indexterm role="concept">
34873 <primary>Sieve filter</primary>
34874 <secondary>vacation directory</secondary>
34875 </indexterm>
34876 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34877 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34878 (do not put anything else in that directory), and ensure that the
34879 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34880 needs their own directory; Exim will create it if necessary.
34881 </para>
34882 <para>
34883 <indexterm role="option">
34884 <primary><option>skip_syntax_errors</option></primary>
34885 </indexterm>
34886 </para>
34887 <informaltable frame="all">
34888 <tgroup cols="4" colsep="0" rowsep="0">
34889 <colspec colwidth="8*" align="left"/>
34890 <colspec colwidth="6*" align="center"/>
34891 <colspec colwidth="6*" align="center"/>
34892 <colspec colwidth="6*" align="right"/>
34893 <tbody>
34894 <row>
34895 <entry><option>skip_syntax_errors</option></entry>
34896 <entry>Use: <emphasis>redirect</emphasis></entry>
34897 <entry>Type: <emphasis>boolean</emphasis></entry>
34898 <entry>Default: <emphasis>false</emphasis></entry>
34899 </row>
34900 </tbody>
34901 </tgroup>
34902 </informaltable>
34903 <para>
34904 <indexterm role="concept">
34905 <primary>forward file</primary>
34906 <secondary>broken</secondary>
34907 </indexterm>
34908 <indexterm role="concept">
34909 <primary>address redirection</primary>
34910 <secondary>broken files</secondary>
34911 </indexterm>
34912 <indexterm role="concept">
34913 <primary>alias file</primary>
34914 <secondary>broken</secondary>
34915 </indexterm>
34916 <indexterm role="concept">
34917 <primary>broken alias or forward files</primary>
34918 </indexterm>
34919 <indexterm role="concept">
34920 <primary>ignoring faulty addresses</primary>
34921 </indexterm>
34922 <indexterm role="concept">
34923 <primary>skipping faulty addresses</primary>
34924 </indexterm>
34925 <indexterm role="concept">
34926 <primary>error</primary>
34927 <secondary>skipping bad syntax</secondary>
34928 </indexterm>
34929 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34930 non-filter redirection data are skipped, and each failing address is logged. If
34931 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34932 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34933 are expanded and placed at the head of the error message generated by
34934 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34935 be the same address as the generic <option>errors_to</option> option. The
34936 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34937 </para>
34938 <para>
34939 If all the addresses in a redirection list are skipped because of syntax
34940 errors, the router declines to handle the original address, and it is passed to
34941 the following routers.
34942 </para>
34943 <para>
34944 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34945 error in the filter causes filtering to be abandoned without any action being
34946 taken. The incident is logged, and the router declines to handle the address,
34947 so it is passed to the following routers.
34948 </para>
34949 <para>
34950 <indexterm role="concept">
34951 <primary>Sieve filter</primary>
34952 <secondary>syntax errors in</secondary>
34953 </indexterm>
34954 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34955 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34956 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34957 </para>
34958 <para>
34959 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
34960 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34961 option, used with an address that does not get redirected, can be used to
34962 notify users of these errors, by means of a router like this:
34963 </para>
34964 <literallayout class="monospaced">
34965 userforward:
34966   driver = redirect
34967   allow_filter
34968   check_local_user
34969   file = $home/.forward
34970   file_transport = address_file
34971   pipe_transport = address_pipe
34972   reply_transport = address_reply
34973   no_verify
34974   skip_syntax_errors
34975   syntax_errors_to = real-$local_part@$domain
34976   syntax_errors_text = \
34977    This is an automatically generated message. An error has\n\
34978    been found in your .forward file. Details of the error are\n\
34979    reported below. While this error persists, you will receive\n\
34980    a copy of this message for every message that is addressed\n\
34981    to you. If your .forward file is a filter file, or if it is\n\
34982    a non-filter file containing no valid forwarding addresses,\n\
34983    a copy of each incoming message will be put in your normal\n\
34984    mailbox. If a non-filter file contains at least one valid\n\
34985    forwarding address, forwarding to the valid addresses will\n\
34986    happen, and those will be the only deliveries that occur.
34987 </literallayout>
34988 <para>
34989 You also need a router to ensure that local addresses that are prefixed by
34990 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
34991 put this immediately before the <command>userforward</command> router:
34992 </para>
34993 <literallayout class="monospaced">
34994 real_localuser:
34995   driver = accept
34996   check_local_user
34997   local_part_prefix = real-
34998   transport = local_delivery
34999 </literallayout>
35000 <para>
35001 For security, it would probably be a good idea to restrict the use of this
35002 router to locally-generated messages, using a condition such as this:
35003 </para>
35004 <literallayout class="monospaced">
35005   condition = ${if match {$sender_host_address}\
35006                          {\N^(|127\.0\.0\.1)$\N}}
35007 </literallayout>
35008 <para>
35009 <indexterm role="option">
35010 <primary><option>syntax_errors_text</option></primary>
35011 </indexterm>
35012 </para>
35013 <informaltable frame="all">
35014 <tgroup cols="4" colsep="0" rowsep="0">
35015 <colspec colwidth="8*" align="left"/>
35016 <colspec colwidth="6*" align="center"/>
35017 <colspec colwidth="6*" align="center"/>
35018 <colspec colwidth="6*" align="right"/>
35019 <tbody>
35020 <row>
35021 <entry><option>syntax_errors_text</option></entry>
35022 <entry>Use: <emphasis>redirect</emphasis></entry>
35023 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35024 <entry>Default: <emphasis>unset</emphasis></entry>
35025 </row>
35026 </tbody>
35027 </tgroup>
35028 </informaltable>
35029 <para>
35030 See <option>skip_syntax_errors</option> above.
35031 </para>
35032 <para>
35033 <indexterm role="option">
35034 <primary><option>syntax_errors_to</option></primary>
35035 </indexterm>
35036 </para>
35037 <informaltable frame="all">
35038 <tgroup cols="4" colsep="0" rowsep="0">
35039 <colspec colwidth="8*" align="left"/>
35040 <colspec colwidth="6*" align="center"/>
35041 <colspec colwidth="6*" align="center"/>
35042 <colspec colwidth="6*" align="right"/>
35043 <tbody>
35044 <row>
35045 <entry><option>syntax_errors_to</option></entry>
35046 <entry>Use: <emphasis>redirect</emphasis></entry>
35047 <entry>Type: <emphasis>string</emphasis></entry>
35048 <entry>Default: <emphasis>unset</emphasis></entry>
35049 </row>
35050 </tbody>
35051 </tgroup>
35052 </informaltable>
35053 <para>
35054 See <option>skip_syntax_errors</option> above.
35055 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35056 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35057 </para>
35058 </section>
35059 </chapter>
35060
35061 <chapter id="CHAPenvironment">
35062 <title>Environment for running local transports</title>
35063 <titleabbrev>Environment for local transports</titleabbrev>
35064 <para>
35065 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35066 <primary>local transports</primary>
35067 <secondary>environment for</secondary>
35068 </indexterm>
35069 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35070 <primary>environment for local transports</primary>
35071 </indexterm>
35072 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35073 <primary>transport</primary>
35074 <secondary>local; environment for</secondary>
35075 </indexterm>
35076 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35077 transport can be thought of as similar to a pipe.) Exim always runs transports
35078 in subprocesses, under specified uids and gids. Typical deliveries to local
35079 mailboxes run under the uid and gid of the local user.
35080 </para>
35081 <para>
35082 Exim also sets a specific current directory while running the transport; for
35083 some transports a home directory setting is also relevant. The <command>pipe</command>
35084 transport is the only one that sets up environment variables; see section
35085 <xref linkend="SECTpipeenv"/> for details.
35086 </para>
35087 <para>
35088 The values used for the uid, gid, and the directories may come from several
35089 different places. In many cases, the router that handles the address associates
35090 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35091 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
35092 configuration, and these override anything that comes from the router.
35093 </para>
35094 <section id="SECID131">
35095 <title>Concurrent deliveries</title>
35096 <para>
35097 <indexterm role="concept">
35098 <primary>concurrent deliveries</primary>
35099 </indexterm>
35100 <indexterm role="concept">
35101 <primary>simultaneous deliveries</primary>
35102 </indexterm>
35103 If two different messages for the same local recipient arrive more or less
35104 simultaneously, the two delivery processes are likely to run concurrently. When
35105 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35106 rules to stop concurrent processes from writing to the same file at the same
35107 time.
35108 </para>
35109 <para>
35110 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35111 locking that is needed. Here is a silly example:
35112 </para>
35113 <literallayout class="monospaced">
35114 my_transport:
35115   driver = pipe
35116   command = /bin/sh -c 'cat &gt;&gt;/some/file'
35117 </literallayout>
35118 <para>
35119 This is supposed to write the message at the end of the file. However, if two
35120 messages arrive at the same time, the file will be scrambled. You can use the
35121 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35122 file using the same algorithm that Exim itself uses.
35123 </para>
35124 </section>
35125 <section id="SECTenvuidgid">
35126 <title>Uids and gids</title>
35127 <para>
35128 <indexterm role="concept">
35129 <primary>local transports</primary>
35130 <secondary>uid and gid</secondary>
35131 </indexterm>
35132 <indexterm role="concept">
35133 <primary>transport</primary>
35134 <secondary>local; uid and gid</secondary>
35135 </indexterm>
35136 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35137 overrides any group that the router set in the address, even if <option>user</option> is not
35138 set for the transport. This makes it possible, for example, to run local mail
35139 delivery under the uid of the recipient (set by the router), but in a special
35140 group (set by the transport). For example:
35141 </para>
35142 <literallayout class="monospaced">
35143 # Routers ...
35144 # User/group are set by check_local_user in this router
35145 local_users:
35146   driver = accept
35147   check_local_user
35148   transport = group_delivery
35149
35150 # Transports ...
35151 # This transport overrides the group
35152 group_delivery:
35153   driver = appendfile
35154   file = /var/spool/mail/$local_part
35155   group = mail
35156 </literallayout>
35157 <para>
35158 If <option>user</option> is set for a transport, its value overrides what is set in the
35159 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35160 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35161 set.
35162 </para>
35163 <para>
35164 <indexterm role="option">
35165 <primary><option>initgroups</option></primary>
35166 </indexterm>
35167 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
35168 function is called for the groups associated with that uid if the
35169 <option>initgroups</option> option is set for the transport. When the uid is not specified
35170 by the transport, but is associated with the address by a router, the option
35171 for calling <function>initgroups()</function> is taken from the router configuration.
35172 </para>
35173 <para>
35174 <indexterm role="concept">
35175 <primary><command>pipe</command> transport</primary>
35176 <secondary>uid for</secondary>
35177 </indexterm>
35178 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35179 is set and <option>user</option> is not set, the uid of the process that called Exim to
35180 receive the message is used, and if <option>group</option> is not set, the corresponding
35181 original gid is also used.
35182 </para>
35183 <para>
35184 This is the detailed preference order for obtaining a gid; the first of the
35185 following that is set is used:
35186 </para>
35187 <itemizedlist>
35188 <listitem>
35189 <para>
35190 A <option>group</option> setting of the transport;
35191 </para>
35192 </listitem>
35193 <listitem>
35194 <para>
35195 A <option>group</option> setting of the router;
35196 </para>
35197 </listitem>
35198 <listitem>
35199 <para>
35200 A gid associated with a user setting of the router, either as a result of
35201 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35202 </para>
35203 </listitem>
35204 <listitem>
35205 <para>
35206 The group associated with a non-numeric <option>user</option> setting of the transport;
35207 </para>
35208 </listitem>
35209 <listitem>
35210 <para>
35211 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
35212 the uid is the creator&#x2019;s uid;
35213 </para>
35214 </listitem>
35215 <listitem>
35216 <para>
35217 The Exim gid if the Exim uid is being used as a default.
35218 </para>
35219 </listitem>
35220 </itemizedlist>
35221 <para>
35222 If, for example, the user is specified numerically on the router and there are
35223 no group settings, no gid is available. In this situation, an error occurs.
35224 This is different for the uid, for which there always is an ultimate default.
35225 The first of the following that is set is used:
35226 </para>
35227 <itemizedlist>
35228 <listitem>
35229 <para>
35230 A <option>user</option> setting of the transport;
35231 </para>
35232 </listitem>
35233 <listitem>
35234 <para>
35235 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
35236 </para>
35237 </listitem>
35238 <listitem>
35239 <para>
35240 A <option>user</option> setting of the router;
35241 </para>
35242 </listitem>
35243 <listitem>
35244 <para>
35245 A <option>check_local_user</option> setting of the router;
35246 </para>
35247 </listitem>
35248 <listitem>
35249 <para>
35250 The Exim uid.
35251 </para>
35252 </listitem>
35253 </itemizedlist>
35254 <para>
35255 Of course, an error will still occur if the uid that is chosen is on the
35256 <option>never_users</option> list.
35257 </para>
35258 </section>
35259 <section id="SECID132">
35260 <title>Current and home directories</title>
35261 <para>
35262 <indexterm role="concept">
35263 <primary>current directory for local transport</primary>
35264 </indexterm>
35265 <indexterm role="concept">
35266 <primary>home directory</primary>
35267 <secondary>for local transport</secondary>
35268 </indexterm>
35269 <indexterm role="concept">
35270 <primary>transport</primary>
35271 <secondary>local; home directory for</secondary>
35272 </indexterm>
35273 <indexterm role="concept">
35274 <primary>transport</primary>
35275 <secondary>local; current directory for</secondary>
35276 </indexterm>
35277 Routers may set current and home directories for local transports by means of
35278 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35279 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
35280 are set, they override the router&#x2019;s values. In detail, the home directory
35281 for a local transport is taken from the first of these values that is set:
35282 </para>
35283 <itemizedlist>
35284 <listitem>
35285 <para>
35286 The <option>home_directory</option> option on the transport;
35287 </para>
35288 </listitem>
35289 <listitem>
35290 <para>
35291 The <option>transport_home_directory</option> option on the router;
35292 </para>
35293 </listitem>
35294 <listitem>
35295 <para>
35296 The password data if <option>check_local_user</option> is set on the router;
35297 </para>
35298 </listitem>
35299 <listitem>
35300 <para>
35301 The <option>router_home_directory</option> option on the router.
35302 </para>
35303 </listitem>
35304 </itemizedlist>
35305 <para>
35306 The current directory is taken from the first of these values that is set:
35307 </para>
35308 <itemizedlist>
35309 <listitem>
35310 <para>
35311 The <option>current_directory</option> option on the transport;
35312 </para>
35313 </listitem>
35314 <listitem>
35315 <para>
35316 The <option>transport_current_directory</option> option on the router.
35317 </para>
35318 </listitem>
35319 </itemizedlist>
35320 <para>
35321 If neither the router nor the transport sets a current directory, Exim uses the
35322 value of the home directory, if it is set. Otherwise it sets the current
35323 directory to <filename>/</filename> before running a local transport.
35324 </para>
35325 </section>
35326 <section id="SECID133">
35327 <title>Expansion variables derived from the address</title>
35328 <para>
35329 <indexterm role="variable">
35330 <primary><varname>$domain</varname></primary>
35331 </indexterm>
35332 <indexterm role="variable">
35333 <primary><varname>$local_part</varname></primary>
35334 </indexterm>
35335 <indexterm role="variable">
35336 <primary><varname>$original_domain</varname></primary>
35337 </indexterm>
35338 Normally a local delivery is handling a single address, and in that case the
35339 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35340 deliveries. However, in some circumstances more than one address may be handled
35341 at once (for example, while writing batch SMTP for onward transmission by some
35342 other means). In this case, the variables associated with the local part are
35343 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35344 and <varname>$original_domain</varname> is never set.
35345 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35346 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35347 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35348 </para>
35349 </section>
35350 </chapter>
35351
35352 <chapter id="CHAPtransportgeneric">
35353 <title>Generic options for transports</title>
35354 <para>
35355 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35356 <primary>generic options</primary>
35357 <secondary>transport</secondary>
35358 </indexterm>
35359 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35360 <primary>options</primary>
35361 <secondary>generic; for transports</secondary>
35362 </indexterm>
35363 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35364 <primary>transport</primary>
35365 <secondary>generic options for</secondary>
35366 </indexterm>
35367 The following generic options apply to all transports:
35368 </para>
35369 <para>
35370 <indexterm role="option">
35371 <primary><option>body_only</option></primary>
35372 </indexterm>
35373 </para>
35374 <informaltable frame="all">
35375 <tgroup cols="4" colsep="0" rowsep="0">
35376 <colspec colwidth="8*" align="left"/>
35377 <colspec colwidth="6*" align="center"/>
35378 <colspec colwidth="6*" align="center"/>
35379 <colspec colwidth="6*" align="right"/>
35380 <tbody>
35381 <row>
35382 <entry><option>body_only</option></entry>
35383 <entry>Use: <emphasis>transports</emphasis></entry>
35384 <entry>Type: <emphasis>boolean</emphasis></entry>
35385 <entry>Default: <emphasis>false</emphasis></entry>
35386 </row>
35387 </tbody>
35388 </tgroup>
35389 </informaltable>
35390 <para>
35391 <indexterm role="concept">
35392 <primary>transport</primary>
35393 <secondary>body only</secondary>
35394 </indexterm>
35395 <indexterm role="concept">
35396 <primary>message</primary>
35397 <secondary>transporting body only</secondary>
35398 </indexterm>
35399 <indexterm role="concept">
35400 <primary>body of message</primary>
35401 <secondary>transporting</secondary>
35402 </indexterm>
35403 If this option is set, the message&#x2019;s headers are not transported. It is
35404 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35405 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35406 <option>message_suffix</option> should be checked, because this option does not
35407 automatically suppress them.
35408 </para>
35409 <para>
35410 <indexterm role="option">
35411 <primary><option>current_directory</option></primary>
35412 </indexterm>
35413 </para>
35414 <informaltable frame="all">
35415 <tgroup cols="4" colsep="0" rowsep="0">
35416 <colspec colwidth="8*" align="left"/>
35417 <colspec colwidth="6*" align="center"/>
35418 <colspec colwidth="6*" align="center"/>
35419 <colspec colwidth="6*" align="right"/>
35420 <tbody>
35421 <row>
35422 <entry><option>current_directory</option></entry>
35423 <entry>Use: <emphasis>transports</emphasis></entry>
35424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35425 <entry>Default: <emphasis>unset</emphasis></entry>
35426 </row>
35427 </tbody>
35428 </tgroup>
35429 </informaltable>
35430 <para>
35431 <indexterm role="concept">
35432 <primary>transport</primary>
35433 <secondary>current directory for</secondary>
35434 </indexterm>
35435 This specifies the current directory that is to be set while running the
35436 transport, overriding any value that may have been set by the router.
35437 If the expansion fails for any reason, including forced failure, an error is
35438 logged, and delivery is deferred.
35439 </para>
35440 <para>
35441 <indexterm role="option">
35442 <primary><option>disable_logging</option></primary>
35443 </indexterm>
35444 </para>
35445 <informaltable frame="all">
35446 <tgroup cols="4" colsep="0" rowsep="0">
35447 <colspec colwidth="8*" align="left"/>
35448 <colspec colwidth="6*" align="center"/>
35449 <colspec colwidth="6*" align="center"/>
35450 <colspec colwidth="6*" align="right"/>
35451 <tbody>
35452 <row>
35453 <entry><option>disable_logging</option></entry>
35454 <entry>Use: <emphasis>transports</emphasis></entry>
35455 <entry>Type: <emphasis>boolean</emphasis></entry>
35456 <entry>Default: <emphasis>false</emphasis></entry>
35457 </row>
35458 </tbody>
35459 </tgroup>
35460 </informaltable>
35461 <para>
35462 If this option is set true, nothing is logged for any
35463 deliveries by the transport or for any
35464 transport errors. You should not set this option unless you really, really know
35465 what you are doing.
35466 </para>
35467 <para>
35468 <indexterm role="option">
35469 <primary><option>debug_print</option></primary>
35470 </indexterm>
35471 </para>
35472 <informaltable frame="all">
35473 <tgroup cols="4" colsep="0" rowsep="0">
35474 <colspec colwidth="8*" align="left"/>
35475 <colspec colwidth="6*" align="center"/>
35476 <colspec colwidth="6*" align="center"/>
35477 <colspec colwidth="6*" align="right"/>
35478 <tbody>
35479 <row>
35480 <entry><option>debug_print</option></entry>
35481 <entry>Use: <emphasis>transports</emphasis></entry>
35482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35483 <entry>Default: <emphasis>unset</emphasis></entry>
35484 </row>
35485 </tbody>
35486 </tgroup>
35487 </informaltable>
35488 <para>
35489 <indexterm role="concept">
35490 <primary>testing</primary>
35491 <secondary>variables in drivers</secondary>
35492 </indexterm>
35493 If this option is set and debugging is enabled (see the <option>-d</option> command line
35494 option), the string is expanded and included in the debugging output when the
35495 transport is run.
35496 If expansion of the string fails, the error message is written to the debugging
35497 output, and Exim carries on processing.
35498 This facility is provided to help with checking out the values of variables and
35499 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35500 option is not working properly, <option>debug_print</option> could be used to output the
35501 variables it references. A newline is added to the text if it does not end with
35502 one.
35503 </para>
35504 <para>
35505 <indexterm role="option">
35506 <primary><option>delivery_date_add</option></primary>
35507 </indexterm>
35508 </para>
35509 <informaltable frame="all">
35510 <tgroup cols="4" colsep="0" rowsep="0">
35511 <colspec colwidth="8*" align="left"/>
35512 <colspec colwidth="6*" align="center"/>
35513 <colspec colwidth="6*" align="center"/>
35514 <colspec colwidth="6*" align="right"/>
35515 <tbody>
35516 <row>
35517 <entry><option>delivery_date_add</option></entry>
35518 <entry>Use: <emphasis>transports</emphasis></entry>
35519 <entry>Type: <emphasis>boolean</emphasis></entry>
35520 <entry>Default: <emphasis>false</emphasis></entry>
35521 </row>
35522 </tbody>
35523 </tgroup>
35524 </informaltable>
35525 <para>
35526 <indexterm role="concept">
35527 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35528 </indexterm>
35529 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35530 This gives the actual time the delivery was made. As this is not a standard
35531 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35532 requests its removal from incoming messages, so that delivered messages can
35533 safely be resent to other recipients.
35534 </para>
35535 <para>
35536 <indexterm role="option">
35537 <primary><option>driver</option></primary>
35538 </indexterm>
35539 </para>
35540 <informaltable frame="all">
35541 <tgroup cols="4" colsep="0" rowsep="0">
35542 <colspec colwidth="8*" align="left"/>
35543 <colspec colwidth="6*" align="center"/>
35544 <colspec colwidth="6*" align="center"/>
35545 <colspec colwidth="6*" align="right"/>
35546 <tbody>
35547 <row>
35548 <entry><option>driver</option></entry>
35549 <entry>Use: <emphasis>transports</emphasis></entry>
35550 <entry>Type: <emphasis>string</emphasis></entry>
35551 <entry>Default: <emphasis>unset</emphasis></entry>
35552 </row>
35553 </tbody>
35554 </tgroup>
35555 </informaltable>
35556 <para>
35557 This specifies which of the available transport drivers is to be used.
35558 There is no default, and this option must be set for every transport.
35559 </para>
35560 <para>
35561 <indexterm role="option">
35562 <primary><option>envelope_to_add</option></primary>
35563 </indexterm>
35564 </para>
35565 <informaltable frame="all">
35566 <tgroup cols="4" colsep="0" rowsep="0">
35567 <colspec colwidth="8*" align="left"/>
35568 <colspec colwidth="6*" align="center"/>
35569 <colspec colwidth="6*" align="center"/>
35570 <colspec colwidth="6*" align="right"/>
35571 <tbody>
35572 <row>
35573 <entry><option>envelope_to_add</option></entry>
35574 <entry>Use: <emphasis>transports</emphasis></entry>
35575 <entry>Type: <emphasis>boolean</emphasis></entry>
35576 <entry>Default: <emphasis>false</emphasis></entry>
35577 </row>
35578 </tbody>
35579 </tgroup>
35580 </informaltable>
35581 <para>
35582 <indexterm role="concept">
35583 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35584 </indexterm>
35585 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35586 This gives the original address(es) in the incoming envelope that caused this
35587 delivery to happen. More than one address may be present if the transport is
35588 configured to handle several addresses at once, or if more than one original
35589 address was redirected to the same final address. As this is not a standard
35590 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35591 its removal from incoming messages, so that delivered messages can safely be
35592 resent to other recipients.
35593 </para>
35594 <para>
35595 <indexterm role="option">
35596 <primary><option>group</option></primary>
35597 </indexterm>
35598 </para>
35599 <informaltable frame="all">
35600 <tgroup cols="4" colsep="0" rowsep="0">
35601 <colspec colwidth="8*" align="left"/>
35602 <colspec colwidth="6*" align="center"/>
35603 <colspec colwidth="6*" align="center"/>
35604 <colspec colwidth="6*" align="right"/>
35605 <tbody>
35606 <row>
35607 <entry><option>group</option></entry>
35608 <entry>Use: <emphasis>transports</emphasis></entry>
35609 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35610 <entry>Default: <emphasis>Exim group</emphasis></entry>
35611 </row>
35612 </tbody>
35613 </tgroup>
35614 </informaltable>
35615 <para>
35616 <indexterm role="concept">
35617 <primary>transport</primary>
35618 <secondary>group; specifying</secondary>
35619 </indexterm>
35620 This option specifies a gid for running the transport process, overriding any
35621 value that the router supplies, and also overriding any value associated with
35622 <option>user</option> (see below).
35623 </para>
35624 <para>
35625 <indexterm role="option">
35626 <primary><option>headers_add</option></primary>
35627 </indexterm>
35628 </para>
35629 <informaltable frame="all">
35630 <tgroup cols="4" colsep="0" rowsep="0">
35631 <colspec colwidth="8*" align="left"/>
35632 <colspec colwidth="6*" align="center"/>
35633 <colspec colwidth="6*" align="center"/>
35634 <colspec colwidth="6*" align="right"/>
35635 <tbody>
35636 <row>
35637 <entry><option>headers_add</option></entry>
35638 <entry>Use: <emphasis>transports</emphasis></entry>
35639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35640 <entry>Default: <emphasis>unset</emphasis></entry>
35641 </row>
35642 </tbody>
35643 </tgroup>
35644 </informaltable>
35645 <para>
35646 <indexterm role="concept">
35647 <primary>header lines</primary>
35648 <secondary>adding in transport</secondary>
35649 </indexterm>
35650 <indexterm role="concept">
35651 <primary>transport</primary>
35652 <secondary>header lines; adding</secondary>
35653 </indexterm>
35654 This option specifies a string of text that is expanded and added to the header
35655 portion of a message as it is transported, as described in section
35656 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35657 routers. If the result of the expansion is an empty string, or if the expansion
35658 is forced to fail, no action is taken. Other expansion failures are treated as
35659 errors and cause the delivery to be deferred.
35660 </para>
35661 <para>
35662 <indexterm role="option">
35663 <primary><option>headers_only</option></primary>
35664 </indexterm>
35665 </para>
35666 <informaltable frame="all">
35667 <tgroup cols="4" colsep="0" rowsep="0">
35668 <colspec colwidth="8*" align="left"/>
35669 <colspec colwidth="6*" align="center"/>
35670 <colspec colwidth="6*" align="center"/>
35671 <colspec colwidth="6*" align="right"/>
35672 <tbody>
35673 <row>
35674 <entry><option>headers_only</option></entry>
35675 <entry>Use: <emphasis>transports</emphasis></entry>
35676 <entry>Type: <emphasis>boolean</emphasis></entry>
35677 <entry>Default: <emphasis>false</emphasis></entry>
35678 </row>
35679 </tbody>
35680 </tgroup>
35681 </informaltable>
35682 <para>
35683 <indexterm role="concept">
35684 <primary>transport</primary>
35685 <secondary>header lines only</secondary>
35686 </indexterm>
35687 <indexterm role="concept">
35688 <primary>message</primary>
35689 <secondary>transporting headers only</secondary>
35690 </indexterm>
35691 <indexterm role="concept">
35692 <primary>header lines</primary>
35693 <secondary>transporting</secondary>
35694 </indexterm>
35695 If this option is set, the message&#x2019;s body is not transported. It is mutually
35696 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35697 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35698 checked, since this option does not automatically suppress them.
35699 </para>
35700 <para>
35701 <indexterm role="option">
35702 <primary><option>headers_remove</option></primary>
35703 </indexterm>
35704 </para>
35705 <informaltable frame="all">
35706 <tgroup cols="4" colsep="0" rowsep="0">
35707 <colspec colwidth="8*" align="left"/>
35708 <colspec colwidth="6*" align="center"/>
35709 <colspec colwidth="6*" align="center"/>
35710 <colspec colwidth="6*" align="right"/>
35711 <tbody>
35712 <row>
35713 <entry><option>headers_remove</option></entry>
35714 <entry>Use: <emphasis>transports</emphasis></entry>
35715 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35716 <entry>Default: <emphasis>unset</emphasis></entry>
35717 </row>
35718 </tbody>
35719 </tgroup>
35720 </informaltable>
35721 <para>
35722 <indexterm role="concept">
35723 <primary>header lines</primary>
35724 <secondary>removing</secondary>
35725 </indexterm>
35726 <indexterm role="concept">
35727 <primary>transport</primary>
35728 <secondary>header lines; removing</secondary>
35729 </indexterm>
35730 This option specifies a string that is expanded into a list of header names;
35731 these headers are omitted from the message as it is transported, as described
35732 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35733 routers. If the result of the expansion is an empty string, or if the expansion
35734 is forced to fail, no action is taken. Other expansion failures are treated as
35735 errors and cause the delivery to be deferred.
35736 </para>
35737 <para>
35738 <indexterm role="option">
35739 <primary><option>headers_rewrite</option></primary>
35740 </indexterm>
35741 </para>
35742 <informaltable frame="all">
35743 <tgroup cols="4" colsep="0" rowsep="0">
35744 <colspec colwidth="8*" align="left"/>
35745 <colspec colwidth="6*" align="center"/>
35746 <colspec colwidth="6*" align="center"/>
35747 <colspec colwidth="6*" align="right"/>
35748 <tbody>
35749 <row>
35750 <entry><option>headers_rewrite</option></entry>
35751 <entry>Use: <emphasis>transports</emphasis></entry>
35752 <entry>Type: <emphasis>string</emphasis></entry>
35753 <entry>Default: <emphasis>unset</emphasis></entry>
35754 </row>
35755 </tbody>
35756 </tgroup>
35757 </informaltable>
35758 <para>
35759 <indexterm role="concept">
35760 <primary>transport</primary>
35761 <secondary>header lines; rewriting</secondary>
35762 </indexterm>
35763 <indexterm role="concept">
35764 <primary>rewriting</primary>
35765 <secondary>at transport time</secondary>
35766 </indexterm>
35767 This option allows addresses in header lines to be rewritten at transport time,
35768 that is, as the message is being copied to its destination. The contents of the
35769 option are a colon-separated list of rewriting rules. Each rule is in exactly
35770 the same form as one of the general rewriting rules that are applied when a
35771 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35772 example,
35773 </para>
35774 <literallayout class="monospaced">
35775 headers_rewrite = a@b c@d f : \
35776                   x@y w@z
35777 </literallayout>
35778 <para>
35779 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35780 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35781 header lines just before they are written out at transport time, so they affect
35782 only those copies of the message that pass through the transport. However, only
35783 the message&#x2019;s original header lines, and any that were added by a system
35784 filter, are rewritten. If a router or transport adds header lines, they are not
35785 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
35786 envelope. You can change the return path using <option>return_path</option>, but you cannot
35787 change envelope recipients at this time.
35788 </para>
35789 <para>
35790 <indexterm role="option">
35791 <primary><option>home_directory</option></primary>
35792 </indexterm>
35793 </para>
35794 <informaltable frame="all">
35795 <tgroup cols="4" colsep="0" rowsep="0">
35796 <colspec colwidth="8*" align="left"/>
35797 <colspec colwidth="6*" align="center"/>
35798 <colspec colwidth="6*" align="center"/>
35799 <colspec colwidth="6*" align="right"/>
35800 <tbody>
35801 <row>
35802 <entry><option>home_directory</option></entry>
35803 <entry>Use: <emphasis>transports</emphasis></entry>
35804 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35805 <entry>Default: <emphasis>unset</emphasis></entry>
35806 </row>
35807 </tbody>
35808 </tgroup>
35809 </informaltable>
35810 <para>
35811 <indexterm role="concept">
35812 <primary>transport</primary>
35813 <secondary>home directory for</secondary>
35814 </indexterm>
35815 <indexterm role="variable">
35816 <primary><varname>$home</varname></primary>
35817 </indexterm>
35818 This option specifies a home directory setting for a local transport,
35819 overriding any value that may be set by the router. The home directory is
35820 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
35821 used as the current directory if no current directory is set by the
35822 <option>current_directory</option> option on the transport or the
35823 <option>transport_current_directory</option> option on the router. If the expansion fails
35824 for any reason, including forced failure, an error is logged, and delivery is
35825 deferred.
35826 </para>
35827 <para>
35828 <indexterm role="option">
35829 <primary><option>initgroups</option></primary>
35830 </indexterm>
35831 </para>
35832 <informaltable frame="all">
35833 <tgroup cols="4" colsep="0" rowsep="0">
35834 <colspec colwidth="8*" align="left"/>
35835 <colspec colwidth="6*" align="center"/>
35836 <colspec colwidth="6*" align="center"/>
35837 <colspec colwidth="6*" align="right"/>
35838 <tbody>
35839 <row>
35840 <entry><option>initgroups</option></entry>
35841 <entry>Use: <emphasis>transports</emphasis></entry>
35842 <entry>Type: <emphasis>boolean</emphasis></entry>
35843 <entry>Default: <emphasis>false</emphasis></entry>
35844 </row>
35845 </tbody>
35846 </tgroup>
35847 </informaltable>
35848 <para>
35849 <indexterm role="concept">
35850 <primary>additional groups</primary>
35851 </indexterm>
35852 <indexterm role="concept">
35853 <primary>groups</primary>
35854 <secondary>additional</secondary>
35855 </indexterm>
35856 <indexterm role="concept">
35857 <primary>transport</primary>
35858 <secondary>group; additional</secondary>
35859 </indexterm>
35860 If this option is true and the uid for the delivery process is provided by the
35861 transport, the <function>initgroups()</function> function is called when running the transport
35862 to ensure that any additional groups associated with the uid are set up.
35863 </para>
35864 <para>
35865 <indexterm role="option">
35866 <primary><option>message_size_limit</option></primary>
35867 </indexterm>
35868 </para>
35869 <informaltable frame="all">
35870 <tgroup cols="4" colsep="0" rowsep="0">
35871 <colspec colwidth="8*" align="left"/>
35872 <colspec colwidth="6*" align="center"/>
35873 <colspec colwidth="6*" align="center"/>
35874 <colspec colwidth="6*" align="right"/>
35875 <tbody>
35876 <row>
35877 <entry><option>message_size_limit</option></entry>
35878 <entry>Use: <emphasis>transports</emphasis></entry>
35879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35880 <entry>Default: <emphasis>0</emphasis></entry>
35881 </row>
35882 </tbody>
35883 </tgroup>
35884 </informaltable>
35885 <para>
35886 <indexterm role="concept">
35887 <primary>limit</primary>
35888 <secondary>message size per transport</secondary>
35889 </indexterm>
35890 <indexterm role="concept">
35891 <primary>size</primary>
35892 <secondary>of message, limit</secondary>
35893 </indexterm>
35894 <indexterm role="concept">
35895 <primary>transport</primary>
35896 <secondary>message size; limiting</secondary>
35897 </indexterm>
35898 This option controls the size of messages passed through the transport. It is
35899 expanded before use; the result of the expansion must be a sequence of decimal
35900 digits, optionally followed by K or M. If the expansion fails for any reason,
35901 including forced failure, or if the result is not of the required form,
35902 delivery is deferred. If the value is greater than zero and the size of a
35903 message exceeds this limit, the address is failed. If there is any chance that
35904 the resulting bounce message could be routed to the same transport, you should
35905 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
35906 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
35907 delivered.
35908 </para>
35909 <para>
35910 <indexterm role="option">
35911 <primary><option>rcpt_include_affixes</option></primary>
35912 </indexterm>
35913 </para>
35914 <informaltable frame="all">
35915 <tgroup cols="4" colsep="0" rowsep="0">
35916 <colspec colwidth="8*" align="left"/>
35917 <colspec colwidth="6*" align="center"/>
35918 <colspec colwidth="6*" align="center"/>
35919 <colspec colwidth="6*" align="right"/>
35920 <tbody>
35921 <row>
35922 <entry><option>rcpt_include_affixes</option></entry>
35923 <entry>Use: <emphasis>transports</emphasis></entry>
35924 <entry>Type: <emphasis>boolean</emphasis></entry>
35925 <entry>Default: <emphasis>false</emphasis></entry>
35926 </row>
35927 </tbody>
35928 </tgroup>
35929 </informaltable>
35930 <para>
35931 <indexterm role="concept">
35932 <primary>prefix</primary>
35933 <secondary>for local part, including in envelope</secondary>
35934 </indexterm>
35935 <indexterm role="concept">
35936 <primary>suffix for local part</primary>
35937 <secondary>including in envelope</secondary>
35938 </indexterm>
35939 <indexterm role="concept">
35940 <primary>local part</primary>
35941 <secondary>prefix</secondary>
35942 </indexterm>
35943 <indexterm role="concept">
35944 <primary>local part</primary>
35945 <secondary>suffix</secondary>
35946 </indexterm>
35947 When this option is false (the default), and an address that has had any
35948 affixes (prefixes or suffixes) removed from the local part is delivered by any
35949 form of SMTP or LMTP, the affixes are not included. For example, if a router
35950 that contains
35951 </para>
35952 <literallayout class="monospaced">
35953 local_part_prefix = *-
35954 </literallayout>
35955 <para>
35956 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35957 is delivered with
35958 </para>
35959 <literallayout class="monospaced">
35960 RCPT TO:&lt;xyz@some.domain&gt;
35961 </literallayout>
35962 <para>
35963 This is also the case when an ACL-time callout is being used to verify a
35964 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35965 whole local part is included in the RCPT command. This option applies to BSMTP
35966 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35967 <command>lmtp</command> and <command>smtp</command> transports.
35968 </para>
35969 <para>
35970 <indexterm role="option">
35971 <primary><option>retry_use_local_part</option></primary>
35972 </indexterm>
35973 </para>
35974 <informaltable frame="all">
35975 <tgroup cols="4" colsep="0" rowsep="0">
35976 <colspec colwidth="8*" align="left"/>
35977 <colspec colwidth="6*" align="center"/>
35978 <colspec colwidth="6*" align="center"/>
35979 <colspec colwidth="6*" align="right"/>
35980 <tbody>
35981 <row>
35982 <entry><option>retry_use_local_part</option></entry>
35983 <entry>Use: <emphasis>transports</emphasis></entry>
35984 <entry>Type: <emphasis>boolean</emphasis></entry>
35985 <entry>Default: <emphasis>see below</emphasis></entry>
35986 </row>
35987 </tbody>
35988 </tgroup>
35989 </informaltable>
35990 <para>
35991 <indexterm role="concept">
35992 <primary>hints database</primary>
35993 <secondary>retry keys</secondary>
35994 </indexterm>
35995 When a delivery suffers a temporary failure, a retry record is created
35996 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
35997 is based on the name and/or IP address of the failing remote host. For local
35998 deliveries, the key is normally the entire address, including both the local
35999 part and the domain. This is suitable for most common cases of local delivery
36000 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
36001 deliveries to that mailbox, not to the whole domain.
36002 </para>
36003 <para>
36004 However, in some special cases you may want to treat a temporary local delivery
36005 as a failure associated with the domain, and not with a particular local part.
36006 (For example, if you are storing all mail for some domain in files.) You can do
36007 this by setting <option>retry_use_local_part</option> false.
36008 </para>
36009 <para>
36010 For all the local transports, its default value is true. For remote transports,
36011 the default value is false for tidiness, but changing the value has no effect
36012 on a remote transport in the current implementation.
36013 </para>
36014 <para>
36015 <indexterm role="option">
36016 <primary><option>return_path</option></primary>
36017 </indexterm>
36018 </para>
36019 <informaltable frame="all">
36020 <tgroup cols="4" colsep="0" rowsep="0">
36021 <colspec colwidth="8*" align="left"/>
36022 <colspec colwidth="6*" align="center"/>
36023 <colspec colwidth="6*" align="center"/>
36024 <colspec colwidth="6*" align="right"/>
36025 <tbody>
36026 <row>
36027 <entry><option>return_path</option></entry>
36028 <entry>Use: <emphasis>transports</emphasis></entry>
36029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36030 <entry>Default: <emphasis>unset</emphasis></entry>
36031 </row>
36032 </tbody>
36033 </tgroup>
36034 </informaltable>
36035 <para>
36036 <indexterm role="concept">
36037 <primary>envelope sender</primary>
36038 </indexterm>
36039 <indexterm role="concept">
36040 <primary>transport</primary>
36041 <secondary>return path; changing</secondary>
36042 </indexterm>
36043 <indexterm role="concept">
36044 <primary>return path</primary>
36045 <secondary>changing in transport</secondary>
36046 </indexterm>
36047 If this option is set, the string is expanded at transport time and replaces
36048 the existing return path (envelope sender) value in the copy of the message
36049 that is being delivered. An empty return path is permitted. This feature is
36050 designed for remote deliveries, where the value of this option is used in the
36051 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36052 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36053 header line, if one is added to the message (see the next option).
36054 </para>
36055 <para>
36056 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36057 <option>return_path_on_delivery</option> to the log selector.
36058 </para>
36059 <para>
36060 <indexterm role="variable">
36061 <primary><varname>$return_path</varname></primary>
36062 </indexterm>
36063 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36064 either the message&#x2019;s envelope sender, or an address set by the
36065 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36066 replacement occurs; if it fails for another reason, delivery is deferred. This
36067 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
36068 section <xref linkend="SECTverp"/>.
36069 </para>
36070 <para>
36071 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36072 remote server rejects a message at SMTP time, the bounce message is not sent to
36073 the value of this option. It is sent to the previously set errors address.
36074 This defaults to the incoming sender address, but can be changed by setting
36075 <option>errors_to</option> in a router.
36076 </para>
36077 <para>
36078 <indexterm role="option">
36079 <primary><option>return_path_add</option></primary>
36080 </indexterm>
36081 </para>
36082 <informaltable frame="all">
36083 <tgroup cols="4" colsep="0" rowsep="0">
36084 <colspec colwidth="8*" align="left"/>
36085 <colspec colwidth="6*" align="center"/>
36086 <colspec colwidth="6*" align="center"/>
36087 <colspec colwidth="6*" align="right"/>
36088 <tbody>
36089 <row>
36090 <entry><option>return_path_add</option></entry>
36091 <entry>Use: <emphasis>transports</emphasis></entry>
36092 <entry>Type: <emphasis>boolean</emphasis></entry>
36093 <entry>Default: <emphasis>false</emphasis></entry>
36094 </row>
36095 </tbody>
36096 </tgroup>
36097 </informaltable>
36098 <para>
36099 <indexterm role="concept">
36100 <primary><emphasis>Return-path:</emphasis> header line</primary>
36101 </indexterm>
36102 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36103 Although the return path is normally available in the prefix line of BSD
36104 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36105 have easy access to it.
36106 </para>
36107 <para>
36108 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36109 the delivery SMTP server makes the final delivery</quote>. This implies that this
36110 header should not be present in incoming messages. Exim has a configuration
36111 option, <option>return_path_remove</option>, which requests removal of this header from
36112 incoming messages, so that delivered messages can safely be resent to other
36113 recipients.
36114 </para>
36115 <para>
36116 <indexterm role="option">
36117 <primary><option>shadow_condition</option></primary>
36118 </indexterm>
36119 </para>
36120 <informaltable frame="all">
36121 <tgroup cols="4" colsep="0" rowsep="0">
36122 <colspec colwidth="8*" align="left"/>
36123 <colspec colwidth="6*" align="center"/>
36124 <colspec colwidth="6*" align="center"/>
36125 <colspec colwidth="6*" align="right"/>
36126 <tbody>
36127 <row>
36128 <entry><option>shadow_condition</option></entry>
36129 <entry>Use: <emphasis>transports</emphasis></entry>
36130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36131 <entry>Default: <emphasis>unset</emphasis></entry>
36132 </row>
36133 </tbody>
36134 </tgroup>
36135 </informaltable>
36136 <para>
36137 See <option>shadow_transport</option> below.
36138 </para>
36139 <para>
36140 <indexterm role="option">
36141 <primary><option>shadow_transport</option></primary>
36142 </indexterm>
36143 </para>
36144 <informaltable frame="all">
36145 <tgroup cols="4" colsep="0" rowsep="0">
36146 <colspec colwidth="8*" align="left"/>
36147 <colspec colwidth="6*" align="center"/>
36148 <colspec colwidth="6*" align="center"/>
36149 <colspec colwidth="6*" align="right"/>
36150 <tbody>
36151 <row>
36152 <entry><option>shadow_transport</option></entry>
36153 <entry>Use: <emphasis>transports</emphasis></entry>
36154 <entry>Type: <emphasis>string</emphasis></entry>
36155 <entry>Default: <emphasis>unset</emphasis></entry>
36156 </row>
36157 </tbody>
36158 </tgroup>
36159 </informaltable>
36160 <para>
36161 <indexterm role="concept">
36162 <primary>shadow transport</primary>
36163 </indexterm>
36164 <indexterm role="concept">
36165 <primary>transport</primary>
36166 <secondary>shadow</secondary>
36167 </indexterm>
36168 A local transport may set the <option>shadow_transport</option> option to the name of
36169 another local transport. Shadow remote transports are not supported.
36170 </para>
36171 <para>
36172 Whenever a delivery to the main transport succeeds, and either
36173 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36174 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36175 passed to the shadow transport, with the same delivery address or addresses. If
36176 expansion fails, no action is taken except that non-forced expansion failures
36177 cause a log line to be written.
36178 </para>
36179 <para>
36180 The result of the shadow transport is discarded and does not affect the
36181 subsequent processing of the message. Only a single level of shadowing is
36182 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36183 is running as a shadow. Options concerned with output from pipes are also
36184 ignored. The log line for the successful delivery has an item added on the end,
36185 of the form
36186 </para>
36187 <literallayout class="monospaced">
36188 ST=&lt;shadow transport name&gt;
36189 </literallayout>
36190 <para>
36191 If the shadow transport did not succeed, the error message is put in
36192 parentheses afterwards. Shadow transports can be used for a number of different
36193 purposes, including keeping more detailed log information than Exim normally
36194 provides, and implementing automatic acknowledgment policies based on message
36195 headers that some sites insist on.
36196 </para>
36197 <para>
36198 <indexterm role="option">
36199 <primary><option>transport_filter</option></primary>
36200 </indexterm>
36201 </para>
36202 <informaltable frame="all">
36203 <tgroup cols="4" colsep="0" rowsep="0">
36204 <colspec colwidth="8*" align="left"/>
36205 <colspec colwidth="6*" align="center"/>
36206 <colspec colwidth="6*" align="center"/>
36207 <colspec colwidth="6*" align="right"/>
36208 <tbody>
36209 <row>
36210 <entry><option>transport_filter</option></entry>
36211 <entry>Use: <emphasis>transports</emphasis></entry>
36212 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36213 <entry>Default: <emphasis>unset</emphasis></entry>
36214 </row>
36215 </tbody>
36216 </tgroup>
36217 </informaltable>
36218 <para>
36219 <indexterm role="concept">
36220 <primary>transport</primary>
36221 <secondary>filter</secondary>
36222 </indexterm>
36223 <indexterm role="concept">
36224 <primary>filter</primary>
36225 <secondary>transport filter</secondary>
36226 </indexterm>
36227 This option sets up a filtering (in the Unix shell sense) process for messages
36228 at transport time. It should not be confused with mail filtering as set up by
36229 individual users or via a system filter.
36230 </para>
36231 <para>
36232 When the message is about to be written out, the command specified by
36233 <option>transport_filter</option> is started up in a separate, parallel process, and
36234 the entire message, including the header lines, is passed to it on its standard
36235 input (this in fact is done from a third process, to avoid deadlock). The
36236 command must be specified as an absolute path.
36237 </para>
36238 <para>
36239 The lines of the message that are written to the transport filter are
36240 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36241 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36242 lines beginning with a dot, and also before any processing implied by the
36243 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36244 <command>pipe</command> transports.
36245 </para>
36246 <para>
36247 The standard error for the filter process is set to the same destination as its
36248 standard output; this is read and written to the message&#x2019;s ultimate
36249 destination. The process that writes the message to the filter, the
36250 filter itself, and the original process that reads the result and delivers it
36251 are all run in parallel, like a shell pipeline.
36252 </para>
36253 <para revisionflag="changed">
36254 The filter can perform any transformations it likes, but of course should take
36255 care not to break RFC 2822 syntax. Exim does not check the result, except to
36256 test for a final newline when SMTP is in use. All messages transmitted over
36257 SMTP must end with a newline, so Exim supplies one if it is missing.
36258 </para>
36259 <para>
36260 <indexterm role="concept">
36261 <primary>content scanning</primary>
36262 <secondary>per user</secondary>
36263 </indexterm>
36264 A transport filter can be used to provide content-scanning on a per-user basis
36265 at delivery time if the only required effect of the scan is to modify the
36266 message. For example, a content scan could insert a new header line containing
36267 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
36268 not possible to discard a message at this stage.
36269 </para>
36270 <para>
36271 <indexterm role="concept">
36272 <primary>SMTP</primary>
36273 <secondary>SIZE</secondary>
36274 </indexterm>
36275 A problem might arise if the filter increases the size of a message that is
36276 being sent down an SMTP connection. If the receiving SMTP server has indicated
36277 support for the SIZE parameter, Exim will have sent the size of the message
36278 at the start of the SMTP session. If what is actually sent is substantially
36279 more, the server might reject the message. This can be worked round by setting
36280 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36281 additions to the message, or to disable the use of SIZE altogether.
36282 </para>
36283 <para>
36284 <indexterm role="variable">
36285 <primary><varname>$pipe_addresses</varname></primary>
36286 </indexterm>
36287 The value of the <option>transport_filter</option> option is the command string for starting
36288 the filter, which is run directly from Exim, not under a shell. The string is
36289 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36290 Exim breaks it up into arguments and then expands each argument separately (see
36291 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36292 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36293 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
36294 an ideal name for this feature here, but as it was already implemented for the
36295 <command>pipe</command> transport, it seemed sensible not to change it.)
36296 </para>
36297 <para>
36298 <indexterm role="variable">
36299 <primary><varname>$host</varname></primary>
36300 </indexterm>
36301 <indexterm role="variable">
36302 <primary><varname>$host_address</varname></primary>
36303 </indexterm>
36304 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36305 transport is a remote one. They contain the name and IP address of the host to
36306 which the message is being sent. For example:
36307 </para>
36308 <literallayout class="monospaced">
36309 transport_filter = /some/directory/transport-filter.pl \
36310   $host $host_address $sender_address $pipe_addresses
36311 </literallayout>
36312 <para>
36313 Two problems arise if you want to use more complicated expansion items to
36314 generate transport filter commands, both of which due to the fact that the
36315 command is split up <emphasis>before</emphasis> expansion.
36316 </para>
36317 <itemizedlist>
36318 <listitem>
36319 <para>
36320 If an expansion item contains white space, you must quote it, so that it is all
36321 part of the same command item. If the entire option setting is one such
36322 expansion item, you have to take care what kind of quoting you use. For
36323 example:
36324 </para>
36325 <literallayout class="monospaced">
36326 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36327 </literallayout>
36328 <para>
36329 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36330 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36331 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
36332 the single quotes were missing, the line would be split into two items,
36333 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36334 Exim tried to expand the first one.
36335 </para>
36336 </listitem>
36337 <listitem>
36338 <para>
36339 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36340 expansion cannot generate multiple arguments, or a command name followed by
36341 arguments. Consider this example:
36342 </para>
36343 <literallayout class="monospaced">
36344 transport_filter = ${lookup{$host}lsearch{/a/file}\
36345                     {$value}{/bin/cat}}
36346 </literallayout>
36347 <para>
36348 The result of the lookup is interpreted as the name of the command, even
36349 if it contains white space. The simplest way round this is to use a shell:
36350 </para>
36351 <literallayout class="monospaced">
36352 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36353                                {$value}{/bin/cat}}
36354 </literallayout>
36355 </listitem>
36356 </itemizedlist>
36357 <para>
36358 The filter process is run under the same uid and gid as the normal delivery.
36359 For remote deliveries this is the Exim uid/gid by default. The command should
36360 normally yield a zero return code. Transport filters are not supposed to fail.
36361 A non-zero code is taken to mean that the transport filter encountered some
36362 serious problem. Delivery of the message is deferred; the message remains on
36363 the queue and is tried again later. It is not possible to cause a message to be
36364 bounced from a transport filter.
36365 </para>
36366 <para>
36367 If a transport filter is set on an autoreply transport, the original message is
36368 passed through the filter as it is being copied into the newly generated
36369 message, which happens if the <option>return_message</option> option is set.
36370 </para>
36371 <para>
36372 <indexterm role="option">
36373 <primary><option>transport_filter_timeout</option></primary>
36374 </indexterm>
36375 </para>
36376 <informaltable frame="all">
36377 <tgroup cols="4" colsep="0" rowsep="0">
36378 <colspec colwidth="8*" align="left"/>
36379 <colspec colwidth="6*" align="center"/>
36380 <colspec colwidth="6*" align="center"/>
36381 <colspec colwidth="6*" align="right"/>
36382 <tbody>
36383 <row>
36384 <entry><option>transport_filter_timeout</option></entry>
36385 <entry>Use: <emphasis>transports</emphasis></entry>
36386 <entry>Type: <emphasis>time</emphasis></entry>
36387 <entry>Default: <emphasis>5m</emphasis></entry>
36388 </row>
36389 </tbody>
36390 </tgroup>
36391 </informaltable>
36392 <para>
36393 <indexterm role="concept">
36394 <primary>transport</primary>
36395 <secondary>filter, timeout</secondary>
36396 </indexterm>
36397 When Exim is reading the output of a transport filter, it a applies a timeout
36398 that can be set by this option. Exceeding the timeout is normally treated as a
36399 temporary delivery failure. However, if a transport filter is used with a
36400 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36401 way as a timeout in the pipe command itself. By default, a timeout is a hard
36402 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
36403 becomes a temporary error.
36404 </para>
36405 <para>
36406 <indexterm role="option">
36407 <primary><option>user</option></primary>
36408 </indexterm>
36409 </para>
36410 <informaltable frame="all">
36411 <tgroup cols="4" colsep="0" rowsep="0">
36412 <colspec colwidth="8*" align="left"/>
36413 <colspec colwidth="6*" align="center"/>
36414 <colspec colwidth="6*" align="center"/>
36415 <colspec colwidth="6*" align="right"/>
36416 <tbody>
36417 <row>
36418 <entry><option>user</option></entry>
36419 <entry>Use: <emphasis>transports</emphasis></entry>
36420 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36421 <entry>Default: <emphasis>Exim user</emphasis></entry>
36422 </row>
36423 </tbody>
36424 </tgroup>
36425 </informaltable>
36426 <para>
36427 <indexterm role="concept">
36428 <primary>uid (user id)</primary>
36429 <secondary>local delivery</secondary>
36430 </indexterm>
36431 <indexterm role="concept">
36432 <primary>transport</primary>
36433 <secondary>user, specifying</secondary>
36434 </indexterm>
36435 This option specifies the user under whose uid the delivery process is to be
36436 run, overriding any uid that may have been set by the router. If the user is
36437 given as a name, the uid is looked up from the password data, and the
36438 associated group is taken as the value of the gid to be used if the <option>group</option>
36439 option is not set.
36440 </para>
36441 <para>
36442 For deliveries that use local transports, a user and group are normally
36443 specified explicitly or implicitly (for example, as a result of
36444 <option>check_local_user</option>) by the router or transport.
36445 </para>
36446 <para>
36447 <indexterm role="concept">
36448 <primary>hints database</primary>
36449 <secondary>access by remote transport</secondary>
36450 </indexterm>
36451 For remote transports, you should leave this option unset unless you really are
36452 sure you know what you are doing. When a remote transport is running, it needs
36453 to be able to access Exim&#x2019;s hints databases, because each host may have its own
36454 retry data.
36455 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36456 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36457 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36458 </para>
36459 </chapter>
36460
36461 <chapter id="CHAPbatching">
36462 <title>Address batching in local transports</title>
36463 <titleabbrev>Address batching</titleabbrev>
36464 <para>
36465 <indexterm role="concept">
36466 <primary>transport</primary>
36467 <secondary>local; address batching in</secondary>
36468 </indexterm>
36469 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36470 one address at a time, so that when several addresses are routed to the same
36471 remote host, just one copy of the message is sent. Local transports, however,
36472 normally handle one address at a time. That is, a separate instance of the
36473 transport is run for each address that is routed to the transport. A separate
36474 copy of the message is delivered each time.
36475 </para>
36476 <para>
36477 <indexterm role="concept">
36478 <primary>batched local delivery</primary>
36479 </indexterm>
36480 <indexterm role="option">
36481 <primary><option>batch_max</option></primary>
36482 </indexterm>
36483 <indexterm role="option">
36484 <primary><option>batch_id</option></primary>
36485 </indexterm>
36486 In special cases, it may be desirable to handle several addresses at once in a
36487 local transport, for example:
36488 </para>
36489 <itemizedlist>
36490 <listitem>
36491 <para>
36492 In an <command>appendfile</command> transport, when storing messages in files for later
36493 delivery by some other means, a single copy of the message with multiple
36494 recipients saves space.
36495 </para>
36496 </listitem>
36497 <listitem>
36498 <para>
36499 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36500 a single copy saves time, and is the normal way LMTP is expected to work.
36501 </para>
36502 </listitem>
36503 <listitem>
36504 <para>
36505 In a <command>pipe</command> transport, when passing the message
36506 to a scanner program or
36507 to some other delivery mechanism such as UUCP, multiple recipients may be
36508 acceptable.
36509 </para>
36510 </listitem>
36511 </itemizedlist>
36512 <para>
36513 These three local transports all have the same options for controlling multiple
36514 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36515 repeating the information for each transport, these options are described here.
36516 </para>
36517 <para>
36518 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36519 delivered together in a single run of the transport. Its default value is one
36520 (no batching). When more than one address is routed to a transport that has a
36521 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36522 (that is, in a single run of the transport with multiple recipients), subject
36523 to certain conditions:
36524 </para>
36525 <itemizedlist>
36526 <listitem>
36527 <para>
36528 <indexterm role="variable">
36529 <primary><varname>$local_part</varname></primary>
36530 </indexterm>
36531 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
36532 batching is possible.
36533 </para>
36534 </listitem>
36535 <listitem>
36536 <para>
36537 <indexterm role="variable">
36538 <primary><varname>$domain</varname></primary>
36539 </indexterm>
36540 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
36541 addresses with the same domain are batched.
36542 </para>
36543 </listitem>
36544 <listitem>
36545 <para>
36546 <indexterm role="concept">
36547 <primary>customizing</primary>
36548 <secondary>batching condition</secondary>
36549 </indexterm>
36550 If <option>batch_id</option> is set, it is expanded for each address, and only those
36551 addresses with the same expanded value are batched. This allows you to specify
36552 customized batching conditions. Failure of the expansion for any reason,
36553 including forced failure, disables batching, but it does not stop the delivery
36554 from taking place.
36555 </para>
36556 </listitem>
36557 <listitem>
36558 <para>
36559 Batched addresses must also have the same errors address (where to send
36560 delivery errors), the same header additions and removals, the same user and
36561 group for the transport, and if a host list is present, the first host must
36562 be the same.
36563 </para>
36564 </listitem>
36565 </itemizedlist>
36566 <para>
36567 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36568 both when the file or pipe command is specified in the transport, and when it
36569 is specified by a <command>redirect</command> router, but all the batched addresses must of
36570 course be routed to the same file or pipe command. These two transports have an
36571 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36572 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36573 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36574 </para>
36575 <literallayout class="monospaced">
36576 check_string = "."
36577 escape_string = ".."
36578 </literallayout>
36579 <para>
36580 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36581 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36582 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36583 </para>
36584 <para>
36585 <indexterm role="concept">
36586 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36587 </indexterm>
36588 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36589 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36590 that are being processed together. If you are using a batching <command>appendfile</command>
36591 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36592 addresses is to set the <option>envelope_to_add</option> option.
36593 </para>
36594 <para>
36595 <indexterm role="concept">
36596 <primary><command>pipe</command> transport</primary>
36597 <secondary>with multiple addresses</secondary>
36598 </indexterm>
36599 <indexterm role="variable">
36600 <primary><varname>$pipe_addresses</varname></primary>
36601 </indexterm>
36602 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36603 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36604 the command. This is not a true variable; it is a bit of magic that causes each
36605 of the recipient addresses to be inserted into the command as a separate
36606 argument. This provides a way of accessing all the addresses that are being
36607 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36608 are specified by a <command>redirect</command> router.
36609 </para>
36610 </chapter>
36611
36612 <chapter id="CHAPappendfile">
36613 <title>The appendfile transport</title>
36614 <para>
36615 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36616 <primary><command>appendfile</command> transport</primary>
36617 </indexterm>
36618 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36619 <primary>transports</primary>
36620 <secondary><command>appendfile</command></secondary>
36621 </indexterm>
36622 <indexterm role="concept">
36623 <primary>directory creation</primary>
36624 </indexterm>
36625 <indexterm role="concept">
36626 <primary>creating directories</primary>
36627 </indexterm>
36628 The <command>appendfile</command> transport delivers a message by appending it to an existing
36629 file, or by creating an entirely new file in a specified directory. Single
36630 files to which messages are appended can be in the traditional Unix mailbox
36631 format, or optionally in the MBX format supported by the Pine MUA and
36632 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36633 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36634 to give added protection against failures that happen part-way through the
36635 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36636 supported. For all file formats, Exim attempts to create as many levels of
36637 directory as necessary, provided that <option>create_directory</option> is set.
36638 </para>
36639 <para>
36640 The code for the optional formats is not included in the Exim binary by
36641 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36642 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36643 included.
36644 </para>
36645 <para>
36646 <indexterm role="concept">
36647 <primary>quota</primary>
36648 <secondary>system</secondary>
36649 </indexterm>
36650 Exim recognizes system quota errors, and generates an appropriate message. Exim
36651 also supports its own quota control within the transport, for use when the
36652 system facility is unavailable or cannot be used for some reason.
36653 </para>
36654 <para>
36655 If there is an error while appending to a file (for example, quota exceeded or
36656 partition filled), Exim attempts to reset the file&#x2019;s length and last
36657 modification time back to what they were before. If there is an error while
36658 creating an entirely new file, the new file is removed.
36659 </para>
36660 <para>
36661 Before appending to a file, a number of security checks are made, and the
36662 file is locked. A detailed description is given below, after the list of
36663 private options.
36664 </para>
36665 <para>
36666 The <command>appendfile</command> transport is most commonly used for local deliveries to
36667 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
36668 putting messages into files for remote delivery by some means other than Exim.
36669 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36670 option).
36671 </para>
36672 <section id="SECTfildiropt">
36673 <title>The file and directory options</title>
36674 <para>
36675 The <option>file</option> option specifies a single file, to which the message is appended;
36676 the <option>directory</option> option specifies a directory, in which a new file containing
36677 the message is created. Only one of these two options can be set, and for
36678 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36679 </para>
36680 <para>
36681 <indexterm role="variable">
36682 <primary><varname>$address_file</varname></primary>
36683 </indexterm>
36684 <indexterm role="variable">
36685 <primary><varname>$local_part</varname></primary>
36686 </indexterm>
36687 However, <command>appendfile</command> is also used for delivering messages to files or
36688 directories whose names (or parts of names) are obtained from alias,
36689 forwarding, or filtering operations (for example, a <option>save</option> command in a
36690 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36691 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36692 name (or partial name) of the file or directory generated by the redirection
36693 operation. There are two cases:
36694 </para>
36695 <itemizedlist>
36696 <listitem>
36697 <para>
36698 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36699 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36700 common case when users with local accounts use filtering to sort mail into
36701 different folders. See for example, the <command>address_file</command> transport in the
36702 default configuration. If the path ends with a slash, it is assumed to be the
36703 name of a directory. A delivery to a directory can also be forced by setting
36704 <option>maildir_format</option> or <option>mailstore_format</option>.
36705 </para>
36706 </listitem>
36707 <listitem>
36708 <para>
36709 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36710 used to determine the file or directory name for the delivery. Normally, the
36711 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36712 </para>
36713 </listitem>
36714 </itemizedlist>
36715 <para>
36716 <indexterm role="concept">
36717 <primary>Sieve filter</primary>
36718 <secondary>configuring <command>appendfile</command></secondary>
36719 </indexterm>
36720 <indexterm role="concept">
36721 <primary>Sieve filter</primary>
36722 <secondary>relative mailbox path handling</secondary>
36723 </indexterm>
36724 As an example of the second case, consider an environment where users do not
36725 have home directories. They may be permitted to use Exim filter commands of the
36726 form:
36727 </para>
36728 <literallayout class="monospaced">
36729 save folder23
36730 </literallayout>
36731 <para>
36732 or Sieve filter commands of the form:
36733 </para>
36734 <literallayout class="monospaced">
36735 require "fileinto";
36736 fileinto "folder23";
36737 </literallayout>
36738 <para>
36739 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36740 must transform the relative path into an appropriate absolute file name. In the
36741 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36742 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36743 way of handling this requirement:
36744 </para>
36745 <literallayout class="monospaced">
36746 file = ${if eq{$address_file}{inbox} \
36747             {/var/mail/$local_part} \
36748             {${if eq{${substr_0_1:$address_file}}{/} \
36749                   {$address_file} \
36750                   {$home/mail/$address_file} \
36751             }} \
36752        }
36753 </literallayout>
36754 <para>
36755 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36756 location, absolute paths are used without change, and other folders are in the
36757 <filename>mail</filename> directory within the home directory.
36758 </para>
36759 <para>
36760 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36761 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36762 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36763 you want to prevent this happening at routing time, you can set
36764 <option>router_home_directory</option> empty. This forces the router to pass the relative
36765 path to the transport.
36766 </para>
36767 <para>
36768 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36769 the <option>file</option> or <option>directory</option> option is still used if it is set.
36770 </para>
36771 </section>
36772 <section id="SECID134">
36773 <title>Private options for appendfile</title>
36774 <para>
36775 <indexterm role="concept">
36776 <primary>options</primary>
36777 <secondary><command>appendfile</command> transport</secondary>
36778 </indexterm>
36779 </para>
36780 <para>
36781 <indexterm role="option">
36782 <primary><option>allow_fifo</option></primary>
36783 </indexterm>
36784 </para>
36785 <informaltable frame="all">
36786 <tgroup cols="4" colsep="0" rowsep="0">
36787 <colspec colwidth="8*" align="left"/>
36788 <colspec colwidth="6*" align="center"/>
36789 <colspec colwidth="6*" align="center"/>
36790 <colspec colwidth="6*" align="right"/>
36791 <tbody>
36792 <row>
36793 <entry><option>allow_fifo</option></entry>
36794 <entry>Use: <emphasis>appendfile</emphasis></entry>
36795 <entry>Type: <emphasis>boolean</emphasis></entry>
36796 <entry>Default: <emphasis>false</emphasis></entry>
36797 </row>
36798 </tbody>
36799 </tgroup>
36800 </informaltable>
36801 <para>
36802 <indexterm role="concept">
36803 <primary>fifo (named pipe)</primary>
36804 </indexterm>
36805 <indexterm role="concept">
36806 <primary>named pipe (fifo)</primary>
36807 </indexterm>
36808 <indexterm role="concept">
36809 <primary>pipe</primary>
36810 <secondary>named (fifo)</secondary>
36811 </indexterm>
36812 Setting this option permits delivery to named pipes (FIFOs) as well as to
36813 regular files. If no process is reading the named pipe at delivery time, the
36814 delivery is deferred.
36815 </para>
36816 <para>
36817 <indexterm role="option">
36818 <primary><option>allow_symlink</option></primary>
36819 </indexterm>
36820 </para>
36821 <informaltable frame="all">
36822 <tgroup cols="4" colsep="0" rowsep="0">
36823 <colspec colwidth="8*" align="left"/>
36824 <colspec colwidth="6*" align="center"/>
36825 <colspec colwidth="6*" align="center"/>
36826 <colspec colwidth="6*" align="right"/>
36827 <tbody>
36828 <row>
36829 <entry><option>allow_symlink</option></entry>
36830 <entry>Use: <emphasis>appendfile</emphasis></entry>
36831 <entry>Type: <emphasis>boolean</emphasis></entry>
36832 <entry>Default: <emphasis>false</emphasis></entry>
36833 </row>
36834 </tbody>
36835 </tgroup>
36836 </informaltable>
36837 <para>
36838 <indexterm role="concept">
36839 <primary>symbolic link</primary>
36840 <secondary>to mailbox</secondary>
36841 </indexterm>
36842 <indexterm role="concept">
36843 <primary>mailbox</primary>
36844 <secondary>symbolic link</secondary>
36845 </indexterm>
36846 By default, <command>appendfile</command> will not deliver if the path name for the file is
36847 that of a symbolic link. Setting this option relaxes that constraint, but there
36848 are security issues involved in the use of symbolic links. Be sure you know
36849 what you are doing if you set this. Details of exactly what this option affects
36850 are included in the discussion which follows this list of options.
36851 </para>
36852 <para>
36853 <indexterm role="option">
36854 <primary><option>batch_id</option></primary>
36855 </indexterm>
36856 </para>
36857 <informaltable frame="all">
36858 <tgroup cols="4" colsep="0" rowsep="0">
36859 <colspec colwidth="8*" align="left"/>
36860 <colspec colwidth="6*" align="center"/>
36861 <colspec colwidth="6*" align="center"/>
36862 <colspec colwidth="6*" align="right"/>
36863 <tbody>
36864 <row>
36865 <entry><option>batch_id</option></entry>
36866 <entry>Use: <emphasis>appendfile</emphasis></entry>
36867 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36868 <entry>Default: <emphasis>unset</emphasis></entry>
36869 </row>
36870 </tbody>
36871 </tgroup>
36872 </informaltable>
36873 <para>
36874 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36875 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36876 happen as a result of forwarding or aliasing or other redirection directly to a
36877 file.
36878 </para>
36879 <para>
36880 <indexterm role="option">
36881 <primary><option>batch_max</option></primary>
36882 </indexterm>
36883 </para>
36884 <informaltable frame="all">
36885 <tgroup cols="4" colsep="0" rowsep="0">
36886 <colspec colwidth="8*" align="left"/>
36887 <colspec colwidth="6*" align="center"/>
36888 <colspec colwidth="6*" align="center"/>
36889 <colspec colwidth="6*" align="right"/>
36890 <tbody>
36891 <row>
36892 <entry><option>batch_max</option></entry>
36893 <entry>Use: <emphasis>appendfile</emphasis></entry>
36894 <entry>Type: <emphasis>integer</emphasis></entry>
36895 <entry>Default: <emphasis>1</emphasis></entry>
36896 </row>
36897 </tbody>
36898 </tgroup>
36899 </informaltable>
36900 <para>
36901 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36902 </para>
36903 <para>
36904 <indexterm role="option">
36905 <primary><option>check_group</option></primary>
36906 </indexterm>
36907 </para>
36908 <informaltable frame="all">
36909 <tgroup cols="4" colsep="0" rowsep="0">
36910 <colspec colwidth="8*" align="left"/>
36911 <colspec colwidth="6*" align="center"/>
36912 <colspec colwidth="6*" align="center"/>
36913 <colspec colwidth="6*" align="right"/>
36914 <tbody>
36915 <row>
36916 <entry><option>check_group</option></entry>
36917 <entry>Use: <emphasis>appendfile</emphasis></entry>
36918 <entry>Type: <emphasis>boolean</emphasis></entry>
36919 <entry>Default: <emphasis>false</emphasis></entry>
36920 </row>
36921 </tbody>
36922 </tgroup>
36923 </informaltable>
36924 <para>
36925 When this option is set, the group owner of the file defined by the <option>file</option>
36926 option is checked to see that it is the same as the group under which the
36927 delivery process is running. The default setting is false because the default
36928 file mode is 0600, which means that the group is irrelevant.
36929 </para>
36930 <para>
36931 <indexterm role="option">
36932 <primary><option>check_owner</option></primary>
36933 </indexterm>
36934 </para>
36935 <informaltable frame="all">
36936 <tgroup cols="4" colsep="0" rowsep="0">
36937 <colspec colwidth="8*" align="left"/>
36938 <colspec colwidth="6*" align="center"/>
36939 <colspec colwidth="6*" align="center"/>
36940 <colspec colwidth="6*" align="right"/>
36941 <tbody>
36942 <row>
36943 <entry><option>check_owner</option></entry>
36944 <entry>Use: <emphasis>appendfile</emphasis></entry>
36945 <entry>Type: <emphasis>boolean</emphasis></entry>
36946 <entry>Default: <emphasis>true</emphasis></entry>
36947 </row>
36948 </tbody>
36949 </tgroup>
36950 </informaltable>
36951 <para>
36952 When this option is set, the owner of the file defined by the <option>file</option> option
36953 is checked to ensure that it is the same as the user under which the delivery
36954 process is running.
36955 </para>
36956 <para>
36957 <indexterm role="option">
36958 <primary><option>check_string</option></primary>
36959 </indexterm>
36960 </para>
36961 <informaltable frame="all">
36962 <tgroup cols="4" colsep="0" rowsep="0">
36963 <colspec colwidth="8*" align="left"/>
36964 <colspec colwidth="6*" align="center"/>
36965 <colspec colwidth="6*" align="center"/>
36966 <colspec colwidth="6*" align="right"/>
36967 <tbody>
36968 <row>
36969 <entry><option>check_string</option></entry>
36970 <entry>Use: <emphasis>appendfile</emphasis></entry>
36971 <entry>Type: <emphasis>string</emphasis></entry>
36972 <entry>Default: <emphasis>see below</emphasis></entry>
36973 </row>
36974 </tbody>
36975 </tgroup>
36976 </informaltable>
36977 <para>
36978 <indexterm role="concept">
36979 <primary><quote>From</quote> line</primary>
36980 </indexterm>
36981 As <command>appendfile</command> writes the message, the start of each line is tested for
36982 matching <option>check_string</option>, and if it does, the initial matching characters are
36983 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
36984 a literal string, not a regular expression, and the case of any letters it
36985 contains is significant.
36986 </para>
36987 <para>
36988 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
36989 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
36990 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
36991 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
36992 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
36993 </para>
36994 <para>
36995 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
36996 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
36997 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
36998 if another format is used. For example, to deliver to mailboxes in MMDF format:
36999 <indexterm role="concept">
37000 <primary>MMDF format mailbox</primary>
37001 </indexterm>
37002 <indexterm role="concept">
37003 <primary>mailbox</primary>
37004 <secondary>MMDF format</secondary>
37005 </indexterm>
37006 </para>
37007 <literallayout class="monospaced">
37008 check_string = "\1\1\1\1\n"
37009 escape_string = "\1\1\1\1 \n"
37010 message_prefix = "\1\1\1\1\n"
37011 message_suffix = "\1\1\1\1\n"
37012 </literallayout>
37013 <para>
37014 <indexterm role="option">
37015 <primary><option>create_directory</option></primary>
37016 </indexterm>
37017 </para>
37018 <informaltable frame="all">
37019 <tgroup cols="4" colsep="0" rowsep="0">
37020 <colspec colwidth="8*" align="left"/>
37021 <colspec colwidth="6*" align="center"/>
37022 <colspec colwidth="6*" align="center"/>
37023 <colspec colwidth="6*" align="right"/>
37024 <tbody>
37025 <row>
37026 <entry><option>create_directory</option></entry>
37027 <entry>Use: <emphasis>appendfile</emphasis></entry>
37028 <entry>Type: <emphasis>boolean</emphasis></entry>
37029 <entry>Default: <emphasis>true</emphasis></entry>
37030 </row>
37031 </tbody>
37032 </tgroup>
37033 </informaltable>
37034 <para>
37035 <indexterm role="concept">
37036 <primary>directory creation</primary>
37037 </indexterm>
37038 When this option is true, Exim attempts to create any missing superior
37039 directories for the file that it is about to write. A created directory&#x2019;s mode
37040 is given by the <option>directory_mode</option> option.
37041 </para>
37042 <para>
37043 The group ownership of a newly created directory is highly dependent on the
37044 operating system (and possibly the file system) that is being used. For
37045 example, in Solaris, if the parent directory has the setgid bit set, its group
37046 is propagated to the child; if not, the currently set group is used. However,
37047 in FreeBSD, the parent&#x2019;s group is always used.
37048 </para>
37049 <para>
37050 <indexterm role="option">
37051 <primary><option>create_file</option></primary>
37052 </indexterm>
37053 </para>
37054 <informaltable frame="all">
37055 <tgroup cols="4" colsep="0" rowsep="0">
37056 <colspec colwidth="8*" align="left"/>
37057 <colspec colwidth="6*" align="center"/>
37058 <colspec colwidth="6*" align="center"/>
37059 <colspec colwidth="6*" align="right"/>
37060 <tbody>
37061 <row>
37062 <entry><option>create_file</option></entry>
37063 <entry>Use: <emphasis>appendfile</emphasis></entry>
37064 <entry>Type: <emphasis>string</emphasis></entry>
37065 <entry>Default: <emphasis>anywhere</emphasis></entry>
37066 </row>
37067 </tbody>
37068 </tgroup>
37069 </informaltable>
37070 <para>
37071 This option constrains the location of files and directories that are created
37072 by this transport. It applies to files defined by the <option>file</option> option and
37073 directories defined by the <option>directory</option> option. In the case of maildir
37074 delivery, it applies to the top level directory, not the maildir directories
37075 beneath.
37076 </para>
37077 <para>
37078 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37079 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37080 set for the transport. This option is not useful when an explicit file name is
37081 given for normal mailbox deliveries. It is intended for the case when file
37082 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
37083 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37084 <option>file_must_exist</option>.
37085 </para>
37086 <para>
37087 <indexterm role="option">
37088 <primary><option>directory</option></primary>
37089 </indexterm>
37090 </para>
37091 <informaltable frame="all">
37092 <tgroup cols="4" colsep="0" rowsep="0">
37093 <colspec colwidth="8*" align="left"/>
37094 <colspec colwidth="6*" align="center"/>
37095 <colspec colwidth="6*" align="center"/>
37096 <colspec colwidth="6*" align="right"/>
37097 <tbody>
37098 <row>
37099 <entry><option>directory</option></entry>
37100 <entry>Use: <emphasis>appendfile</emphasis></entry>
37101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37102 <entry>Default: <emphasis>unset</emphasis></entry>
37103 </row>
37104 </tbody>
37105 </tgroup>
37106 </informaltable>
37107 <para>
37108 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37109 or <option>directory</option> must be set, unless the delivery is the direct result of a
37110 redirection (see section <xref linkend="SECTfildiropt"/>).
37111 </para>
37112 <para>
37113 When <option>directory</option> is set, the string is expanded, and the message is delivered
37114 into a new file or files in or below the given directory, instead of being
37115 appended to a single mailbox file. A number of different formats are provided
37116 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37117 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37118 </para>
37119 <para>
37120 <indexterm role="option">
37121 <primary><option>directory_file</option></primary>
37122 </indexterm>
37123 </para>
37124 <informaltable frame="all">
37125 <tgroup cols="4" colsep="0" rowsep="0">
37126 <colspec colwidth="8*" align="left"/>
37127 <colspec colwidth="6*" align="center"/>
37128 <colspec colwidth="6*" align="center"/>
37129 <colspec colwidth="6*" align="right"/>
37130 <tbody>
37131 <row>
37132 <entry><option>directory_file</option></entry>
37133 <entry>Use: <emphasis>appendfile</emphasis></entry>
37134 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37135 <entry>Default: <emphasis>see below</emphasis></entry>
37136 </row>
37137 </tbody>
37138 </tgroup>
37139 </informaltable>
37140 <para>
37141 <indexterm role="concept">
37142 <primary>base62</primary>
37143 </indexterm>
37144 <indexterm role="variable">
37145 <primary><varname>$inode</varname></primary>
37146 </indexterm>
37147 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37148 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37149 whose name is obtained by expanding this string. The default value is:
37150 </para>
37151 <literallayout class="monospaced">
37152 q${base62:$tod_epoch}-$inode
37153 </literallayout>
37154 <para>
37155 This generates a unique name from the current time, in base 62 form, and the
37156 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37157 option.
37158 </para>
37159 <para>
37160 <indexterm role="option">
37161 <primary><option>directory_mode</option></primary>
37162 </indexterm>
37163 </para>
37164 <informaltable frame="all">
37165 <tgroup cols="4" colsep="0" rowsep="0">
37166 <colspec colwidth="8*" align="left"/>
37167 <colspec colwidth="6*" align="center"/>
37168 <colspec colwidth="6*" align="center"/>
37169 <colspec colwidth="6*" align="right"/>
37170 <tbody>
37171 <row>
37172 <entry><option>directory_mode</option></entry>
37173 <entry>Use: <emphasis>appendfile</emphasis></entry>
37174 <entry>Type: <emphasis>octal integer</emphasis></entry>
37175 <entry>Default: <emphasis>0700</emphasis></entry>
37176 </row>
37177 </tbody>
37178 </tgroup>
37179 </informaltable>
37180 <para>
37181 If <command>appendfile</command> creates any directories as a result of the
37182 <option>create_directory</option> option, their mode is specified by this option.
37183 </para>
37184 <para>
37185 <indexterm role="option">
37186 <primary><option>escape_string</option></primary>
37187 </indexterm>
37188 </para>
37189 <informaltable frame="all">
37190 <tgroup cols="4" colsep="0" rowsep="0">
37191 <colspec colwidth="8*" align="left"/>
37192 <colspec colwidth="6*" align="center"/>
37193 <colspec colwidth="6*" align="center"/>
37194 <colspec colwidth="6*" align="right"/>
37195 <tbody>
37196 <row>
37197 <entry><option>escape_string</option></entry>
37198 <entry>Use: <emphasis>appendfile</emphasis></entry>
37199 <entry>Type: <emphasis>string</emphasis></entry>
37200 <entry>Default: <emphasis>see description</emphasis></entry>
37201 </row>
37202 </tbody>
37203 </tgroup>
37204 </informaltable>
37205 <para>
37206 See <option>check_string</option> above.
37207 </para>
37208 <para>
37209 <indexterm role="option">
37210 <primary><option>file</option></primary>
37211 </indexterm>
37212 </para>
37213 <informaltable frame="all">
37214 <tgroup cols="4" colsep="0" rowsep="0">
37215 <colspec colwidth="8*" align="left"/>
37216 <colspec colwidth="6*" align="center"/>
37217 <colspec colwidth="6*" align="center"/>
37218 <colspec colwidth="6*" align="right"/>
37219 <tbody>
37220 <row>
37221 <entry><option>file</option></entry>
37222 <entry>Use: <emphasis>appendfile</emphasis></entry>
37223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37224 <entry>Default: <emphasis>unset</emphasis></entry>
37225 </row>
37226 </tbody>
37227 </tgroup>
37228 </informaltable>
37229 <para>
37230 This option is mutually exclusive with the <option>directory</option> option, but one of
37231 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37232 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37233 specifies a single file, to which the message is appended. One or more of
37234 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37235 <option>file</option>.
37236 </para>
37237 <para>
37238 <indexterm role="concept">
37239 <primary>NFS</primary>
37240 <secondary>lock file</secondary>
37241 </indexterm>
37242 <indexterm role="concept">
37243 <primary>locking files</primary>
37244 </indexterm>
37245 <indexterm role="concept">
37246 <primary>lock files</primary>
37247 </indexterm>
37248 If you are using more than one host to deliver over NFS into the same
37249 mailboxes, you should always use lock files.
37250 </para>
37251 <para>
37252 The string value is expanded for each delivery, and must yield an absolute
37253 path. The most common settings of this option are variations on one of these
37254 examples:
37255 </para>
37256 <literallayout class="monospaced">
37257 file = /var/spool/mail/$local_part
37258 file = /home/$local_part/inbox
37259 file = $home/inbox
37260 </literallayout>
37261 <para>
37262 <indexterm role="concept">
37263 <primary><quote>sticky</quote> bit</primary>
37264 </indexterm>
37265 In the first example, all deliveries are done into the same directory. If Exim
37266 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37267 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37268 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37269 run the delivery under a group id which has write access to the directory.
37270 </para>
37271 <para>
37272 <indexterm role="option">
37273 <primary><option>file_format</option></primary>
37274 </indexterm>
37275 </para>
37276 <informaltable frame="all">
37277 <tgroup cols="4" colsep="0" rowsep="0">
37278 <colspec colwidth="8*" align="left"/>
37279 <colspec colwidth="6*" align="center"/>
37280 <colspec colwidth="6*" align="center"/>
37281 <colspec colwidth="6*" align="right"/>
37282 <tbody>
37283 <row>
37284 <entry><option>file_format</option></entry>
37285 <entry>Use: <emphasis>appendfile</emphasis></entry>
37286 <entry>Type: <emphasis>string</emphasis></entry>
37287 <entry>Default: <emphasis>unset</emphasis></entry>
37288 </row>
37289 </tbody>
37290 </tgroup>
37291 </informaltable>
37292 <para>
37293 <indexterm role="concept">
37294 <primary>file</primary>
37295 <secondary>mailbox; checking existing format</secondary>
37296 </indexterm>
37297 This option requests the transport to check the format of an existing file
37298 before adding to it. The check consists of matching a specific string at the
37299 start of the file. The value of the option consists of an even number of
37300 colon-separated strings. The first of each pair is the test string, and the
37301 second is the name of a transport. If the transport associated with a matched
37302 string is not the current transport, control is passed over to the other
37303 transport. For example, suppose the standard <command>local_delivery</command> transport has
37304 this added to it:
37305 </para>
37306 <literallayout class="monospaced">
37307 file_format = "From       : local_delivery :\
37308                \1\1\1\1\n : local_mmdf_delivery"
37309 </literallayout>
37310 <para>
37311 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37312 a mailbox begins with four binary ones followed by a newline, control is passed
37313 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37314 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37315 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
37316 match any string, or if the transport named for a given string is not defined,
37317 delivery is deferred.
37318 </para>
37319 <para>
37320 <indexterm role="option">
37321 <primary><option>file_must_exist</option></primary>
37322 </indexterm>
37323 </para>
37324 <informaltable frame="all">
37325 <tgroup cols="4" colsep="0" rowsep="0">
37326 <colspec colwidth="8*" align="left"/>
37327 <colspec colwidth="6*" align="center"/>
37328 <colspec colwidth="6*" align="center"/>
37329 <colspec colwidth="6*" align="right"/>
37330 <tbody>
37331 <row>
37332 <entry><option>file_must_exist</option></entry>
37333 <entry>Use: <emphasis>appendfile</emphasis></entry>
37334 <entry>Type: <emphasis>boolean</emphasis></entry>
37335 <entry>Default: <emphasis>false</emphasis></entry>
37336 </row>
37337 </tbody>
37338 </tgroup>
37339 </informaltable>
37340 <para>
37341 If this option is true, the file specified by the <option>file</option> option must exist.
37342 A temporary error occurs if it does not, causing delivery to be deferred.
37343 If this option is false, the file is created if it does not exist.
37344 </para>
37345 <para>
37346 <indexterm role="option">
37347 <primary><option>lock_fcntl_timeout</option></primary>
37348 </indexterm>
37349 </para>
37350 <informaltable frame="all">
37351 <tgroup cols="4" colsep="0" rowsep="0">
37352 <colspec colwidth="8*" align="left"/>
37353 <colspec colwidth="6*" align="center"/>
37354 <colspec colwidth="6*" align="center"/>
37355 <colspec colwidth="6*" align="right"/>
37356 <tbody>
37357 <row>
37358 <entry><option>lock_fcntl_timeout</option></entry>
37359 <entry>Use: <emphasis>appendfile</emphasis></entry>
37360 <entry>Type: <emphasis>time</emphasis></entry>
37361 <entry>Default: <emphasis>0s</emphasis></entry>
37362 </row>
37363 </tbody>
37364 </tgroup>
37365 </informaltable>
37366 <para>
37367 <indexterm role="concept">
37368 <primary>timeout</primary>
37369 <secondary>mailbox locking</secondary>
37370 </indexterm>
37371 <indexterm role="concept">
37372 <primary>mailbox</primary>
37373 <secondary>locking, blocking and non-blocking</secondary>
37374 </indexterm>
37375 <indexterm role="concept">
37376 <primary>locking files</primary>
37377 </indexterm>
37378 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37379 when locking an open mailbox file. If the call fails, the delivery process
37380 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37381 Non-blocking calls are used so that the file is not kept open during the wait
37382 for the lock; the reason for this is to make it as safe as possible for
37383 deliveries over NFS in the case when processes might be accessing an NFS
37384 mailbox without using a lock file. This should not be done, but
37385 misunderstandings and hence misconfigurations are not unknown.
37386 </para>
37387 <para>
37388 On a busy system, however, the performance of a non-blocking lock approach is
37389 not as good as using a blocking lock with a timeout. In this case, the waiting
37390 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
37391 and can proceed as soon as the previous lock holder releases it.
37392 </para>
37393 <para>
37394 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37395 timeout, are used. There may still be some retrying: the maximum number of
37396 retries is
37397 </para>
37398 <literallayout class="monospaced">
37399 (lock_retries * lock_interval) / lock_fcntl_timeout
37400 </literallayout>
37401 <para>
37402 rounded up to the next whole number. In other words, the total time during
37403 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37404 <option>lock_fcntl_timeout</option> is set very large.
37405 </para>
37406 <para>
37407 You should consider setting this option if you are getting a lot of delayed
37408 local deliveries because of errors of the form
37409 </para>
37410 <literallayout class="monospaced">
37411 failed to lock mailbox /some/file (fcntl)
37412 </literallayout>
37413 <para>
37414 <indexterm role="option">
37415 <primary><option>lock_flock_timeout</option></primary>
37416 </indexterm>
37417 </para>
37418 <informaltable frame="all">
37419 <tgroup cols="4" colsep="0" rowsep="0">
37420 <colspec colwidth="8*" align="left"/>
37421 <colspec colwidth="6*" align="center"/>
37422 <colspec colwidth="6*" align="center"/>
37423 <colspec colwidth="6*" align="right"/>
37424 <tbody>
37425 <row>
37426 <entry><option>lock_flock_timeout</option></entry>
37427 <entry>Use: <emphasis>appendfile</emphasis></entry>
37428 <entry>Type: <emphasis>time</emphasis></entry>
37429 <entry>Default: <emphasis>0s</emphasis></entry>
37430 </row>
37431 </tbody>
37432 </tgroup>
37433 </informaltable>
37434 <para>
37435 This timeout applies to file locking when using <function>flock()</function> (see
37436 <option>use_flock</option>); the timeout operates in a similar manner to
37437 <option>lock_fcntl_timeout</option>.
37438 </para>
37439 <para>
37440 <indexterm role="option">
37441 <primary><option>lock_interval</option></primary>
37442 </indexterm>
37443 </para>
37444 <informaltable frame="all">
37445 <tgroup cols="4" colsep="0" rowsep="0">
37446 <colspec colwidth="8*" align="left"/>
37447 <colspec colwidth="6*" align="center"/>
37448 <colspec colwidth="6*" align="center"/>
37449 <colspec colwidth="6*" align="right"/>
37450 <tbody>
37451 <row>
37452 <entry><option>lock_interval</option></entry>
37453 <entry>Use: <emphasis>appendfile</emphasis></entry>
37454 <entry>Type: <emphasis>time</emphasis></entry>
37455 <entry>Default: <emphasis>3s</emphasis></entry>
37456 </row>
37457 </tbody>
37458 </tgroup>
37459 </informaltable>
37460 <para>
37461 This specifies the time to wait between attempts to lock the file. See below
37462 for details of locking.
37463 </para>
37464 <para>
37465 <indexterm role="option">
37466 <primary><option>lock_retries</option></primary>
37467 </indexterm>
37468 </para>
37469 <informaltable frame="all">
37470 <tgroup cols="4" colsep="0" rowsep="0">
37471 <colspec colwidth="8*" align="left"/>
37472 <colspec colwidth="6*" align="center"/>
37473 <colspec colwidth="6*" align="center"/>
37474 <colspec colwidth="6*" align="right"/>
37475 <tbody>
37476 <row>
37477 <entry><option>lock_retries</option></entry>
37478 <entry>Use: <emphasis>appendfile</emphasis></entry>
37479 <entry>Type: <emphasis>integer</emphasis></entry>
37480 <entry>Default: <emphasis>10</emphasis></entry>
37481 </row>
37482 </tbody>
37483 </tgroup>
37484 </informaltable>
37485 <para>
37486 This specifies the maximum number of attempts to lock the file. A value of zero
37487 is treated as 1. See below for details of locking.
37488 </para>
37489 <para>
37490 <indexterm role="option">
37491 <primary><option>lockfile_mode</option></primary>
37492 </indexterm>
37493 </para>
37494 <informaltable frame="all">
37495 <tgroup cols="4" colsep="0" rowsep="0">
37496 <colspec colwidth="8*" align="left"/>
37497 <colspec colwidth="6*" align="center"/>
37498 <colspec colwidth="6*" align="center"/>
37499 <colspec colwidth="6*" align="right"/>
37500 <tbody>
37501 <row>
37502 <entry><option>lockfile_mode</option></entry>
37503 <entry>Use: <emphasis>appendfile</emphasis></entry>
37504 <entry>Type: <emphasis>octal integer</emphasis></entry>
37505 <entry>Default: <emphasis>0600</emphasis></entry>
37506 </row>
37507 </tbody>
37508 </tgroup>
37509 </informaltable>
37510 <para>
37511 This specifies the mode of the created lock file, when a lock file is being
37512 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37513 </para>
37514 <para>
37515 <indexterm role="option">
37516 <primary><option>lockfile_timeout</option></primary>
37517 </indexterm>
37518 </para>
37519 <informaltable frame="all">
37520 <tgroup cols="4" colsep="0" rowsep="0">
37521 <colspec colwidth="8*" align="left"/>
37522 <colspec colwidth="6*" align="center"/>
37523 <colspec colwidth="6*" align="center"/>
37524 <colspec colwidth="6*" align="right"/>
37525 <tbody>
37526 <row>
37527 <entry><option>lockfile_timeout</option></entry>
37528 <entry>Use: <emphasis>appendfile</emphasis></entry>
37529 <entry>Type: <emphasis>time</emphasis></entry>
37530 <entry>Default: <emphasis>30m</emphasis></entry>
37531 </row>
37532 </tbody>
37533 </tgroup>
37534 </informaltable>
37535 <para>
37536 <indexterm role="concept">
37537 <primary>timeout</primary>
37538 <secondary>mailbox locking</secondary>
37539 </indexterm>
37540 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37541 exists and is older than this value, it is assumed to have been left behind by
37542 accident, and Exim attempts to remove it.
37543 </para>
37544 <para>
37545 <indexterm role="option">
37546 <primary><option>mailbox_filecount</option></primary>
37547 </indexterm>
37548 </para>
37549 <informaltable frame="all">
37550 <tgroup cols="4" colsep="0" rowsep="0">
37551 <colspec colwidth="8*" align="left"/>
37552 <colspec colwidth="6*" align="center"/>
37553 <colspec colwidth="6*" align="center"/>
37554 <colspec colwidth="6*" align="right"/>
37555 <tbody>
37556 <row>
37557 <entry><option>mailbox_filecount</option></entry>
37558 <entry>Use: <emphasis>appendfile</emphasis></entry>
37559 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37560 <entry>Default: <emphasis>unset</emphasis></entry>
37561 </row>
37562 </tbody>
37563 </tgroup>
37564 </informaltable>
37565 <para>
37566 <indexterm role="concept">
37567 <primary>mailbox</primary>
37568 <secondary>specifying size of</secondary>
37569 </indexterm>
37570 <indexterm role="concept">
37571 <primary>size</primary>
37572 <secondary>of mailbox</secondary>
37573 </indexterm>
37574 If this option is set, it is expanded, and the result is taken as the current
37575 number of files in the mailbox. It must be a decimal number, optionally
37576 followed by K or M. This provides a way of obtaining this information from an
37577 external source that maintains the data.
37578 </para>
37579 <para>
37580 <indexterm role="option">
37581 <primary><option>mailbox_size</option></primary>
37582 </indexterm>
37583 </para>
37584 <informaltable frame="all">
37585 <tgroup cols="4" colsep="0" rowsep="0">
37586 <colspec colwidth="8*" align="left"/>
37587 <colspec colwidth="6*" align="center"/>
37588 <colspec colwidth="6*" align="center"/>
37589 <colspec colwidth="6*" align="right"/>
37590 <tbody>
37591 <row>
37592 <entry><option>mailbox_size</option></entry>
37593 <entry>Use: <emphasis>appendfile</emphasis></entry>
37594 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37595 <entry>Default: <emphasis>unset</emphasis></entry>
37596 </row>
37597 </tbody>
37598 </tgroup>
37599 </informaltable>
37600 <para>
37601 <indexterm role="concept">
37602 <primary>mailbox</primary>
37603 <secondary>specifying size of</secondary>
37604 </indexterm>
37605 <indexterm role="concept">
37606 <primary>size</primary>
37607 <secondary>of mailbox</secondary>
37608 </indexterm>
37609 If this option is set, it is expanded, and the result is taken as the current
37610 size the mailbox. It must be a decimal number, optionally followed by K or M.
37611 This provides a way of obtaining this information from an external source that
37612 maintains the data. This is likely to be helpful for maildir deliveries where
37613 it is computationally expensive to compute the size of a mailbox.
37614 </para>
37615 <para>
37616 <indexterm role="option">
37617 <primary><option>maildir_format</option></primary>
37618 </indexterm>
37619 </para>
37620 <informaltable frame="all">
37621 <tgroup cols="4" colsep="0" rowsep="0">
37622 <colspec colwidth="8*" align="left"/>
37623 <colspec colwidth="6*" align="center"/>
37624 <colspec colwidth="6*" align="center"/>
37625 <colspec colwidth="6*" align="right"/>
37626 <tbody>
37627 <row>
37628 <entry><option>maildir_format</option></entry>
37629 <entry>Use: <emphasis>appendfile</emphasis></entry>
37630 <entry>Type: <emphasis>boolean</emphasis></entry>
37631 <entry>Default: <emphasis>false</emphasis></entry>
37632 </row>
37633 </tbody>
37634 </tgroup>
37635 </informaltable>
37636 <para>
37637 <indexterm role="concept">
37638 <primary>maildir format</primary>
37639 <secondary>specifying</secondary>
37640 </indexterm>
37641 If this option is set with the <option>directory</option> option, the delivery is into a new
37642 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37643 transport is activated directly from a <command>redirect</command> router (for example, the
37644 <command>address_file</command> transport in the default configuration), setting
37645 <option>maildir_format</option> causes the path received from the router to be treated as a
37646 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37647 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37648 <xref linkend="SECTmaildirdelivery"/> below for further details.
37649 </para>
37650 <para>
37651 <indexterm role="option">
37652 <primary><option>maildir_quota_directory_regex</option></primary>
37653 </indexterm>
37654 </para>
37655 <informaltable frame="all">
37656 <tgroup cols="4" colsep="0" rowsep="0">
37657 <colspec colwidth="8*" align="left"/>
37658 <colspec colwidth="6*" align="center"/>
37659 <colspec colwidth="6*" align="center"/>
37660 <colspec colwidth="6*" align="right"/>
37661 <tbody>
37662 <row>
37663 <entry><option>maildir_quota_directory_regex</option></entry>
37664 <entry>Use: <emphasis>appendfile</emphasis></entry>
37665 <entry>Type: <emphasis>string</emphasis></entry>
37666 <entry>Default: <emphasis>See below</emphasis></entry>
37667 </row>
37668 </tbody>
37669 </tgroup>
37670 </informaltable>
37671 <para>
37672 <indexterm role="concept">
37673 <primary>maildir format</primary>
37674 <secondary>quota; directories included in</secondary>
37675 </indexterm>
37676 <indexterm role="concept">
37677 <primary>quota</primary>
37678 <secondary>maildir; directories included in</secondary>
37679 </indexterm>
37680 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37681 a regular expression for specifying directories, relative to the quota
37682 directory (see <option>quota_directory</option>), that should be included in the quota
37683 calculation. The default value is:
37684 </para>
37685 <literallayout class="monospaced">
37686 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37687 </literallayout>
37688 <para>
37689 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37690 (directories whose names begin with a dot). If you want to exclude the
37691 <filename>Trash</filename>
37692 folder from the count (as some sites do), you need to change this setting to
37693 </para>
37694 <literallayout class="monospaced">
37695 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37696 </literallayout>
37697 <para>
37698 This uses a negative lookahead in the regular expression to exclude the
37699 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37700 calculations, quota processing is bypassed for any messages that are delivered
37701 directly into that directory.
37702 </para>
37703 <para>
37704 <indexterm role="option">
37705 <primary><option>maildir_retries</option></primary>
37706 </indexterm>
37707 </para>
37708 <informaltable frame="all">
37709 <tgroup cols="4" colsep="0" rowsep="0">
37710 <colspec colwidth="8*" align="left"/>
37711 <colspec colwidth="6*" align="center"/>
37712 <colspec colwidth="6*" align="center"/>
37713 <colspec colwidth="6*" align="right"/>
37714 <tbody>
37715 <row>
37716 <entry><option>maildir_retries</option></entry>
37717 <entry>Use: <emphasis>appendfile</emphasis></entry>
37718 <entry>Type: <emphasis>integer</emphasis></entry>
37719 <entry>Default: <emphasis>10</emphasis></entry>
37720 </row>
37721 </tbody>
37722 </tgroup>
37723 </informaltable>
37724 <para>
37725 This option specifies the number of times to retry when writing a file in
37726 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37727 </para>
37728 <para>
37729 <indexterm role="option">
37730 <primary><option>maildir_tag</option></primary>
37731 </indexterm>
37732 </para>
37733 <informaltable frame="all">
37734 <tgroup cols="4" colsep="0" rowsep="0">
37735 <colspec colwidth="8*" align="left"/>
37736 <colspec colwidth="6*" align="center"/>
37737 <colspec colwidth="6*" align="center"/>
37738 <colspec colwidth="6*" align="right"/>
37739 <tbody>
37740 <row>
37741 <entry><option>maildir_tag</option></entry>
37742 <entry>Use: <emphasis>appendfile</emphasis></entry>
37743 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37744 <entry>Default: <emphasis>unset</emphasis></entry>
37745 </row>
37746 </tbody>
37747 </tgroup>
37748 </informaltable>
37749 <para>
37750 This option applies only to deliveries in maildir format, and is described in
37751 section <xref linkend="SECTmaildirdelivery"/> below.
37752 </para>
37753 <para>
37754 <indexterm role="option">
37755 <primary><option>maildir_use_size_file</option></primary>
37756 </indexterm>
37757 </para>
37758 <informaltable frame="all">
37759 <tgroup cols="4" colsep="0" rowsep="0">
37760 <colspec colwidth="8*" align="left"/>
37761 <colspec colwidth="6*" align="center"/>
37762 <colspec colwidth="6*" align="center"/>
37763 <colspec colwidth="6*" align="right"/>
37764 <tbody>
37765 <row>
37766 <entry><option>maildir_use_size_file</option></entry>
37767 <entry>Use: <emphasis>appendfile</emphasis></entry>
37768 <entry>Type: <emphasis>boolean</emphasis></entry>
37769 <entry>Default: <emphasis>false</emphasis></entry>
37770 </row>
37771 </tbody>
37772 </tgroup>
37773 </informaltable>
37774 <para>
37775 <indexterm role="concept">
37776 <primary>maildir format</primary>
37777 <secondary><filename>maildirsize</filename> file</secondary>
37778 </indexterm>
37779 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37780 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37781 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37782 value is zero. See <option>maildir_quota_directory_regex</option> above and section
37783 <xref linkend="SECTmaildirdelivery"/> below for further details.
37784 </para>
37785 <para>
37786 <indexterm role="option">
37787 <primary><option>maildirfolder_create_regex</option></primary>
37788 </indexterm>
37789 </para>
37790 <informaltable frame="all">
37791 <tgroup cols="4" colsep="0" rowsep="0">
37792 <colspec colwidth="8*" align="left"/>
37793 <colspec colwidth="6*" align="center"/>
37794 <colspec colwidth="6*" align="center"/>
37795 <colspec colwidth="6*" align="right"/>
37796 <tbody>
37797 <row>
37798 <entry><option>maildirfolder_create_regex</option></entry>
37799 <entry>Use: <emphasis>appendfile</emphasis></entry>
37800 <entry>Type: <emphasis>string</emphasis></entry>
37801 <entry>Default: <emphasis>unset</emphasis></entry>
37802 </row>
37803 </tbody>
37804 </tgroup>
37805 </informaltable>
37806 <para>
37807 <indexterm role="concept">
37808 <primary>maildir format</primary>
37809 <secondary><filename>maildirfolder</filename> file</secondary>
37810 </indexterm>
37811 <indexterm role="concept">
37812 <primary><filename>maildirfolder</filename>, creating</primary>
37813 </indexterm>
37814 The value of this option is a regular expression. If it is unset, it has no
37815 effect. Otherwise, before a maildir delivery takes place, the pattern is
37816 matched against the name of the maildir directory, that is, the directory
37817 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
37818 delivery. If there is a match, Exim checks for the existence of a file called
37819 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
37820 See section <xref linkend="SECTmaildirdelivery"/> for more details.
37821 </para>
37822 <para>
37823 <indexterm role="option">
37824 <primary><option>mailstore_format</option></primary>
37825 </indexterm>
37826 </para>
37827 <informaltable frame="all">
37828 <tgroup cols="4" colsep="0" rowsep="0">
37829 <colspec colwidth="8*" align="left"/>
37830 <colspec colwidth="6*" align="center"/>
37831 <colspec colwidth="6*" align="center"/>
37832 <colspec colwidth="6*" align="right"/>
37833 <tbody>
37834 <row>
37835 <entry><option>mailstore_format</option></entry>
37836 <entry>Use: <emphasis>appendfile</emphasis></entry>
37837 <entry>Type: <emphasis>boolean</emphasis></entry>
37838 <entry>Default: <emphasis>false</emphasis></entry>
37839 </row>
37840 </tbody>
37841 </tgroup>
37842 </informaltable>
37843 <para>
37844 <indexterm role="concept">
37845 <primary>mailstore format</primary>
37846 <secondary>specifying</secondary>
37847 </indexterm>
37848 If this option is set with the <option>directory</option> option, the delivery is into two
37849 new files in  <quote>mailstore</quote> format. The option is available only if
37850 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
37851 below for further details.
37852 </para>
37853 <para>
37854 <indexterm role="option">
37855 <primary><option>mailstore_prefix</option></primary>
37856 </indexterm>
37857 </para>
37858 <informaltable frame="all">
37859 <tgroup cols="4" colsep="0" rowsep="0">
37860 <colspec colwidth="8*" align="left"/>
37861 <colspec colwidth="6*" align="center"/>
37862 <colspec colwidth="6*" align="center"/>
37863 <colspec colwidth="6*" align="right"/>
37864 <tbody>
37865 <row>
37866 <entry><option>mailstore_prefix</option></entry>
37867 <entry>Use: <emphasis>appendfile</emphasis></entry>
37868 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37869 <entry>Default: <emphasis>unset</emphasis></entry>
37870 </row>
37871 </tbody>
37872 </tgroup>
37873 </informaltable>
37874 <para>
37875 This option applies only to deliveries in mailstore format, and is described in
37876 section <xref linkend="SECTopdir"/> below.
37877 </para>
37878 <para>
37879 <indexterm role="option">
37880 <primary><option>mailstore_suffix</option></primary>
37881 </indexterm>
37882 </para>
37883 <informaltable frame="all">
37884 <tgroup cols="4" colsep="0" rowsep="0">
37885 <colspec colwidth="8*" align="left"/>
37886 <colspec colwidth="6*" align="center"/>
37887 <colspec colwidth="6*" align="center"/>
37888 <colspec colwidth="6*" align="right"/>
37889 <tbody>
37890 <row>
37891 <entry><option>mailstore_suffix</option></entry>
37892 <entry>Use: <emphasis>appendfile</emphasis></entry>
37893 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37894 <entry>Default: <emphasis>unset</emphasis></entry>
37895 </row>
37896 </tbody>
37897 </tgroup>
37898 </informaltable>
37899 <para>
37900 This option applies only to deliveries in mailstore format, and is described in
37901 section <xref linkend="SECTopdir"/> below.
37902 </para>
37903 <para>
37904 <indexterm role="option">
37905 <primary><option>mbx_format</option></primary>
37906 </indexterm>
37907 </para>
37908 <informaltable frame="all">
37909 <tgroup cols="4" colsep="0" rowsep="0">
37910 <colspec colwidth="8*" align="left"/>
37911 <colspec colwidth="6*" align="center"/>
37912 <colspec colwidth="6*" align="center"/>
37913 <colspec colwidth="6*" align="right"/>
37914 <tbody>
37915 <row>
37916 <entry><option>mbx_format</option></entry>
37917 <entry>Use: <emphasis>appendfile</emphasis></entry>
37918 <entry>Type: <emphasis>boolean</emphasis></entry>
37919 <entry>Default: <emphasis>false</emphasis></entry>
37920 </row>
37921 </tbody>
37922 </tgroup>
37923 </informaltable>
37924 <para>
37925 <indexterm role="concept">
37926 <primary>locking files</primary>
37927 </indexterm>
37928 <indexterm role="concept">
37929 <primary>file</primary>
37930 <secondary>locking</secondary>
37931 </indexterm>
37932 <indexterm role="concept">
37933 <primary>file</primary>
37934 <secondary>MBX format</secondary>
37935 </indexterm>
37936 <indexterm role="concept">
37937 <primary>MBX format, specifying</primary>
37938 </indexterm>
37939 This option is available only if Exim has been compiled with SUPPORT_MBX
37940 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37941 the message is appended to the mailbox file in MBX format instead of
37942 traditional Unix format. This format is supported by Pine4 and its associated
37943 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37944 </para>
37945 <para>
37946 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37947 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37948 empty when using MBX format, so this option almost always appears in this
37949 combination:
37950 </para>
37951 <literallayout class="monospaced">
37952 mbx_format = true
37953 message_prefix =
37954 message_suffix =
37955 </literallayout>
37956 <para>
37957 If none of the locking options are mentioned in the configuration,
37958 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37959 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37960 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37961 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37962 should not be used if any program that does not use this form of locking is
37963 going to access the mailbox, nor should it be used if the mailbox file is NFS
37964 mounted, because it works only when the mailbox is accessed from a single host.
37965 </para>
37966 <para>
37967 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37968 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37969 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37970 append messages to it.
37971 </para>
37972 <para>
37973 <indexterm role="option">
37974 <primary><option>message_prefix</option></primary>
37975 </indexterm>
37976 </para>
37977 <informaltable frame="all">
37978 <tgroup cols="4" colsep="0" rowsep="0">
37979 <colspec colwidth="8*" align="left"/>
37980 <colspec colwidth="6*" align="center"/>
37981 <colspec colwidth="6*" align="center"/>
37982 <colspec colwidth="6*" align="right"/>
37983 <tbody>
37984 <row>
37985 <entry><option>message_prefix</option></entry>
37986 <entry>Use: <emphasis>appendfile</emphasis></entry>
37987 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37988 <entry>Default: <emphasis>see below</emphasis></entry>
37989 </row>
37990 </tbody>
37991 </tgroup>
37992 </informaltable>
37993 <para>
37994 <indexterm role="concept">
37995 <primary><quote>From</quote> line</primary>
37996 </indexterm>
37997 The string specified here is expanded and output at the start of every message.
37998 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37999 in which case it is:
38000 </para>
38001 <literallayout class="monospaced">
38002 message_prefix = "From ${if def:return_path{$return_path}\
38003   {MAILER-DAEMON}} $tod_bsdinbox\n"
38004 </literallayout>
38005 <para>
38006 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38007 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38008 </para>
38009 <para>
38010 <indexterm role="option">
38011 <primary><option>message_suffix</option></primary>
38012 </indexterm>
38013 </para>
38014 <informaltable frame="all">
38015 <tgroup cols="4" colsep="0" rowsep="0">
38016 <colspec colwidth="8*" align="left"/>
38017 <colspec colwidth="6*" align="center"/>
38018 <colspec colwidth="6*" align="center"/>
38019 <colspec colwidth="6*" align="right"/>
38020 <tbody>
38021 <row>
38022 <entry><option>message_suffix</option></entry>
38023 <entry>Use: <emphasis>appendfile</emphasis></entry>
38024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38025 <entry>Default: <emphasis>see below</emphasis></entry>
38026 </row>
38027 </tbody>
38028 </tgroup>
38029 </informaltable>
38030 <para>
38031 The string specified here is expanded and output at the end of every message.
38032 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38033 in which case it is a single newline character. The suffix can be suppressed by
38034 setting
38035 </para>
38036 <literallayout class="monospaced">
38037 message_suffix =
38038 </literallayout>
38039 <para>
38040 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38041 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38042 </para>
38043 <para>
38044 <indexterm role="option">
38045 <primary><option>mode</option></primary>
38046 </indexterm>
38047 </para>
38048 <informaltable frame="all">
38049 <tgroup cols="4" colsep="0" rowsep="0">
38050 <colspec colwidth="8*" align="left"/>
38051 <colspec colwidth="6*" align="center"/>
38052 <colspec colwidth="6*" align="center"/>
38053 <colspec colwidth="6*" align="right"/>
38054 <tbody>
38055 <row>
38056 <entry><option>mode</option></entry>
38057 <entry>Use: <emphasis>appendfile</emphasis></entry>
38058 <entry>Type: <emphasis>octal integer</emphasis></entry>
38059 <entry>Default: <emphasis>0600</emphasis></entry>
38060 </row>
38061 </tbody>
38062 </tgroup>
38063 </informaltable>
38064 <para>
38065 If the output file is created, it is given this mode. If it already exists and
38066 has wider permissions, they are reduced to this mode. If it has narrower
38067 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38068 if the delivery is the result of a <option>save</option> command in a filter file specifying
38069 a particular mode, the mode of the output file is always forced to take that
38070 value, and this option is ignored.
38071 </para>
38072 <para>
38073 <indexterm role="option">
38074 <primary><option>mode_fail_narrower</option></primary>
38075 </indexterm>
38076 </para>
38077 <informaltable frame="all">
38078 <tgroup cols="4" colsep="0" rowsep="0">
38079 <colspec colwidth="8*" align="left"/>
38080 <colspec colwidth="6*" align="center"/>
38081 <colspec colwidth="6*" align="center"/>
38082 <colspec colwidth="6*" align="right"/>
38083 <tbody>
38084 <row>
38085 <entry><option>mode_fail_narrower</option></entry>
38086 <entry>Use: <emphasis>appendfile</emphasis></entry>
38087 <entry>Type: <emphasis>boolean</emphasis></entry>
38088 <entry>Default: <emphasis>true</emphasis></entry>
38089 </row>
38090 </tbody>
38091 </tgroup>
38092 </informaltable>
38093 <para>
38094 This option applies in the case when an existing mailbox file has a narrower
38095 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38096 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38097 continues with the delivery attempt, using the existing mode of the file.
38098 </para>
38099 <para>
38100 <indexterm role="option">
38101 <primary><option>notify_comsat</option></primary>
38102 </indexterm>
38103 </para>
38104 <informaltable frame="all">
38105 <tgroup cols="4" colsep="0" rowsep="0">
38106 <colspec colwidth="8*" align="left"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="center"/>
38109 <colspec colwidth="6*" align="right"/>
38110 <tbody>
38111 <row>
38112 <entry><option>notify_comsat</option></entry>
38113 <entry>Use: <emphasis>appendfile</emphasis></entry>
38114 <entry>Type: <emphasis>boolean</emphasis></entry>
38115 <entry>Default: <emphasis>false</emphasis></entry>
38116 </row>
38117 </tbody>
38118 </tgroup>
38119 </informaltable>
38120 <para>
38121 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38122 successful delivery to a user mailbox. This is the daemon that notifies logged
38123 on users about incoming mail.
38124 </para>
38125 <para>
38126 <indexterm role="option">
38127 <primary><option>quota</option></primary>
38128 </indexterm>
38129 </para>
38130 <informaltable frame="all">
38131 <tgroup cols="4" colsep="0" rowsep="0">
38132 <colspec colwidth="8*" align="left"/>
38133 <colspec colwidth="6*" align="center"/>
38134 <colspec colwidth="6*" align="center"/>
38135 <colspec colwidth="6*" align="right"/>
38136 <tbody>
38137 <row>
38138 <entry><option>quota</option></entry>
38139 <entry>Use: <emphasis>appendfile</emphasis></entry>
38140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38141 <entry>Default: <emphasis>unset</emphasis></entry>
38142 </row>
38143 </tbody>
38144 </tgroup>
38145 </informaltable>
38146 <para>
38147 <indexterm role="concept">
38148 <primary>quota</primary>
38149 <secondary>imposed by Exim</secondary>
38150 </indexterm>
38151 This option imposes a limit on the size of the file to which Exim is appending,
38152 or to the total space used in the directory tree when the <option>directory</option> option
38153 is set. In the latter case, computation of the space used is expensive, because
38154 all the files in the directory (and any sub-directories) have to be
38155 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38156 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38157 have no shell access to their mailboxes).
38158 </para>
38159 <para>
38160 As there is no interlock against two simultaneous deliveries into a
38161 multi-file mailbox, it is possible for the quota to be overrun in this case.
38162 For single-file mailboxes, of course, an interlock is a necessity.
38163 </para>
38164 <para>
38165 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38166 may be a lot less than the actual amount of disk space allocated to the file.
38167 If the sizes of a number of files are being added up, the rounding effect can
38168 become quite noticeable, especially on systems that have large block sizes.
38169 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38170 the obvious value which users understand most easily.
38171 </para>
38172 <para>
38173 The value of the option is expanded, and must then be a numerical value
38174 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38175 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38176 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38177 be handled.
38178 </para>
38179 <para>
38180 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38181 </para>
38182 <para>
38183 The expansion happens while Exim is running as root, before it changes uid for
38184 the delivery. This means that files that are inaccessible to the end user can
38185 be used to hold quota values that are looked up in the expansion. When delivery
38186 fails because this quota is exceeded, the handling of the error is as for
38187 system quota failures.
38188 </para>
38189 <para>
38190 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
38191 mailbox to the specified maximum size, though the value is not accurate to the
38192 last byte, owing to separator lines and additional headers that may get added
38193 during message delivery. When a mailbox is nearly full, large messages may get
38194 refused even though small ones are accepted, because the size of the current
38195 message is added to the quota when the check is made. This behaviour can be
38196 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38197 for exceeding the quota does not include the current message. Thus, deliveries
38198 continue until the quota has been exceeded; thereafter, no further messages are
38199 delivered. See also <option>quota_warn_threshold</option>.
38200 </para>
38201 <para>
38202 <indexterm role="option">
38203 <primary><option>quota_directory</option></primary>
38204 </indexterm>
38205 </para>
38206 <informaltable frame="all">
38207 <tgroup cols="4" colsep="0" rowsep="0">
38208 <colspec colwidth="8*" align="left"/>
38209 <colspec colwidth="6*" align="center"/>
38210 <colspec colwidth="6*" align="center"/>
38211 <colspec colwidth="6*" align="right"/>
38212 <tbody>
38213 <row>
38214 <entry><option>quota_directory</option></entry>
38215 <entry>Use: <emphasis>appendfile</emphasis></entry>
38216 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38217 <entry>Default: <emphasis>unset</emphasis></entry>
38218 </row>
38219 </tbody>
38220 </tgroup>
38221 </informaltable>
38222 <para>
38223 This option defines the directory to check for quota purposes when delivering
38224 into individual files. The default is the delivery directory, or, if a file
38225 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38226 delivery directory.
38227 </para>
38228 <para>
38229 <indexterm role="option">
38230 <primary><option>quota_filecount</option></primary>
38231 </indexterm>
38232 </para>
38233 <informaltable frame="all">
38234 <tgroup cols="4" colsep="0" rowsep="0">
38235 <colspec colwidth="8*" align="left"/>
38236 <colspec colwidth="6*" align="center"/>
38237 <colspec colwidth="6*" align="center"/>
38238 <colspec colwidth="6*" align="right"/>
38239 <tbody>
38240 <row>
38241 <entry><option>quota_filecount</option></entry>
38242 <entry>Use: <emphasis>appendfile</emphasis></entry>
38243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38244 <entry>Default: <emphasis>0</emphasis></entry>
38245 </row>
38246 </tbody>
38247 </tgroup>
38248 </informaltable>
38249 <para>
38250 This option applies when the <option>directory</option> option is set. It limits the total
38251 number of files in the directory (compare the inode limit in system quotas). It
38252 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38253 failure causes delivery to be deferred. A value of zero is interpreted as
38254 <quote>no quota</quote>.
38255 </para>
38256 <para>
38257 <indexterm role="option">
38258 <primary><option>quota_is_inclusive</option></primary>
38259 </indexterm>
38260 </para>
38261 <informaltable frame="all">
38262 <tgroup cols="4" colsep="0" rowsep="0">
38263 <colspec colwidth="8*" align="left"/>
38264 <colspec colwidth="6*" align="center"/>
38265 <colspec colwidth="6*" align="center"/>
38266 <colspec colwidth="6*" align="right"/>
38267 <tbody>
38268 <row>
38269 <entry><option>quota_is_inclusive</option></entry>
38270 <entry>Use: <emphasis>appendfile</emphasis></entry>
38271 <entry>Type: <emphasis>boolean</emphasis></entry>
38272 <entry>Default: <emphasis>true</emphasis></entry>
38273 </row>
38274 </tbody>
38275 </tgroup>
38276 </informaltable>
38277 <para>
38278 See <option>quota</option> above.
38279 </para>
38280 <para>
38281 <indexterm role="option">
38282 <primary><option>quota_size_regex</option></primary>
38283 </indexterm>
38284 </para>
38285 <informaltable frame="all">
38286 <tgroup cols="4" colsep="0" rowsep="0">
38287 <colspec colwidth="8*" align="left"/>
38288 <colspec colwidth="6*" align="center"/>
38289 <colspec colwidth="6*" align="center"/>
38290 <colspec colwidth="6*" align="right"/>
38291 <tbody>
38292 <row>
38293 <entry><option>quota_size_regex</option></entry>
38294 <entry>Use: <emphasis>appendfile</emphasis></entry>
38295 <entry>Type: <emphasis>string</emphasis></entry>
38296 <entry>Default: <emphasis>unset</emphasis></entry>
38297 </row>
38298 </tbody>
38299 </tgroup>
38300 </informaltable>
38301 <para>
38302 This option applies when one of the delivery modes that writes a separate file
38303 for each message is being used. When Exim wants to find the size of one of
38304 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38305 If this is set to a regular expression that matches the file name, and it
38306 captures one string, that string is interpreted as a representation of the
38307 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
38308 </para>
38309 <para>
38310 This feature is useful only when users have no shell access to their mailboxes
38311 &ndash; otherwise they could defeat the quota simply by renaming the files. This
38312 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38313 the file length to the file name. For example:
38314 </para>
38315 <literallayout class="monospaced">
38316 maildir_tag = ,S=$message_size
38317 quota_size_regex = ,S=(\d+)
38318 </literallayout>
38319 <para>
38320 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38321 number of lines in the message.
38322 </para>
38323 <para>
38324 The regular expression should not assume that the length is at the end of the
38325 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38326 sometimes add other information onto the ends of message file names.
38327 </para>
38328 <para>
38329 <indexterm role="option">
38330 <primary><option>quota_warn_message</option></primary>
38331 </indexterm>
38332 </para>
38333 <informaltable frame="all">
38334 <tgroup cols="4" colsep="0" rowsep="0">
38335 <colspec colwidth="8*" align="left"/>
38336 <colspec colwidth="6*" align="center"/>
38337 <colspec colwidth="6*" align="center"/>
38338 <colspec colwidth="6*" align="right"/>
38339 <tbody>
38340 <row>
38341 <entry><option>quota_warn_message</option></entry>
38342 <entry>Use: <emphasis>appendfile</emphasis></entry>
38343 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38344 <entry>Default: <emphasis>see below</emphasis></entry>
38345 </row>
38346 </tbody>
38347 </tgroup>
38348 </informaltable>
38349 <para>
38350 See below for the use of this option. If it is not set when
38351 <option>quota_warn_threshold</option> is set, it defaults to
38352 </para>
38353 <literallayout class="monospaced">
38354 quota_warn_message = "\
38355   To: $local_part@$domain\n\
38356   Subject: Your mailbox\n\n\
38357   This message is automatically created \
38358   by mail delivery software.\n\n\
38359   The size of your mailbox has exceeded \
38360   a warning threshold that is\n\
38361   set by the system administrator.\n"
38362 </literallayout>
38363 <para>
38364 <indexterm role="option">
38365 <primary><option>quota_warn_threshold</option></primary>
38366 </indexterm>
38367 </para>
38368 <informaltable frame="all">
38369 <tgroup cols="4" colsep="0" rowsep="0">
38370 <colspec colwidth="8*" align="left"/>
38371 <colspec colwidth="6*" align="center"/>
38372 <colspec colwidth="6*" align="center"/>
38373 <colspec colwidth="6*" align="right"/>
38374 <tbody>
38375 <row>
38376 <entry><option>quota_warn_threshold</option></entry>
38377 <entry>Use: <emphasis>appendfile</emphasis></entry>
38378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38379 <entry>Default: <emphasis>0</emphasis></entry>
38380 </row>
38381 </tbody>
38382 </tgroup>
38383 </informaltable>
38384 <para>
38385 <indexterm role="concept">
38386 <primary>quota</primary>
38387 <secondary>warning threshold</secondary>
38388 </indexterm>
38389 <indexterm role="concept">
38390 <primary>mailbox</primary>
38391 <secondary>size warning</secondary>
38392 </indexterm>
38393 <indexterm role="concept">
38394 <primary>size</primary>
38395 <secondary>of mailbox</secondary>
38396 </indexterm>
38397 This option is expanded in the same way as <option>quota</option> (see above). If the
38398 resulting value is greater than zero, and delivery of the message causes the
38399 size of the file or total space in the directory tree to cross the given
38400 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38401 may be specified as a percentage of it by following the value with a percent
38402 sign. For example:
38403 </para>
38404 <literallayout class="monospaced">
38405 quota = 10M
38406 quota_warn_threshold = 75%
38407 </literallayout>
38408 <para>
38409 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38410 percent sign is ignored.
38411 </para>
38412 <para>
38413 The warning message itself is specified by the <option>quota_warn_message</option> option,
38414 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38415 warning message. These do not necessarily have to include the recipient(s) of
38416 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38417 can include any other header lines that you want. If you do not include a
38418 <emphasis>From:</emphasis> line, the default is:
38419 </para>
38420 <literallayout class="monospaced">
38421 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
38422 </literallayout>
38423 <para>
38424 <indexterm role="option">
38425 <primary><option>errors_reply_to</option></primary>
38426 </indexterm>
38427 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38428 option.
38429 </para>
38430 <para>
38431 The <option>quota</option> option does not have to be set in order to use this option; they
38432 are independent of one another except when the threshold is specified as a
38433 percentage.
38434 </para>
38435 <para>
38436 <indexterm role="option">
38437 <primary><option>use_bsmtp</option></primary>
38438 </indexterm>
38439 </para>
38440 <informaltable frame="all">
38441 <tgroup cols="4" colsep="0" rowsep="0">
38442 <colspec colwidth="8*" align="left"/>
38443 <colspec colwidth="6*" align="center"/>
38444 <colspec colwidth="6*" align="center"/>
38445 <colspec colwidth="6*" align="right"/>
38446 <tbody>
38447 <row>
38448 <entry><option>use_bsmtp</option></entry>
38449 <entry>Use: <emphasis>appendfile</emphasis></entry>
38450 <entry>Type: <emphasis>boolean</emphasis></entry>
38451 <entry>Default: <emphasis>false</emphasis></entry>
38452 </row>
38453 </tbody>
38454 </tgroup>
38455 </informaltable>
38456 <para>
38457 <indexterm role="concept">
38458 <primary>envelope sender</primary>
38459 </indexterm>
38460 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38461 format, with the envelope sender and recipient(s) included as SMTP commands. If
38462 you want to include a leading HELO command with such messages, you can do
38463 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38464 for details of batch SMTP.
38465 </para>
38466 <para>
38467 <indexterm role="option">
38468 <primary><option>use_crlf</option></primary>
38469 </indexterm>
38470 </para>
38471 <informaltable frame="all">
38472 <tgroup cols="4" colsep="0" rowsep="0">
38473 <colspec colwidth="8*" align="left"/>
38474 <colspec colwidth="6*" align="center"/>
38475 <colspec colwidth="6*" align="center"/>
38476 <colspec colwidth="6*" align="right"/>
38477 <tbody>
38478 <row>
38479 <entry><option>use_crlf</option></entry>
38480 <entry>Use: <emphasis>appendfile</emphasis></entry>
38481 <entry>Type: <emphasis>boolean</emphasis></entry>
38482 <entry>Default: <emphasis>false</emphasis></entry>
38483 </row>
38484 </tbody>
38485 </tgroup>
38486 </informaltable>
38487 <para>
38488 <indexterm role="concept">
38489 <primary>carriage return</primary>
38490 </indexterm>
38491 <indexterm role="concept">
38492 <primary>linefeed</primary>
38493 </indexterm>
38494 This option causes lines to be terminated with the two-character CRLF sequence
38495 (carriage return, linefeed) instead of just a linefeed character. In the case
38496 of batched SMTP, the byte sequence written to the file is then an exact image
38497 of what would be sent down a real SMTP connection.
38498 </para>
38499 <para>
38500 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38501 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
38502 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38503 carriage return characters if these are needed. In cases where these options
38504 have non-empty defaults, the values end with a single linefeed, so they must be
38505 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38506 </para>
38507 <para>
38508 <indexterm role="option">
38509 <primary><option>use_fcntl_lock</option></primary>
38510 </indexterm>
38511 </para>
38512 <informaltable frame="all">
38513 <tgroup cols="4" colsep="0" rowsep="0">
38514 <colspec colwidth="8*" align="left"/>
38515 <colspec colwidth="6*" align="center"/>
38516 <colspec colwidth="6*" align="center"/>
38517 <colspec colwidth="6*" align="right"/>
38518 <tbody>
38519 <row>
38520 <entry><option>use_fcntl_lock</option></entry>
38521 <entry>Use: <emphasis>appendfile</emphasis></entry>
38522 <entry>Type: <emphasis>boolean</emphasis></entry>
38523 <entry>Default: <emphasis>see below</emphasis></entry>
38524 </row>
38525 </tbody>
38526 </tgroup>
38527 </informaltable>
38528 <para>
38529 This option controls the use of the <function>fcntl()</function> function to lock a file for
38530 exclusive use when a message is being appended. It is set by default unless
38531 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38532 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38533 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38534 </para>
38535 <para>
38536 <indexterm role="option">
38537 <primary><option>use_flock_lock</option></primary>
38538 </indexterm>
38539 </para>
38540 <informaltable frame="all">
38541 <tgroup cols="4" colsep="0" rowsep="0">
38542 <colspec colwidth="8*" align="left"/>
38543 <colspec colwidth="6*" align="center"/>
38544 <colspec colwidth="6*" align="center"/>
38545 <colspec colwidth="6*" align="right"/>
38546 <tbody>
38547 <row>
38548 <entry><option>use_flock_lock</option></entry>
38549 <entry>Use: <emphasis>appendfile</emphasis></entry>
38550 <entry>Type: <emphasis>boolean</emphasis></entry>
38551 <entry>Default: <emphasis>false</emphasis></entry>
38552 </row>
38553 </tbody>
38554 </tgroup>
38555 </informaltable>
38556 <para>
38557 This option is provided to support the use of <function>flock()</function> for file locking, for
38558 the few situations where it is needed. Most modern operating systems support
38559 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38560 each other. Exim uses <function>fcntl()</function> locking by default.
38561 </para>
38562 <para>
38563 This option is required only if you are using an operating system where
38564 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38565 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38566 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38567 </para>
38568 <para>
38569 <indexterm role="concept">
38570 <primary>Solaris</primary>
38571 <secondary><function>flock()</function> support</secondary>
38572 </indexterm>
38573 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38574 have it (and some, I think, provide a not quite right version built on top of
38575 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38576 the ability to use it, and any attempt to do so will cause a configuration
38577 error.
38578 </para>
38579 <para>
38580 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38581 is just being mapped onto <function>fcntl()</function> by the OS).
38582 </para>
38583 <para>
38584 <indexterm role="option">
38585 <primary><option>use_lockfile</option></primary>
38586 </indexterm>
38587 </para>
38588 <informaltable frame="all">
38589 <tgroup cols="4" colsep="0" rowsep="0">
38590 <colspec colwidth="8*" align="left"/>
38591 <colspec colwidth="6*" align="center"/>
38592 <colspec colwidth="6*" align="center"/>
38593 <colspec colwidth="6*" align="right"/>
38594 <tbody>
38595 <row>
38596 <entry><option>use_lockfile</option></entry>
38597 <entry>Use: <emphasis>appendfile</emphasis></entry>
38598 <entry>Type: <emphasis>boolean</emphasis></entry>
38599 <entry>Default: <emphasis>see below</emphasis></entry>
38600 </row>
38601 </tbody>
38602 </tgroup>
38603 </informaltable>
38604 <para>
38605 If this option is turned off, Exim does not attempt to create a lock file when
38606 appending to a mailbox file. In this situation, the only locking is by
38607 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38608 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
38609 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38610 delivering over NFS from more than one host.
38611 </para>
38612 <para>
38613 <indexterm role="concept">
38614 <primary>NFS</primary>
38615 <secondary>lock file</secondary>
38616 </indexterm>
38617 In order to append to an NFS file safely from more than one host, it is
38618 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38619 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38620 file corruption.
38621 </para>
38622 <para>
38623 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38624 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38625 except when <option>mbx_format</option> is set.
38626 </para>
38627 <para>
38628 <indexterm role="option">
38629 <primary><option>use_mbx_lock</option></primary>
38630 </indexterm>
38631 </para>
38632 <informaltable frame="all">
38633 <tgroup cols="4" colsep="0" rowsep="0">
38634 <colspec colwidth="8*" align="left"/>
38635 <colspec colwidth="6*" align="center"/>
38636 <colspec colwidth="6*" align="center"/>
38637 <colspec colwidth="6*" align="right"/>
38638 <tbody>
38639 <row>
38640 <entry><option>use_mbx_lock</option></entry>
38641 <entry>Use: <emphasis>appendfile</emphasis></entry>
38642 <entry>Type: <emphasis>boolean</emphasis></entry>
38643 <entry>Default: <emphasis>see below</emphasis></entry>
38644 </row>
38645 </tbody>
38646 </tgroup>
38647 </informaltable>
38648 <para>
38649 This option is available only if Exim has been compiled with SUPPORT_MBX
38650 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38651 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38652 of the locking options are mentioned in the configuration. The locking rules
38653 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38654 the IMAP4 and POP daemons that come with it (see the discussion below). The
38655 rules allow for shared access to the mailbox. However, this kind of locking
38656 does not work when the mailbox is NFS mounted.
38657 </para>
38658 <para>
38659 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38660 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38661 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38662 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38663 </para>
38664 </section>
38665 <section id="SECTopappend">
38666 <title>Operational details for appending</title>
38667 <para>
38668 <indexterm role="concept">
38669 <primary>appending to a file</primary>
38670 </indexterm>
38671 <indexterm role="concept">
38672 <primary>file</primary>
38673 <secondary>appending</secondary>
38674 </indexterm>
38675 Before appending to a file, the following preparations are made:
38676 </para>
38677 <itemizedlist>
38678 <listitem>
38679 <para>
38680 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38681 return is given.
38682 </para>
38683 </listitem>
38684 <listitem>
38685 <para>
38686 <indexterm role="concept">
38687 <primary>directory creation</primary>
38688 </indexterm>
38689 If any directories on the file&#x2019;s path are missing, Exim creates them if the
38690 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
38691 <option>directory_mode</option> option.
38692 </para>
38693 </listitem>
38694 <listitem>
38695 <para>
38696 If <option>file_format</option> is set, the format of an existing file is checked. If this
38697 indicates that a different transport should be used, control is passed to that
38698 transport.
38699 </para>
38700 </listitem>
38701 <listitem>
38702 <para>
38703 <indexterm role="concept">
38704 <primary>file</primary>
38705 <secondary>locking</secondary>
38706 </indexterm>
38707 <indexterm role="concept">
38708 <primary>locking files</primary>
38709 </indexterm>
38710 <indexterm role="concept">
38711 <primary>NFS</primary>
38712 <secondary>lock file</secondary>
38713 </indexterm>
38714 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38715 reliably over NFS, as follows:
38716 </para>
38717 <orderedlist numeration="arabic">
38718 <listitem>
38719 <para>
38720 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38721 current time, primary host name, and process id added, by opening for writing
38722 as a new file. If this fails with an access error, delivery is deferred.
38723 </para>
38724 </listitem>
38725 <listitem>
38726 <para>
38727 Close the hitching post file, and hard link it to the lock file name.
38728 </para>
38729 </listitem>
38730 <listitem>
38731 <para>
38732 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38733 Unlink the hitching post name.
38734 </para>
38735 </listitem>
38736 <listitem>
38737 <para>
38738 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38739 then unlink hitching post name. If the number of links is exactly two, creation
38740 of the lock file succeeded but something (for example, an NFS server crash and
38741 restart) caused this fact not to be communicated to the <function>link()</function> call.
38742 </para>
38743 </listitem>
38744 <listitem>
38745 <para>
38746 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38747 up to <option>lock_retries</option> times. However, since any program that writes to a
38748 mailbox should complete its task very quickly, it is reasonable to time out old
38749 lock files that are normally the result of user agent and system crashes. If an
38750 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38751 it before trying again.
38752 </para>
38753 </listitem>
38754 </orderedlist>
38755 </listitem>
38756 <listitem>
38757 <para>
38758 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38759 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38760 than non-existence, delivery is deferred.
38761 </para>
38762 </listitem>
38763 <listitem>
38764 <para>
38765 <indexterm role="concept">
38766 <primary>symbolic link</primary>
38767 <secondary>to mailbox</secondary>
38768 </indexterm>
38769 <indexterm role="concept">
38770 <primary>mailbox</primary>
38771 <secondary>symbolic link</secondary>
38772 </indexterm>
38773 If the file does exist and is a symbolic link, delivery is deferred, unless the
38774 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38775 checked, and then <function>stat()</function> is called to find out about the real file, which
38776 is then subjected to the checks below. The check on the top-level link
38777 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
38778 directory, though allowing symbolic links in this case is definitely not a good
38779 idea. If there is a chain of symbolic links, the intermediate ones are not
38780 checked.
38781 </para>
38782 </listitem>
38783 <listitem>
38784 <para>
38785 If the file already exists but is not a regular file, or if the file&#x2019;s owner
38786 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
38787 different from the user and group under which the delivery is running,
38788 delivery is deferred.
38789 </para>
38790 </listitem>
38791 <listitem>
38792 <para>
38793 If the file&#x2019;s permissions are more generous than specified, they are reduced.
38794 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
38795 is set false, in which case the delivery is tried using the existing
38796 permissions.
38797 </para>
38798 </listitem>
38799 <listitem>
38800 <para>
38801 The file&#x2019;s inode number is saved, and the file is then opened for appending.
38802 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
38803 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
38804 </para>
38805 </listitem>
38806 <listitem>
38807 <para>
38808 If the file is opened successfully, check that the inode number hasn&#x2019;t
38809 changed, that it is still a regular file, and that the owner and permissions
38810 have not changed. If anything is wrong, defer delivery and freeze the message.
38811 </para>
38812 </listitem>
38813 <listitem>
38814 <para>
38815 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
38816 option is set. Otherwise, check that the file is being created in a permitted
38817 directory if the <option>create_file</option> option is set (deferring on failure), and then
38818 open for writing as a new file, with the O_EXCL and O_CREAT options,
38819 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
38820 set). In this case, which can happen if the link points to a non-existent file,
38821 the file is opened for writing using O_CREAT but not O_EXCL, because
38822 that prevents link following.
38823 </para>
38824 </listitem>
38825 <listitem>
38826 <para>
38827 <indexterm role="concept">
38828 <primary>loop</primary>
38829 <secondary>while file testing</secondary>
38830 </indexterm>
38831 If opening fails because the file exists, obey the tests given above for
38832 existing files. However, to avoid looping in a situation where the file is
38833 being continuously created and destroyed, the exists/not-exists loop is broken
38834 after 10 repetitions, and the message is then frozen.
38835 </para>
38836 </listitem>
38837 <listitem>
38838 <para>
38839 If opening fails with any other error, defer delivery.
38840 </para>
38841 </listitem>
38842 <listitem>
38843 <para>
38844 <indexterm role="concept">
38845 <primary>file</primary>
38846 <secondary>locking</secondary>
38847 </indexterm>
38848 <indexterm role="concept">
38849 <primary>locking files</primary>
38850 </indexterm>
38851 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
38852 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
38853 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
38854 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
38855 file, and an exclusive lock on the file whose name is
38856 </para>
38857 <literallayout class="monospaced">
38858 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
38859 </literallayout>
38860 <para>
38861 using the device and inode numbers of the open mailbox file, in accordance with
38862 the MBX locking rules. This file is created with a mode that is specified by
38863 the <option>lockfile_mode</option> option.
38864 </para>
38865 <para>
38866 If Exim fails to lock the file, there are two possible courses of action,
38867 depending on the value of the locking timeout. This is obtained from
38868 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38869 </para>
38870 <para>
38871 If the timeout value is zero, the file is closed, Exim waits for
38872 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38873 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38874 delivery is deferred.
38875 </para>
38876 <para>
38877 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38878 <function>flock()</function> are used (with the given timeout), so there has already been some
38879 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38880 immediately. It retries up to
38881 </para>
38882 <literallayout class="monospaced">
38883 (lock_retries * lock_interval) / &lt;timeout&gt;
38884 </literallayout>
38885 <para>
38886 times (rounded up).
38887 </para>
38888 </listitem>
38889 </itemizedlist>
38890 <para>
38891 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38892 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38893 </para>
38894 </section>
38895 <section id="SECTopdir">
38896 <title>Operational details for delivery to a new file</title>
38897 <para>
38898 <indexterm role="concept">
38899 <primary>delivery</primary>
38900 <secondary>to single file</secondary>
38901 </indexterm>
38902 <indexterm role="concept">
38903 <primary><quote>From</quote> line</primary>
38904 </indexterm>
38905 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38906 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38907 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38908 <option>directory</option> is normally set, because the path for delivery is supplied by the
38909 router. (See for example, the <command>address_file</command> transport in the default
38910 configuration.) In this case, delivery is to a new file if either the path name
38911 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38912 </para>
38913 <para>
38914 No locking is required while writing the message to a new file, so the various
38915 locking options of the transport are ignored. The <quote>From</quote> line that by default
38916 separates messages in a single file is not normally needed, nor is the escaping
38917 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38918 newline at the end of each message. Consequently, the default values for
38919 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38920 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38921 </para>
38922 <para>
38923 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38924 the files in the delivery directory by default. However, you can specify a
38925 different directory by setting <option>quota_directory</option>. Also, for maildir
38926 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38927 </para>
38928 <para>
38929 <indexterm role="concept">
38930 <primary>maildir format</primary>
38931 </indexterm>
38932 <indexterm role="concept">
38933 <primary>mailstore format</primary>
38934 </indexterm>
38935 There are three different ways in which delivery to individual files can be
38936 done, controlled by the settings of the <option>maildir_format</option> and
38937 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38938 formats is not included in the binary unless SUPPORT_MAILDIR or
38939 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38940 </para>
38941 <para>
38942 <indexterm role="concept">
38943 <primary>directory creation</primary>
38944 </indexterm>
38945 In all three cases an attempt is made to create the directory and any necessary
38946 sub-directories if they do not exist, provided that the <option>create_directory</option>
38947 option is set (the default). The location of a created directory can be
38948 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
38949 the <option>directory_mode</option> option. If creation fails, or if the
38950 <option>create_directory</option> option is not set when creation is required, delivery is
38951 deferred.
38952 </para>
38953 </section>
38954 <section id="SECTmaildirdelivery">
38955 <title>Maildir delivery</title>
38956 <para>
38957 <indexterm role="concept">
38958 <primary>maildir format</primary>
38959 <secondary>description of</secondary>
38960 </indexterm>
38961 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38962 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
38963 directory that is defined by the <option>directory</option> option (the <quote>delivery
38964 directory</quote>). If the delivery is successful, the file is renamed into the
38965 <filename>new</filename> subdirectory.
38966 </para>
38967 <para>
38968 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
38969 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
38970 Exim checks that the time-of-day clock has moved on by at least one microsecond
38971 before terminating the delivery process. This guarantees uniqueness for the
38972 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38973 opening it. If any response other than ENOENT (does not exist) is given,
38974 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38975 </para>
38976 <para>
38977 Before Exim carries out a maildir delivery, it ensures that subdirectories
38978 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38979 do not exist, Exim tries to create them and any superior directories in their
38980 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38981 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38982 contains matches the delivery directory, Exim also ensures that a file called
38983 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
38984 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
38985 </para>
38986 <para>
38987 These features make it possible to use Exim to create all the necessary files
38988 and directories in a maildir mailbox, including subdirectories for maildir++
38989 folders. Consider this example:
38990 </para>
38991 <literallayout class="monospaced">
38992 maildir_format = true
38993 directory = /var/mail/$local_part\
38994            ${if eq{$local_part_suffix}{}{}\
38995            {/.${substr_1:$local_part_suffix}}}
38996 maildirfolder_create_regex = /\.[^/]+$
38997 </literallayout>
38998 <para>
38999 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39000 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39001 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39002 not match this name, so Exim will not look for or create the file
39003 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39004 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39005 </para>
39006 <para>
39007 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39008 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39009 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39010 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39011 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39012 </para>
39013 <para>
39014 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39015 not inadvertently match the toplevel maildir directory, because a
39016 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39017 </para>
39018 <para>
39019 <indexterm role="concept">
39020 <primary>quota</primary>
39021 <secondary>in maildir delivery</secondary>
39022 </indexterm>
39023 <indexterm role="concept">
39024 <primary>maildir++</primary>
39025 </indexterm>
39026 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39027 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39028 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39029 Exim assumes the directory is a maildir++ folder directory, which is one level
39030 down from the user&#x2019;s top level mailbox directory. This causes it to start at
39031 the parent directory instead of the current directory when calculating the
39032 amount of space used.
39033 </para>
39034 <para>
39035 One problem with delivering into a multi-file mailbox is that it is
39036 computationally expensive to compute the size of the mailbox for quota
39037 checking. Various approaches have been taken to reduce the amount of work
39038 needed. The next two sections describe two of them. A third alternative is to
39039 use some external process for maintaining the size data, and use the expansion
39040 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39041 </para>
39042 </section>
39043 <section id="SECID135">
39044 <title>Using tags to record message sizes</title>
39045 <para>
39046 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39047 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39048 tag is added to its name. However, if adding the tag takes the length of the
39049 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39050 the tag is dropped and the maildir file is created with no tag.
39051 </para>
39052 <para>
39053 <indexterm role="variable">
39054 <primary><varname>$message_size</varname></primary>
39055 </indexterm>
39056 Tags can be used to encode the size of files in their names; see
39057 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39058 happens after the message has been written. The value of the <varname>$message_size</varname>
39059 variable is set to the number of bytes actually written. If the expansion is
39060 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39061 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39062 Non-printing characters in the string are ignored; if the resulting string is
39063 empty, it is ignored. If it starts with an alphanumeric character, a leading
39064 colon is inserted.
39065 </para>
39066 </section>
39067 <section id="SECID136">
39068 <title>Using a maildirsize file</title>
39069 <para>
39070 <indexterm role="concept">
39071 <primary>quota</primary>
39072 <secondary>in maildir delivery</secondary>
39073 </indexterm>
39074 <indexterm role="concept">
39075 <primary>maildir format</primary>
39076 <secondary><filename>maildirsize</filename> file</secondary>
39077 </indexterm>
39078 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39079 storing quota and message size information in a file called <filename>maildirsize</filename>
39080 within the toplevel maildir directory. If this file does not exist, Exim
39081 creates it, setting the quota from the <option>quota</option> option of the transport. If
39082 the maildir directory itself does not exist, it is created before any attempt
39083 to write a <filename>maildirsize</filename> file.
39084 </para>
39085 <para>
39086 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39087 messages in the maildir, thus speeding up quota calculations. The quota value
39088 in the file is just a cache; if the quota is changed in the transport, the new
39089 value overrides the cached value when the next message is delivered. The cache
39090 is maintained for the benefit of other programs that access the maildir and
39091 need to know the quota.
39092 </para>
39093 <para>
39094 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39095 file is maintained (with a zero quota setting), but no quota is imposed.
39096 </para>
39097 <para>
39098 A regular expression is available for controlling which directories in the
39099 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39100 See the description of the <option>maildir_quota_directory_regex</option> option above for
39101 details.
39102 </para>
39103 </section>
39104 <section id="SECID137">
39105 <title>Mailstore delivery</title>
39106 <para>
39107 <indexterm role="concept">
39108 <primary>mailstore format</primary>
39109 <secondary>description of</secondary>
39110 </indexterm>
39111 If the <option>mailstore_format</option> option is true, each message is written as two
39112 files in the given directory. A unique base name is constructed from the
39113 message id and the current delivery process, and the files that are written use
39114 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39115 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
39116 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39117 </para>
39118 <para>
39119 During delivery, the envelope is first written to a file with the suffix
39120 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39121 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39122 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39123 file before accessing either of them. An alternative approach is to wait for
39124 the absence of a <filename>.tmp</filename> file.
39125 </para>
39126 <para>
39127 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39128 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
39129 the sender address on one line, then all the recipient addresses, one per line.
39130 There can be more than one recipient only if the <option>batch_max</option> option is set
39131 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39132 appended to the file, followed by a newline if it does not end with one.
39133 </para>
39134 <para>
39135 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39136 failure, it is ignored. Other expansion errors are treated as serious
39137 configuration errors, and delivery is deferred. The variable
39138 <varname>$mailstore_basename</varname> is available for use during these expansions.
39139 </para>
39140 </section>
39141 <section id="SECID138">
39142 <title>Non-special new file delivery</title>
39143 <para>
39144 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39145 file is created directly in the named directory. For example, when delivering
39146 messages into files in batched SMTP format for later delivery to some host (see
39147 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39148 </para>
39149 <literallayout class="monospaced">
39150 directory = /var/bsmtp/$host
39151 </literallayout>
39152 <para>
39153 might be used. A message is written to a file with a temporary name, which is
39154 then renamed when the delivery is complete. The final name is obtained by
39155 expanding the contents of the <option>directory_file</option> option.
39156 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39157 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39158 </para>
39159 </section>
39160 </chapter>
39161
39162 <chapter id="CHID8">
39163 <title>The autoreply transport</title>
39164 <para>
39165 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39166 <primary>transports</primary>
39167 <secondary><command>autoreply</command></secondary>
39168 </indexterm>
39169 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39170 <primary><command>autoreply</command> transport</primary>
39171 </indexterm>
39172 The <command>autoreply</command> transport is not a true transport in that it does not cause
39173 the message to be transmitted. Instead, it generates a new mail message as an
39174 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39175 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39176 to the rules in RFCs 2822 and 3834, respectively.
39177 </para>
39178 <para>
39179 If the router that passes the message to this transport does not have the
39180 <option>unseen</option> option set, the original message (for the current recipient) is not
39181 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39182 that passes the message to this transport, routing of the address continues, so
39183 another router can set up a normal message delivery.
39184 </para>
39185 <para>
39186 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39187 <quote>vacation</quote> message being the standard example. However, it can also be run
39188 directly from a router like any other transport. To reduce the possibility of
39189 message cascades, messages created by the <command>autoreply</command> transport always have
39190 empty envelope sender addresses, like bounce messages.
39191 </para>
39192 <para>
39193 The parameters of the message to be sent can be specified in the configuration
39194 by options described below. However, these are used only when the address
39195 passed to the transport does not contain its own reply information. When the
39196 transport is run as a consequence of a
39197 <option>mail</option>
39198 or <option>vacation</option> command in a filter file, the parameters of the message are
39199 supplied by the filter, and passed with the address. The transport&#x2019;s options
39200 that define the message are then ignored (so they are not usually set in this
39201 case). The message is specified entirely by the filter or by the transport; it
39202 is never built from a mixture of options. However, the <option>file_optional</option>,
39203 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39204 </para>
39205 <para>
39206 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39207 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
39208 gid of the user, and with appropriate current and home directories (see chapter
39209 <xref linkend="CHAPenvironment"/>).
39210 </para>
39211 <para>
39212 There is a subtle difference between routing a message to a <command>pipe</command> transport
39213 that generates some text to be returned to the sender, and routing it to an
39214 <command>autoreply</command> transport. This difference is noticeable only if more than one
39215 address from the same message is so handled. In the case of a pipe, the
39216 separate outputs from the different addresses are gathered up and returned to
39217 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39218 message is generated for each address that is passed to it.
39219 </para>
39220 <para>
39221 Non-printing characters are not permitted in the header lines generated for the
39222 message that <command>autoreply</command> creates, with the exception of newlines that are
39223 immediately followed by white space. If any non-printing characters are found,
39224 the transport defers.
39225 Whether characters with the top bit set count as printing characters or not is
39226 controlled by the <option>print_topbitchars</option> global option.
39227 </para>
39228 <para>
39229 If any of the generic options for manipulating headers (for example,
39230 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39231 of the original message that is included in the generated message when
39232 <option>return_message</option> is set. They do not apply to the generated message itself.
39233 </para>
39234 <para>
39235 <indexterm role="variable">
39236 <primary><varname>$sender_address</varname></primary>
39237 </indexterm>
39238 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39239 the message, indicating that there were no recipients, it does not treat this
39240 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39241 is empty (because the incoming message is a bounce message) do not cause
39242 problems. They are just discarded.
39243 </para>
39244 <section id="SECID139">
39245 <title>Private options for autoreply</title>
39246 <para>
39247 <indexterm role="concept">
39248 <primary>options</primary>
39249 <secondary><command>autoreply</command> transport</secondary>
39250 </indexterm>
39251 </para>
39252 <para>
39253 <indexterm role="option">
39254 <primary><option>bcc</option></primary>
39255 </indexterm>
39256 </para>
39257 <informaltable frame="all">
39258 <tgroup cols="4" colsep="0" rowsep="0">
39259 <colspec colwidth="8*" align="left"/>
39260 <colspec colwidth="6*" align="center"/>
39261 <colspec colwidth="6*" align="center"/>
39262 <colspec colwidth="6*" align="right"/>
39263 <tbody>
39264 <row>
39265 <entry><option>bcc</option></entry>
39266 <entry>Use: <emphasis>autoreply</emphasis></entry>
39267 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39268 <entry>Default: <emphasis>unset</emphasis></entry>
39269 </row>
39270 </tbody>
39271 </tgroup>
39272 </informaltable>
39273 <para>
39274 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39275 message when the message is specified by the transport.
39276 </para>
39277 <para>
39278 <indexterm role="option">
39279 <primary><option>cc</option></primary>
39280 </indexterm>
39281 </para>
39282 <informaltable frame="all">
39283 <tgroup cols="4" colsep="0" rowsep="0">
39284 <colspec colwidth="8*" align="left"/>
39285 <colspec colwidth="6*" align="center"/>
39286 <colspec colwidth="6*" align="center"/>
39287 <colspec colwidth="6*" align="right"/>
39288 <tbody>
39289 <row>
39290 <entry><option>cc</option></entry>
39291 <entry>Use: <emphasis>autoreply</emphasis></entry>
39292 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39293 <entry>Default: <emphasis>unset</emphasis></entry>
39294 </row>
39295 </tbody>
39296 </tgroup>
39297 </informaltable>
39298 <para>
39299 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39300 when the message is specified by the transport.
39301 </para>
39302 <para>
39303 <indexterm role="option">
39304 <primary><option>file</option></primary>
39305 </indexterm>
39306 </para>
39307 <informaltable frame="all">
39308 <tgroup cols="4" colsep="0" rowsep="0">
39309 <colspec colwidth="8*" align="left"/>
39310 <colspec colwidth="6*" align="center"/>
39311 <colspec colwidth="6*" align="center"/>
39312 <colspec colwidth="6*" align="right"/>
39313 <tbody>
39314 <row>
39315 <entry><option>file</option></entry>
39316 <entry>Use: <emphasis>autoreply</emphasis></entry>
39317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39318 <entry>Default: <emphasis>unset</emphasis></entry>
39319 </row>
39320 </tbody>
39321 </tgroup>
39322 </informaltable>
39323 <para>
39324 The contents of the file are sent as the body of the message when the message
39325 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39326 string comes first.
39327 </para>
39328 <para>
39329 <indexterm role="option">
39330 <primary><option>file_expand</option></primary>
39331 </indexterm>
39332 </para>
39333 <informaltable frame="all">
39334 <tgroup cols="4" colsep="0" rowsep="0">
39335 <colspec colwidth="8*" align="left"/>
39336 <colspec colwidth="6*" align="center"/>
39337 <colspec colwidth="6*" align="center"/>
39338 <colspec colwidth="6*" align="right"/>
39339 <tbody>
39340 <row>
39341 <entry><option>file_expand</option></entry>
39342 <entry>Use: <emphasis>autoreply</emphasis></entry>
39343 <entry>Type: <emphasis>boolean</emphasis></entry>
39344 <entry>Default: <emphasis>false</emphasis></entry>
39345 </row>
39346 </tbody>
39347 </tgroup>
39348 </informaltable>
39349 <para>
39350 If this is set, the contents of the file named by the <option>file</option> option are
39351 subjected to string expansion as they are added to the message.
39352 </para>
39353 <para>
39354 <indexterm role="option">
39355 <primary><option>file_optional</option></primary>
39356 </indexterm>
39357 </para>
39358 <informaltable frame="all">
39359 <tgroup cols="4" colsep="0" rowsep="0">
39360 <colspec colwidth="8*" align="left"/>
39361 <colspec colwidth="6*" align="center"/>
39362 <colspec colwidth="6*" align="center"/>
39363 <colspec colwidth="6*" align="right"/>
39364 <tbody>
39365 <row>
39366 <entry><option>file_optional</option></entry>
39367 <entry>Use: <emphasis>autoreply</emphasis></entry>
39368 <entry>Type: <emphasis>boolean</emphasis></entry>
39369 <entry>Default: <emphasis>false</emphasis></entry>
39370 </row>
39371 </tbody>
39372 </tgroup>
39373 </informaltable>
39374 <para>
39375 If this option is true, no error is generated if the file named by the <option>file</option>
39376 option or passed with the address does not exist or cannot be read.
39377 </para>
39378 <para>
39379 <indexterm role="option">
39380 <primary><option>from</option></primary>
39381 </indexterm>
39382 </para>
39383 <informaltable frame="all">
39384 <tgroup cols="4" colsep="0" rowsep="0">
39385 <colspec colwidth="8*" align="left"/>
39386 <colspec colwidth="6*" align="center"/>
39387 <colspec colwidth="6*" align="center"/>
39388 <colspec colwidth="6*" align="right"/>
39389 <tbody>
39390 <row>
39391 <entry><option>from</option></entry>
39392 <entry>Use: <emphasis>autoreply</emphasis></entry>
39393 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39394 <entry>Default: <emphasis>unset</emphasis></entry>
39395 </row>
39396 </tbody>
39397 </tgroup>
39398 </informaltable>
39399 <para>
39400 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39401 specified by the transport.
39402 </para>
39403 <para>
39404 <indexterm role="option">
39405 <primary><option>headers</option></primary>
39406 </indexterm>
39407 </para>
39408 <informaltable frame="all">
39409 <tgroup cols="4" colsep="0" rowsep="0">
39410 <colspec colwidth="8*" align="left"/>
39411 <colspec colwidth="6*" align="center"/>
39412 <colspec colwidth="6*" align="center"/>
39413 <colspec colwidth="6*" align="right"/>
39414 <tbody>
39415 <row>
39416 <entry><option>headers</option></entry>
39417 <entry>Use: <emphasis>autoreply</emphasis></entry>
39418 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39419 <entry>Default: <emphasis>unset</emphasis></entry>
39420 </row>
39421 </tbody>
39422 </tgroup>
39423 </informaltable>
39424 <para>
39425 This specifies additional RFC 2822 headers that are to be added to the message
39426 when the message is specified by the transport. Several can be given by using
39427 <quote>\n</quote> to separate them. There is no check on the format.
39428 </para>
39429 <para>
39430 <indexterm role="option">
39431 <primary><option>log</option></primary>
39432 </indexterm>
39433 </para>
39434 <informaltable frame="all">
39435 <tgroup cols="4" colsep="0" rowsep="0">
39436 <colspec colwidth="8*" align="left"/>
39437 <colspec colwidth="6*" align="center"/>
39438 <colspec colwidth="6*" align="center"/>
39439 <colspec colwidth="6*" align="right"/>
39440 <tbody>
39441 <row>
39442 <entry><option>log</option></entry>
39443 <entry>Use: <emphasis>autoreply</emphasis></entry>
39444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39445 <entry>Default: <emphasis>unset</emphasis></entry>
39446 </row>
39447 </tbody>
39448 </tgroup>
39449 </informaltable>
39450 <para>
39451 This option names a file in which a record of every message sent is logged when
39452 the message is specified by the transport.
39453 </para>
39454 <para>
39455 <indexterm role="option">
39456 <primary><option>mode</option></primary>
39457 </indexterm>
39458 </para>
39459 <informaltable frame="all">
39460 <tgroup cols="4" colsep="0" rowsep="0">
39461 <colspec colwidth="8*" align="left"/>
39462 <colspec colwidth="6*" align="center"/>
39463 <colspec colwidth="6*" align="center"/>
39464 <colspec colwidth="6*" align="right"/>
39465 <tbody>
39466 <row>
39467 <entry><option>mode</option></entry>
39468 <entry>Use: <emphasis>autoreply</emphasis></entry>
39469 <entry>Type: <emphasis>octal integer</emphasis></entry>
39470 <entry>Default: <emphasis>0600</emphasis></entry>
39471 </row>
39472 </tbody>
39473 </tgroup>
39474 </informaltable>
39475 <para>
39476 If either the log file or the <quote>once</quote> file has to be created, this mode is
39477 used.
39478 </para>
39479 <para>
39480 <indexterm role="option">
39481 <primary><option>never_mail</option></primary>
39482 </indexterm>
39483 </para>
39484 <informaltable frame="all">
39485 <tgroup cols="4" colsep="0" rowsep="0">
39486 <colspec colwidth="8*" align="left"/>
39487 <colspec colwidth="6*" align="center"/>
39488 <colspec colwidth="6*" align="center"/>
39489 <colspec colwidth="6*" align="right"/>
39490 <tbody>
39491 <row>
39492 <entry><option>never_mail</option></entry>
39493 <entry>Use: <emphasis>autoreply</emphasis></entry>
39494 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
39495 <entry>Default: <emphasis>unset</emphasis></entry>
39496 </row>
39497 </tbody>
39498 </tgroup>
39499 </informaltable>
39500 <para>
39501 If any run of the transport creates a message with a recipient that matches any
39502 item in the list, that recipient is quietly discarded. If all recipients are
39503 discarded, no message is created. This applies both when the recipients are
39504 generated by a filter and when they are specified in the transport.
39505 </para>
39506 <para>
39507 <indexterm role="option">
39508 <primary><option>once</option></primary>
39509 </indexterm>
39510 </para>
39511 <informaltable frame="all">
39512 <tgroup cols="4" colsep="0" rowsep="0">
39513 <colspec colwidth="8*" align="left"/>
39514 <colspec colwidth="6*" align="center"/>
39515 <colspec colwidth="6*" align="center"/>
39516 <colspec colwidth="6*" align="right"/>
39517 <tbody>
39518 <row>
39519 <entry><option>once</option></entry>
39520 <entry>Use: <emphasis>autoreply</emphasis></entry>
39521 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39522 <entry>Default: <emphasis>unset</emphasis></entry>
39523 </row>
39524 </tbody>
39525 </tgroup>
39526 </informaltable>
39527 <para>
39528 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39529 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39530 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39531 </para>
39532 <para>
39533 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39534 By default, if <option>once</option> is set to a non-empty file name, the message
39535 is not sent if a potential recipient is already listed in the database.
39536 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39537 message is sent if that much time has elapsed since a message was last sent to
39538 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39539 prevents a message from being sent a second time &ndash; in this case, zero means
39540 infinity.
39541 </para>
39542 <para>
39543 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39544 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39545 greater than zero, it changes the way Exim implements the <option>once</option> option.
39546 Instead of using a DBM file to record every recipient it sends to, it uses a
39547 regular file, whose size will never get larger than the given value.
39548 </para>
39549 <para>
39550 In the file, Exim keeps a linear list of recipient addresses and the times at
39551 which they were sent messages. If the file is full when a new address needs to
39552 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39553 means that a given recipient may receive multiple messages, but at
39554 unpredictable intervals that depend on the rate of turnover of addresses in the
39555 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39556 </para>
39557 <para>
39558 <indexterm role="option">
39559 <primary><option>once_file_size</option></primary>
39560 </indexterm>
39561 </para>
39562 <informaltable frame="all">
39563 <tgroup cols="4" colsep="0" rowsep="0">
39564 <colspec colwidth="8*" align="left"/>
39565 <colspec colwidth="6*" align="center"/>
39566 <colspec colwidth="6*" align="center"/>
39567 <colspec colwidth="6*" align="right"/>
39568 <tbody>
39569 <row>
39570 <entry><option>once_file_size</option></entry>
39571 <entry>Use: <emphasis>autoreply</emphasis></entry>
39572 <entry>Type: <emphasis>integer</emphasis></entry>
39573 <entry>Default: <emphasis>0</emphasis></entry>
39574 </row>
39575 </tbody>
39576 </tgroup>
39577 </informaltable>
39578 <para>
39579 See <option>once</option> above.
39580 </para>
39581 <para>
39582 <indexterm role="option">
39583 <primary><option>once_repeat</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>once_repeat</option></entry>
39595 <entry>Use: <emphasis>autoreply</emphasis></entry>
39596 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
39597 <entry>Default: <emphasis>0s</emphasis></entry>
39598 </row>
39599 </tbody>
39600 </tgroup>
39601 </informaltable>
39602 <para>
39603 See <option>once</option> above.
39604 After expansion, the value of this option must be a valid time value.
39605 </para>
39606 <para>
39607 <indexterm role="option">
39608 <primary><option>reply_to</option></primary>
39609 </indexterm>
39610 </para>
39611 <informaltable frame="all">
39612 <tgroup cols="4" colsep="0" rowsep="0">
39613 <colspec colwidth="8*" align="left"/>
39614 <colspec colwidth="6*" align="center"/>
39615 <colspec colwidth="6*" align="center"/>
39616 <colspec colwidth="6*" align="right"/>
39617 <tbody>
39618 <row>
39619 <entry><option>reply_to</option></entry>
39620 <entry>Use: <emphasis>autoreply</emphasis></entry>
39621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39622 <entry>Default: <emphasis>unset</emphasis></entry>
39623 </row>
39624 </tbody>
39625 </tgroup>
39626 </informaltable>
39627 <para>
39628 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39629 specified by the transport.
39630 </para>
39631 <para>
39632 <indexterm role="option">
39633 <primary><option>return_message</option></primary>
39634 </indexterm>
39635 </para>
39636 <informaltable frame="all">
39637 <tgroup cols="4" colsep="0" rowsep="0">
39638 <colspec colwidth="8*" align="left"/>
39639 <colspec colwidth="6*" align="center"/>
39640 <colspec colwidth="6*" align="center"/>
39641 <colspec colwidth="6*" align="right"/>
39642 <tbody>
39643 <row>
39644 <entry><option>return_message</option></entry>
39645 <entry>Use: <emphasis>autoreply</emphasis></entry>
39646 <entry>Type: <emphasis>boolean</emphasis></entry>
39647 <entry>Default: <emphasis>false</emphasis></entry>
39648 </row>
39649 </tbody>
39650 </tgroup>
39651 </informaltable>
39652 <para>
39653 If this is set, a copy of the original message is returned with the new
39654 message, subject to the maximum size set in the <option>return_size_limit</option> global
39655 configuration option.
39656 </para>
39657 <para>
39658 <indexterm role="option">
39659 <primary><option>subject</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>subject</option></entry>
39671 <entry>Use: <emphasis>autoreply</emphasis></entry>
39672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39673 <entry>Default: <emphasis>unset</emphasis></entry>
39674 </row>
39675 </tbody>
39676 </tgroup>
39677 </informaltable>
39678 <para>
39679 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39680 specified by the transport. It is tempting to quote the original subject in
39681 automatic responses. For example:
39682 </para>
39683 <literallayout class="monospaced">
39684 subject = Re: $h_subject:
39685 </literallayout>
39686 <para>
39687 There is a danger in doing this, however. It may allow a third party to
39688 subscribe your users to an opt-in mailing list, provided that the list accepts
39689 bounce messages as subscription confirmations. Well-managed lists require a
39690 non-bounce message to confirm a subscription, so the danger is relatively
39691 small.
39692 </para>
39693 <para>
39694 <indexterm role="option">
39695 <primary><option>text</option></primary>
39696 </indexterm>
39697 </para>
39698 <informaltable frame="all">
39699 <tgroup cols="4" colsep="0" rowsep="0">
39700 <colspec colwidth="8*" align="left"/>
39701 <colspec colwidth="6*" align="center"/>
39702 <colspec colwidth="6*" align="center"/>
39703 <colspec colwidth="6*" align="right"/>
39704 <tbody>
39705 <row>
39706 <entry><option>text</option></entry>
39707 <entry>Use: <emphasis>autoreply</emphasis></entry>
39708 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39709 <entry>Default: <emphasis>unset</emphasis></entry>
39710 </row>
39711 </tbody>
39712 </tgroup>
39713 </informaltable>
39714 <para>
39715 This specifies a single string to be used as the body of the message when the
39716 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39717 the text comes first.
39718 </para>
39719 <para>
39720 <indexterm role="option">
39721 <primary><option>to</option></primary>
39722 </indexterm>
39723 </para>
39724 <informaltable frame="all">
39725 <tgroup cols="4" colsep="0" rowsep="0">
39726 <colspec colwidth="8*" align="left"/>
39727 <colspec colwidth="6*" align="center"/>
39728 <colspec colwidth="6*" align="center"/>
39729 <colspec colwidth="6*" align="right"/>
39730 <tbody>
39731 <row>
39732 <entry><option>to</option></entry>
39733 <entry>Use: <emphasis>autoreply</emphasis></entry>
39734 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39735 <entry>Default: <emphasis>unset</emphasis></entry>
39736 </row>
39737 </tbody>
39738 </tgroup>
39739 </informaltable>
39740 <para>
39741 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39742 when the message is specified by the transport.
39743 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39744 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39745 </para>
39746 </section>
39747 </chapter>
39748
39749 <chapter id="CHAPLMTP">
39750 <title>The lmtp transport</title>
39751 <para>
39752 <indexterm role="concept">
39753 <primary>transports</primary>
39754 <secondary><command>lmtp</command></secondary>
39755 </indexterm>
39756 <indexterm role="concept">
39757 <primary><command>lmtp</command> transport</primary>
39758 </indexterm>
39759 <indexterm role="concept">
39760 <primary>LMTP</primary>
39761 <secondary>over a pipe</secondary>
39762 </indexterm>
39763 <indexterm role="concept">
39764 <primary>LMTP</primary>
39765 <secondary>over a socket</secondary>
39766 </indexterm>
39767 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39768 specified command
39769 or by interacting with a Unix domain socket.
39770 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39771 transports. Exim also has support for using LMTP over TCP/IP; this is
39772 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39773 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39774 has it commented out. You need to ensure that
39775 </para>
39776 <literallayout class="monospaced">
39777 TRANSPORT_LMTP=yes
39778 </literallayout>
39779 <para>
39780 <indexterm role="concept">
39781 <primary>options</primary>
39782 <secondary><command>lmtp</command> transport</secondary>
39783 </indexterm>
39784 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
39785 included in the Exim binary. The private options of the <command>lmtp</command> transport are
39786 as follows:
39787 </para>
39788 <para>
39789 <indexterm role="option">
39790 <primary><option>batch_id</option></primary>
39791 </indexterm>
39792 </para>
39793 <informaltable frame="all">
39794 <tgroup cols="4" colsep="0" rowsep="0">
39795 <colspec colwidth="8*" align="left"/>
39796 <colspec colwidth="6*" align="center"/>
39797 <colspec colwidth="6*" align="center"/>
39798 <colspec colwidth="6*" align="right"/>
39799 <tbody>
39800 <row>
39801 <entry><option>batch_id</option></entry>
39802 <entry>Use: <emphasis>lmtp</emphasis></entry>
39803 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39804 <entry>Default: <emphasis>unset</emphasis></entry>
39805 </row>
39806 </tbody>
39807 </tgroup>
39808 </informaltable>
39809 <para>
39810 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39811 </para>
39812 <para>
39813 <indexterm role="option">
39814 <primary><option>batch_max</option></primary>
39815 </indexterm>
39816 </para>
39817 <informaltable frame="all">
39818 <tgroup cols="4" colsep="0" rowsep="0">
39819 <colspec colwidth="8*" align="left"/>
39820 <colspec colwidth="6*" align="center"/>
39821 <colspec colwidth="6*" align="center"/>
39822 <colspec colwidth="6*" align="right"/>
39823 <tbody>
39824 <row>
39825 <entry><option>batch_max</option></entry>
39826 <entry>Use: <emphasis>lmtp</emphasis></entry>
39827 <entry>Type: <emphasis>integer</emphasis></entry>
39828 <entry>Default: <emphasis>1</emphasis></entry>
39829 </row>
39830 </tbody>
39831 </tgroup>
39832 </informaltable>
39833 <para>
39834 This limits the number of addresses that can be handled in a single delivery.
39835 Most LMTP servers can handle several addresses at once, so it is normally a
39836 good idea to increase this value. See the description of local delivery
39837 batching in chapter <xref linkend="CHAPbatching"/>.
39838 </para>
39839 <para>
39840 <indexterm role="option">
39841 <primary><option>command</option></primary>
39842 </indexterm>
39843 </para>
39844 <informaltable frame="all">
39845 <tgroup cols="4" colsep="0" rowsep="0">
39846 <colspec colwidth="8*" align="left"/>
39847 <colspec colwidth="6*" align="center"/>
39848 <colspec colwidth="6*" align="center"/>
39849 <colspec colwidth="6*" align="right"/>
39850 <tbody>
39851 <row>
39852 <entry><option>command</option></entry>
39853 <entry>Use: <emphasis>lmtp</emphasis></entry>
39854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39855 <entry>Default: <emphasis>unset</emphasis></entry>
39856 </row>
39857 </tbody>
39858 </tgroup>
39859 </informaltable>
39860 <para>
39861 This option must be set if <option>socket</option> is not set. The string is a command which
39862 is run in a separate process. It is split up into a command name and list of
39863 arguments, each of which is separately expanded (so expansion cannot change the
39864 number of arguments). The command is run directly, not via a shell. The message
39865 is passed to the new process using the standard input and output to operate the
39866 LMTP protocol.
39867 </para>
39868 <para>
39869 <indexterm role="option">
39870 <primary><option>ignore_quota</option></primary>
39871 </indexterm>
39872 </para>
39873 <informaltable frame="all">
39874 <tgroup cols="4" colsep="0" rowsep="0">
39875 <colspec colwidth="8*" align="left"/>
39876 <colspec colwidth="6*" align="center"/>
39877 <colspec colwidth="6*" align="center"/>
39878 <colspec colwidth="6*" align="right"/>
39879 <tbody>
39880 <row>
39881 <entry><option>ignore_quota</option></entry>
39882 <entry>Use: <emphasis>lmtp</emphasis></entry>
39883 <entry>Type: <emphasis>boolean</emphasis></entry>
39884 <entry>Default: <emphasis>false</emphasis></entry>
39885 </row>
39886 </tbody>
39887 </tgroup>
39888 </informaltable>
39889 <para>
39890 <indexterm role="concept">
39891 <primary>LMTP</primary>
39892 <secondary>ignoring quota errors</secondary>
39893 </indexterm>
39894 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39895 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39896 in its response to the LHLO command.
39897 </para>
39898 <para>
39899 <indexterm role="option">
39900 <primary><option>socket</option></primary>
39901 </indexterm>
39902 </para>
39903 <informaltable frame="all">
39904 <tgroup cols="4" colsep="0" rowsep="0">
39905 <colspec colwidth="8*" align="left"/>
39906 <colspec colwidth="6*" align="center"/>
39907 <colspec colwidth="6*" align="center"/>
39908 <colspec colwidth="6*" align="right"/>
39909 <tbody>
39910 <row>
39911 <entry><option>socket</option></entry>
39912 <entry>Use: <emphasis>lmtp</emphasis></entry>
39913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39914 <entry>Default: <emphasis>unset</emphasis></entry>
39915 </row>
39916 </tbody>
39917 </tgroup>
39918 </informaltable>
39919 <para>
39920 This option must be set if <option>command</option> is not set. The result of expansion must
39921 be the name of a Unix domain socket. The transport connects to the socket and
39922 delivers the message to it using the LMTP protocol.
39923 </para>
39924 <para>
39925 <indexterm role="option">
39926 <primary><option>timeout</option></primary>
39927 </indexterm>
39928 </para>
39929 <informaltable frame="all">
39930 <tgroup cols="4" colsep="0" rowsep="0">
39931 <colspec colwidth="8*" align="left"/>
39932 <colspec colwidth="6*" align="center"/>
39933 <colspec colwidth="6*" align="center"/>
39934 <colspec colwidth="6*" align="right"/>
39935 <tbody>
39936 <row>
39937 <entry><option>timeout</option></entry>
39938 <entry>Use: <emphasis>lmtp</emphasis></entry>
39939 <entry>Type: <emphasis>time</emphasis></entry>
39940 <entry>Default: <emphasis>5m</emphasis></entry>
39941 </row>
39942 </tbody>
39943 </tgroup>
39944 </informaltable>
39945 <para>
39946 The transport is aborted if the created process or Unix domain socket does not
39947 respond to LMTP commands or message input within this timeout. Delivery
39948 is deferred, and will be tried again later. Here is an example of a typical
39949 LMTP transport:
39950 </para>
39951 <literallayout class="monospaced">
39952 lmtp:
39953   driver = lmtp
39954   command = /some/local/lmtp/delivery/program
39955   batch_max = 20
39956   user = exim
39957 </literallayout>
39958 <para>
39959 This delivers up to 20 addresses at a time, in a mixture of domains if
39960 necessary, running as the user <emphasis>exim</emphasis>.
39961 </para>
39962 </chapter>
39963
39964 <chapter id="CHAPpipetransport">
39965 <title>The pipe transport</title>
39966 <para>
39967 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39968 <primary>transports</primary>
39969 <secondary><command>pipe</command></secondary>
39970 </indexterm>
39971 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39972 <primary><command>pipe</command> transport</primary>
39973 </indexterm>
39974 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39975 running in another process. One example is the use of <command>pipe</command> as a
39976 pseudo-remote transport for passing messages to some other delivery mechanism
39977 (such as UUCP). Another is the use by individual users to automatically process
39978 their incoming messages. The <command>pipe</command> transport can be used in one of the
39979 following ways:
39980 </para>
39981 <itemizedlist>
39982 <listitem>
39983 <para>
39984 <indexterm role="variable">
39985 <primary><varname>$local_part</varname></primary>
39986 </indexterm>
39987 A router routes one address to a transport in the normal way, and the
39988 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
39989 contains the local part of the address (as usual), and the command that is run
39990 is specified by the <option>command</option> option on the transport.
39991 </para>
39992 </listitem>
39993 <listitem>
39994 <para>
39995 <indexterm role="variable">
39996 <primary><varname>$pipe_addresses</varname></primary>
39997 </indexterm>
39998 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
39999 transport can handle more than one address in a single run. In this case, when
40000 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40001 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40002 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40003 that are routed to the transport.
40004 </para>
40005 </listitem>
40006 <listitem>
40007 <para>
40008 <indexterm role="variable">
40009 <primary><varname>$address_pipe</varname></primary>
40010 </indexterm>
40011 A router redirects an address directly to a pipe command (for example, from an
40012 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40013 pipe command, and the <option>command</option> option on the transport is ignored. If only
40014 one address is being transported (<option>batch_max</option> is not greater than one, or
40015 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40016 the local part that was redirected.
40017 </para>
40018 </listitem>
40019 </itemizedlist>
40020 <para>
40021 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40022 deliver messages over pipes using the LMTP interactive protocol. This is
40023 implemented by the <command>lmtp</command> transport.
40024 </para>
40025 <para>
40026 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
40027 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40028 other cases, the uid and gid have to be specified explicitly, either on the
40029 transport or on the router that handles the address. Current and <quote>home</quote>
40030 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40031 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40032 for a discussion of local delivery batching.
40033 </para>
40034 <section id="SECID140">
40035 <title>Concurrent delivery</title>
40036 <para>
40037 If two messages arrive at almost the same time, and both are routed to a pipe
40038 delivery, the two pipe transports may be run concurrently. You must ensure that
40039 any pipe commands you set up are robust against this happening. If the commands
40040 write to a file, the <option>exim_lock</option> utility might be of use.
40041 </para>
40042 </section>
40043 <section id="SECID141">
40044 <title>Returned status and data</title>
40045 <para>
40046 <indexterm role="concept">
40047 <primary><command>pipe</command> transport</primary>
40048 <secondary>returned data</secondary>
40049 </indexterm>
40050 If the command exits with a non-zero return code, the delivery is deemed to
40051 have failed, unless either the <option>ignore_status</option> option is set (in which case
40052 the return code is treated as zero), or the return code is one of those listed
40053 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40054 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40055 logged, but are not included in the bounce message, which merely contains
40056 <quote>local delivery failed</quote>.
40057 </para>
40058 <para>
40059 If the return code is greater than 128 and the command being run is a shell
40060 script, it normally means that the script was terminated by a signal whose
40061 value is the return code minus 128.
40062 </para>
40063 <para>
40064 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40065 return code is set to 127. This is the value that a shell returns if it is
40066 asked to run a non-existent command. The wording for the log line suggests that
40067 a non-existent command may be the problem.
40068 </para>
40069 <para>
40070 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40071 set and the command produces any output on its standard output or standard
40072 error streams, the command is considered to have failed, even if it gave a zero
40073 return code or if <option>ignore_status</option> is set. The output from the command is
40074 included as part of the bounce message. The <option>return_fail_output</option> option is
40075 similar, except that output is returned only when the command exits with a
40076 failure return code, that is, a value other than zero or a code that matches
40077 <option>temp_errors</option>.
40078 </para>
40079 </section>
40080 <section id="SECThowcommandrun">
40081 <title>How the command is run</title>
40082 <para>
40083 <indexterm role="concept">
40084 <primary><command>pipe</command> transport</primary>
40085 <secondary>path for command</secondary>
40086 </indexterm>
40087 The command line is (by default) broken down into a command name and arguments
40088 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40089 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40090 run.
40091 </para>
40092 <para>
40093 <indexterm role="concept">
40094 <primary>quoting</primary>
40095 <secondary>in pipe command</secondary>
40096 </indexterm>
40097 Unquoted arguments are delimited by white space. If an argument appears in
40098 double quotes, backslash is interpreted as an escape character in the usual
40099 way. If an argument appears in single quotes, no escaping is done.
40100 </para>
40101 <para>
40102 String expansion is applied to the command line except when it comes from a
40103 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40104 expansion is applied to each argument in turn rather than to the whole line.
40105 For this reason, any string expansion item that contains white space must be
40106 quoted so as to be contained within a single argument. A setting such as
40107 </para>
40108 <literallayout class="monospaced">
40109 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40110 </literallayout>
40111 <para>
40112 will not work, because the expansion item gets split between several
40113 arguments. You have to write
40114 </para>
40115 <literallayout class="monospaced">
40116 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40117 </literallayout>
40118 <para>
40119 to ensure that it is all in one argument. The expansion is done in this way,
40120 argument by argument, so that the number of arguments cannot be changed as a
40121 result of expansion, and quotes or backslashes in inserted variables do not
40122 interact with external quoting. However, this leads to problems if you want to
40123 generate multiple arguments (or the command name plus arguments) from a single
40124 expansion. In this situation, the simplest solution is to use a shell. For
40125 example:
40126 </para>
40127 <literallayout class="monospaced">
40128 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40129 </literallayout>
40130 <para>
40131 <indexterm role="concept">
40132 <primary>transport</primary>
40133 <secondary>filter</secondary>
40134 </indexterm>
40135 <indexterm role="concept">
40136 <primary>filter</primary>
40137 <secondary>transport filter</secondary>
40138 </indexterm>
40139 <indexterm role="variable">
40140 <primary><varname>$pipe_addresses</varname></primary>
40141 </indexterm>
40142 Special handling takes place when an argument consists of precisely the text
40143 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40144 place this string is recognized is when it appears as an argument for a pipe or
40145 transport filter command. It causes each address that is being handled to be
40146 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40147 avoids any problems with spaces or shell metacharacters, and is of use when a
40148 <command>pipe</command> transport is handling groups of addresses in a batch.
40149 </para>
40150 <para>
40151 After splitting up into arguments and expansion, the resulting command is run
40152 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40153 message that is being delivered is supplied on the standard input, and the
40154 standard output and standard error are both connected to a single pipe that is
40155 read by Exim. The <option>max_output</option> option controls how much output the command
40156 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40157 control what is done with it.
40158 </para>
40159 <para>
40160 Not running the command under a shell (by default) lessens the security risks
40161 in cases when a command from a user&#x2019;s filter file is built out of data that was
40162 taken from an incoming message. If a shell is required, it can of course be
40163 explicitly specified as the command to be run. However, there are circumstances
40164 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40165 under a shell and cannot easily be modified. To allow for these cases, there is
40166 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40167 works. Instead of breaking up the command line as just described, it expands it
40168 as a single string and passes the result to <filename>/bin/sh</filename>. The
40169 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40170 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40171 </para>
40172 </section>
40173 <section id="SECTpipeenv">
40174 <title>Environment variables</title>
40175 <para>
40176 <indexterm role="concept">
40177 <primary><command>pipe</command> transport</primary>
40178 <secondary>environment for command</secondary>
40179 </indexterm>
40180 <indexterm role="concept">
40181 <primary>environment for pipe transport</primary>
40182 </indexterm>
40183 The environment variables listed below are set up when the command is invoked.
40184 This list is a compromise for maximum compatibility with other MTAs. Note that
40185 the <option>environment</option> option can be used to add additional variables to this
40186 environment.
40187 </para>
40188 <literallayout>
40189 <literal>DOMAIN            </literal>   the domain of the address
40190 <literal>HOME              </literal>   the home directory, if set
40191 <literal>HOST              </literal>   the host name when called from a router (see below)
40192 <literal>LOCAL_PART        </literal>   see below
40193 <literal>LOCAL_PART_PREFIX </literal>   see below
40194 <literal>LOCAL_PART_SUFFIX </literal>   see below
40195 <literal>LOGNAME           </literal>   see below
40196 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
40197 <literal>PATH              </literal>   as specified by the <option>path</option> option below
40198 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
40199 <literal>RECIPIENT         </literal>   the complete recipient address
40200 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
40201 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
40202 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
40203 <literal>USER              </literal>   see below
40204 </literallayout>
40205 <para>
40206 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40207 router, LOCAL_PART is set to the local part of the address. When it is
40208 called as a result of a forward or alias expansion, LOCAL_PART is set to
40209 the local part of the address that was expanded. In both cases, any affixes are
40210 removed from the local part, and made available in LOCAL_PART_PREFIX and
40211 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40212 same value as LOCAL_PART for compatibility with other MTAs.
40213 </para>
40214 <para>
40215 <indexterm role="concept">
40216 <primary>HOST</primary>
40217 </indexterm>
40218 HOST is set only when a <command>pipe</command> transport is called from a router that
40219 associates hosts with an address, typically when using <command>pipe</command> as a
40220 pseudo-remote transport. HOST is set to the first host name specified by
40221 the router.
40222 </para>
40223 <para>
40224 <indexterm role="concept">
40225 <primary>HOME</primary>
40226 </indexterm>
40227 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
40228 for the HOME environment variable. Otherwise, a home directory may be set
40229 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
40230 user&#x2019;s home directory if <option>check_local_user</option> is set.
40231 </para>
40232 </section>
40233 <section id="SECID142">
40234 <title>Private options for pipe</title>
40235 <para>
40236 <indexterm role="concept">
40237 <primary>options</primary>
40238 <secondary><command>pipe</command> transport</secondary>
40239 </indexterm>
40240 </para>
40241 <para>
40242 <indexterm role="option">
40243 <primary><option>allow_commands</option></primary>
40244 </indexterm>
40245 </para>
40246 <informaltable frame="all">
40247 <tgroup cols="4" colsep="0" rowsep="0">
40248 <colspec colwidth="8*" align="left"/>
40249 <colspec colwidth="6*" align="center"/>
40250 <colspec colwidth="6*" align="center"/>
40251 <colspec colwidth="6*" align="right"/>
40252 <tbody>
40253 <row>
40254 <entry><option>allow_commands</option></entry>
40255 <entry>Use: <emphasis>pipe</emphasis></entry>
40256 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40257 <entry>Default: <emphasis>unset</emphasis></entry>
40258 </row>
40259 </tbody>
40260 </tgroup>
40261 </informaltable>
40262 <para>
40263 <indexterm role="concept">
40264 <primary><command>pipe</command> transport</primary>
40265 <secondary>permitted commands</secondary>
40266 </indexterm>
40267 The string is expanded, and is then interpreted as a colon-separated list of
40268 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40269 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40270 paths; the <option>path</option> option is still used for relative paths. If
40271 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40272 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40273 the path. In other words, if neither <option>allow_commands</option> nor
40274 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40275 otherwise only commands that are permitted by one or the other are allowed. For
40276 example, if
40277 </para>
40278 <literallayout class="monospaced">
40279 allow_commands = /usr/bin/vacation
40280 </literallayout>
40281 <para>
40282 and <option>restrict_to_path</option> is not set, the only permitted command is
40283 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40284 <option>use_shell</option> is set.
40285 </para>
40286 <para>
40287 <indexterm role="option">
40288 <primary><option>batch_id</option></primary>
40289 </indexterm>
40290 </para>
40291 <informaltable frame="all">
40292 <tgroup cols="4" colsep="0" rowsep="0">
40293 <colspec colwidth="8*" align="left"/>
40294 <colspec colwidth="6*" align="center"/>
40295 <colspec colwidth="6*" align="center"/>
40296 <colspec colwidth="6*" align="right"/>
40297 <tbody>
40298 <row>
40299 <entry><option>batch_id</option></entry>
40300 <entry>Use: <emphasis>pipe</emphasis></entry>
40301 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40302 <entry>Default: <emphasis>unset</emphasis></entry>
40303 </row>
40304 </tbody>
40305 </tgroup>
40306 </informaltable>
40307 <para>
40308 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40309 </para>
40310 <para>
40311 <indexterm role="option">
40312 <primary><option>batch_max</option></primary>
40313 </indexterm>
40314 </para>
40315 <informaltable frame="all">
40316 <tgroup cols="4" colsep="0" rowsep="0">
40317 <colspec colwidth="8*" align="left"/>
40318 <colspec colwidth="6*" align="center"/>
40319 <colspec colwidth="6*" align="center"/>
40320 <colspec colwidth="6*" align="right"/>
40321 <tbody>
40322 <row>
40323 <entry><option>batch_max</option></entry>
40324 <entry>Use: <emphasis>pipe</emphasis></entry>
40325 <entry>Type: <emphasis>integer</emphasis></entry>
40326 <entry>Default: <emphasis>1</emphasis></entry>
40327 </row>
40328 </tbody>
40329 </tgroup>
40330 </informaltable>
40331 <para>
40332 This limits the number of addresses that can be handled in a single delivery.
40333 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40334 </para>
40335 <para>
40336 <indexterm role="option">
40337 <primary><option>check_string</option></primary>
40338 </indexterm>
40339 </para>
40340 <informaltable frame="all">
40341 <tgroup cols="4" colsep="0" rowsep="0">
40342 <colspec colwidth="8*" align="left"/>
40343 <colspec colwidth="6*" align="center"/>
40344 <colspec colwidth="6*" align="center"/>
40345 <colspec colwidth="6*" align="right"/>
40346 <tbody>
40347 <row>
40348 <entry><option>check_string</option></entry>
40349 <entry>Use: <emphasis>pipe</emphasis></entry>
40350 <entry>Type: <emphasis>string</emphasis></entry>
40351 <entry>Default: <emphasis>unset</emphasis></entry>
40352 </row>
40353 </tbody>
40354 </tgroup>
40355 </informaltable>
40356 <para>
40357 As <command>pipe</command> writes the message, the start of each line is tested for matching
40358 <option>check_string</option>, and if it does, the initial matching characters are replaced
40359 by the contents of <option>escape_string</option>, provided both are set. The value of
40360 <option>check_string</option> is a literal string, not a regular expression, and the case of
40361 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40362 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40363 the SMTP escaping protocol. Any settings made in the configuration file are
40364 ignored.
40365 </para>
40366 <para>
40367 <indexterm role="option">
40368 <primary><option>command</option></primary>
40369 </indexterm>
40370 </para>
40371 <informaltable frame="all">
40372 <tgroup cols="4" colsep="0" rowsep="0">
40373 <colspec colwidth="8*" align="left"/>
40374 <colspec colwidth="6*" align="center"/>
40375 <colspec colwidth="6*" align="center"/>
40376 <colspec colwidth="6*" align="right"/>
40377 <tbody>
40378 <row>
40379 <entry><option>command</option></entry>
40380 <entry>Use: <emphasis>pipe</emphasis></entry>
40381 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40382 <entry>Default: <emphasis>unset</emphasis></entry>
40383 </row>
40384 </tbody>
40385 </tgroup>
40386 </informaltable>
40387 <para>
40388 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40389 obtained directly from address redirections. In other cases, the option must be
40390 set, to provide a command to be run. It need not yield an absolute path (see
40391 the <option>path</option> option below). The command is split up into separate arguments by
40392 Exim, and each argument is separately expanded, as described in section
40393 <xref linkend="SECThowcommandrun"/> above.
40394 </para>
40395 <para>
40396 <indexterm role="option">
40397 <primary><option>environment</option></primary>
40398 </indexterm>
40399 </para>
40400 <informaltable frame="all">
40401 <tgroup cols="4" colsep="0" rowsep="0">
40402 <colspec colwidth="8*" align="left"/>
40403 <colspec colwidth="6*" align="center"/>
40404 <colspec colwidth="6*" align="center"/>
40405 <colspec colwidth="6*" align="right"/>
40406 <tbody>
40407 <row>
40408 <entry><option>environment</option></entry>
40409 <entry>Use: <emphasis>pipe</emphasis></entry>
40410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40411 <entry>Default: <emphasis>unset</emphasis></entry>
40412 </row>
40413 </tbody>
40414 </tgroup>
40415 </informaltable>
40416 <para>
40417 <indexterm role="concept">
40418 <primary><command>pipe</command> transport</primary>
40419 <secondary>environment for command</secondary>
40420 </indexterm>
40421 <indexterm role="concept">
40422 <primary>environment for <command>pipe</command> transport</primary>
40423 </indexterm>
40424 This option is used to add additional variables to the environment in which the
40425 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40426 a string which is expanded, and then interpreted as a colon-separated list of
40427 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
40428 </para>
40429 <para>
40430 <indexterm role="option">
40431 <primary><option>escape_string</option></primary>
40432 </indexterm>
40433 </para>
40434 <informaltable frame="all">
40435 <tgroup cols="4" colsep="0" rowsep="0">
40436 <colspec colwidth="8*" align="left"/>
40437 <colspec colwidth="6*" align="center"/>
40438 <colspec colwidth="6*" align="center"/>
40439 <colspec colwidth="6*" align="right"/>
40440 <tbody>
40441 <row>
40442 <entry><option>escape_string</option></entry>
40443 <entry>Use: <emphasis>pipe</emphasis></entry>
40444 <entry>Type: <emphasis>string</emphasis></entry>
40445 <entry>Default: <emphasis>unset</emphasis></entry>
40446 </row>
40447 </tbody>
40448 </tgroup>
40449 </informaltable>
40450 <para>
40451 See <option>check_string</option> above.
40452 </para>
40453 <para>
40454 <indexterm role="option">
40455 <primary><option>freeze_exec_fail</option></primary>
40456 </indexterm>
40457 </para>
40458 <informaltable frame="all">
40459 <tgroup cols="4" colsep="0" rowsep="0">
40460 <colspec colwidth="8*" align="left"/>
40461 <colspec colwidth="6*" align="center"/>
40462 <colspec colwidth="6*" align="center"/>
40463 <colspec colwidth="6*" align="right"/>
40464 <tbody>
40465 <row>
40466 <entry><option>freeze_exec_fail</option></entry>
40467 <entry>Use: <emphasis>pipe</emphasis></entry>
40468 <entry>Type: <emphasis>boolean</emphasis></entry>
40469 <entry>Default: <emphasis>false</emphasis></entry>
40470 </row>
40471 </tbody>
40472 </tgroup>
40473 </informaltable>
40474 <para>
40475 <indexterm role="concept">
40476 <primary>exec failure</primary>
40477 </indexterm>
40478 <indexterm role="concept">
40479 <primary>failure of exec</primary>
40480 </indexterm>
40481 <indexterm role="concept">
40482 <primary><command>pipe</command> transport</primary>
40483 <secondary>failure of exec</secondary>
40484 </indexterm>
40485 Failure to exec the command in a pipe transport is by default treated like
40486 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40487 is set, failure to exec is treated specially, and causes the message to be
40488 frozen, whatever the setting of <option>ignore_status</option>.
40489 </para>
40490 <para>
40491 <indexterm role="option">
40492 <primary><option>ignore_status</option></primary>
40493 </indexterm>
40494 </para>
40495 <informaltable frame="all">
40496 <tgroup cols="4" colsep="0" rowsep="0">
40497 <colspec colwidth="8*" align="left"/>
40498 <colspec colwidth="6*" align="center"/>
40499 <colspec colwidth="6*" align="center"/>
40500 <colspec colwidth="6*" align="right"/>
40501 <tbody>
40502 <row>
40503 <entry><option>ignore_status</option></entry>
40504 <entry>Use: <emphasis>pipe</emphasis></entry>
40505 <entry>Type: <emphasis>boolean</emphasis></entry>
40506 <entry>Default: <emphasis>false</emphasis></entry>
40507 </row>
40508 </tbody>
40509 </tgroup>
40510 </informaltable>
40511 <para>
40512 If this option is true, the status returned by the subprocess that is set up to
40513 run the command is ignored, and Exim behaves as if zero had been returned.
40514 Otherwise, a non-zero status or termination by signal causes an error return
40515 from the transport unless the status value is one of those listed in
40516 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40517 </para>
40518 <para>
40519 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40520 See the <option>timeout_defer</option> option for how timeouts are handled.
40521 </para>
40522 <para>
40523 <indexterm role="option">
40524 <primary><option>log_defer_output</option></primary>
40525 </indexterm>
40526 </para>
40527 <informaltable frame="all">
40528 <tgroup cols="4" colsep="0" rowsep="0">
40529 <colspec colwidth="8*" align="left"/>
40530 <colspec colwidth="6*" align="center"/>
40531 <colspec colwidth="6*" align="center"/>
40532 <colspec colwidth="6*" align="right"/>
40533 <tbody>
40534 <row>
40535 <entry><option>log_defer_output</option></entry>
40536 <entry>Use: <emphasis>pipe</emphasis></entry>
40537 <entry>Type: <emphasis>boolean</emphasis></entry>
40538 <entry>Default: <emphasis>false</emphasis></entry>
40539 </row>
40540 </tbody>
40541 </tgroup>
40542 </informaltable>
40543 <para>
40544 <indexterm role="concept">
40545 <primary><command>pipe</command> transport</primary>
40546 <secondary>logging output</secondary>
40547 </indexterm>
40548 If this option is set, and the status returned by the command is
40549 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40550 and any output was produced, the first line of it is written to the main log.
40551 </para>
40552 <para>
40553 <indexterm role="option">
40554 <primary><option>log_fail_output</option></primary>
40555 </indexterm>
40556 </para>
40557 <informaltable frame="all">
40558 <tgroup cols="4" colsep="0" rowsep="0">
40559 <colspec colwidth="8*" align="left"/>
40560 <colspec colwidth="6*" align="center"/>
40561 <colspec colwidth="6*" align="center"/>
40562 <colspec colwidth="6*" align="right"/>
40563 <tbody>
40564 <row>
40565 <entry><option>log_fail_output</option></entry>
40566 <entry>Use: <emphasis>pipe</emphasis></entry>
40567 <entry>Type: <emphasis>boolean</emphasis></entry>
40568 <entry>Default: <emphasis>false</emphasis></entry>
40569 </row>
40570 </tbody>
40571 </tgroup>
40572 </informaltable>
40573 <para>
40574 If this option is set, and the command returns any output, and also ends with a
40575 return code that is neither zero nor one of the return codes listed in
40576 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40577 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40578 Only one of them may be set.
40579 </para>
40580 <para>
40581 <indexterm role="option">
40582 <primary><option>log_output</option></primary>
40583 </indexterm>
40584 </para>
40585 <informaltable frame="all">
40586 <tgroup cols="4" colsep="0" rowsep="0">
40587 <colspec colwidth="8*" align="left"/>
40588 <colspec colwidth="6*" align="center"/>
40589 <colspec colwidth="6*" align="center"/>
40590 <colspec colwidth="6*" align="right"/>
40591 <tbody>
40592 <row>
40593 <entry><option>log_output</option></entry>
40594 <entry>Use: <emphasis>pipe</emphasis></entry>
40595 <entry>Type: <emphasis>boolean</emphasis></entry>
40596 <entry>Default: <emphasis>false</emphasis></entry>
40597 </row>
40598 </tbody>
40599 </tgroup>
40600 </informaltable>
40601 <para>
40602 If this option is set and the command returns any output, the first line of
40603 output is written to the main log, whatever the return code. This option and
40604 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40605 </para>
40606 <para>
40607 <indexterm role="option">
40608 <primary><option>max_output</option></primary>
40609 </indexterm>
40610 </para>
40611 <informaltable frame="all">
40612 <tgroup cols="4" colsep="0" rowsep="0">
40613 <colspec colwidth="8*" align="left"/>
40614 <colspec colwidth="6*" align="center"/>
40615 <colspec colwidth="6*" align="center"/>
40616 <colspec colwidth="6*" align="right"/>
40617 <tbody>
40618 <row>
40619 <entry><option>max_output</option></entry>
40620 <entry>Use: <emphasis>pipe</emphasis></entry>
40621 <entry>Type: <emphasis>integer</emphasis></entry>
40622 <entry>Default: <emphasis>20K</emphasis></entry>
40623 </row>
40624 </tbody>
40625 </tgroup>
40626 </informaltable>
40627 <para>
40628 This specifies the maximum amount of output that the command may produce on its
40629 standard output and standard error file combined. If the limit is exceeded, the
40630 process running the command is killed. This is intended as a safety measure to
40631 catch runaway processes. The limit is applied independently of the settings of
40632 the options that control what is done with such output (for example,
40633 <option>return_output</option>). Because of buffering effects, the amount of output may
40634 exceed the limit by a small amount before Exim notices.
40635 </para>
40636 <para>
40637 <indexterm role="option">
40638 <primary><option>message_prefix</option></primary>
40639 </indexterm>
40640 </para>
40641 <informaltable frame="all">
40642 <tgroup cols="4" colsep="0" rowsep="0">
40643 <colspec colwidth="8*" align="left"/>
40644 <colspec colwidth="6*" align="center"/>
40645 <colspec colwidth="6*" align="center"/>
40646 <colspec colwidth="6*" align="right"/>
40647 <tbody>
40648 <row>
40649 <entry><option>message_prefix</option></entry>
40650 <entry>Use: <emphasis>pipe</emphasis></entry>
40651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40652 <entry>Default: <emphasis>see below</emphasis></entry>
40653 </row>
40654 </tbody>
40655 </tgroup>
40656 </informaltable>
40657 <para>
40658 The string specified here is expanded and output at the start of every message.
40659 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40660 </para>
40661 <literallayout class="monospaced">
40662 message_prefix = \
40663   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40664   ${tod_bsdinbox}\n
40665 </literallayout>
40666 <para>
40667 <indexterm role="concept">
40668 <primary>Cyrus</primary>
40669 </indexterm>
40670 <indexterm role="concept">
40671 <primary><option>tmail</option></primary>
40672 </indexterm>
40673 <indexterm role="concept">
40674 <primary><quote>From</quote> line</primary>
40675 </indexterm>
40676 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40677 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40678 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40679 setting
40680 </para>
40681 <literallayout class="monospaced">
40682 message_prefix =
40683 </literallayout>
40684 <para>
40685 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40686 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40687 </para>
40688 <para>
40689 <indexterm role="option">
40690 <primary><option>message_suffix</option></primary>
40691 </indexterm>
40692 </para>
40693 <informaltable frame="all">
40694 <tgroup cols="4" colsep="0" rowsep="0">
40695 <colspec colwidth="8*" align="left"/>
40696 <colspec colwidth="6*" align="center"/>
40697 <colspec colwidth="6*" align="center"/>
40698 <colspec colwidth="6*" align="right"/>
40699 <tbody>
40700 <row>
40701 <entry><option>message_suffix</option></entry>
40702 <entry>Use: <emphasis>pipe</emphasis></entry>
40703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40704 <entry>Default: <emphasis>see below</emphasis></entry>
40705 </row>
40706 </tbody>
40707 </tgroup>
40708 </informaltable>
40709 <para>
40710 The string specified here is expanded and output at the end of every message.
40711 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40712 The suffix can be suppressed by setting
40713 </para>
40714 <literallayout class="monospaced">
40715 message_suffix =
40716 </literallayout>
40717 <para>
40718 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40719 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40720 </para>
40721 <para>
40722 <indexterm role="option">
40723 <primary><option>path</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>path</option></entry>
40735 <entry>Use: <emphasis>pipe</emphasis></entry>
40736 <entry>Type: <emphasis>string</emphasis></entry>
40737 <entry>Default: <emphasis>see below</emphasis></entry>
40738 </row>
40739 </tbody>
40740 </tgroup>
40741 </informaltable>
40742 <para>
40743 This option specifies the string that is set up in the PATH environment
40744 variable of the subprocess. The default is:
40745 </para>
40746 <literallayout class="monospaced">
40747 /bin:/usr/bin
40748 </literallayout>
40749 <para>
40750 If the <option>command</option> option does not yield an absolute path name, the command is
40751 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40752 apply to a command specified as a transport filter.
40753 </para>
40754 <para>
40755 <indexterm role="option">
40756 <primary><option>pipe_as_creator</option></primary>
40757 </indexterm>
40758 </para>
40759 <informaltable frame="all">
40760 <tgroup cols="4" colsep="0" rowsep="0">
40761 <colspec colwidth="8*" align="left"/>
40762 <colspec colwidth="6*" align="center"/>
40763 <colspec colwidth="6*" align="center"/>
40764 <colspec colwidth="6*" align="right"/>
40765 <tbody>
40766 <row>
40767 <entry><option>pipe_as_creator</option></entry>
40768 <entry>Use: <emphasis>pipe</emphasis></entry>
40769 <entry>Type: <emphasis>boolean</emphasis></entry>
40770 <entry>Default: <emphasis>false</emphasis></entry>
40771 </row>
40772 </tbody>
40773 </tgroup>
40774 </informaltable>
40775 <para>
40776 <indexterm role="concept">
40777 <primary>uid (user id)</primary>
40778 <secondary>local delivery</secondary>
40779 </indexterm>
40780 If the generic <option>user</option> option is not set and this option is true, the delivery
40781 process is run under the uid that was in force when Exim was originally called
40782 to accept the message. If the group id is not otherwise set (via the generic
40783 <option>group</option> option), the gid that was in force when Exim was originally called to
40784 accept the message is used.
40785 </para>
40786 <para>
40787 <indexterm role="option">
40788 <primary><option>restrict_to_path</option></primary>
40789 </indexterm>
40790 </para>
40791 <informaltable frame="all">
40792 <tgroup cols="4" colsep="0" rowsep="0">
40793 <colspec colwidth="8*" align="left"/>
40794 <colspec colwidth="6*" align="center"/>
40795 <colspec colwidth="6*" align="center"/>
40796 <colspec colwidth="6*" align="right"/>
40797 <tbody>
40798 <row>
40799 <entry><option>restrict_to_path</option></entry>
40800 <entry>Use: <emphasis>pipe</emphasis></entry>
40801 <entry>Type: <emphasis>boolean</emphasis></entry>
40802 <entry>Default: <emphasis>false</emphasis></entry>
40803 </row>
40804 </tbody>
40805 </tgroup>
40806 </informaltable>
40807 <para>
40808 When this option is set, any command name not listed in <option>allow_commands</option> must
40809 contain no slashes. The command is searched for only in the directories listed
40810 in the <option>path</option> option. This option is intended for use in the case when a pipe
40811 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
40812 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
40813 </para>
40814 <para>
40815 <indexterm role="option">
40816 <primary><option>return_fail_output</option></primary>
40817 </indexterm>
40818 </para>
40819 <informaltable frame="all">
40820 <tgroup cols="4" colsep="0" rowsep="0">
40821 <colspec colwidth="8*" align="left"/>
40822 <colspec colwidth="6*" align="center"/>
40823 <colspec colwidth="6*" align="center"/>
40824 <colspec colwidth="6*" align="right"/>
40825 <tbody>
40826 <row>
40827 <entry><option>return_fail_output</option></entry>
40828 <entry>Use: <emphasis>pipe</emphasis></entry>
40829 <entry>Type: <emphasis>boolean</emphasis></entry>
40830 <entry>Default: <emphasis>false</emphasis></entry>
40831 </row>
40832 </tbody>
40833 </tgroup>
40834 </informaltable>
40835 <para>
40836 If this option is true, and the command produced any output and ended with a
40837 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
40838 is, the delivery failed), the output is returned in the bounce message.
40839 However, if the message has a null sender (that is, it is itself a bounce
40840 message), output from the command is discarded. This option and
40841 <option>return_output</option> are mutually exclusive. Only one of them may be set.
40842 </para>
40843 <para>
40844 <indexterm role="option">
40845 <primary><option>return_output</option></primary>
40846 </indexterm>
40847 </para>
40848 <informaltable frame="all">
40849 <tgroup cols="4" colsep="0" rowsep="0">
40850 <colspec colwidth="8*" align="left"/>
40851 <colspec colwidth="6*" align="center"/>
40852 <colspec colwidth="6*" align="center"/>
40853 <colspec colwidth="6*" align="right"/>
40854 <tbody>
40855 <row>
40856 <entry><option>return_output</option></entry>
40857 <entry>Use: <emphasis>pipe</emphasis></entry>
40858 <entry>Type: <emphasis>boolean</emphasis></entry>
40859 <entry>Default: <emphasis>false</emphasis></entry>
40860 </row>
40861 </tbody>
40862 </tgroup>
40863 </informaltable>
40864 <para>
40865 If this option is true, and the command produced any output, the delivery is
40866 deemed to have failed whatever the return code from the command, and the output
40867 is returned in the bounce message. Otherwise, the output is just discarded.
40868 However, if the message has a null sender (that is, it is a bounce message),
40869 output from the command is always discarded, whatever the setting of this
40870 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
40871 of them may be set.
40872 </para>
40873 <para>
40874 <indexterm role="option">
40875 <primary><option>temp_errors</option></primary>
40876 </indexterm>
40877 </para>
40878 <informaltable frame="all">
40879 <tgroup cols="4" colsep="0" rowsep="0">
40880 <colspec colwidth="8*" align="left"/>
40881 <colspec colwidth="6*" align="center"/>
40882 <colspec colwidth="6*" align="center"/>
40883 <colspec colwidth="6*" align="right"/>
40884 <tbody>
40885 <row>
40886 <entry><option>temp_errors</option></entry>
40887 <entry>Use: <emphasis>pipe</emphasis></entry>
40888 <entry>Type: <emphasis>string list</emphasis></entry>
40889 <entry>Default: <emphasis>see below</emphasis></entry>
40890 </row>
40891 </tbody>
40892 </tgroup>
40893 </informaltable>
40894 <para>
40895 <indexterm role="concept">
40896 <primary><command>pipe</command> transport</primary>
40897 <secondary>temporary failure</secondary>
40898 </indexterm>
40899 This option contains either a colon-separated list of numbers, or a single
40900 asterisk. If <option>ignore_status</option> is false
40901 and <option>return_output</option> is not set,
40902 and the command exits with a non-zero return code, the failure is treated as
40903 temporary and the delivery is deferred if the return code matches one of the
40904 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40905 codes are treated as permanent errors. The default setting contains the codes
40906 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40907 compiled on a system that does not define these macros, it assumes values of 75
40908 and 73, respectively.
40909 </para>
40910 <para>
40911 <indexterm role="option">
40912 <primary><option>timeout</option></primary>
40913 </indexterm>
40914 </para>
40915 <informaltable frame="all">
40916 <tgroup cols="4" colsep="0" rowsep="0">
40917 <colspec colwidth="8*" align="left"/>
40918 <colspec colwidth="6*" align="center"/>
40919 <colspec colwidth="6*" align="center"/>
40920 <colspec colwidth="6*" align="right"/>
40921 <tbody>
40922 <row>
40923 <entry><option>timeout</option></entry>
40924 <entry>Use: <emphasis>pipe</emphasis></entry>
40925 <entry>Type: <emphasis>time</emphasis></entry>
40926 <entry>Default: <emphasis>1h</emphasis></entry>
40927 </row>
40928 </tbody>
40929 </tgroup>
40930 </informaltable>
40931 <para>
40932 If the command fails to complete within this time, it is killed. This normally
40933 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40934 specifies no timeout. In order to ensure that any subprocesses created by the
40935 command are also killed, Exim makes the initial process a process group leader,
40936 and kills the whole process group on a timeout. However, this can be defeated
40937 if one of the processes starts a new process group.
40938 </para>
40939 <para>
40940 <indexterm role="option">
40941 <primary><option>timeout_defer</option></primary>
40942 </indexterm>
40943 </para>
40944 <informaltable frame="all">
40945 <tgroup cols="4" colsep="0" rowsep="0">
40946 <colspec colwidth="8*" align="left"/>
40947 <colspec colwidth="6*" align="center"/>
40948 <colspec colwidth="6*" align="center"/>
40949 <colspec colwidth="6*" align="right"/>
40950 <tbody>
40951 <row>
40952 <entry><option>timeout_defer</option></entry>
40953 <entry>Use: <emphasis>pipe</emphasis></entry>
40954 <entry>Type: <emphasis>boolean</emphasis></entry>
40955 <entry>Default: <emphasis>false</emphasis></entry>
40956 </row>
40957 </tbody>
40958 </tgroup>
40959 </informaltable>
40960 <para>
40961 A timeout in a <command>pipe</command> transport, either in the command that the transport
40962 runs, or in a transport filter that is associated with it, is by default
40963 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40964 is set true, both kinds of timeout become temporary errors, causing the
40965 delivery to be deferred.
40966 </para>
40967 <para>
40968 <indexterm role="option">
40969 <primary><option>umask</option></primary>
40970 </indexterm>
40971 </para>
40972 <informaltable frame="all">
40973 <tgroup cols="4" colsep="0" rowsep="0">
40974 <colspec colwidth="8*" align="left"/>
40975 <colspec colwidth="6*" align="center"/>
40976 <colspec colwidth="6*" align="center"/>
40977 <colspec colwidth="6*" align="right"/>
40978 <tbody>
40979 <row>
40980 <entry><option>umask</option></entry>
40981 <entry>Use: <emphasis>pipe</emphasis></entry>
40982 <entry>Type: <emphasis>octal integer</emphasis></entry>
40983 <entry>Default: <emphasis>022</emphasis></entry>
40984 </row>
40985 </tbody>
40986 </tgroup>
40987 </informaltable>
40988 <para>
40989 This specifies the umask setting for the subprocess that runs the command.
40990 </para>
40991 <para>
40992 <indexterm role="option">
40993 <primary><option>use_bsmtp</option></primary>
40994 </indexterm>
40995 </para>
40996 <informaltable frame="all">
40997 <tgroup cols="4" colsep="0" rowsep="0">
40998 <colspec colwidth="8*" align="left"/>
40999 <colspec colwidth="6*" align="center"/>
41000 <colspec colwidth="6*" align="center"/>
41001 <colspec colwidth="6*" align="right"/>
41002 <tbody>
41003 <row>
41004 <entry><option>use_bsmtp</option></entry>
41005 <entry>Use: <emphasis>pipe</emphasis></entry>
41006 <entry>Type: <emphasis>boolean</emphasis></entry>
41007 <entry>Default: <emphasis>false</emphasis></entry>
41008 </row>
41009 </tbody>
41010 </tgroup>
41011 </informaltable>
41012 <para>
41013 <indexterm role="concept">
41014 <primary>envelope sender</primary>
41015 </indexterm>
41016 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41017 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41018 commands. If you want to include a leading HELO command with such messages,
41019 you can do so by setting the <option>message_prefix</option> option. See section
41020 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41021 </para>
41022 <para>
41023 <indexterm role="option">
41024 <primary><option>use_classresources</option></primary>
41025 </indexterm>
41026 </para>
41027 <informaltable frame="all">
41028 <tgroup cols="4" colsep="0" rowsep="0">
41029 <colspec colwidth="8*" align="left"/>
41030 <colspec colwidth="6*" align="center"/>
41031 <colspec colwidth="6*" align="center"/>
41032 <colspec colwidth="6*" align="right"/>
41033 <tbody>
41034 <row>
41035 <entry><option>use_classresources</option></entry>
41036 <entry>Use: <emphasis>pipe</emphasis></entry>
41037 <entry>Type: <emphasis>boolean</emphasis></entry>
41038 <entry>Default: <emphasis>false</emphasis></entry>
41039 </row>
41040 </tbody>
41041 </tgroup>
41042 </informaltable>
41043 <para>
41044 <indexterm role="concept">
41045 <primary>class resources (BSD)</primary>
41046 </indexterm>
41047 This option is available only when Exim is running on FreeBSD, NetBSD, or
41048 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41049 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41050 limits for the uid under which the pipe is to run are obtained from the login
41051 class database.
41052 </para>
41053 <para>
41054 <indexterm role="option">
41055 <primary><option>use_crlf</option></primary>
41056 </indexterm>
41057 </para>
41058 <informaltable frame="all">
41059 <tgroup cols="4" colsep="0" rowsep="0">
41060 <colspec colwidth="8*" align="left"/>
41061 <colspec colwidth="6*" align="center"/>
41062 <colspec colwidth="6*" align="center"/>
41063 <colspec colwidth="6*" align="right"/>
41064 <tbody>
41065 <row>
41066 <entry><option>use_crlf</option></entry>
41067 <entry>Use: <emphasis>pipe</emphasis></entry>
41068 <entry>Type: <emphasis>boolean</emphasis></entry>
41069 <entry>Default: <emphasis>false</emphasis></entry>
41070 </row>
41071 </tbody>
41072 </tgroup>
41073 </informaltable>
41074 <para>
41075 <indexterm role="concept">
41076 <primary>carriage return</primary>
41077 </indexterm>
41078 <indexterm role="concept">
41079 <primary>linefeed</primary>
41080 </indexterm>
41081 This option causes lines to be terminated with the two-character CRLF sequence
41082 (carriage return, linefeed) instead of just a linefeed character. In the case
41083 of batched SMTP, the byte sequence written to the pipe is then an exact image
41084 of what would be sent down a real SMTP connection.
41085 </para>
41086 <para>
41087 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41088 written verbatim, so must contain their own carriage return characters if these
41089 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41090 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41091 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41092 </para>
41093 <para>
41094 <indexterm role="option">
41095 <primary><option>use_shell</option></primary>
41096 </indexterm>
41097 </para>
41098 <informaltable frame="all">
41099 <tgroup cols="4" colsep="0" rowsep="0">
41100 <colspec colwidth="8*" align="left"/>
41101 <colspec colwidth="6*" align="center"/>
41102 <colspec colwidth="6*" align="center"/>
41103 <colspec colwidth="6*" align="right"/>
41104 <tbody>
41105 <row>
41106 <entry><option>use_shell</option></entry>
41107 <entry>Use: <emphasis>pipe</emphasis></entry>
41108 <entry>Type: <emphasis>boolean</emphasis></entry>
41109 <entry>Default: <emphasis>false</emphasis></entry>
41110 </row>
41111 </tbody>
41112 </tgroup>
41113 </informaltable>
41114 <para>
41115 <indexterm role="variable">
41116 <primary><varname>$pipe_addresses</varname></primary>
41117 </indexterm>
41118 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41119 instead of being run directly from the transport, as described in section
41120 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41121 where the command is expected to be run under a shell and cannot easily be
41122 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41123 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41124 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41125 its <option>-c</option> option.
41126 </para>
41127 </section>
41128 <section id="SECID143">
41129 <title>Using an external local delivery agent</title>
41130 <para>
41131 <indexterm role="concept">
41132 <primary>local delivery</primary>
41133 <secondary>using an external agent</secondary>
41134 </indexterm>
41135 <indexterm role="concept">
41136 <primary><emphasis>procmail</emphasis></primary>
41137 </indexterm>
41138 <indexterm role="concept">
41139 <primary>external local delivery</primary>
41140 </indexterm>
41141 <indexterm role="concept">
41142 <primary>delivery</primary>
41143 <secondary><emphasis>procmail</emphasis></secondary>
41144 </indexterm>
41145 <indexterm role="concept">
41146 <primary>delivery</primary>
41147 <secondary>by external agent</secondary>
41148 </indexterm>
41149 The <command>pipe</command> transport can be used to pass all messages that require local
41150 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41151 this, care must be taken to ensure that the pipe is run under an appropriate
41152 uid and gid. In some configurations one wants this to be a uid that is trusted
41153 by the delivery agent to supply the correct sender of the message. It may be
41154 necessary to recompile or reconfigure the delivery agent so that it trusts an
41155 appropriate user. The following is an example transport and router
41156 configuration for <option>procmail</option>:
41157 </para>
41158 <literallayout class="monospaced">
41159 # transport
41160 procmail_pipe:
41161   driver = pipe
41162   command = /usr/local/bin/procmail -d $local_part
41163   return_path_add
41164   delivery_date_add
41165   envelope_to_add
41166   check_string = "From "
41167   escape_string = "&gt;From "
41168   user = $local_part
41169   group = mail
41170
41171 # router
41172 procmail:
41173   driver = accept
41174   check_local_user
41175   transport = procmail_pipe
41176 </literallayout>
41177 <para>
41178 In this example, the pipe is run as the local user, but with the group set to
41179 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41180 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41181 user to supply a correct sender address. If you do not specify either a
41182 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41183 home directory is the user&#x2019;s home directory by default.
41184 </para>
41185 <para>
41186 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41187 </para>
41188 <literallayout class="monospaced">
41189 IFS=" "
41190 </literallayout>
41191 <para>
41192 as shown in some <option>procmail</option> documentation, because Exim does not by default
41193 use a shell to run pipe commands.
41194 </para>
41195 <para>
41196 <indexterm role="concept">
41197 <primary>Cyrus</primary>
41198 </indexterm>
41199 The next example shows a transport and a router for a system where local
41200 deliveries are handled by the Cyrus IMAP server.
41201 </para>
41202 <literallayout class="monospaced">
41203 # transport
41204 local_delivery_cyrus:
41205   driver = pipe
41206   command = /usr/cyrus/bin/deliver \
41207             -m ${substr_1:$local_part_suffix} -- $local_part
41208   user = cyrus
41209   group = mail
41210   return_output
41211   log_output
41212   message_prefix =
41213   message_suffix =
41214
41215 # router
41216 local_user_cyrus:
41217   driver = accept
41218   check_local_user
41219   local_part_suffix = .*
41220   transport = local_delivery_cyrus
41221 </literallayout>
41222 <para>
41223 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41224 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41225 sender.
41226 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41227 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41228 </para>
41229 </section>
41230 </chapter>
41231
41232 <chapter id="CHAPsmtptrans">
41233 <title>The smtp transport</title>
41234 <para>
41235 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41236 <primary>transports</primary>
41237 <secondary><command>smtp</command></secondary>
41238 </indexterm>
41239 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41240 <primary><command>smtp</command> transport</primary>
41241 </indexterm>
41242 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41243 or LMTP protocol. The list of hosts to try can either be taken from the address
41244 that is being processed (having been set up by the router), or specified
41245 explicitly for the transport. Timeout and retry processing (see chapter
41246 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41247 </para>
41248 <section id="SECID144">
41249 <title>Multiple messages on a single connection</title>
41250 <para>
41251 The sending of multiple messages over a single TCP/IP connection can arise in
41252 two ways:
41253 </para>
41254 <itemizedlist>
41255 <listitem>
41256 <para>
41257 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41258 routed to the same host, more than one copy of the message has to be sent to
41259 that host. In this situation, multiple copies may be sent in a single run of
41260 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41261 does when it has too many addresses to send in one message also depends on the
41262 value of the global <option>remote_max_parallel</option> option. Details are given in
41263 section <xref linkend="SECToutSMTPTCP"/>.)
41264 </para>
41265 </listitem>
41266 <listitem>
41267 <para>
41268 <indexterm role="concept">
41269 <primary>hints database</primary>
41270 <secondary>remembering routing</secondary>
41271 </indexterm>
41272 When a message has been successfully delivered over a TCP/IP connection, Exim
41273 looks in its hints database to see if there are any other messages awaiting a
41274 connection to the same host. If there are, a new delivery process is started
41275 for one of them, and the current TCP/IP connection is passed on to it. The new
41276 process may in turn send multiple copies and possibly create yet another
41277 process.
41278 </para>
41279 </listitem>
41280 </itemizedlist>
41281 <para>
41282 For each copy sent over the same TCP/IP connection, a sequence counter is
41283 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41284 no further messages are sent over that connection.
41285 </para>
41286 </section>
41287 <section id="SECID145">
41288 <title>Use of the $host and $host_address variables</title>
41289 <para>
41290 <indexterm role="variable">
41291 <primary><varname>$host</varname></primary>
41292 </indexterm>
41293 <indexterm role="variable">
41294 <primary><varname>$host_address</varname></primary>
41295 </indexterm>
41296 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41297 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41298 passed by the router. However, when the transport is about to connect to a
41299 specific host, and while it is connected to that host, <varname>$host</varname> and
41300 <varname>$host_address</varname> are set to the values for that host. These are the values
41301 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41302 <option>serialize_hosts</option>, and the various TLS options are expanded.
41303 </para>
41304 </section>
41305 <section id="usecippeer">
41306 <title>Use of $tls_cipher and $tls_peerdn</title>
41307 <para>
41308 <indexterm role="variable">
41309 <primary><varname>$tls_cipher</varname></primary>
41310 </indexterm>
41311 <indexterm role="variable">
41312 <primary><varname>$tls_peerdn</varname></primary>
41313 </indexterm>
41314 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41315 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41316 These are the values that are used for options that are expanded before any
41317 SMTP connections are made. Just before each connection is made, these two
41318 variables are emptied. If TLS is subsequently started, they are set to the
41319 appropriate values for the outgoing connection, and these are the values that
41320 are in force when any authenticators are run and when the
41321 <option>authenticated_sender</option> option is expanded.
41322 </para>
41323 </section>
41324 <section id="SECID146">
41325 <title>Private options for smtp</title>
41326 <para>
41327 <indexterm role="concept">
41328 <primary>options</primary>
41329 <secondary><command>smtp</command> transport</secondary>
41330 </indexterm>
41331 The private options of the <command>smtp</command> transport are as follows:
41332 </para>
41333 <para>
41334 <indexterm role="option">
41335 <primary><option>address_retry_include_sender</option></primary>
41336 </indexterm>
41337 </para>
41338 <informaltable frame="all">
41339 <tgroup cols="4" colsep="0" rowsep="0">
41340 <colspec colwidth="8*" align="left"/>
41341 <colspec colwidth="6*" align="center"/>
41342 <colspec colwidth="6*" align="center"/>
41343 <colspec colwidth="6*" align="right"/>
41344 <tbody>
41345 <row>
41346 <entry><option>address_retry_include_sender</option></entry>
41347 <entry>Use: <emphasis>smtp</emphasis></entry>
41348 <entry>Type: <emphasis>boolean</emphasis></entry>
41349 <entry>Default: <emphasis>true</emphasis></entry>
41350 </row>
41351 </tbody>
41352 </tgroup>
41353 </informaltable>
41354 <para>
41355 <indexterm role="concept">
41356 <primary>4<emphasis>xx</emphasis> responses</primary>
41357 <secondary>retrying after</secondary>
41358 </indexterm>
41359 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41360 is the combination of sender and recipient that is delayed in subsequent queue
41361 runs until the retry time is reached. You can delay the recipient without
41362 reference to the sender (which is what earlier versions of Exim did), by
41363 setting <option>address_retry_include_sender</option> false. However, this can lead to
41364 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41365 </para>
41366 <para>
41367 <indexterm role="option">
41368 <primary><option>allow_localhost</option></primary>
41369 </indexterm>
41370 </para>
41371 <informaltable frame="all">
41372 <tgroup cols="4" colsep="0" rowsep="0">
41373 <colspec colwidth="8*" align="left"/>
41374 <colspec colwidth="6*" align="center"/>
41375 <colspec colwidth="6*" align="center"/>
41376 <colspec colwidth="6*" align="right"/>
41377 <tbody>
41378 <row>
41379 <entry><option>allow_localhost</option></entry>
41380 <entry>Use: <emphasis>smtp</emphasis></entry>
41381 <entry>Type: <emphasis>boolean</emphasis></entry>
41382 <entry>Default: <emphasis>false</emphasis></entry>
41383 </row>
41384 </tbody>
41385 </tgroup>
41386 </informaltable>
41387 <para>
41388 <indexterm role="concept">
41389 <primary>local host</primary>
41390 <secondary>sending to</secondary>
41391 </indexterm>
41392 <indexterm role="concept">
41393 <primary>fallback</primary>
41394 <secondary>hosts specified on transport</secondary>
41395 </indexterm>
41396 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41397 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41398 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41399 the delivery anyway. This should be used only in special cases when the
41400 configuration ensures that no looping will result (for example, a differently
41401 configured Exim is listening on the port to which the message is sent).
41402 </para>
41403 <para>
41404 <indexterm role="option">
41405 <primary><option>authenticated_sender</option></primary>
41406 </indexterm>
41407 </para>
41408 <informaltable frame="all">
41409 <tgroup cols="4" colsep="0" rowsep="0">
41410 <colspec colwidth="8*" align="left"/>
41411 <colspec colwidth="6*" align="center"/>
41412 <colspec colwidth="6*" align="center"/>
41413 <colspec colwidth="6*" align="right"/>
41414 <tbody>
41415 <row>
41416 <entry><option>authenticated_sender</option></entry>
41417 <entry>Use: <emphasis>smtp</emphasis></entry>
41418 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41419 <entry>Default: <emphasis>unset</emphasis></entry>
41420 </row>
41421 </tbody>
41422 </tgroup>
41423 </informaltable>
41424 <para>
41425 <indexterm role="concept">
41426 <primary>Cyrus</primary>
41427 </indexterm>
41428 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41429 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41430 overriding any existing authenticated sender value. If the string expansion is
41431 forced to fail, the option is ignored. Other expansion failures cause delivery
41432 to be deferred. If the result of expansion is an empty string, that is also
41433 ignored.
41434 </para>
41435 <para>
41436 The expansion happens after the outgoing connection has been made and TLS
41437 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41438 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41439 particular connection.
41440 </para>
41441 <para>
41442 If the SMTP session is not authenticated, the expansion of
41443 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41444 deferred if it fails), but no AUTH= item is added to MAIL commands
41445 unless <option>authenticated_sender_force</option> is true.
41446 </para>
41447 <para>
41448 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41449 deliver mail to Cyrus IMAP and provide the proper local part as the
41450 <quote>authenticated sender</quote>, via a setting such as:
41451 </para>
41452 <literallayout class="monospaced">
41453 authenticated_sender = $local_part
41454 </literallayout>
41455 <para>
41456 This removes the need for IMAP subfolders to be assigned special ACLs to
41457 allow direct delivery to those subfolders.
41458 </para>
41459 <para>
41460 Because of expected uses such as that just described for Cyrus (when no
41461 domain is involved), there is no checking on the syntax of the provided
41462 value.
41463 </para>
41464 <para>
41465 <indexterm role="option">
41466 <primary><option>authenticated_sender_force</option></primary>
41467 </indexterm>
41468 </para>
41469 <informaltable frame="all">
41470 <tgroup cols="4" colsep="0" rowsep="0">
41471 <colspec colwidth="8*" align="left"/>
41472 <colspec colwidth="6*" align="center"/>
41473 <colspec colwidth="6*" align="center"/>
41474 <colspec colwidth="6*" align="right"/>
41475 <tbody>
41476 <row>
41477 <entry><option>authenticated_sender_force</option></entry>
41478 <entry>Use: <emphasis>smtp</emphasis></entry>
41479 <entry>Type: <emphasis>boolean</emphasis></entry>
41480 <entry>Default: <emphasis>false</emphasis></entry>
41481 </row>
41482 </tbody>
41483 </tgroup>
41484 </informaltable>
41485 <para>
41486 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
41487 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41488 authenticated as a client.
41489 </para>
41490 <para>
41491 <indexterm role="option">
41492 <primary><option>command_timeout</option></primary>
41493 </indexterm>
41494 </para>
41495 <informaltable frame="all">
41496 <tgroup cols="4" colsep="0" rowsep="0">
41497 <colspec colwidth="8*" align="left"/>
41498 <colspec colwidth="6*" align="center"/>
41499 <colspec colwidth="6*" align="center"/>
41500 <colspec colwidth="6*" align="right"/>
41501 <tbody>
41502 <row>
41503 <entry><option>command_timeout</option></entry>
41504 <entry>Use: <emphasis>smtp</emphasis></entry>
41505 <entry>Type: <emphasis>time</emphasis></entry>
41506 <entry>Default: <emphasis>5m</emphasis></entry>
41507 </row>
41508 </tbody>
41509 </tgroup>
41510 </informaltable>
41511 <para>
41512 This sets a timeout for receiving a response to an SMTP command that has been
41513 sent out. It is also used when waiting for the initial banner line from the
41514 remote host. Its value must not be zero.
41515 </para>
41516 <para>
41517 <indexterm role="option">
41518 <primary><option>connect_timeout</option></primary>
41519 </indexterm>
41520 </para>
41521 <informaltable frame="all">
41522 <tgroup cols="4" colsep="0" rowsep="0">
41523 <colspec colwidth="8*" align="left"/>
41524 <colspec colwidth="6*" align="center"/>
41525 <colspec colwidth="6*" align="center"/>
41526 <colspec colwidth="6*" align="right"/>
41527 <tbody>
41528 <row>
41529 <entry><option>connect_timeout</option></entry>
41530 <entry>Use: <emphasis>smtp</emphasis></entry>
41531 <entry>Type: <emphasis>time</emphasis></entry>
41532 <entry>Default: <emphasis>5m</emphasis></entry>
41533 </row>
41534 </tbody>
41535 </tgroup>
41536 </informaltable>
41537 <para>
41538 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41539 to a remote host. A setting of zero allows the system timeout (typically
41540 several minutes) to act. To have any effect, the value of this option must be
41541 less than the system timeout. However, it has been observed that on some
41542 systems there is no system timeout, which is why the default value for this
41543 option is 5 minutes, a value recommended by RFC 1123.
41544 </para>
41545 <para>
41546 <indexterm role="option">
41547 <primary><option>connection_max_messages</option></primary>
41548 </indexterm>
41549 </para>
41550 <informaltable frame="all">
41551 <tgroup cols="4" colsep="0" rowsep="0">
41552 <colspec colwidth="8*" align="left"/>
41553 <colspec colwidth="6*" align="center"/>
41554 <colspec colwidth="6*" align="center"/>
41555 <colspec colwidth="6*" align="right"/>
41556 <tbody>
41557 <row>
41558 <entry><option>connection_max_messages</option></entry>
41559 <entry>Use: <emphasis>smtp</emphasis></entry>
41560 <entry>Type: <emphasis>integer</emphasis></entry>
41561 <entry>Default: <emphasis>500</emphasis></entry>
41562 </row>
41563 </tbody>
41564 </tgroup>
41565 </informaltable>
41566 <para>
41567 <indexterm role="concept">
41568 <primary>SMTP</primary>
41569 <secondary>passed connection</secondary>
41570 </indexterm>
41571 <indexterm role="concept">
41572 <primary>SMTP</primary>
41573 <secondary>multiple deliveries</secondary>
41574 </indexterm>
41575 <indexterm role="concept">
41576 <primary>multiple SMTP deliveries</primary>
41577 </indexterm>
41578 This controls the maximum number of separate message deliveries that are sent
41579 over a single TCP/IP connection. If the value is zero, there is no limit.
41580 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41581 option.
41582 </para>
41583 <para>
41584 <indexterm role="option">
41585 <primary><option>data_timeout</option></primary>
41586 </indexterm>
41587 </para>
41588 <informaltable frame="all">
41589 <tgroup cols="4" colsep="0" rowsep="0">
41590 <colspec colwidth="8*" align="left"/>
41591 <colspec colwidth="6*" align="center"/>
41592 <colspec colwidth="6*" align="center"/>
41593 <colspec colwidth="6*" align="right"/>
41594 <tbody>
41595 <row>
41596 <entry><option>data_timeout</option></entry>
41597 <entry>Use: <emphasis>smtp</emphasis></entry>
41598 <entry>Type: <emphasis>time</emphasis></entry>
41599 <entry>Default: <emphasis>5m</emphasis></entry>
41600 </row>
41601 </tbody>
41602 </tgroup>
41603 </informaltable>
41604 <para>
41605 This sets a timeout for the transmission of each block in the data portion of
41606 the message. As a result, the overall timeout for a message depends on the size
41607 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41608 </para>
41609 <para>
41610 <indexterm role="option">
41611 <primary><option>delay_after_cutoff</option></primary>
41612 </indexterm>
41613 </para>
41614 <informaltable frame="all">
41615 <tgroup cols="4" colsep="0" rowsep="0">
41616 <colspec colwidth="8*" align="left"/>
41617 <colspec colwidth="6*" align="center"/>
41618 <colspec colwidth="6*" align="center"/>
41619 <colspec colwidth="6*" align="right"/>
41620 <tbody>
41621 <row>
41622 <entry><option>delay_after_cutoff</option></entry>
41623 <entry>Use: <emphasis>smtp</emphasis></entry>
41624 <entry>Type: <emphasis>boolean</emphasis></entry>
41625 <entry>Default: <emphasis>true</emphasis></entry>
41626 </row>
41627 </tbody>
41628 </tgroup>
41629 </informaltable>
41630 <para>
41631 This option controls what happens when all remote IP addresses for a given
41632 domain have been inaccessible for so long that they have passed their retry
41633 cutoff times.
41634 </para>
41635 <para>
41636 In the default state, if the next retry time has not been reached for any of
41637 them, the address is bounced without trying any deliveries. In other words,
41638 Exim delays retrying an IP address after the final cutoff time until a new
41639 retry time is reached, and can therefore bounce an address without ever trying
41640 a delivery, when machines have been down for a long time. Some people are
41641 unhappy at this prospect, so...
41642 </para>
41643 <para>
41644 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41645 addresses are past their final cutoff time, Exim tries to deliver to those
41646 IP addresses that have not been tried since the message arrived. If there are
41647 none, of if they all fail, the address is bounced. In other words, it does not
41648 delay when a new message arrives, but immediately tries those expired IP
41649 addresses that haven&#x2019;t been tried since the message arrived. If there is a
41650 continuous stream of messages for the dead hosts, unsetting
41651 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41652 to them.
41653 </para>
41654 <para>
41655 <indexterm role="option">
41656 <primary><option>dns_qualify_single</option></primary>
41657 </indexterm>
41658 </para>
41659 <informaltable frame="all">
41660 <tgroup cols="4" colsep="0" rowsep="0">
41661 <colspec colwidth="8*" align="left"/>
41662 <colspec colwidth="6*" align="center"/>
41663 <colspec colwidth="6*" align="center"/>
41664 <colspec colwidth="6*" align="right"/>
41665 <tbody>
41666 <row>
41667 <entry><option>dns_qualify_single</option></entry>
41668 <entry>Use: <emphasis>smtp</emphasis></entry>
41669 <entry>Type: <emphasis>boolean</emphasis></entry>
41670 <entry>Default: <emphasis>true</emphasis></entry>
41671 </row>
41672 </tbody>
41673 </tgroup>
41674 </informaltable>
41675 <para>
41676 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41677 and the <option>gethostbyname</option> option is false,
41678 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41679 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41680 </para>
41681 <para>
41682 <indexterm role="option">
41683 <primary><option>dns_search_parents</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>dns_search_parents</option></entry>
41695 <entry>Use: <emphasis>smtp</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 the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41704 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41705 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41706 details.
41707 </para>
41708 <para>
41709 <indexterm role="option">
41710 <primary><option>fallback_hosts</option></primary>
41711 </indexterm>
41712 </para>
41713 <informaltable frame="all">
41714 <tgroup cols="4" colsep="0" rowsep="0">
41715 <colspec colwidth="8*" align="left"/>
41716 <colspec colwidth="6*" align="center"/>
41717 <colspec colwidth="6*" align="center"/>
41718 <colspec colwidth="6*" align="right"/>
41719 <tbody>
41720 <row>
41721 <entry><option>fallback_hosts</option></entry>
41722 <entry>Use: <emphasis>smtp</emphasis></entry>
41723 <entry>Type: <emphasis>string list</emphasis></entry>
41724 <entry>Default: <emphasis>unset</emphasis></entry>
41725 </row>
41726 </tbody>
41727 </tgroup>
41728 </informaltable>
41729 <para>
41730 <indexterm role="concept">
41731 <primary>fallback</primary>
41732 <secondary>hosts specified on transport</secondary>
41733 </indexterm>
41734 String expansion is not applied to this option. The argument must be a
41735 colon-separated list of host names or IP addresses, optionally also including
41736 port numbers, though the separator can be changed, as described in section
41737 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41738 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41739 in section <xref linkend="SECTformatonehostitem"/>.
41740 </para>
41741 <para>
41742 Fallback hosts can also be specified on routers, which associate them with the
41743 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41744 <option>fallback_hosts</option> specified on the transport is used only if the address does
41745 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41746 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41747 However, <option>hosts_randomize</option> does apply to fallback host lists.
41748 </para>
41749 <para>
41750 If Exim is unable to deliver to any of the hosts for a particular address, and
41751 the errors are not permanent rejections, the address is put on a separate
41752 transport queue with its host list replaced by the fallback hosts, unless the
41753 address was routed via MX records and the current host was in the original MX
41754 list. In that situation, the fallback host list is not used.
41755 </para>
41756 <para>
41757 Once normal deliveries are complete, the fallback queue is delivered by
41758 re-running the same transports with the new host lists. If several failing
41759 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
41760 copy of the message is sent.
41761 </para>
41762 <para>
41763 The resolution of the host names on the fallback list is controlled by the
41764 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
41765 both to cases when the host list comes with the address and when it is taken
41766 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
41767 fails</quote> facility.
41768 </para>
41769 <para>
41770 <indexterm role="option">
41771 <primary><option>final_timeout</option></primary>
41772 </indexterm>
41773 </para>
41774 <informaltable frame="all">
41775 <tgroup cols="4" colsep="0" rowsep="0">
41776 <colspec colwidth="8*" align="left"/>
41777 <colspec colwidth="6*" align="center"/>
41778 <colspec colwidth="6*" align="center"/>
41779 <colspec colwidth="6*" align="right"/>
41780 <tbody>
41781 <row>
41782 <entry><option>final_timeout</option></entry>
41783 <entry>Use: <emphasis>smtp</emphasis></entry>
41784 <entry>Type: <emphasis>time</emphasis></entry>
41785 <entry>Default: <emphasis>10m</emphasis></entry>
41786 </row>
41787 </tbody>
41788 </tgroup>
41789 </informaltable>
41790 <para>
41791 This is the timeout that applies while waiting for the response to the final
41792 line containing just <quote>.</quote> that terminates a message. Its value must not be
41793 zero.
41794 </para>
41795 <para>
41796 <indexterm role="option">
41797 <primary><option>gethostbyname</option></primary>
41798 </indexterm>
41799 </para>
41800 <informaltable frame="all">
41801 <tgroup cols="4" colsep="0" rowsep="0">
41802 <colspec colwidth="8*" align="left"/>
41803 <colspec colwidth="6*" align="center"/>
41804 <colspec colwidth="6*" align="center"/>
41805 <colspec colwidth="6*" align="right"/>
41806 <tbody>
41807 <row>
41808 <entry><option>gethostbyname</option></entry>
41809 <entry>Use: <emphasis>smtp</emphasis></entry>
41810 <entry>Type: <emphasis>boolean</emphasis></entry>
41811 <entry>Default: <emphasis>false</emphasis></entry>
41812 </row>
41813 </tbody>
41814 </tgroup>
41815 </informaltable>
41816 <para>
41817 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
41818 being used, names are looked up using <function>gethostbyname()</function>
41819 (or <function>getipnodebyname()</function> when available)
41820 instead of using the DNS. Of course, that function may in fact use the DNS, but
41821 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
41822 </para>
41823 <para>
41824 <indexterm role="option">
41825 <primary><option>gnutls_require_kx</option></primary>
41826 </indexterm>
41827 </para>
41828 <informaltable frame="all">
41829 <tgroup cols="4" colsep="0" rowsep="0">
41830 <colspec colwidth="8*" align="left"/>
41831 <colspec colwidth="6*" align="center"/>
41832 <colspec colwidth="6*" align="center"/>
41833 <colspec colwidth="6*" align="right"/>
41834 <tbody>
41835 <row>
41836 <entry><option>gnutls_require_kx</option></entry>
41837 <entry>Use: <emphasis>main</emphasis></entry>
41838 <entry>Type: <emphasis>string</emphasis></entry>
41839 <entry>Default: <emphasis>unset</emphasis></entry>
41840 </row>
41841 </tbody>
41842 </tgroup>
41843 </informaltable>
41844 <para>
41845 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
41846 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41847 </para>
41848 <para>
41849 <indexterm role="option">
41850 <primary><option>gnutls_require_mac</option></primary>
41851 </indexterm>
41852 </para>
41853 <informaltable frame="all">
41854 <tgroup cols="4" colsep="0" rowsep="0">
41855 <colspec colwidth="8*" align="left"/>
41856 <colspec colwidth="6*" align="center"/>
41857 <colspec colwidth="6*" align="center"/>
41858 <colspec colwidth="6*" align="right"/>
41859 <tbody>
41860 <row>
41861 <entry><option>gnutls_require_mac</option></entry>
41862 <entry>Use: <emphasis>main</emphasis></entry>
41863 <entry>Type: <emphasis>string</emphasis></entry>
41864 <entry>Default: <emphasis>unset</emphasis></entry>
41865 </row>
41866 </tbody>
41867 </tgroup>
41868 </informaltable>
41869 <para>
41870 This option controls the MAC algorithms when GnuTLS is used in an Exim
41871 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41872 </para>
41873 <para>
41874 <indexterm role="option">
41875 <primary><option>gnutls_require_protocols</option></primary>
41876 </indexterm>
41877 </para>
41878 <informaltable frame="all">
41879 <tgroup cols="4" colsep="0" rowsep="0">
41880 <colspec colwidth="8*" align="left"/>
41881 <colspec colwidth="6*" align="center"/>
41882 <colspec colwidth="6*" align="center"/>
41883 <colspec colwidth="6*" align="right"/>
41884 <tbody>
41885 <row>
41886 <entry><option>gnutls_require_protocols</option></entry>
41887 <entry>Use: <emphasis>main</emphasis></entry>
41888 <entry>Type: <emphasis>string</emphasis></entry>
41889 <entry>Default: <emphasis>unset</emphasis></entry>
41890 </row>
41891 </tbody>
41892 </tgroup>
41893 </informaltable>
41894 <para>
41895 This option controls the protocols when GnuTLS is used in an Exim
41896 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41897 </para>
41898 <para revisionflag="changed">
41899 <indexterm role="option">
41900 <primary><option>gnutls_compat_mode</option></primary>
41901 </indexterm>
41902 </para>
41903 <informaltable frame="all" revisionflag="changed">
41904 <tgroup cols="4" colsep="0" rowsep="0">
41905 <colspec colwidth="8*" align="left"/>
41906 <colspec colwidth="6*" align="center"/>
41907 <colspec colwidth="6*" align="center"/>
41908 <colspec colwidth="6*" align="right"/>
41909 <tbody>
41910 <row>
41911 <entry><option>gnutls_compat_mode</option></entry>
41912 <entry>Use: <emphasis>main</emphasis></entry>
41913 <entry>Type: <emphasis>boolean</emphasis></entry>
41914 <entry>Default: <emphasis>unset</emphasis></entry>
41915 </row>
41916 </tbody>
41917 </tgroup>
41918 </informaltable>
41919 <para revisionflag="changed">
41920 This option controls whether GnuTLS is used in compatibility mode in an Exim
41921 server. This reduces security slightly, but improves interworking with older
41922 implementations of TLS.
41923 </para>
41924 <para>
41925 <indexterm role="option">
41926 <primary><option>helo_data</option></primary>
41927 </indexterm>
41928 </para>
41929 <informaltable frame="all">
41930 <tgroup cols="4" colsep="0" rowsep="0">
41931 <colspec colwidth="8*" align="left"/>
41932 <colspec colwidth="6*" align="center"/>
41933 <colspec colwidth="6*" align="center"/>
41934 <colspec colwidth="6*" align="right"/>
41935 <tbody>
41936 <row>
41937 <entry><option>helo_data</option></entry>
41938 <entry>Use: <emphasis>smtp</emphasis></entry>
41939 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41940 <entry>Default: <emphasis>see below</emphasis></entry>
41941 </row>
41942 </tbody>
41943 </tgroup>
41944 </informaltable>
41945 <para>
41946 <indexterm role="concept">
41947 <primary>HELO</primary>
41948 <secondary>argument, setting</secondary>
41949 </indexterm>
41950 <indexterm role="concept">
41951 <primary>EHLO</primary>
41952 <secondary>argument, setting</secondary>
41953 </indexterm>
41954 <indexterm role="concept">
41955 <primary>LHLO argument setting</primary>
41956 </indexterm>
41957 The value of this option is expanded after a connection to a another host has
41958 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
41959 command that starts the outgoing SMTP or LMTP session. The default value of the
41960 option is:
41961 </para>
41962 <literallayout class="monospaced">
41963 $primary_hostname
41964 </literallayout>
41965 <para>
41966 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
41967 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
41968 <varname>$sending_port</varname> are set to the local IP address and port number that are being
41969 used. These variables can be used to generate different values for different
41970 servers or different local IP addresses. For example, if you want the string
41971 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
41972 interface address, you could use this:
41973 </para>
41974 <literallayout class="monospaced">
41975 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
41976   {$primary_hostname}}
41977 </literallayout>
41978 <para>
41979 The use of <option>helo_data</option> applies both to sending messages and when doing
41980 callouts.
41981 </para>
41982 <para>
41983 <indexterm role="option">
41984 <primary><option>hosts</option></primary>
41985 </indexterm>
41986 </para>
41987 <informaltable frame="all">
41988 <tgroup cols="4" colsep="0" rowsep="0">
41989 <colspec colwidth="8*" align="left"/>
41990 <colspec colwidth="6*" align="center"/>
41991 <colspec colwidth="6*" align="center"/>
41992 <colspec colwidth="6*" align="right"/>
41993 <tbody>
41994 <row>
41995 <entry><option>hosts</option></entry>
41996 <entry>Use: <emphasis>smtp</emphasis></entry>
41997 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41998 <entry>Default: <emphasis>unset</emphasis></entry>
41999 </row>
42000 </tbody>
42001 </tgroup>
42002 </informaltable>
42003 <para>
42004 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42005 finds the hosts by looking up the address domain in the DNS, or by
42006 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42007 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42008 all of them can provide an associated list of hosts.
42009 </para>
42010 <para>
42011 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42012 processed does not have any hosts associated with it. The hosts specified by
42013 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42014 <option>hosts_override</option> is set.
42015 </para>
42016 <para>
42017 The string is first expanded, before being interpreted as a colon-separated
42018 list of host names or IP addresses, possibly including port numbers. The
42019 separator may be changed to something other than colon, as described in section
42020 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42021 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42022 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42023 of the <command>manualroute</command> router is not available here.
42024 </para>
42025 <para>
42026 If the expansion fails, delivery is deferred. Unless the failure was caused by
42027 the inability to complete a lookup, the error is logged to the panic log as
42028 well as the main log. Host names are looked up either by searching directly for
42029 address records in the DNS or by calling <function>gethostbyname()</function> (or
42030 <function>getipnodebyname()</function> when available), depending on the setting of the
42031 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42032 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42033 address are used.
42034 </para>
42035 <para>
42036 During delivery, the hosts are tried in order, subject to their retry status,
42037 unless <option>hosts_randomize</option> is set.
42038 </para>
42039 <para>
42040 <indexterm role="option">
42041 <primary><option>hosts_avoid_esmtp</option></primary>
42042 </indexterm>
42043 </para>
42044 <informaltable frame="all">
42045 <tgroup cols="4" colsep="0" rowsep="0">
42046 <colspec colwidth="8*" align="left"/>
42047 <colspec colwidth="6*" align="center"/>
42048 <colspec colwidth="6*" align="center"/>
42049 <colspec colwidth="6*" align="right"/>
42050 <tbody>
42051 <row>
42052 <entry><option>hosts_avoid_esmtp</option></entry>
42053 <entry>Use: <emphasis>smtp</emphasis></entry>
42054 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42055 <entry>Default: <emphasis>unset</emphasis></entry>
42056 </row>
42057 </tbody>
42058 </tgroup>
42059 </informaltable>
42060 <para>
42061 <indexterm role="concept">
42062 <primary>ESMTP, avoiding use of</primary>
42063 </indexterm>
42064 <indexterm role="concept">
42065 <primary>HELO</primary>
42066 <secondary>forcing use of</secondary>
42067 </indexterm>
42068 <indexterm role="concept">
42069 <primary>EHLO</primary>
42070 <secondary>avoiding use of</secondary>
42071 </indexterm>
42072 <indexterm role="concept">
42073 <primary>PIPELINING</primary>
42074 <secondary>avoiding the use of</secondary>
42075 </indexterm>
42076 This option is for use with broken hosts that announce ESMTP facilities (for
42077 example, PIPELINING) and then fail to implement them properly. When a host
42078 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42079 start of the SMTP session. This means that it cannot use any of the ESMTP
42080 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42081 </para>
42082 <para>
42083 <indexterm role="option">
42084 <primary><option>hosts_avoid_pipelining</option></primary>
42085 </indexterm>
42086 </para>
42087 <informaltable frame="all">
42088 <tgroup cols="4" colsep="0" rowsep="0">
42089 <colspec colwidth="8*" align="left"/>
42090 <colspec colwidth="6*" align="center"/>
42091 <colspec colwidth="6*" align="center"/>
42092 <colspec colwidth="6*" align="right"/>
42093 <tbody>
42094 <row>
42095 <entry><option>hosts_avoid_pipelining</option></entry>
42096 <entry>Use: <emphasis>smtp</emphasis></entry>
42097 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42098 <entry>Default: <emphasis>unset</emphasis></entry>
42099 </row>
42100 </tbody>
42101 </tgroup>
42102 </informaltable>
42103 <para>
42104 <indexterm role="concept">
42105 <primary>PIPELINING</primary>
42106 <secondary>avoiding the use of</secondary>
42107 </indexterm>
42108 Exim will not use the SMTP PIPELINING extension when delivering to any host
42109 that matches this list, even if the server host advertises PIPELINING support.
42110 </para>
42111 <para>
42112 <indexterm role="option">
42113 <primary><option>hosts_avoid_tls</option></primary>
42114 </indexterm>
42115 </para>
42116 <informaltable frame="all">
42117 <tgroup cols="4" colsep="0" rowsep="0">
42118 <colspec colwidth="8*" align="left"/>
42119 <colspec colwidth="6*" align="center"/>
42120 <colspec colwidth="6*" align="center"/>
42121 <colspec colwidth="6*" align="right"/>
42122 <tbody>
42123 <row>
42124 <entry><option>hosts_avoid_tls</option></entry>
42125 <entry>Use: <emphasis>smtp</emphasis></entry>
42126 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42127 <entry>Default: <emphasis>unset</emphasis></entry>
42128 </row>
42129 </tbody>
42130 </tgroup>
42131 </informaltable>
42132 <para>
42133 <indexterm role="concept">
42134 <primary>TLS</primary>
42135 <secondary>avoiding for certain hosts</secondary>
42136 </indexterm>
42137 Exim will not try to start a TLS session when delivering to any host that
42138 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42139 </para>
42140 <para>
42141 <indexterm role="option">
42142 <primary><option>hosts_max_try</option></primary>
42143 </indexterm>
42144 </para>
42145 <informaltable frame="all">
42146 <tgroup cols="4" colsep="0" rowsep="0">
42147 <colspec colwidth="8*" align="left"/>
42148 <colspec colwidth="6*" align="center"/>
42149 <colspec colwidth="6*" align="center"/>
42150 <colspec colwidth="6*" align="right"/>
42151 <tbody>
42152 <row>
42153 <entry><option>hosts_max_try</option></entry>
42154 <entry>Use: <emphasis>smtp</emphasis></entry>
42155 <entry>Type: <emphasis>integer</emphasis></entry>
42156 <entry>Default: <emphasis>5</emphasis></entry>
42157 </row>
42158 </tbody>
42159 </tgroup>
42160 </informaltable>
42161 <para>
42162 <indexterm role="concept">
42163 <primary>host</primary>
42164 <secondary>maximum number to try</secondary>
42165 </indexterm>
42166 <indexterm role="concept">
42167 <primary>limit</primary>
42168 <secondary>number of hosts tried</secondary>
42169 </indexterm>
42170 <indexterm role="concept">
42171 <primary>limit</primary>
42172 <secondary>number of MX tried</secondary>
42173 </indexterm>
42174 <indexterm role="concept">
42175 <primary>MX record</primary>
42176 <secondary>maximum tried</secondary>
42177 </indexterm>
42178 This option limits the number of IP addresses that are tried for any one
42179 delivery in cases where there are temporary delivery errors. Section
42180 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42181 </para>
42182 <para>
42183 <indexterm role="option">
42184 <primary><option>hosts_max_try_hardlimit</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>hosts_max_try_hardlimit</option></entry>
42196 <entry>Use: <emphasis>smtp</emphasis></entry>
42197 <entry>Type: <emphasis>integer</emphasis></entry>
42198 <entry>Default: <emphasis>50</emphasis></entry>
42199 </row>
42200 </tbody>
42201 </tgroup>
42202 </informaltable>
42203 <para>
42204 This is an additional check on the maximum number of IP addresses that Exim
42205 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42206 why it exists.
42207 </para>
42208 <para>
42209 <indexterm role="option">
42210 <primary><option>hosts_nopass_tls</option></primary>
42211 </indexterm>
42212 </para>
42213 <informaltable frame="all">
42214 <tgroup cols="4" colsep="0" rowsep="0">
42215 <colspec colwidth="8*" align="left"/>
42216 <colspec colwidth="6*" align="center"/>
42217 <colspec colwidth="6*" align="center"/>
42218 <colspec colwidth="6*" align="right"/>
42219 <tbody>
42220 <row>
42221 <entry><option>hosts_nopass_tls</option></entry>
42222 <entry>Use: <emphasis>smtp</emphasis></entry>
42223 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42224 <entry>Default: <emphasis>unset</emphasis></entry>
42225 </row>
42226 </tbody>
42227 </tgroup>
42228 </informaltable>
42229 <para>
42230 <indexterm role="concept">
42231 <primary>TLS</primary>
42232 <secondary>passing connection</secondary>
42233 </indexterm>
42234 <indexterm role="concept">
42235 <primary>multiple SMTP deliveries</primary>
42236 </indexterm>
42237 <indexterm role="concept">
42238 <primary>TLS</primary>
42239 <secondary>multiple message deliveries</secondary>
42240 </indexterm>
42241 For any host that matches this list, a connection on which a TLS session has
42242 been started will not be passed to a new delivery process for sending another
42243 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42244 explanation of when this might be needed.
42245 </para>
42246 <para>
42247 <indexterm role="option">
42248 <primary><option>hosts_override</option></primary>
42249 </indexterm>
42250 </para>
42251 <informaltable frame="all">
42252 <tgroup cols="4" colsep="0" rowsep="0">
42253 <colspec colwidth="8*" align="left"/>
42254 <colspec colwidth="6*" align="center"/>
42255 <colspec colwidth="6*" align="center"/>
42256 <colspec colwidth="6*" align="right"/>
42257 <tbody>
42258 <row>
42259 <entry><option>hosts_override</option></entry>
42260 <entry>Use: <emphasis>smtp</emphasis></entry>
42261 <entry>Type: <emphasis>boolean</emphasis></entry>
42262 <entry>Default: <emphasis>false</emphasis></entry>
42263 </row>
42264 </tbody>
42265 </tgroup>
42266 </informaltable>
42267 <para>
42268 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42269 attached to the address are ignored, and instead the hosts specified by the
42270 <option>hosts</option> option are always used. This option does not apply to
42271 <option>fallback_hosts</option>.
42272 </para>
42273 <para>
42274 <indexterm role="option">
42275 <primary><option>hosts_randomize</option></primary>
42276 </indexterm>
42277 </para>
42278 <informaltable frame="all">
42279 <tgroup cols="4" colsep="0" rowsep="0">
42280 <colspec colwidth="8*" align="left"/>
42281 <colspec colwidth="6*" align="center"/>
42282 <colspec colwidth="6*" align="center"/>
42283 <colspec colwidth="6*" align="right"/>
42284 <tbody>
42285 <row>
42286 <entry><option>hosts_randomize</option></entry>
42287 <entry>Use: <emphasis>smtp</emphasis></entry>
42288 <entry>Type: <emphasis>boolean</emphasis></entry>
42289 <entry>Default: <emphasis>false</emphasis></entry>
42290 </row>
42291 </tbody>
42292 </tgroup>
42293 </informaltable>
42294 <para>
42295 <indexterm role="concept">
42296 <primary>randomized host list</primary>
42297 </indexterm>
42298 <indexterm role="concept">
42299 <primary>host</primary>
42300 <secondary>list of; randomized</secondary>
42301 </indexterm>
42302 <indexterm role="concept">
42303 <primary>fallback</primary>
42304 <secondary>randomized hosts</secondary>
42305 </indexterm>
42306 If this option is set, and either the list of hosts is taken from the
42307 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42308 were not obtained from MX records (this includes fallback hosts from the
42309 router), and were not randomized by the router, the order of trying the hosts
42310 is randomized each time the transport runs. Randomizing the order of a host
42311 list can be used to do crude load sharing.
42312 </para>
42313 <para>
42314 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42315 order is separately randomized. This makes it possible to set up MX-like
42316 behaviour. The boundaries between groups are indicated by an item that is just
42317 <literal>+</literal> in the host list. For example:
42318 </para>
42319 <literallayout class="monospaced">
42320 hosts = host1:host2:host3:+:host4:host5
42321 </literallayout>
42322 <para>
42323 The order of the first three hosts and the order of the last two hosts is
42324 randomized for each use, but the first three always end up before the last two.
42325 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42326 </para>
42327 <para>
42328 <indexterm role="option">
42329 <primary><option>hosts_require_auth</option></primary>
42330 </indexterm>
42331 </para>
42332 <informaltable frame="all">
42333 <tgroup cols="4" colsep="0" rowsep="0">
42334 <colspec colwidth="8*" align="left"/>
42335 <colspec colwidth="6*" align="center"/>
42336 <colspec colwidth="6*" align="center"/>
42337 <colspec colwidth="6*" align="right"/>
42338 <tbody>
42339 <row>
42340 <entry><option>hosts_require_auth</option></entry>
42341 <entry>Use: <emphasis>smtp</emphasis></entry>
42342 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42343 <entry>Default: <emphasis>unset</emphasis></entry>
42344 </row>
42345 </tbody>
42346 </tgroup>
42347 </informaltable>
42348 <para>
42349 <indexterm role="concept">
42350 <primary>authentication</primary>
42351 <secondary>required by client</secondary>
42352 </indexterm>
42353 This option provides a list of servers for which authentication must succeed
42354 before Exim will try to transfer a message. If authentication fails for
42355 servers which are not in this list, Exim tries to send unauthenticated. If
42356 authentication fails for one of these servers, delivery is deferred. This
42357 temporary error is detectable in the retry rules, so it can be turned into a
42358 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42359 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42360 </para>
42361 <para>
42362 <indexterm role="option">
42363 <primary><option>hosts_require_tls</option></primary>
42364 </indexterm>
42365 </para>
42366 <informaltable frame="all">
42367 <tgroup cols="4" colsep="0" rowsep="0">
42368 <colspec colwidth="8*" align="left"/>
42369 <colspec colwidth="6*" align="center"/>
42370 <colspec colwidth="6*" align="center"/>
42371 <colspec colwidth="6*" align="right"/>
42372 <tbody>
42373 <row>
42374 <entry><option>hosts_require_tls</option></entry>
42375 <entry>Use: <emphasis>smtp</emphasis></entry>
42376 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42377 <entry>Default: <emphasis>unset</emphasis></entry>
42378 </row>
42379 </tbody>
42380 </tgroup>
42381 </informaltable>
42382 <para>
42383 <indexterm role="concept">
42384 <primary>TLS</primary>
42385 <secondary>requiring for certain servers</secondary>
42386 </indexterm>
42387 Exim will insist on using a TLS session when delivering to any host that
42388 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42389 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42390 incoming messages, use an appropriate ACL.
42391 </para>
42392 <para>
42393 <indexterm role="option">
42394 <primary><option>hosts_try_auth</option></primary>
42395 </indexterm>
42396 </para>
42397 <informaltable frame="all">
42398 <tgroup cols="4" colsep="0" rowsep="0">
42399 <colspec colwidth="8*" align="left"/>
42400 <colspec colwidth="6*" align="center"/>
42401 <colspec colwidth="6*" align="center"/>
42402 <colspec colwidth="6*" align="right"/>
42403 <tbody>
42404 <row>
42405 <entry><option>hosts_try_auth</option></entry>
42406 <entry>Use: <emphasis>smtp</emphasis></entry>
42407 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42408 <entry>Default: <emphasis>unset</emphasis></entry>
42409 </row>
42410 </tbody>
42411 </tgroup>
42412 </informaltable>
42413 <para>
42414 <indexterm role="concept">
42415 <primary>authentication</primary>
42416 <secondary>optional in client</secondary>
42417 </indexterm>
42418 This option provides a list of servers to which, provided they announce
42419 authentication support, Exim will attempt to authenticate as a client when it
42420 connects. If authentication fails, Exim will try to transfer the message
42421 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42422 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42423 </para>
42424 <para>
42425 <indexterm role="option">
42426 <primary><option>interface</option></primary>
42427 </indexterm>
42428 </para>
42429 <informaltable frame="all">
42430 <tgroup cols="4" colsep="0" rowsep="0">
42431 <colspec colwidth="8*" align="left"/>
42432 <colspec colwidth="6*" align="center"/>
42433 <colspec colwidth="6*" align="center"/>
42434 <colspec colwidth="6*" align="right"/>
42435 <tbody>
42436 <row>
42437 <entry><option>interface</option></entry>
42438 <entry>Use: <emphasis>smtp</emphasis></entry>
42439 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42440 <entry>Default: <emphasis>unset</emphasis></entry>
42441 </row>
42442 </tbody>
42443 </tgroup>
42444 </informaltable>
42445 <para>
42446 <indexterm role="concept">
42447 <primary>bind IP address</primary>
42448 </indexterm>
42449 <indexterm role="concept">
42450 <primary>IP address</primary>
42451 <secondary>binding</secondary>
42452 </indexterm>
42453 <indexterm role="variable">
42454 <primary><varname>$host</varname></primary>
42455 </indexterm>
42456 <indexterm role="variable">
42457 <primary><varname>$host_address</varname></primary>
42458 </indexterm>
42459 This option specifies which interface to bind to when making an outgoing SMTP
42460 call. The value is an IP address, not an interface name such as
42461 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
42462 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42463 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42464 outgoing interface address. There is no variable that contains an outgoing
42465 interface address because, unless it is set by this option, its value is
42466 unknown.
42467 </para>
42468 <para>
42469 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42470 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42471 during the expansion of the string. Forced expansion failure, or an empty
42472 string result causes the option to be ignored. Otherwise, after expansion, the
42473 string must be a list of IP addresses, colon-separated by default, but the
42474 separator can be changed in the usual way. For example:
42475 </para>
42476 <literallayout class="monospaced">
42477 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42478 </literallayout>
42479 <para>
42480 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42481 connection. If none of them are the correct type, the option is ignored. If
42482 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
42483 interface to use if the host has more than one.
42484 </para>
42485 <para>
42486 <indexterm role="option">
42487 <primary><option>keepalive</option></primary>
42488 </indexterm>
42489 </para>
42490 <informaltable frame="all">
42491 <tgroup cols="4" colsep="0" rowsep="0">
42492 <colspec colwidth="8*" align="left"/>
42493 <colspec colwidth="6*" align="center"/>
42494 <colspec colwidth="6*" align="center"/>
42495 <colspec colwidth="6*" align="right"/>
42496 <tbody>
42497 <row>
42498 <entry><option>keepalive</option></entry>
42499 <entry>Use: <emphasis>smtp</emphasis></entry>
42500 <entry>Type: <emphasis>boolean</emphasis></entry>
42501 <entry>Default: <emphasis>true</emphasis></entry>
42502 </row>
42503 </tbody>
42504 </tgroup>
42505 </informaltable>
42506 <para>
42507 <indexterm role="concept">
42508 <primary>keepalive</primary>
42509 <secondary>on outgoing connection</secondary>
42510 </indexterm>
42511 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42512 connections. When set, it causes the kernel to probe idle connections
42513 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42514 of the connection should send a acknowledgment if the connection is still okay
42515 or a reset if the connection has been aborted. The reason for doing this is
42516 that it has the beneficial effect of freeing up certain types of connection
42517 that can get stuck when the remote host is disconnected without tidying up the
42518 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42519 unreachable hosts.
42520 </para>
42521 <para>
42522 <indexterm role="option">
42523 <primary><option>lmtp_ignore_quota</option></primary>
42524 </indexterm>
42525 </para>
42526 <informaltable frame="all">
42527 <tgroup cols="4" colsep="0" rowsep="0">
42528 <colspec colwidth="8*" align="left"/>
42529 <colspec colwidth="6*" align="center"/>
42530 <colspec colwidth="6*" align="center"/>
42531 <colspec colwidth="6*" align="right"/>
42532 <tbody>
42533 <row>
42534 <entry><option>lmtp_ignore_quota</option></entry>
42535 <entry>Use: <emphasis>smtp</emphasis></entry>
42536 <entry>Type: <emphasis>boolean</emphasis></entry>
42537 <entry>Default: <emphasis>false</emphasis></entry>
42538 </row>
42539 </tbody>
42540 </tgroup>
42541 </informaltable>
42542 <para>
42543 <indexterm role="concept">
42544 <primary>LMTP</primary>
42545 <secondary>ignoring quota errors</secondary>
42546 </indexterm>
42547 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42548 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42549 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42550 </para>
42551 <para>
42552 <indexterm role="option">
42553 <primary><option>max_rcpt</option></primary>
42554 </indexterm>
42555 </para>
42556 <informaltable frame="all">
42557 <tgroup cols="4" colsep="0" rowsep="0">
42558 <colspec colwidth="8*" align="left"/>
42559 <colspec colwidth="6*" align="center"/>
42560 <colspec colwidth="6*" align="center"/>
42561 <colspec colwidth="6*" align="right"/>
42562 <tbody>
42563 <row>
42564 <entry><option>max_rcpt</option></entry>
42565 <entry>Use: <emphasis>smtp</emphasis></entry>
42566 <entry>Type: <emphasis>integer</emphasis></entry>
42567 <entry>Default: <emphasis>100</emphasis></entry>
42568 </row>
42569 </tbody>
42570 </tgroup>
42571 </informaltable>
42572 <para>
42573 <indexterm role="concept">
42574 <primary>RCPT</primary>
42575 <secondary>maximum number of outgoing</secondary>
42576 </indexterm>
42577 This option limits the number of RCPT commands that are sent in a single
42578 SMTP message transaction. Each set of addresses is treated independently, and
42579 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42580 permits this.
42581 </para>
42582 <para>
42583 <indexterm role="option">
42584 <primary><option>multi_domain</option></primary>
42585 </indexterm>
42586 </para>
42587 <informaltable frame="all">
42588 <tgroup cols="4" colsep="0" rowsep="0">
42589 <colspec colwidth="8*" align="left"/>
42590 <colspec colwidth="6*" align="center"/>
42591 <colspec colwidth="6*" align="center"/>
42592 <colspec colwidth="6*" align="right"/>
42593 <tbody>
42594 <row>
42595 <entry><option>multi_domain</option></entry>
42596 <entry>Use: <emphasis>smtp</emphasis></entry>
42597 <entry>Type: <emphasis>boolean</emphasis></entry>
42598 <entry>Default: <emphasis>true</emphasis></entry>
42599 </row>
42600 </tbody>
42601 </tgroup>
42602 </informaltable>
42603 <para>
42604 <indexterm role="variable">
42605 <primary><varname>$domain</varname></primary>
42606 </indexterm>
42607 When this option is set, the <command>smtp</command> transport can handle a number of
42608 addresses containing a mixture of different domains provided they all resolve
42609 to the same list of hosts. Turning the option off restricts the transport to
42610 handling only one domain at a time. This is useful if you want to use
42611 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42612 is a single domain involved in a remote delivery.
42613 </para>
42614 <para>
42615 <indexterm role="option">
42616 <primary><option>port</option></primary>
42617 </indexterm>
42618 </para>
42619 <informaltable frame="all">
42620 <tgroup cols="4" colsep="0" rowsep="0">
42621 <colspec colwidth="8*" align="left"/>
42622 <colspec colwidth="6*" align="center"/>
42623 <colspec colwidth="6*" align="center"/>
42624 <colspec colwidth="6*" align="right"/>
42625 <tbody>
42626 <row>
42627 <entry><option>port</option></entry>
42628 <entry>Use: <emphasis>smtp</emphasis></entry>
42629 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42630 <entry>Default: <emphasis>see below</emphasis></entry>
42631 </row>
42632 </tbody>
42633 </tgroup>
42634 </informaltable>
42635 <para>
42636 <indexterm role="concept">
42637 <primary>port</primary>
42638 <secondary>sending TCP/IP</secondary>
42639 </indexterm>
42640 <indexterm role="concept">
42641 <primary>TCP/IP</primary>
42642 <secondary>setting outgoing port</secondary>
42643 </indexterm>
42644 This option specifies the TCP/IP port on the server to which Exim connects.
42645 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42646 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42647 The name was changed to minimize confusion with the outgoing port. There is no
42648 variable that contains an outgoing port.
42649 </para>
42650 <para>
42651 If the value of this option begins with a digit it is taken as a port number;
42652 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42653 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42654 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42655 is deferred.
42656 </para>
42657 <para>
42658 <indexterm role="option">
42659 <primary><option>protocol</option></primary>
42660 </indexterm>
42661 </para>
42662 <informaltable frame="all">
42663 <tgroup cols="4" colsep="0" rowsep="0">
42664 <colspec colwidth="8*" align="left"/>
42665 <colspec colwidth="6*" align="center"/>
42666 <colspec colwidth="6*" align="center"/>
42667 <colspec colwidth="6*" align="right"/>
42668 <tbody>
42669 <row>
42670 <entry><option>protocol</option></entry>
42671 <entry>Use: <emphasis>smtp</emphasis></entry>
42672 <entry>Type: <emphasis>string</emphasis></entry>
42673 <entry>Default: <emphasis>smtp</emphasis></entry>
42674 </row>
42675 </tbody>
42676 </tgroup>
42677 </informaltable>
42678 <para>
42679 <indexterm role="concept">
42680 <primary>LMTP</primary>
42681 <secondary>over TCP/IP</secondary>
42682 </indexterm>
42683 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42684 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42685 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42686 deliveries into closed message stores. Exim also has support for running LMTP
42687 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
42688 </para>
42689 <para>
42690 <indexterm role="option">
42691 <primary><option>retry_include_ip_address</option></primary>
42692 </indexterm>
42693 </para>
42694 <informaltable frame="all">
42695 <tgroup cols="4" colsep="0" rowsep="0">
42696 <colspec colwidth="8*" align="left"/>
42697 <colspec colwidth="6*" align="center"/>
42698 <colspec colwidth="6*" align="center"/>
42699 <colspec colwidth="6*" align="right"/>
42700 <tbody>
42701 <row>
42702 <entry><option>retry_include_ip_address</option></entry>
42703 <entry>Use: <emphasis>smtp</emphasis></entry>
42704 <entry>Type: <emphasis>boolean</emphasis></entry>
42705 <entry>Default: <emphasis>true</emphasis></entry>
42706 </row>
42707 </tbody>
42708 </tgroup>
42709 </informaltable>
42710 <para>
42711 Exim normally includes both the host name and the IP address in the key it
42712 constructs for indexing retry data after a temporary delivery failure. This
42713 means that when one of several IP addresses for a host is failing, it gets
42714 tried periodically (controlled by the retry rules), but use of the other IP
42715 addresses is not affected.
42716 </para>
42717 <para>
42718 However, in some dialup environments hosts are assigned a different IP address
42719 each time they connect. In this situation the use of the IP address as part of
42720 the retry key leads to undesirable behaviour. Setting this option false causes
42721 Exim to use only the host name. This should normally be done on a separate
42722 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42723 hosts.
42724 </para>
42725 <para>
42726 <indexterm role="option">
42727 <primary><option>serialize_hosts</option></primary>
42728 </indexterm>
42729 </para>
42730 <informaltable frame="all">
42731 <tgroup cols="4" colsep="0" rowsep="0">
42732 <colspec colwidth="8*" align="left"/>
42733 <colspec colwidth="6*" align="center"/>
42734 <colspec colwidth="6*" align="center"/>
42735 <colspec colwidth="6*" align="right"/>
42736 <tbody>
42737 <row>
42738 <entry><option>serialize_hosts</option></entry>
42739 <entry>Use: <emphasis>smtp</emphasis></entry>
42740 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42741 <entry>Default: <emphasis>unset</emphasis></entry>
42742 </row>
42743 </tbody>
42744 </tgroup>
42745 </informaltable>
42746 <para>
42747 <indexterm role="concept">
42748 <primary>serializing connections</primary>
42749 </indexterm>
42750 <indexterm role="concept">
42751 <primary>host</primary>
42752 <secondary>serializing connections</secondary>
42753 </indexterm>
42754 Because Exim operates in a distributed manner, if several messages for the same
42755 host arrive at around the same time, more than one simultaneous connection to
42756 the remote host can occur. This is not usually a problem except when there is a
42757 slow link between the hosts. In that situation it may be helpful to restrict
42758 Exim to one connection at a time. This can be done by setting
42759 <option>serialize_hosts</option> to match the relevant hosts.
42760 </para>
42761 <para>
42762 <indexterm role="concept">
42763 <primary>hints database</primary>
42764 <secondary>serializing deliveries to a host</secondary>
42765 </indexterm>
42766 Exim implements serialization by means of a hints database in which a record is
42767 written whenever a process connects to one of the restricted hosts. The record
42768 is deleted when the connection is completed. Obviously there is scope for
42769 records to get left lying around if there is a system or program crash. To
42770 guard against this, Exim ignores any records that are more than six hours old.
42771 </para>
42772 <para>
42773 If you set up this kind of serialization, you should also arrange to delete the
42774 relevant hints database whenever your system reboots. The names of the files
42775 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42776 may be one or two files, depending on the type of DBM in use. The same files
42777 are used for ETRN serialization.
42778 </para>
42779 <para>
42780 <indexterm role="option">
42781 <primary><option>size_addition</option></primary>
42782 </indexterm>
42783 </para>
42784 <informaltable frame="all">
42785 <tgroup cols="4" colsep="0" rowsep="0">
42786 <colspec colwidth="8*" align="left"/>
42787 <colspec colwidth="6*" align="center"/>
42788 <colspec colwidth="6*" align="center"/>
42789 <colspec colwidth="6*" align="right"/>
42790 <tbody>
42791 <row>
42792 <entry><option>size_addition</option></entry>
42793 <entry>Use: <emphasis>smtp</emphasis></entry>
42794 <entry>Type: <emphasis>integer</emphasis></entry>
42795 <entry>Default: <emphasis>1024</emphasis></entry>
42796 </row>
42797 </tbody>
42798 </tgroup>
42799 </informaltable>
42800 <para>
42801 <indexterm role="concept">
42802 <primary>SMTP</primary>
42803 <secondary>SIZE</secondary>
42804 </indexterm>
42805 <indexterm role="concept">
42806 <primary>message</primary>
42807 <secondary>size issue for transport filter</secondary>
42808 </indexterm>
42809 <indexterm role="concept">
42810 <primary>size</primary>
42811 <secondary>of message</secondary>
42812 </indexterm>
42813 <indexterm role="concept">
42814 <primary>transport</primary>
42815 <secondary>filter</secondary>
42816 </indexterm>
42817 <indexterm role="concept">
42818 <primary>filter</primary>
42819 <secondary>transport filter</secondary>
42820 </indexterm>
42821 If a remote SMTP server indicates that it supports the SIZE option of the
42822 MAIL command, Exim uses this to pass over the message size at the start of
42823 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
42824 sends, to allow for headers and other text that may be added during delivery by
42825 configuration options or in a transport filter. It may be necessary to increase
42826 this if a lot of text is added to messages.
42827 </para>
42828 <para>
42829 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
42830 the use of the SIZE option altogether.
42831 </para>
42832 <para>
42833 <indexterm role="option">
42834 <primary><option>tls_certificate</option></primary>
42835 </indexterm>
42836 </para>
42837 <informaltable frame="all">
42838 <tgroup cols="4" colsep="0" rowsep="0">
42839 <colspec colwidth="8*" align="left"/>
42840 <colspec colwidth="6*" align="center"/>
42841 <colspec colwidth="6*" align="center"/>
42842 <colspec colwidth="6*" align="right"/>
42843 <tbody>
42844 <row>
42845 <entry><option>tls_certificate</option></entry>
42846 <entry>Use: <emphasis>smtp</emphasis></entry>
42847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42848 <entry>Default: <emphasis>unset</emphasis></entry>
42849 </row>
42850 </tbody>
42851 </tgroup>
42852 </informaltable>
42853 <para>
42854 <indexterm role="concept">
42855 <primary>TLS</primary>
42856 <secondary>client certificate, location of</secondary>
42857 </indexterm>
42858 <indexterm role="concept">
42859 <primary>certificate</primary>
42860 <secondary>client, location of</secondary>
42861 </indexterm>
42862 <indexterm role="variable">
42863 <primary><varname>$host</varname></primary>
42864 </indexterm>
42865 <indexterm role="variable">
42866 <primary><varname>$host_address</varname></primary>
42867 </indexterm>
42868 The value of this option must be the absolute path to a file which contains the
42869 client&#x2019;s certificate, for possible use when sending a message over an encrypted
42870 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
42871 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
42872 details of TLS.
42873 </para>
42874 <para>
42875 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
42876 certificate when sending messages as a client. The global option of the same
42877 name specifies the certificate for Exim as a server; it is not automatically
42878 assumed that the same certificate should be used when Exim is operating as a
42879 client.
42880 </para>
42881 <para>
42882 <indexterm role="option">
42883 <primary><option>tls_crl</option></primary>
42884 </indexterm>
42885 </para>
42886 <informaltable frame="all">
42887 <tgroup cols="4" colsep="0" rowsep="0">
42888 <colspec colwidth="8*" align="left"/>
42889 <colspec colwidth="6*" align="center"/>
42890 <colspec colwidth="6*" align="center"/>
42891 <colspec colwidth="6*" align="right"/>
42892 <tbody>
42893 <row>
42894 <entry><option>tls_crl</option></entry>
42895 <entry>Use: <emphasis>smtp</emphasis></entry>
42896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42897 <entry>Default: <emphasis>unset</emphasis></entry>
42898 </row>
42899 </tbody>
42900 </tgroup>
42901 </informaltable>
42902 <para>
42903 <indexterm role="concept">
42904 <primary>TLS</primary>
42905 <secondary>client certificate revocation list</secondary>
42906 </indexterm>
42907 <indexterm role="concept">
42908 <primary>certificate</primary>
42909 <secondary>revocation list for client</secondary>
42910 </indexterm>
42911 This option specifies a certificate revocation list. The expanded value must
42912 be the name of a file that contains a CRL in PEM format.
42913 </para>
42914 <para>
42915 <indexterm role="option">
42916 <primary><option>tls_privatekey</option></primary>
42917 </indexterm>
42918 </para>
42919 <informaltable frame="all">
42920 <tgroup cols="4" colsep="0" rowsep="0">
42921 <colspec colwidth="8*" align="left"/>
42922 <colspec colwidth="6*" align="center"/>
42923 <colspec colwidth="6*" align="center"/>
42924 <colspec colwidth="6*" align="right"/>
42925 <tbody>
42926 <row>
42927 <entry><option>tls_privatekey</option></entry>
42928 <entry>Use: <emphasis>smtp</emphasis></entry>
42929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42930 <entry>Default: <emphasis>unset</emphasis></entry>
42931 </row>
42932 </tbody>
42933 </tgroup>
42934 </informaltable>
42935 <para>
42936 <indexterm role="concept">
42937 <primary>TLS</primary>
42938 <secondary>client private key, location of</secondary>
42939 </indexterm>
42940 <indexterm role="variable">
42941 <primary><varname>$host</varname></primary>
42942 </indexterm>
42943 <indexterm role="variable">
42944 <primary><varname>$host_address</varname></primary>
42945 </indexterm>
42946 The value of this option must be the absolute path to a file which contains the
42947 client&#x2019;s private key. This is used when sending a message over an encrypted
42948 connection using a client certificate. The values of <varname>$host</varname> and
42949 <varname>$host_address</varname> are set to the name and address of the server during the
42950 expansion. If this option is unset, or the expansion is forced to fail, or the
42951 result is an empty string, the private key is assumed to be in the same file as
42952 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42953 </para>
42954 <para>
42955 <indexterm role="option">
42956 <primary><option>tls_require_ciphers</option></primary>
42957 </indexterm>
42958 </para>
42959 <informaltable frame="all">
42960 <tgroup cols="4" colsep="0" rowsep="0">
42961 <colspec colwidth="8*" align="left"/>
42962 <colspec colwidth="6*" align="center"/>
42963 <colspec colwidth="6*" align="center"/>
42964 <colspec colwidth="6*" align="right"/>
42965 <tbody>
42966 <row>
42967 <entry><option>tls_require_ciphers</option></entry>
42968 <entry>Use: <emphasis>smtp</emphasis></entry>
42969 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42970 <entry>Default: <emphasis>unset</emphasis></entry>
42971 </row>
42972 </tbody>
42973 </tgroup>
42974 </informaltable>
42975 <para>
42976 <indexterm role="concept">
42977 <primary>TLS</primary>
42978 <secondary>requiring specific ciphers</secondary>
42979 </indexterm>
42980 <indexterm role="concept">
42981 <primary>cipher</primary>
42982 <secondary>requiring specific</secondary>
42983 </indexterm>
42984 <indexterm role="variable">
42985 <primary><varname>$host</varname></primary>
42986 </indexterm>
42987 <indexterm role="variable">
42988 <primary><varname>$host_address</varname></primary>
42989 </indexterm>
42990 The value of this option must be a list of permitted cipher suites, for use
42991 when setting up an outgoing encrypted connection. (There is a global option of
42992 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
42993 <varname>$host_address</varname> are set to the name and address of the server during the
42994 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
42995 is used in different ways by OpenSSL and GnuTLS (see sections
42996 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
42997 ciphers is a preference order.
42998 </para>
42999 <para>
43000 <indexterm role="option">
43001 <primary><option>tls_tempfail_tryclear</option></primary>
43002 </indexterm>
43003 </para>
43004 <informaltable frame="all">
43005 <tgroup cols="4" colsep="0" rowsep="0">
43006 <colspec colwidth="8*" align="left"/>
43007 <colspec colwidth="6*" align="center"/>
43008 <colspec colwidth="6*" align="center"/>
43009 <colspec colwidth="6*" align="right"/>
43010 <tbody>
43011 <row>
43012 <entry><option>tls_tempfail_tryclear</option></entry>
43013 <entry>Use: <emphasis>smtp</emphasis></entry>
43014 <entry>Type: <emphasis>boolean</emphasis></entry>
43015 <entry>Default: <emphasis>true</emphasis></entry>
43016 </row>
43017 </tbody>
43018 </tgroup>
43019 </informaltable>
43020 <para>
43021 <indexterm role="concept">
43022 <primary>4<emphasis>xx</emphasis> responses</primary>
43023 <secondary>to STARTTLS</secondary>
43024 </indexterm>
43025 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43026 setting up a TLS session, this option determines whether or not Exim should try
43027 to deliver the message unencrypted. If it is set false, delivery to the
43028 current host is deferred; if there are other hosts, they are tried. If this
43029 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43030 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43031 TLS negotiation fails, Exim closes the current connection (because it is in an
43032 unknown state), opens a new one to the same host, and then tries the delivery
43033 in clear.
43034 </para>
43035 <para>
43036 <indexterm role="option">
43037 <primary><option>tls_verify_certificates</option></primary>
43038 </indexterm>
43039 </para>
43040 <informaltable frame="all">
43041 <tgroup cols="4" colsep="0" rowsep="0">
43042 <colspec colwidth="8*" align="left"/>
43043 <colspec colwidth="6*" align="center"/>
43044 <colspec colwidth="6*" align="center"/>
43045 <colspec colwidth="6*" align="right"/>
43046 <tbody>
43047 <row>
43048 <entry><option>tls_verify_certificates</option></entry>
43049 <entry>Use: <emphasis>smtp</emphasis></entry>
43050 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43051 <entry>Default: <emphasis>unset</emphasis></entry>
43052 </row>
43053 </tbody>
43054 </tgroup>
43055 </informaltable>
43056 <para>
43057 <indexterm role="concept">
43058 <primary>TLS</primary>
43059 <secondary>server certificate verification</secondary>
43060 </indexterm>
43061 <indexterm role="concept">
43062 <primary>certificate</primary>
43063 <secondary>verification of server</secondary>
43064 </indexterm>
43065 <indexterm role="variable">
43066 <primary><varname>$host</varname></primary>
43067 </indexterm>
43068 <indexterm role="variable">
43069 <primary><varname>$host_address</varname></primary>
43070 </indexterm>
43071 The value of this option must be the absolute path to a file containing
43072 permitted server certificates, for use when setting up an encrypted connection.
43073 Alternatively, if you are using OpenSSL, you can set
43074 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43075 files. This does not work with GnuTLS; the option must be set to the name of a
43076 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43077 <varname>$host_address</varname> are set to the name and address of the server during the
43078 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43079 </para>
43080 </section>
43081 <section id="SECTvalhosmax">
43082 <title>How the limits for the number of hosts to try are used</title>
43083 <para>
43084 <indexterm role="concept">
43085 <primary>host</primary>
43086 <secondary>maximum number to try</secondary>
43087 </indexterm>
43088 <indexterm role="concept">
43089 <primary>limit</primary>
43090 <secondary>hosts; maximum number tried</secondary>
43091 </indexterm>
43092 There are two options that are concerned with the number of hosts that are
43093 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43094 <option>hosts_max_try_hardlimit</option>.
43095 </para>
43096 <para>
43097 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43098 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43099 option actually applies to each IP address independently. In other words, a
43100 multihomed host is treated as several independent hosts, just as it is for
43101 retrying.
43102 </para>
43103 <para>
43104 Many of the larger ISPs have multiple MX records which often point to
43105 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43106 created as a result of routing one of these domains.
43107 </para>
43108 <para>
43109 Trying every single IP address on such a long list does not seem sensible; if
43110 several at the top of the list fail, it is reasonable to assume there is some
43111 problem that is likely to affect all of them. Roughly speaking, the value of
43112 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43113 delivery. However, the logic cannot be quite that simple.
43114 </para>
43115 <para>
43116 Firstly, IP addresses that are skipped because their retry times have not
43117 arrived do not count, and in addition, addresses that are past their retry
43118 limits are also not counted, even when they are tried. This means that when
43119 some IP addresses are past their retry limits, more than the value of
43120 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43121 that all IP addresses are considered before timing out an email address (but
43122 see below for an exception).
43123 </para>
43124 <para>
43125 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43126 list to see if there is a subsequent host with a different (higher valued) MX.
43127 If there is, that host is considered next, and the current IP address is used
43128 but not counted. This behaviour helps in the case of a domain with a retry rule
43129 that hardly ever delays any hosts, as is now explained:
43130 </para>
43131 <para>
43132 Consider the case of a long list of hosts with one MX value, and a few with a
43133 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43134 hosts at the top of the list are tried at first. With the default retry rule,
43135 which specifies increasing retry times, the higher MX hosts are eventually
43136 tried when those at the top of the list are skipped because they have not
43137 reached their retry times.
43138 </para>
43139 <para>
43140 However, it is common practice to put a fixed short retry time on domains for
43141 large ISPs, on the grounds that their servers are rarely down for very long.
43142 Unfortunately, these are exactly the domains that tend to resolve to long lists
43143 of hosts. The short retry time means that the lowest MX hosts are tried every
43144 time. The attempts may be in a different order because of random sorting, but
43145 without the special MX check, the higher MX hosts would never be tried until
43146 all the lower MX hosts had timed out (which might be several days), because
43147 there are always some lower MX hosts that have reached their retry times. With
43148 the special check, Exim considers at least one IP address from each MX value at
43149 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43150 reached.
43151 </para>
43152 <para>
43153 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43154 particular, Exim normally eventually tries all the IP addresses before timing
43155 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43156 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43157 been set up with hundreds of IP addresses for some domains. It can
43158 take a very long time indeed for an address to time out in these cases.
43159 </para>
43160 <para>
43161 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43162 Exim never tries more than this number of IP addresses; if it hits this limit
43163 and they are all timed out, the email address is bounced, even though not all
43164 possible IP addresses have been tried.
43165 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43166 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43167 </para>
43168 </section>
43169 </chapter>
43170
43171 <chapter id="CHAPrewrite">
43172 <title>Address rewriting</title>
43173 <para>
43174 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43175 <primary>rewriting</primary>
43176 <secondary>addresses</secondary>
43177 </indexterm>
43178 There are some circumstances in which Exim automatically rewrites domains in
43179 addresses. The two most common are when an address is given without a domain
43180 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43181 abbreviated domain that is expanded by DNS lookup.
43182 </para>
43183 <para>
43184 Unqualified envelope addresses are accepted only for locally submitted
43185 messages, or for messages that are received from hosts matching
43186 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43187 appropriate. Unqualified addresses in header lines are qualified if they are in
43188 locally submitted messages, or messages from hosts that are permitted to send
43189 unqualified envelope addresses. Otherwise, unqualified addresses in header
43190 lines are neither qualified nor rewritten.
43191 </para>
43192 <para>
43193 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43194 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43195 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43196 do this. The new RFCs do not contain this suggestion.
43197 </para>
43198 <section id="SECID147">
43199 <title>Explicitly configured address rewriting</title>
43200 <para>
43201 This chapter describes the rewriting rules that can be used in the
43202 main rewrite section of the configuration file, and also in the generic
43203 <option>headers_rewrite</option> option that can be set on any transport.
43204 </para>
43205 <para>
43206 Some people believe that configured address rewriting is a Mortal Sin.
43207 Others believe that life is not possible without it. Exim provides the
43208 facility; you do not have to use it.
43209 </para>
43210 <para>
43211 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43212 configuration file are applied to addresses in incoming messages, both envelope
43213 addresses and addresses in header lines. Each rule specifies the types of
43214 address to which it applies.
43215 </para>
43216 <para>
43217 Whether or not addresses in header lines are rewritten depends on the origin of
43218 the headers and the type of rewriting. Global rewriting, that is, rewriting
43219 rules from the rewrite section of the configuration file, is applied only to
43220 those headers that were received with the message. Header lines that are added
43221 by ACLs or by a system filter or by individual routers or transports (which
43222 are specific to individual recipient addresses) are not rewritten by the global
43223 rules.
43224 </para>
43225 <para>
43226 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43227 applies all headers except those added by routers and transports. That is, as
43228 well as the headers that were received with the message, it also applies to
43229 headers that were added by an ACL or a system filter.
43230 </para>
43231 <para>
43232 In general, rewriting addresses from your own system or domain has some
43233 legitimacy. Rewriting other addresses should be done only with great care and
43234 in special circumstances. The author of Exim believes that rewriting should be
43235 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43236 Although it can sometimes be used as a routing tool, this is very strongly
43237 discouraged.
43238 </para>
43239 <para>
43240 There are two commonly encountered circumstances where rewriting is used, as
43241 illustrated by these examples:
43242 </para>
43243 <itemizedlist>
43244 <listitem>
43245 <para>
43246 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43247 exchange mail with each other behind a firewall, but there is only a single
43248 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43249 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43250 </para>
43251 </listitem>
43252 <listitem>
43253 <para>
43254 A host rewrites the local parts of its own users so that, for example,
43255 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43256 </para>
43257 </listitem>
43258 </itemizedlist>
43259 </section>
43260 <section id="SECID148">
43261 <title>When does rewriting happen?</title>
43262 <para>
43263 <indexterm role="concept">
43264 <primary>rewriting</primary>
43265 <secondary>timing of</secondary>
43266 </indexterm>
43267 <indexterm role="concept">
43268 <primary>access control lists (ACLs)</primary>
43269 <secondary>rewriting addresses in</secondary>
43270 </indexterm>
43271 Configured address rewriting can take place at several different stages of a
43272 message&#x2019;s processing.
43273 </para>
43274 <para>
43275 <indexterm role="variable">
43276 <primary><varname>$sender_address</varname></primary>
43277 </indexterm>
43278 At the start of an ACL for MAIL, the sender address may have been rewritten
43279 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43280 ordinary rewrite rules have yet been applied. If, however, the sender address
43281 is verified in the ACL, it is rewritten before verification, and remains
43282 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43283 rewritten address. This also applies if sender verification happens in a
43284 RCPT ACL. Otherwise, when the sender address is not verified, it is
43285 rewritten as soon as a message&#x2019;s header lines have been received.
43286 </para>
43287 <para>
43288 <indexterm role="variable">
43289 <primary><varname>$domain</varname></primary>
43290 </indexterm>
43291 <indexterm role="variable">
43292 <primary><varname>$local_part</varname></primary>
43293 </indexterm>
43294 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
43295 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43296 rewrite rules have yet been applied to it. However, the behaviour is different
43297 from the sender address when a recipient is verified. The address is rewritten
43298 for the verification, but the rewriting is not remembered at this stage. The
43299 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43300 as they were before (that is, they contain the unrewritten &ndash; except for
43301 SMTP-time rewriting &ndash; address).
43302 </para>
43303 <para>
43304 As soon as a message&#x2019;s header lines have been received, all the envelope
43305 recipient addresses are permanently rewritten, and rewriting is also applied to
43306 the addresses in the header lines (if configured). This happens before adding
43307 any header lines that were specified in MAIL or RCPT ACLs, and
43308 <indexterm role="concept">
43309 <primary><function>local_scan()</function> function</primary>
43310 <secondary>address rewriting; timing of</secondary>
43311 </indexterm>
43312 before the DATA ACL and <function>local_scan()</function> functions are run.
43313 </para>
43314 <para>
43315 When an address is being routed, either for delivery or for verification,
43316 rewriting is applied immediately to child addresses that are generated by
43317 redirection, unless <option>no_rewrite</option> is set on the router.
43318 </para>
43319 <para>
43320 <indexterm role="concept">
43321 <primary>envelope sender</primary>
43322 <secondary>rewriting at transport time</secondary>
43323 </indexterm>
43324 <indexterm role="concept">
43325 <primary>rewriting</primary>
43326 <secondary>at transport time</secondary>
43327 </indexterm>
43328 <indexterm role="concept">
43329 <primary>header lines</primary>
43330 <secondary>rewriting at transport time</secondary>
43331 </indexterm>
43332 At transport time, additional rewriting of addresses in header lines can be
43333 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43334 This option contains rules that are identical in form to those in the rewrite
43335 section of the configuration file. They are applied to the original message
43336 header lines and any that were added by ACLs or a system filter. They are not
43337 applied to header lines that are added by routers or the transport.
43338 </para>
43339 <para>
43340 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43341 transport option. However, it is not possible to rewrite envelope recipients at
43342 transport time.
43343 </para>
43344 </section>
43345 <section id="SECID149">
43346 <title>Testing the rewriting rules that apply on input</title>
43347 <para>
43348 <indexterm role="concept">
43349 <primary>rewriting</primary>
43350 <secondary>testing</secondary>
43351 </indexterm>
43352 <indexterm role="concept">
43353 <primary>testing</primary>
43354 <secondary>rewriting</secondary>
43355 </indexterm>
43356 Exim&#x2019;s input rewriting configuration appears in a part of the run time
43357 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43358 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43359 2822 address) as its argument. The output is a list of how the address would be
43360 transformed by the rewriting rules for each of the different places it might
43361 appear in an incoming message, that is, for each different header and for the
43362 envelope sender and recipient fields. For example,
43363 </para>
43364 <literallayout class="monospaced">
43365 exim -brw ph10@exim.workshop.example
43366 </literallayout>
43367 <para>
43368 might produce the output
43369 </para>
43370 <literallayout class="monospaced">
43371 sender: Philip.Hazel@exim.workshop.example
43372 from: Philip.Hazel@exim.workshop.example
43373 to: ph10@exim.workshop.example
43374 cc: ph10@exim.workshop.example
43375 bcc: ph10@exim.workshop.example
43376 reply-to: Philip.Hazel@exim.workshop.example
43377 env-from: Philip.Hazel@exim.workshop.example
43378 env-to: ph10@exim.workshop.example
43379 </literallayout>
43380 <para>
43381 which shows that rewriting has been set up for that address when used in any of
43382 the source fields, but not when it appears as a recipient address. At the
43383 present time, there is no equivalent way of testing rewriting rules that are
43384 set for a particular transport.
43385 </para>
43386 </section>
43387 <section id="SECID150">
43388 <title>Rewriting rules</title>
43389 <para>
43390 <indexterm role="concept">
43391 <primary>rewriting</primary>
43392 <secondary>rules</secondary>
43393 </indexterm>
43394 The rewrite section of the configuration file consists of lines of rewriting
43395 rules in the form
43396 </para>
43397 <literallayout>
43398 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
43399 </literallayout>
43400 <para>
43401 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43402 transport option are given as a colon-separated list. Each item in the list
43403 takes the same form as a line in the main rewriting configuration (except that
43404 any colons must be doubled, of course).
43405 </para>
43406 <para>
43407 The formats of source patterns and replacement strings are described below.
43408 Each is terminated by white space, unless enclosed in double quotes, in which
43409 case normal quoting conventions apply inside the quotes. The flags are single
43410 characters which may appear in any order. Spaces and tabs between them are
43411 ignored.
43412 </para>
43413 <para>
43414 For each address that could potentially be rewritten, the rules are scanned in
43415 order, and replacements for the address from earlier rules can themselves be
43416 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43417 </para>
43418 <para>
43419 The order in which addresses are rewritten is undefined, may change between
43420 releases, and must not be relied on, with one exception: when a message is
43421 received, the envelope sender is always rewritten first, before any header
43422 lines are rewritten. For example, the replacement string for a rewrite of an
43423 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
43424 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43425 that the envelope sender has already been rewritten.
43426 </para>
43427 <para>
43428 <indexterm role="variable">
43429 <primary><varname>$domain</varname></primary>
43430 </indexterm>
43431 <indexterm role="variable">
43432 <primary><varname>$local_part</varname></primary>
43433 </indexterm>
43434 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43435 string to refer to the address that is being rewritten. Note that lookup-driven
43436 rewriting can be done by a rule of the form
43437 </para>
43438 <literallayout class="monospaced">
43439 *@*   ${lookup ...
43440 </literallayout>
43441 <para>
43442 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43443 refer to the address that is being rewritten.
43444 </para>
43445 </section>
43446 <section id="SECID151">
43447 <title>Rewriting patterns</title>
43448 <para>
43449 <indexterm role="concept">
43450 <primary>rewriting</primary>
43451 <secondary>patterns</secondary>
43452 </indexterm>
43453 <indexterm role="concept">
43454 <primary>address list</primary>
43455 <secondary>in a rewriting pattern</secondary>
43456 </indexterm>
43457 The source pattern in a rewriting rule is any item which may appear in an
43458 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43459 single-item address list, which means that it is expanded before being tested
43460 against the address. As always, if you use a regular expression as a pattern,
43461 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43462 facility to suppress string expansion within the regular expression.
43463 </para>
43464 <para>
43465 Domains in patterns should be given in lower case. Local parts in patterns are
43466 case-sensitive. If you want to do case-insensitive matching of local parts, you
43467 can use a regular expression that starts with <literal>^(?i)</literal>.
43468 </para>
43469 <para>
43470 <indexterm role="concept">
43471 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43472 <secondary>in rewriting rules</secondary>
43473 </indexterm>
43474 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43475 depending on the type of match which occurred. These can be used in the
43476 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43477 refers to the complete incoming address. When a regular expression is used, the
43478 numerical variables are set from its capturing subexpressions. For other types
43479 of pattern they are set as follows:
43480 </para>
43481 <itemizedlist>
43482 <listitem>
43483 <para>
43484 If a local part or domain starts with an asterisk, the numerical variables
43485 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43486 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43487 pattern
43488 </para>
43489 <literallayout class="monospaced">
43490 *queen@*.fict.example
43491 </literallayout>
43492 <para>
43493 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43494 </para>
43495 <literallayout class="monospaced">
43496 $0 = hearts-queen@wonderland.fict.example
43497 $1 = hearts-
43498 $2 = wonderland
43499 </literallayout>
43500 <para>
43501 Note that if the local part does not start with an asterisk, but the domain
43502 does, it is <varname>$1</varname> that contains the wild part of the domain.
43503 </para>
43504 </listitem>
43505 <listitem>
43506 <para>
43507 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43508 of the domain are placed in the next available numerical variables. Suppose,
43509 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43510 rewriting rule of the form
43511 </para>
43512 <literallayout>
43513 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
43514 </literallayout>
43515 <para>
43516 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43517 </para>
43518 <literallayout class="monospaced">
43519 $1 = foo
43520 $2 = bar
43521 $3 = baz.example
43522 </literallayout>
43523 <para>
43524 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43525 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43526 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43527 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43528 whole domain. For non-partial domain lookups, no numerical variables are set.
43529 </para>
43530 </listitem>
43531 </itemizedlist>
43532 </section>
43533 <section id="SECID152">
43534 <title>Rewriting replacements</title>
43535 <para>
43536 <indexterm role="concept">
43537 <primary>rewriting</primary>
43538 <secondary>replacements</secondary>
43539 </indexterm>
43540 If the replacement string for a rule is a single asterisk, addresses that
43541 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43542 rewriting rules are scanned. For example,
43543 </para>
43544 <literallayout class="monospaced">
43545 hatta@lookingglass.fict.example  *  f
43546 </literallayout>
43547 <para>
43548 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43549 <emphasis>From:</emphasis> headers.
43550 </para>
43551 <para>
43552 <indexterm role="variable">
43553 <primary><varname>$domain</varname></primary>
43554 </indexterm>
43555 <indexterm role="variable">
43556 <primary><varname>$local_part</varname></primary>
43557 </indexterm>
43558 If the replacement string is not a single asterisk, it is expanded, and must
43559 yield a fully qualified address. Within the expansion, the variables
43560 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43561 Any letters they contain retain their original case &ndash; they are not lower
43562 cased. The numerical variables are set up according to the type of pattern that
43563 matched the address, as described above. If the expansion is forced to fail by
43564 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43565 current rule is abandoned, but subsequent rules may take effect. Any other
43566 expansion failure causes the entire rewriting operation to be abandoned, and an
43567 entry written to the panic log.
43568 </para>
43569 </section>
43570 <section id="SECID153">
43571 <title>Rewriting flags</title>
43572 <para>
43573 There are three different kinds of flag that may appear on rewriting rules:
43574 </para>
43575 <itemizedlist>
43576 <listitem>
43577 <para>
43578 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43579 c, f, h, r, s, t.
43580 </para>
43581 </listitem>
43582 <listitem>
43583 <para>
43584 A flag that specifies rewriting at SMTP time: S.
43585 </para>
43586 </listitem>
43587 <listitem>
43588 <para>
43589 Flags that control the rewriting process: Q, q, R, w.
43590 </para>
43591 </listitem>
43592 </itemizedlist>
43593 <para>
43594 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43595 E, F, T, and S are not permitted.
43596 </para>
43597 </section>
43598 <section id="SECID154">
43599 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43600 <para>
43601 <indexterm role="concept">
43602 <primary>rewriting</primary>
43603 <secondary>flags</secondary>
43604 </indexterm>
43605 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43606 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43607 and to both the sender and recipient fields of the envelope, whereas a
43608 transport-time rewriting rule just applies to all headers. Otherwise, the
43609 rewriting rule is skipped unless the relevant addresses are being processed.
43610 </para>
43611 <literallayout>
43612 <literal>E</literal>       rewrite all envelope fields
43613 <literal>F</literal>       rewrite the envelope From field
43614 <literal>T</literal>       rewrite the envelope To field
43615 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
43616 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
43617 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
43618 <literal>h</literal>       rewrite all headers
43619 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
43620 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
43621 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
43622 </literallayout>
43623 <para>
43624 "All headers" means all of the headers listed above that can be selected
43625 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
43626 other headers such as <emphasis>Subject:</emphasis> etc.
43627 </para>
43628 <para>
43629 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43630 restrict this to special known cases in your own domains.
43631 </para>
43632 </section>
43633 <section id="SECTrewriteS">
43634 <title>The SMTP-time rewriting flag</title>
43635 <para>
43636 <indexterm role="concept">
43637 <primary>SMTP</primary>
43638 <secondary>rewriting malformed addresses</secondary>
43639 </indexterm>
43640 <indexterm role="concept">
43641 <primary>RCPT</primary>
43642 <secondary>rewriting argument of</secondary>
43643 </indexterm>
43644 <indexterm role="concept">
43645 <primary>MAIL</primary>
43646 <secondary>rewriting argument of</secondary>
43647 </indexterm>
43648 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43649 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43650 before any other processing; even before syntax checking. The pattern is
43651 required to be a regular expression, and it is matched against the whole of the
43652 data for the command, including any surrounding angle brackets.
43653 </para>
43654 <para>
43655 <indexterm role="variable">
43656 <primary><varname>$domain</varname></primary>
43657 </indexterm>
43658 <indexterm role="variable">
43659 <primary><varname>$local_part</varname></primary>
43660 </indexterm>
43661 This form of rewrite rule allows for the handling of addresses that are not
43662 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43663 input). Because the input is not required to be a syntactically valid address,
43664 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43665 expansion of the replacement string. The result of rewriting replaces the
43666 original address in the MAIL or RCPT command.
43667 </para>
43668 </section>
43669 <section id="SECID155">
43670 <title>Flags controlling the rewriting process</title>
43671 <para>
43672 There are four flags which control the way the rewriting process works. These
43673 take effect only when a rule is invoked, that is, when the address is of the
43674 correct type (matches the flags) and matches the pattern:
43675 </para>
43676 <itemizedlist>
43677 <listitem>
43678 <para>
43679 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43680 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43681 absence of <quote>Q</quote> the rewritten address must always include a domain.
43682 </para>
43683 </listitem>
43684 <listitem>
43685 <para>
43686 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43687 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43688 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43689 (does not match the flags) or does not match the pattern.
43690 </para>
43691 </listitem>
43692 <listitem>
43693 <para>
43694 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43695 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43696 rewriting once it fails to match (after at least one successful rewrite).
43697 </para>
43698 </listitem>
43699 <listitem>
43700 <para>
43701 <indexterm role="concept">
43702 <primary>rewriting</primary>
43703 <secondary>whole addresses</secondary>
43704 </indexterm>
43705 When an address in a header is rewritten, the rewriting normally applies only
43706 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43707 left unchanged. For example, rewriting might change
43708 </para>
43709 <literallayout class="monospaced">
43710 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
43711 </literallayout>
43712 <para>
43713 into
43714 </para>
43715 <literallayout class="monospaced">
43716 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
43717 </literallayout>
43718 <para>
43719 <indexterm role="concept">
43720 <primary>RFC 2047</primary>
43721 </indexterm>
43722 Sometimes there is a need to replace the whole address item, and this can be
43723 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43724 causes an address in a header line to be rewritten, the entire address is
43725 replaced, not just the working part. The replacement must be a complete RFC
43726 2822 address, including the angle brackets if necessary. If text outside angle
43727 brackets contains a character whose value is greater than 126 or less than 32
43728 (except for tab), the text is encoded according to RFC 2047. The character set
43729 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43730 </para>
43731 <para>
43732 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43733 rewritten, all but the working part of the replacement address is discarded.
43734 </para>
43735 </listitem>
43736 </itemizedlist>
43737 </section>
43738 <section id="SECID156">
43739 <title>Rewriting examples</title>
43740 <para>
43741 Here is an example of the two common rewriting paradigms:
43742 </para>
43743 <literallayout class="monospaced">
43744 *@*.hitch.fict.example  $1@hitch.fict.example
43745 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
43746                      {$value}fail}@hitch.fict.example bctfrF
43747 </literallayout>
43748 <para>
43749 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43750 the string expansion to fail if the lookup does not succeed. In this context it
43751 has the effect of leaving the original address unchanged, but Exim goes on to
43752 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
43753 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
43754 explicitly, which would cause the rewritten address to be the same as before,
43755 at the cost of a small bit of processing. Not supplying either of these is an
43756 error, since the rewritten address would then contain no local part.
43757 </para>
43758 <para>
43759 The first example above replaces the domain with a superior, more general
43760 domain. This may not be desirable for certain local parts. If the rule
43761 </para>
43762 <literallayout class="monospaced">
43763 root@*.hitch.fict.example  *
43764 </literallayout>
43765 <para>
43766 were inserted before the first rule, rewriting would be suppressed for the
43767 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
43768 </para>
43769 <para>
43770 Rewriting can be made conditional on a number of tests, by making use of
43771 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
43772 messages that originate outside the local host:
43773 </para>
43774 <literallayout class="monospaced">
43775 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
43776                          {$1@hitch.fict.example}fail}"
43777 </literallayout>
43778 <para>
43779 The replacement string is quoted in this example because it contains white
43780 space.
43781 </para>
43782 <para>
43783 <indexterm role="concept">
43784 <primary>rewriting</primary>
43785 <secondary>bang paths</secondary>
43786 </indexterm>
43787 <indexterm role="concept">
43788 <primary>bang paths</primary>
43789 <secondary>rewriting</secondary>
43790 </indexterm>
43791 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
43792 an address it treats it as an unqualified local part which it qualifies with
43793 the local qualification domain (if the source of the message is local or if the
43794 remote host is permitted to send unqualified addresses). Rewriting can
43795 sometimes be used to handle simple bang paths with a fixed number of
43796 components. For example, the rule
43797 </para>
43798 <literallayout class="monospaced">
43799 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
43800 </literallayout>
43801 <para>
43802 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
43803 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
43804 a global rewriting rule for envelope addresses. It can provide a backdoor
43805 method for using your system as a relay, because the incoming addresses appear
43806 to be local. If the bang path addresses are received via SMTP, it is safer to
43807 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
43808 can be done on the rewritten addresses.
43809 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
43810 </para>
43811 </section>
43812 </chapter>
43813
43814 <chapter id="CHAPretry">
43815 <title>Retry configuration</title>
43816 <para>
43817 <indexterm role="concept" id="IIDretconf1" class="startofrange">
43818 <primary>retry</primary>
43819 <secondary>configuration, description of</secondary>
43820 </indexterm>
43821 <indexterm role="concept" id="IIDregconf2" class="startofrange">
43822 <primary>configuration file</primary>
43823 <secondary>retry section</secondary>
43824 </indexterm>
43825 The <quote>retry</quote> section of the runtime configuration file contains a list of
43826 retry rules that control how often Exim tries to deliver messages that cannot
43827 be delivered at the first attempt. If there are no retry rules (the section is
43828 empty or not present), there are no retries. In this situation, temporary
43829 errors are treated as permanent. The default configuration contains a single,
43830 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
43831 line option can be used to test which retry rule will be used for a given
43832 address, domain and error.
43833 </para>
43834 <para>
43835 The most common cause of retries is temporary failure to deliver to a remote
43836 host because the host is down, or inaccessible because of a network problem.
43837 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
43838 address) basis, not on a per-message basis. Thus, if one message has recently
43839 been delayed, delivery of a new message to the same host is not immediately
43840 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
43841 log selector is set, the message
43842 <indexterm role="concept">
43843 <primary>retry</primary>
43844 <secondary>time not reached</secondary>
43845 </indexterm>
43846 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
43847 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
43848 the handling of errors during remote deliveries.
43849 </para>
43850 <para>
43851 Retry processing applies to routing as well as to delivering, except as covered
43852 in the next paragraph. The retry rules do not distinguish between these
43853 actions. It is not possible, for example, to specify different behaviour for
43854 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
43855 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
43856 added complication, so did not implement it. However, although they share the
43857 same retry rule, the actual retry times for routing and transporting a given
43858 domain are maintained independently.
43859 </para>
43860 <para>
43861 When a delivery is not part of a queue run (typically an immediate delivery on
43862 receipt of a message), the routers are always run, and local deliveries are
43863 always attempted, even if retry times are set for them. This makes for better
43864 behaviour if one particular message is causing problems (for example, causing
43865 quota overflow, or provoking an error in a filter file). If such a delivery
43866 suffers a temporary failure, the retry data is updated as normal, and
43867 subsequent delivery attempts from queue runs occur only when the retry time for
43868 the local address is reached.
43869 </para>
43870 <section id="SECID157">
43871 <title>Changing retry rules</title>
43872 <para>
43873 If you change the retry rules in your configuration, you should consider
43874 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
43875 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
43876 always safe; that is why they are called <quote>hints</quote>.
43877 </para>
43878 <para>
43879 The hints retry data contains suggested retry times based on the previous
43880 rules. In the case of a long-running problem with a remote host, it might
43881 record the fact that the host has timed out. If your new rules increase the
43882 timeout time for such a host, you should definitely remove the old retry data
43883 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
43884 messages that it should now be retaining.
43885 </para>
43886 </section>
43887 <section id="SECID158">
43888 <title>Format of retry rules</title>
43889 <para>
43890 <indexterm role="concept">
43891 <primary>retry</primary>
43892 <secondary>rules</secondary>
43893 </indexterm>
43894 Each retry rule occupies one line and consists of three or four parts,
43895 separated by white space: a pattern, an error name, an optional list of sender
43896 addresses, and a list of retry parameters. The pattern and sender lists must be
43897 enclosed in double quotes if they contain white space. The rules are searched
43898 in order until one is found where the pattern, error name, and sender list (if
43899 present) match the failing host or address, the error that occurred, and the
43900 message&#x2019;s sender, respectively.
43901 </para>
43902 <para>
43903 The pattern is any single item that may appear in an address list (see section
43904 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
43905 which means that it is expanded before being tested against the address that
43906 has been delayed. A negated address list item is permitted. Address
43907 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
43908 which makes it possible for many retry rules to start with just a domain. For
43909 example,
43910 </para>
43911 <literallayout class="monospaced">
43912 lookingglass.fict.example        *  F,24h,30m;
43913 </literallayout>
43914 <para>
43915 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
43916 whereas
43917 </para>
43918 <literallayout class="monospaced">
43919 alice@lookingglass.fict.example  *  F,24h,30m;
43920 </literallayout>
43921 <para>
43922 applies only to temporary failures involving the local part <option>alice</option>.
43923 In practice, almost all rules start with a domain name pattern without a local
43924 part.
43925 </para>
43926 <para>
43927 <indexterm role="concept">
43928 <primary>regular expressions</primary>
43929 <secondary>in retry rules</secondary>
43930 </indexterm>
43931 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
43932 must match a complete address, not just a domain, because that is how regular
43933 expressions work in address lists.
43934 </para>
43935 <literallayout>
43936 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
43937 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
43938 </literallayout>
43939 </section>
43940 <section id="SECID159">
43941 <title>Choosing which retry rule to use for address errors</title>
43942 <para>
43943 When Exim is looking for a retry rule after a routing attempt has failed (for
43944 example, after a DNS timeout), each line in the retry configuration is tested
43945 against the complete address only if <option>retry_use_local_part</option> is set for the
43946 router. Otherwise, only the domain is used, except when matching against a
43947 regular expression, when the local part of the address is replaced with <quote>*</quote>.
43948 A domain on its own can match a domain pattern, or a pattern that starts with
43949 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
43950 <option>check_local_user</option> is true, and false for other routers.
43951 </para>
43952 <para>
43953 Similarly, when Exim is looking for a retry rule after a local delivery has
43954 failed (for example, after a mailbox full error), each line in the retry
43955 configuration is tested against the complete address only if
43956 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
43957 local transports).
43958 </para>
43959 <para>
43960 <indexterm role="concept">
43961 <primary>4<emphasis>xx</emphasis> responses</primary>
43962 <secondary>retry rules for</secondary>
43963 </indexterm>
43964 However, when Exim is looking for a retry rule after a remote delivery attempt
43965 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
43966 whole address is always used as the key when searching the retry rules. The
43967 rule that is found is used to create a retry time for the combination of the
43968 failing address and the message&#x2019;s sender. It is the combination of sender and
43969 recipient that is delayed in subsequent queue runs until its retry time is
43970 reached. You can delay the recipient without regard to the sender by setting
43971 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
43972 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
43973 commands.
43974 </para>
43975 </section>
43976 <section id="SECID160">
43977 <title>Choosing which retry rule to use for host and message errors</title>
43978 <para>
43979 For a temporary error that is not related to an individual address (for
43980 example, a connection timeout), each line in the retry configuration is checked
43981 twice. First, the name of the remote host is used as a domain name (preceded by
43982 <quote>*@</quote> when matching a regular expression). If this does not match the line,
43983 the domain from the email address is tried in a similar fashion. For example,
43984 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
43985 </para>
43986 <literallayout class="monospaced">
43987 a.b.c.example  MX  5  x.y.z.example
43988                MX  6  p.q.r.example
43989                MX  7  m.n.o.example
43990 </literallayout>
43991 <para>
43992 and the retry rules are
43993 </para>
43994 <literallayout class="monospaced">
43995 p.q.r.example    *      F,24h,30m;
43996 a.b.c.example    *      F,4d,45m;
43997 </literallayout>
43998 <para>
43999 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44000 first rule matches neither the host nor the domain, so Exim looks at the second
44001 rule. This does not match the host, but it does match the domain, so it is used
44002 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44003 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44004 first retry rule is used, because it matches the host.
44005 </para>
44006 <para>
44007 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44008 first rule to determine retry times, but for all the other hosts for the domain
44009 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44010 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44011 </para>
44012 <para>
44013 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44014 However, if a message is routed directly to an IP address without the use of a
44015 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44016 </para>
44017 <literallayout class="monospaced">
44018 route_list = *.a.example  192.168.34.23
44019 </literallayout>
44020 <para>
44021 then the <quote>host name</quote> that is used when searching for a retry rule is the
44022 textual form of the IP address.
44023 </para>
44024 </section>
44025 <section id="SECID161">
44026 <title>Retry rules for specific errors</title>
44027 <para>
44028 <indexterm role="concept">
44029 <primary>retry</primary>
44030 <secondary>specific errors; specifying</secondary>
44031 </indexterm>
44032 The second field in a retry rule is the name of a particular error, or an
44033 asterisk, which matches any error. The errors that can be tested for are:
44034 </para>
44035 <variablelist>
44036 <varlistentry>
44037 <term><option>auth_failed</option></term>
44038 <listitem>
44039 <para>
44040 Authentication failed when trying to send to a host in the
44041 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44042 </para>
44043 </listitem></varlistentry>
44044 <varlistentry>
44045 <term><option>data_4xx</option></term>
44046 <listitem>
44047 <para>
44048 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44049 after the command, or after sending the message&#x2019;s data.
44050 </para>
44051 </listitem></varlistentry>
44052 <varlistentry>
44053 <term><option>mail_4xx</option></term>
44054 <listitem>
44055 <para>
44056 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44057 </para>
44058 </listitem></varlistentry>
44059 <varlistentry>
44060 <term><option>rcpt_4xx</option></term>
44061 <listitem>
44062 <para>
44063 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44064 </para>
44065 </listitem></varlistentry>
44066 </variablelist>
44067 <para>
44068 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
44069 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44070 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44071 and have retries every ten minutes with a one-hour timeout, you could set up a
44072 retry rule of this form:
44073 </para>
44074 <literallayout class="monospaced">
44075 the.domain.name  rcpt_452   F,1h,10m
44076 </literallayout>
44077 <para>
44078 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44079 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44080 </para>
44081 <variablelist>
44082 <varlistentry>
44083 <term><option>lost_connection</option></term>
44084 <listitem>
44085 <para>
44086 A server unexpectedly closed the SMTP connection. There may, of course,
44087 legitimate reasons for this (host died, network died), but if it repeats a lot
44088 for the same host, it indicates something odd.
44089 </para>
44090 </listitem></varlistentry>
44091 <varlistentry>
44092 <term><option>refused_MX</option></term>
44093 <listitem>
44094 <para>
44095 A connection to a host obtained from an MX record was refused.
44096 </para>
44097 </listitem></varlistentry>
44098 <varlistentry>
44099 <term><option>refused_A</option></term>
44100 <listitem>
44101 <para>
44102 A connection to a host not obtained from an MX record was refused.
44103 </para>
44104 </listitem></varlistentry>
44105 <varlistentry>
44106 <term><option>refused</option></term>
44107 <listitem>
44108 <para>
44109 A connection was refused.
44110 </para>
44111 </listitem></varlistentry>
44112 <varlistentry>
44113 <term><option>timeout_connect_MX</option></term>
44114 <listitem>
44115 <para>
44116 A connection attempt to a host obtained from an MX record timed out.
44117 </para>
44118 </listitem></varlistentry>
44119 <varlistentry>
44120 <term><option>timeout_connect_A</option></term>
44121 <listitem>
44122 <para>
44123 A connection attempt to a host not obtained from an MX record timed out.
44124 </para>
44125 </listitem></varlistentry>
44126 <varlistentry>
44127 <term><option>timeout_connect</option></term>
44128 <listitem>
44129 <para>
44130 A connection attempt timed out.
44131 </para>
44132 </listitem></varlistentry>
44133 <varlistentry>
44134 <term><option>timeout_MX</option></term>
44135 <listitem>
44136 <para>
44137 There was a timeout while connecting or during an SMTP session with a host
44138 obtained from an MX record.
44139 </para>
44140 </listitem></varlistentry>
44141 <varlistentry>
44142 <term><option>timeout_A</option></term>
44143 <listitem>
44144 <para>
44145 There was a timeout while connecting or during an SMTP session with a host not
44146 obtained from an MX record.
44147 </para>
44148 </listitem></varlistentry>
44149 <varlistentry>
44150 <term><option>timeout</option></term>
44151 <listitem>
44152 <para>
44153 There was a timeout while connecting or during an SMTP session.
44154 </para>
44155 </listitem></varlistentry>
44156 <varlistentry>
44157 <term><option>tls_required</option></term>
44158 <listitem>
44159 <para>
44160 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44161 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44162 to STARTTLS, or there was a problem setting up the TLS connection.
44163 </para>
44164 </listitem></varlistentry>
44165 <varlistentry>
44166 <term><option>quota</option></term>
44167 <listitem>
44168 <para>
44169 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44170 transport.
44171 </para>
44172 </listitem></varlistentry>
44173 <varlistentry>
44174 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
44175 <listitem>
44176 <para>
44177 <indexterm role="concept">
44178 <primary>quota</primary>
44179 <secondary>error testing in retry rule</secondary>
44180 </indexterm>
44181 <indexterm role="concept">
44182 <primary>retry</primary>
44183 <secondary>quota error testing</secondary>
44184 </indexterm>
44185 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44186 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
44187 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44188 for four days.
44189 </para>
44190 </listitem></varlistentry>
44191 </variablelist>
44192 <para>
44193 <indexterm role="concept">
44194 <primary>mailbox</primary>
44195 <secondary>time of last read</secondary>
44196 </indexterm>
44197 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
44198 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44199 it should be based on the last time that the user accessed the mailbox.
44200 However, it is not always possible to determine this. Exim uses the following
44201 heuristic rules:
44202 </para>
44203 <itemizedlist>
44204 <listitem>
44205 <para>
44206 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44207 used. As no new messages are being delivered (because the mailbox is over
44208 quota), Exim does not access the file, so this is the time of last user access.
44209 </para>
44210 </listitem>
44211 <listitem>
44212 <para>
44213 <indexterm role="concept">
44214 <primary>maildir format</primary>
44215 <secondary>time of last read</secondary>
44216 </indexterm>
44217 For a maildir delivery, the time of last modification of the <filename>new</filename>
44218 subdirectory is used. As the mailbox is over quota, no new files are created in
44219 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44220 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44221 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44222 time that is used is therefore the last time that the user read a new message.
44223 </para>
44224 </listitem>
44225 <listitem>
44226 <para>
44227 For other kinds of multi-file mailbox, the time of last access cannot be
44228 obtained, so a retry rule that uses this type of error field is never matched.
44229 </para>
44230 </listitem>
44231 </itemizedlist>
44232 <para>
44233 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
44234 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44235 when a local delivery is deferred because a partition is full (the ENOSPC
44236 error).
44237 </para>
44238 </section>
44239 <section id="SECID162">
44240 <title>Retry rules for specified senders</title>
44241 <para>
44242 <indexterm role="concept">
44243 <primary>retry</primary>
44244 <secondary>rules; sender-specific</secondary>
44245 </indexterm>
44246 You can specify retry rules that apply only when the failing message has a
44247 specific sender. In particular, this can be used to define retry rules that
44248 apply only to bounce messages. The third item in a retry rule can be of this
44249 form:
44250 </para>
44251 <literallayout>
44252 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
44253 </literallayout>
44254 <para>
44255 The retry timings themselves are then the fourth item. For example:
44256 </para>
44257 <literallayout class="monospaced">
44258 *   rcpt_4xx   senders=:   F,1h,30m
44259 </literallayout>
44260 <para>
44261 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44262 host. If the address list contains white space, it must be enclosed in quotes.
44263 For example:
44264 </para>
44265 <literallayout class="monospaced">
44266 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
44267 </literallayout>
44268 <para>
44269 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44270 (which do not depend on the recipient). The reason is that the sender is used
44271 only to match the retry rule. Once the rule has been found for a host error,
44272 its contents are used to set a retry time for the host, and this will apply to
44273 all messages, not just those with specific senders.
44274 </para>
44275 <para>
44276 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44277 <option>-f</option> command line option, like this:
44278 </para>
44279 <literallayout class="monospaced">
44280 exim -f "" -brt user@dom.ain
44281 </literallayout>
44282 <para>
44283 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44284 list is never matched.
44285 </para>
44286 </section>
44287 <section id="SECID163">
44288 <title>Retry parameters</title>
44289 <para>
44290 <indexterm role="concept">
44291 <primary>retry</primary>
44292 <secondary>parameters in rules</secondary>
44293 </indexterm>
44294 The third (or fourth, if a senders list is present) field in a retry rule is a
44295 sequence of retry parameter sets, separated by semicolons. Each set consists of
44296 </para>
44297 <literallayout>
44298 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
44299 </literallayout>
44300 <para>
44301 The letter identifies the algorithm for computing a new retry time; the cutoff
44302 time is the time beyond which this algorithm no longer applies, and the
44303 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
44304 time that the first failure for the domain (combined with the local part if
44305 relevant) was detected, not from the time the message was received.
44306 </para>
44307 <para>
44308 <indexterm role="concept">
44309 <primary>retry</primary>
44310 <secondary>algorithms</secondary>
44311 </indexterm>
44312 <indexterm role="concept">
44313 <primary>retry</primary>
44314 <secondary>fixed intervals</secondary>
44315 </indexterm>
44316 <indexterm role="concept">
44317 <primary>retry</primary>
44318 <secondary>increasing intervals</secondary>
44319 </indexterm>
44320 <indexterm role="concept">
44321 <primary>retry</primary>
44322 <secondary>random intervals</secondary>
44323 </indexterm>
44324 The available algorithms are:
44325 </para>
44326 <itemizedlist>
44327 <listitem>
44328 <para>
44329 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44330 the interval.
44331 </para>
44332 </listitem>
44333 <listitem>
44334 <para>
44335 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44336 specifies a starting value for the interval, and the second a multiplier, which
44337 is used to increase the size of the interval at each retry.
44338 </para>
44339 </listitem>
44340 <listitem>
44341 <para>
44342 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44343 retry, the previous interval is multiplied by the factor in order to get a
44344 maximum for the next interval. The minimum interval is the first argument of
44345 the parameter, and an actual interval is chosen randomly between them. Such a
44346 rule has been found to be helpful in cluster configurations when all the
44347 members of the cluster restart at once, and may therefore synchronize their
44348 queue processing times.
44349 </para>
44350 </listitem>
44351 </itemizedlist>
44352 <para>
44353 When computing the next retry time, the algorithm definitions are scanned in
44354 order until one whose cutoff time has not yet passed is reached. This is then
44355 used to compute a new retry time that is later than the current time. In the
44356 case of fixed interval retries, this simply means adding the interval to the
44357 current time. For geometrically increasing intervals, retry intervals are
44358 computed from the rule&#x2019;s parameters until one that is greater than the previous
44359 interval is found. The main configuration variable
44360 <indexterm role="concept">
44361 <primary>limit</primary>
44362 <secondary>retry interval</secondary>
44363 </indexterm>
44364 <indexterm role="concept">
44365 <primary>retry</primary>
44366 <secondary>interval, maximum</secondary>
44367 </indexterm>
44368 <indexterm role="option">
44369 <primary><option>retry_interval_max</option></primary>
44370 </indexterm>
44371 <option>retry_interval_max</option> limits the maximum interval between retries. It
44372 cannot be set greater than <literal>24h</literal>, which is its default value.
44373 </para>
44374 <para>
44375 A single remote domain may have a number of hosts associated with it, and each
44376 host may have more than one IP address. Retry algorithms are selected on the
44377 basis of the domain name, but are applied to each IP address independently. If,
44378 for example, a host has two IP addresses and one is unusable, Exim will
44379 generate retry times for it and will not try to use it until its next retry
44380 time comes. Thus the good IP address is likely to be tried first most of the
44381 time.
44382 </para>
44383 <para>
44384 <indexterm role="concept">
44385 <primary>hints database</primary>
44386 <secondary>use for retrying</secondary>
44387 </indexterm>
44388 Retry times are hints rather than promises. Exim does not make any attempt to
44389 run deliveries exactly at the computed times. Instead, a queue runner process
44390 starts delivery processes for delayed messages periodically, and these attempt
44391 new deliveries only for those addresses that have passed their next retry time.
44392 If a new message arrives for a deferred address, an immediate delivery attempt
44393 occurs only if the address has passed its retry time. In the absence of new
44394 messages, the minimum time between retries is the interval between queue runner
44395 processes. There is not much point in setting retry times of five minutes if
44396 your queue runners happen only once an hour, unless there are a significant
44397 number of incoming messages (which might be the case on a system that is
44398 sending everything to a smart host, for example).
44399 </para>
44400 <para>
44401 The data in the retry hints database can be inspected by using the
44402 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44403 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44404 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44405 are for the hosts associated with a particular mail domain, and also for local
44406 deliveries that have been deferred.
44407 </para>
44408 </section>
44409 <section id="SECID164">
44410 <title>Retry rule examples</title>
44411 <para>
44412 Here are some example retry rules:
44413 </para>
44414 <literallayout class="monospaced">
44415 alice@wonderland.fict.example quota_5d  F,7d,3h
44416 wonderland.fict.example       quota_5d
44417 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
44418 lookingglass.fict.example     *         F,24h,30m;
44419 *                 refused_A   F,2h,20m;
44420 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
44421 </literallayout>
44422 <para>
44423 The first rule sets up special handling for mail to
44424 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44425 mailbox has not been read for at least 5 days. Retries continue every three
44426 hours for 7 days. The second rule handles over-quota errors for all other local
44427 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44428 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44429 fail are bounced immediately if the mailbox has not been read for at least 5
44430 days.
44431 </para>
44432 <para>
44433 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44434 happen every 15 minutes for an hour, then with geometrically increasing
44435 intervals until two days have passed since a delivery first failed. After the
44436 first hour there is a delay of one hour, then two hours, then four hours, and
44437 so on (this is a rather extreme example).
44438 </para>
44439 <para>
44440 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44441 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44442 all other domains, with special action for connection refusal from hosts that
44443 were not obtained from an MX record.
44444 </para>
44445 <para>
44446 The final rule in a retry configuration should always have asterisks in the
44447 first two fields so as to provide a general catch-all for any addresses that do
44448 not have their own special handling. This example tries every 15 minutes for 2
44449 hours, then with intervals starting at one hour and increasing by a factor of
44450 1.5 up to 16 hours, then every 8 hours up to 5 days.
44451 </para>
44452 </section>
44453 <section id="SECID165">
44454 <title>Timeout of retry data</title>
44455 <para>
44456 <indexterm role="concept">
44457 <primary>timeout</primary>
44458 <secondary>of retry data</secondary>
44459 </indexterm>
44460 <indexterm role="option">
44461 <primary><option>retry_data_expire</option></primary>
44462 </indexterm>
44463 <indexterm role="concept">
44464 <primary>hints database</primary>
44465 <secondary>data expiry</secondary>
44466 </indexterm>
44467 <indexterm role="concept">
44468 <primary>retry</primary>
44469 <secondary>timeout of data</secondary>
44470 </indexterm>
44471 Exim timestamps the data that it writes to its retry hints database. When it
44472 consults the data during a delivery it ignores any that is older than the value
44473 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
44474 been tried for 7 days, Exim will try to deliver to it immediately a message
44475 arrives, and if that fails, it will calculate a retry time as if it were
44476 failing for the first time.
44477 </para>
44478 <para>
44479 This improves the behaviour for messages routed to rarely-used hosts such as MX
44480 backups. If such a host was down at one time, and happens to be down again when
44481 Exim tries a month later, using the old retry data would imply that it had been
44482 down all the time, which is not a justified assumption.
44483 </para>
44484 <para>
44485 If a host really is permanently dead, this behaviour causes a burst of retries
44486 every now and again, but only if messages routed to it are rare. If there is a
44487 message at least once every 7 days the retry data never expires.
44488 </para>
44489 </section>
44490 <section id="SECID166">
44491 <title>Long-term failures</title>
44492 <para>
44493 <indexterm role="concept">
44494 <primary>delivery failure, long-term</primary>
44495 </indexterm>
44496 <indexterm role="concept">
44497 <primary>retry</primary>
44498 <secondary>after long-term failure</secondary>
44499 </indexterm>
44500 Special processing happens when an email address has been failing for so long
44501 that the cutoff time for the last algorithm is reached. For example, using the
44502 default retry rule:
44503 </para>
44504 <literallayout class="monospaced">
44505 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44506 </literallayout>
44507 <para>
44508 the cutoff time is four days. Reaching the retry cutoff is independent of how
44509 long any specific message has been failing; it is the length of continuous
44510 failure for the recipient address that counts.
44511 </para>
44512 <para>
44513 When the cutoff time is reached for a local delivery, or for all the IP
44514 addresses associated with a remote delivery, a subsequent delivery failure
44515 causes Exim to give up on the address, and a bounce message is generated.
44516 In order to cater for new messages that use the failing address, a next retry
44517 time is still computed from the final algorithm, and is used as follows:
44518 </para>
44519 <para>
44520 For local deliveries, one delivery attempt is always made for any subsequent
44521 messages. If this delivery fails, the address fails immediately. The
44522 post-cutoff retry time is not used.
44523 </para>
44524 <para>
44525 If the delivery is remote, there are two possibilities, controlled by the
44526 <indexterm role="option">
44527 <primary><option>delay_after_cutoff</option></primary>
44528 </indexterm>
44529 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44530 default. Until the post-cutoff retry time for one of the IP addresses is
44531 reached, the failing email address is bounced immediately, without a delivery
44532 attempt taking place. After that time, one new delivery attempt is made to
44533 those IP addresses that are past their retry times, and if that still fails,
44534 the address is bounced and new retry times are computed.
44535 </para>
44536 <para>
44537 In other words, when all the hosts for a given email address have been failing
44538 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
44539 times is reached. Then it tries once, and bounces if that attempt fails. This
44540 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44541 to a broken destination, but if the host does recover, Exim will eventually
44542 notice.
44543 </para>
44544 <para>
44545 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44546 addresses are past their final cutoff time, Exim tries to deliver to those IP
44547 addresses that have not been tried since the message arrived. If there are
44548 no suitable IP addresses, or if they all fail, the address is bounced. In other
44549 words, it does not delay when a new message arrives, but tries the expired
44550 addresses immediately, unless they have been tried since the message arrived.
44551 If there is a continuous stream of messages for the failing domains, setting
44552 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44553 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44554 true.
44555 </para>
44556 </section>
44557 <section id="SECID167">
44558 <title>Deliveries that work intermittently</title>
44559 <para>
44560 <indexterm role="concept">
44561 <primary>retry</primary>
44562 <secondary>intermittently working deliveries</secondary>
44563 </indexterm>
44564 Some additional logic is needed to cope with cases where a host is
44565 intermittently available, or when a message has some attribute that prevents
44566 its delivery when others to the same address get through. In this situation,
44567 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44568 host or address keeps getting reset by the successful deliveries, and so
44569 failing messages remain on the queue for ever because the cutoff time is never
44570 reached.
44571 </para>
44572 <para>
44573 Two exceptional actions are applied to prevent this happening. The first
44574 applies to errors that are related to a message rather than a remote host.
44575 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44576 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44577 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
44578 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44579 is used when scanning the retry rules to decide when to try next and when to
44580 time out the address.
44581 </para>
44582 <para>
44583 The exceptional second action applies in all cases. If a message has been on
44584 the queue for longer than the cutoff time of any applicable retry rule for a
44585 given address, a delivery is attempted for that address, even if it is not yet
44586 time, and if this delivery fails, the address is timed out. A new retry time is
44587 not computed in this case, so that other messages for the same address are
44588 considered immediately.
44589 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44590 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44591 </para>
44592 </section>
44593 </chapter>
44594
44595 <chapter id="CHAPSMTPAUTH">
44596 <title>SMTP authentication</title>
44597 <para>
44598 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44599 <primary>SMTP</primary>
44600 <secondary>authentication configuration</secondary>
44601 </indexterm>
44602 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44603 <primary>authentication</primary>
44604 </indexterm>
44605 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
44606 with SMTP authentication. This facility is an extension to the SMTP protocol,
44607 described in RFC 2554, which allows a client SMTP host to authenticate itself
44608 to a server. This is a common way for a server to recognize clients that are
44609 permitted to use it as a relay. SMTP authentication is not of relevance to the
44610 transfer of mail between servers that have no managerial connection with each
44611 other.
44612 </para>
44613 <para>
44614 <indexterm role="concept">
44615 <primary>AUTH</primary>
44616 <secondary>description of</secondary>
44617 </indexterm>
44618 Very briefly, the way SMTP authentication works is as follows:
44619 </para>
44620 <itemizedlist>
44621 <listitem>
44622 <para>
44623 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44624 the client&#x2019;s EHLO command.
44625 </para>
44626 </listitem>
44627 <listitem>
44628 <para>
44629 The client issues an AUTH command, naming a specific mechanism. The command
44630 may, optionally, contain some authentication data.
44631 </para>
44632 </listitem>
44633 <listitem>
44634 <para>
44635 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44636 appropriate responses. In simple authentication mechanisms, the challenges are
44637 just prompts for user names and passwords. The server does not have to issue
44638 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
44639 with the AUTH command.
44640 </para>
44641 </listitem>
44642 <listitem>
44643 <para>
44644 The server either accepts or denies authentication.
44645 </para>
44646 </listitem>
44647 <listitem>
44648 <para>
44649 If authentication succeeds, the client may optionally make use of the AUTH
44650 option on the MAIL command to pass an authenticated sender in subsequent
44651 mail transactions. Authentication lasts for the remainder of the SMTP
44652 connection.
44653 </para>
44654 </listitem>
44655 <listitem>
44656 <para>
44657 If authentication fails, the client may give up, or it may try a different
44658 authentication mechanism, or it may try transferring mail over the
44659 unauthenticated connection.
44660 </para>
44661 </listitem>
44662 </itemizedlist>
44663 <para>
44664 If you are setting up a client, and want to know which authentication
44665 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44666 SMTP port) on the server, and issue an EHLO command. The response to this
44667 includes the list of supported mechanisms. For example:
44668 </para>
44669 <literallayout>
44670 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44671 <literal>Trying 192.168.34.25...</literal>
44672 <literal>Connected to server.example.</literal>
44673 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
44674 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44675 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44676 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44677 <literal>250-SIZE 52428800</literal>
44678 <literal>250-PIPELINING</literal>
44679 <literal>250-AUTH PLAIN</literal>
44680 <literal>250 HELP</literal>
44681 </literallayout>
44682 <para>
44683 The second-last line of this example output shows that the server supports
44684 authentication using the PLAIN mechanism. In Exim, the different authentication
44685 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44686 routers and transports, which authenticators are included in the binary is
44687 controlled by build-time definitions. The following are currently available,
44688 included by setting
44689 </para>
44690 <literallayout class="monospaced">
44691 AUTH_CRAM_MD5=yes
44692 AUTH_CYRUS_SASL=yes
44693 AUTH_PLAINTEXT=yes
44694 AUTH_SPA=yes
44695 </literallayout>
44696 <para>
44697 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44698 authentication mechanism (RFC 2195), and the second provides an interface to
44699 the Cyrus SASL authentication library. The third can be configured to support
44700 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44701 not formally documented, but used by several MUAs. The fourth authenticator
44702 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
44703 </para>
44704 <para>
44705 The authenticators are configured using the same syntax as other drivers (see
44706 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44707 authentication section need be present in the configuration file. Each
44708 authenticator can in principle have both server and client functions. When Exim
44709 is receiving SMTP mail, it is acting as a server; when it is sending out
44710 messages over SMTP, it is acting as a client. Authenticator configuration
44711 options are provided for use in both these circumstances.
44712 </para>
44713 <para>
44714 To make it clear which options apply to which situation, the prefixes
44715 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44716 either the server or the client function, respectively. Server and client
44717 functions are disabled if none of their options are set. If an authenticator is
44718 to be used for both server and client functions, a single definition, using
44719 both sets of options, is required. For example:
44720 </para>
44721 <literallayout class="monospaced">
44722 cram:
44723   driver = cram_md5
44724   public_name = CRAM-MD5
44725   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44726   client_name = ph10
44727   client_secret = secret2
44728 </literallayout>
44729 <para>
44730 The <option>server_</option> option is used when Exim is acting as a server, and the
44731 <option>client_</option> options when it is acting as a client.
44732 </para>
44733 <para>
44734 Descriptions of the individual authenticators are given in subsequent chapters.
44735 The remainder of this chapter covers the generic options for the
44736 authenticators, followed by general discussion of the way authentication works
44737 in Exim.
44738 </para>
44739 <section id="SECID168">
44740 <title>Generic options for authenticators</title>
44741 <para>
44742 <indexterm role="concept">
44743 <primary>authentication</primary>
44744 <secondary>generic options</secondary>
44745 </indexterm>
44746 <indexterm role="concept">
44747 <primary>options</primary>
44748 <secondary>generic; for authenticators</secondary>
44749 </indexterm>
44750 </para>
44751 <para>
44752 <indexterm role="option">
44753 <primary><option>client_condition</option></primary>
44754 </indexterm>
44755 </para>
44756 <informaltable frame="all">
44757 <tgroup cols="4" colsep="0" rowsep="0">
44758 <colspec colwidth="8*" align="left"/>
44759 <colspec colwidth="6*" align="center"/>
44760 <colspec colwidth="6*" align="center"/>
44761 <colspec colwidth="6*" align="right"/>
44762 <tbody>
44763 <row>
44764 <entry><option>client_condition</option></entry>
44765 <entry>Use: <emphasis>authenticators</emphasis></entry>
44766 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44767 <entry>Default: <emphasis>unset</emphasis></entry>
44768 </row>
44769 </tbody>
44770 </tgroup>
44771 </informaltable>
44772 <para>
44773 When Exim is authenticating as a client, it skips any authenticator whose
44774 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
44775 used, for example, to skip plain text authenticators when the connection is not
44776 encrypted by a setting such as:
44777 </para>
44778 <literallayout class="monospaced">
44779 client_condition = ${if !eq{$tls_cipher}{}}
44780 </literallayout>
44781 <para>
44782 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
44783 used for incoming messages. In fact, during SMTP delivery, it contains the
44784 cipher used for the delivery.)
44785 </para>
44786 <para>
44787 <indexterm role="option">
44788 <primary><option>driver</option></primary>
44789 </indexterm>
44790 </para>
44791 <informaltable frame="all">
44792 <tgroup cols="4" colsep="0" rowsep="0">
44793 <colspec colwidth="8*" align="left"/>
44794 <colspec colwidth="6*" align="center"/>
44795 <colspec colwidth="6*" align="center"/>
44796 <colspec colwidth="6*" align="right"/>
44797 <tbody>
44798 <row>
44799 <entry><option>driver</option></entry>
44800 <entry>Use: <emphasis>authenticators</emphasis></entry>
44801 <entry>Type: <emphasis>string</emphasis></entry>
44802 <entry>Default: <emphasis>unset</emphasis></entry>
44803 </row>
44804 </tbody>
44805 </tgroup>
44806 </informaltable>
44807 <para>
44808 This option must always be set. It specifies which of the available
44809 authenticators is to be used.
44810 </para>
44811 <para>
44812 <indexterm role="option">
44813 <primary><option>public_name</option></primary>
44814 </indexterm>
44815 </para>
44816 <informaltable frame="all">
44817 <tgroup cols="4" colsep="0" rowsep="0">
44818 <colspec colwidth="8*" align="left"/>
44819 <colspec colwidth="6*" align="center"/>
44820 <colspec colwidth="6*" align="center"/>
44821 <colspec colwidth="6*" align="right"/>
44822 <tbody>
44823 <row>
44824 <entry><option>public_name</option></entry>
44825 <entry>Use: <emphasis>authenticators</emphasis></entry>
44826 <entry>Type: <emphasis>string</emphasis></entry>
44827 <entry>Default: <emphasis>unset</emphasis></entry>
44828 </row>
44829 </tbody>
44830 </tgroup>
44831 </informaltable>
44832 <para>
44833 This option specifies the name of the authentication mechanism that the driver
44834 implements, and by which it is known to the outside world. These names should
44835 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
44836 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
44837 defaults to the driver&#x2019;s instance name.
44838 </para>
44839 <para>
44840 <indexterm role="option">
44841 <primary><option>server_advertise_condition</option></primary>
44842 </indexterm>
44843 </para>
44844 <informaltable frame="all">
44845 <tgroup cols="4" colsep="0" rowsep="0">
44846 <colspec colwidth="8*" align="left"/>
44847 <colspec colwidth="6*" align="center"/>
44848 <colspec colwidth="6*" align="center"/>
44849 <colspec colwidth="6*" align="right"/>
44850 <tbody>
44851 <row>
44852 <entry><option>server_advertise_condition</option></entry>
44853 <entry>Use: <emphasis>authenticators</emphasis></entry>
44854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44855 <entry>Default: <emphasis>unset</emphasis></entry>
44856 </row>
44857 </tbody>
44858 </tgroup>
44859 </informaltable>
44860 <para>
44861 When a server is about to advertise an authentication mechanism, the condition
44862 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
44863 mechanism is not advertised.
44864 If the expansion fails, the mechanism is not advertised. If the failure was not
44865 forced, and was not caused by a lookup defer, the incident is logged.
44866 See section <xref linkend="SECTauthexiser"/> below for further discussion.
44867 </para>
44868 <para>
44869 <indexterm role="option">
44870 <primary><option>server_condition</option></primary>
44871 </indexterm>
44872 </para>
44873 <informaltable frame="all">
44874 <tgroup cols="4" colsep="0" rowsep="0">
44875 <colspec colwidth="8*" align="left"/>
44876 <colspec colwidth="6*" align="center"/>
44877 <colspec colwidth="6*" align="center"/>
44878 <colspec colwidth="6*" align="right"/>
44879 <tbody>
44880 <row>
44881 <entry><option>server_condition</option></entry>
44882 <entry>Use: <emphasis>authenticators</emphasis></entry>
44883 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44884 <entry>Default: <emphasis>unset</emphasis></entry>
44885 </row>
44886 </tbody>
44887 </tgroup>
44888 </informaltable>
44889 <para>
44890 This option must be set for a <option>plaintext</option> server authenticator, where it
44891 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
44892 for details.
44893 </para>
44894 <para>
44895 For the other authenticators, <option>server_condition</option> can be used as an additional
44896 authentication or authorization mechanism that is applied after the other
44897 authenticator conditions succeed. If it is set, it is expanded when the
44898 authenticator would otherwise return a success code. If the expansion is forced
44899 to fail, authentication fails. Any other expansion failure causes a temporary
44900 error code to be returned. If the result of a successful expansion is an empty
44901 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44902 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
44903 other result, a temporary error code is returned, with the expanded string as
44904 the error text.
44905 </para>
44906 <para>
44907 <indexterm role="option">
44908 <primary><option>server_debug_print</option></primary>
44909 </indexterm>
44910 </para>
44911 <informaltable frame="all">
44912 <tgroup cols="4" colsep="0" rowsep="0">
44913 <colspec colwidth="8*" align="left"/>
44914 <colspec colwidth="6*" align="center"/>
44915 <colspec colwidth="6*" align="center"/>
44916 <colspec colwidth="6*" align="right"/>
44917 <tbody>
44918 <row>
44919 <entry><option>server_debug_print</option></entry>
44920 <entry>Use: <emphasis>authenticators</emphasis></entry>
44921 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44922 <entry>Default: <emphasis>unset</emphasis></entry>
44923 </row>
44924 </tbody>
44925 </tgroup>
44926 </informaltable>
44927 <para>
44928 If this option is set and authentication debugging is enabled (see the <option>-d</option>
44929 command line option), the string is expanded and included in the debugging
44930 output when the authenticator is run as a server. This can help with checking
44931 out the values of variables.
44932 If expansion of the string fails, the error message is written to the debugging
44933 output, and Exim carries on processing.
44934 </para>
44935 <para>
44936 <indexterm role="option">
44937 <primary><option>server_set_id</option></primary>
44938 </indexterm>
44939 </para>
44940 <informaltable frame="all">
44941 <tgroup cols="4" colsep="0" rowsep="0">
44942 <colspec colwidth="8*" align="left"/>
44943 <colspec colwidth="6*" align="center"/>
44944 <colspec colwidth="6*" align="center"/>
44945 <colspec colwidth="6*" align="right"/>
44946 <tbody>
44947 <row>
44948 <entry><option>server_set_id</option></entry>
44949 <entry>Use: <emphasis>authenticators</emphasis></entry>
44950 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44951 <entry>Default: <emphasis>unset</emphasis></entry>
44952 </row>
44953 </tbody>
44954 </tgroup>
44955 </informaltable>
44956 <para>
44957 <indexterm role="variable">
44958 <primary><varname>$authenticated_id</varname></primary>
44959 </indexterm>
44960 When an Exim server successfully authenticates a client, this string is
44961 expanded using data from the authentication, and preserved for any incoming
44962 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
44963 lines for incoming messages. For example, a user/password authenticator
44964 configuration might preserve the user name that was used to authenticate, and
44965 refer to it subsequently during delivery of the message.
44966 If expansion fails, the option is ignored.
44967 </para>
44968 <para>
44969 <indexterm role="option">
44970 <primary><option>server_mail_auth_condition</option></primary>
44971 </indexterm>
44972 </para>
44973 <informaltable frame="all">
44974 <tgroup cols="4" colsep="0" rowsep="0">
44975 <colspec colwidth="8*" align="left"/>
44976 <colspec colwidth="6*" align="center"/>
44977 <colspec colwidth="6*" align="center"/>
44978 <colspec colwidth="6*" align="right"/>
44979 <tbody>
44980 <row>
44981 <entry><option>server_mail_auth_condition</option></entry>
44982 <entry>Use: <emphasis>authenticators</emphasis></entry>
44983 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44984 <entry>Default: <emphasis>unset</emphasis></entry>
44985 </row>
44986 </tbody>
44987 </tgroup>
44988 </informaltable>
44989 <para>
44990 This option allows a server to discard authenticated sender addresses supplied
44991 as part of MAIL commands in SMTP connections that are authenticated by the
44992 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
44993 as part of the authentication process; instead its (unexpanded) value is
44994 remembered for later use.
44995 How it is used is described in the following section.
44996 </para>
44997 </section>
44998 <section id="SECTauthparamail">
44999 <title>The AUTH parameter on MAIL commands</title>
45000 <para>
45001 <indexterm role="concept">
45002 <primary>authentication</primary>
45003 <secondary>sender; authenticated</secondary>
45004 </indexterm>
45005 <indexterm role="concept">
45006 <primary>AUTH</primary>
45007 <secondary>on MAIL command</secondary>
45008 </indexterm>
45009 When a client supplied an AUTH= item on a MAIL command, Exim applies
45010 the following checks before accepting it as the authenticated sender of the
45011 message:
45012 </para>
45013 <itemizedlist>
45014 <listitem>
45015 <para>
45016 If the connection is not using extended SMTP (that is, HELO was used rather
45017 than EHLO), the use of AUTH= is a syntax error.
45018 </para>
45019 </listitem>
45020 <listitem>
45021 <para>
45022 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
45023 </para>
45024 </listitem>
45025 <listitem>
45026 <para>
45027 <indexterm role="variable">
45028 <primary><varname>$authenticated_sender</varname></primary>
45029 </indexterm>
45030 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45031 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45032 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45033 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45034 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45035 given for the MAIL command.
45036 </para>
45037 </listitem>
45038 <listitem>
45039 <para>
45040 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45041 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45042 authenticated.
45043 </para>
45044 </listitem>
45045 <listitem>
45046 <para>
45047 If the AUTH= value was accepted by either of the two previous rules, and
45048 the client has authenticated, and the authenticator has a setting for the
45049 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45050 valued that was saved from the authenticator is expanded. If the expansion
45051 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45052 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45053 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45054 message.
45055 </para>
45056 </listitem>
45057 </itemizedlist>
45058 <para>
45059 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45060 hosts to which Exim authenticates as a client. Do not confuse this value with
45061 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45062 process, and which is not usually a complete email address.
45063 </para>
45064 <para>
45065 <indexterm role="variable">
45066 <primary><varname>$sender_address</varname></primary>
45067 </indexterm>
45068 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45069 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45070 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45071 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45072 ACL is run.
45073 </para>
45074 </section>
45075 <section id="SECTauthexiser">
45076 <title>Authentication on an Exim server</title>
45077 <para>
45078 <indexterm role="concept">
45079 <primary>authentication</primary>
45080 <secondary>on an Exim server</secondary>
45081 </indexterm>
45082 When Exim receives an EHLO command, it advertises the public names of those
45083 authenticators that are configured as servers, subject to the following
45084 conditions:
45085 </para>
45086 <itemizedlist>
45087 <listitem>
45088 <para>
45089 The client host must match <option>auth_advertise_hosts</option> (default *).
45090 </para>
45091 </listitem>
45092 <listitem>
45093 <para>
45094 It the <option>server_advertise_condition</option> option is set, its expansion must not
45095 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45096 </para>
45097 </listitem>
45098 </itemizedlist>
45099 <para>
45100 The order in which the authenticators are defined controls the order in which
45101 the mechanisms are advertised.
45102 </para>
45103 <para>
45104 Some mail clients (for example, some versions of Netscape) require the user to
45105 provide a name and password for authentication whenever AUTH is advertised,
45106 even though authentication may not in fact be needed (for example, Exim may be
45107 set up to allow unconditional relaying from the client by an IP address check).
45108 You can make such clients more friendly by not advertising AUTH to them.
45109 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45110 that runs for RCPT) to relay without authentication, you should set
45111 </para>
45112 <literallayout class="monospaced">
45113 auth_advertise_hosts = ! 10.9.8.0/24
45114 </literallayout>
45115 <para>
45116 so that no authentication mechanisms are advertised to them.
45117 </para>
45118 <para>
45119 The <option>server_advertise_condition</option> controls the advertisement of individual
45120 authentication mechanisms. For example, it can be used to restrict the
45121 advertisement of a particular mechanism to encrypted connections, by a setting
45122 such as:
45123 </para>
45124 <literallayout class="monospaced">
45125 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45126 </literallayout>
45127 <para>
45128 <indexterm role="variable">
45129 <primary><varname>$tls_cipher</varname></primary>
45130 </indexterm>
45131 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45132 yields <quote>yes</quote>, which allows the advertisement to happen.
45133 </para>
45134 <para>
45135 When an Exim server receives an AUTH command from a client, it rejects it
45136 immediately if AUTH was not advertised in response to an earlier EHLO
45137 command. This is the case if
45138 </para>
45139 <itemizedlist>
45140 <listitem>
45141 <para>
45142 The client host does not match <option>auth_advertise_hosts</option>; or
45143 </para>
45144 </listitem>
45145 <listitem>
45146 <para>
45147 No authenticators are configured with server options; or
45148 </para>
45149 </listitem>
45150 <listitem>
45151 <para>
45152 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45153 server authenticators.
45154 </para>
45155 </listitem>
45156 </itemizedlist>
45157 <para>
45158 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45159 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45160 AUTH is accepted from any client host.
45161 </para>
45162 <para>
45163 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45164 server authentication mechanism that was advertised in response to EHLO and
45165 that matches the one named in the AUTH command. If it finds one, it runs
45166 the appropriate authentication protocol, and authentication either succeeds or
45167 fails. If there is no matching advertised mechanism, the AUTH command is
45168 rejected with a 504 error.
45169 </para>
45170 <para>
45171 <indexterm role="variable">
45172 <primary><varname>$received_protocol</varname></primary>
45173 </indexterm>
45174 <indexterm role="variable">
45175 <primary><varname>$sender_host_authenticated</varname></primary>
45176 </indexterm>
45177 When a message is received from an authenticated host, the value of
45178 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45179 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45180 public name) of the authenticator driver that successfully authenticated the
45181 client from which the message was received. This variable is empty if there was
45182 no successful authentication.
45183 </para>
45184 </section>
45185 <section id="SECID169">
45186 <title>Testing server authentication</title>
45187 <para>
45188 <indexterm role="concept">
45189 <primary>authentication</primary>
45190 <secondary>testing a server</secondary>
45191 </indexterm>
45192 <indexterm role="concept">
45193 <primary>AUTH</primary>
45194 <secondary>testing a server</secondary>
45195 </indexterm>
45196 <indexterm role="concept">
45197 <primary>base64 encoding</primary>
45198 <secondary>creating authentication test data</secondary>
45199 </indexterm>
45200 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
45201 configurations. The data for the AUTH command has to be sent using base64
45202 encoding. A quick way to produce such data for testing is the following Perl
45203 script:
45204 </para>
45205 <literallayout class="monospaced">
45206 use MIME::Base64;
45207 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45208 </literallayout>
45209 <para>
45210 <indexterm role="concept">
45211 <primary>binary zero</primary>
45212 <secondary>in authentication data</secondary>
45213 </indexterm>
45214 This interprets its argument as a Perl string, and then encodes it. The
45215 interpretation as a Perl string allows binary zeros, which are required for
45216 some kinds of authentication, to be included in the data. For example, a
45217 command line to run this script on such data might be
45218 </para>
45219 <literallayout class="monospaced">
45220 encode '\0user\0password'
45221 </literallayout>
45222 <para>
45223 Note the use of single quotes to prevent the shell interpreting the
45224 backslashes, so that they can be interpreted by Perl to specify characters
45225 whose code value is zero.
45226 </para>
45227 <para>
45228 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45229 digit, you must use three zeros instead of one after the leading backslash. If
45230 you do not, the octal digit that starts your string will be incorrectly
45231 interpreted as part of the code for the first character.
45232 </para>
45233 <para>
45234 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45235 specially, you must use a Perl escape to prevent them being misinterpreted. For
45236 example, a command such as
45237 </para>
45238 <literallayout class="monospaced">
45239 encode '\0user@domain.com\0pas$$word'
45240 </literallayout>
45241 <para>
45242 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45243 </para>
45244 <para>
45245 If you have the <option>mimencode</option> command installed, another way to do produce
45246 base64-encoded strings is to run the command
45247 </para>
45248 <literallayout class="monospaced">
45249 echo -e -n `\0user\0password' | mimencode
45250 </literallayout>
45251 <para>
45252 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45253 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45254 output. However, not all versions of <option>echo</option> recognize these options, so you
45255 should check your version before relying on this suggestion.
45256 </para>
45257 </section>
45258 <section id="SECID170">
45259 <title>Authentication by an Exim client</title>
45260 <para>
45261 <indexterm role="concept">
45262 <primary>authentication</primary>
45263 <secondary>on an Exim client</secondary>
45264 </indexterm>
45265 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45266 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45267 announces support for authentication, and the host matches an entry in either
45268 of these options, Exim (as a client) tries to authenticate as follows:
45269 </para>
45270 <itemizedlist>
45271 <listitem>
45272 <para>
45273 For each authenticator that is configured as a client, in the order in which
45274 they are defined in the configuration, it searches the authentication
45275 mechanisms announced by the server for one whose name matches the public name
45276 of the authenticator.
45277 </para>
45278 </listitem>
45279 <listitem>
45280 <para>
45281 <indexterm role="variable">
45282 <primary><varname>$host</varname></primary>
45283 </indexterm>
45284 <indexterm role="variable">
45285 <primary><varname>$host_address</varname></primary>
45286 </indexterm>
45287 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
45288 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45289 that the client might do. They are set to the server&#x2019;s name and IP address. If
45290 any expansion is forced to fail, the authentication attempt is abandoned, and
45291 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45292 delivery to be deferred.
45293 </para>
45294 </listitem>
45295 <listitem>
45296 <para>
45297 If the result of the authentication attempt is a temporary error or a timeout,
45298 Exim abandons trying to send the message to the host for the moment. It will
45299 try again later. If there are any backup hosts available, they are tried in the
45300 usual way.
45301 </para>
45302 </listitem>
45303 <listitem>
45304 <para>
45305 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45306 carries on searching the list of authenticators and tries another one if
45307 possible. If all authentication attempts give permanent errors, or if there are
45308 no attempts because no mechanisms match (or option expansions force failure),
45309 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45310 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45311 delivery is deferred. The error can be detected in the retry rules, and thereby
45312 turned into a permanent error if you wish. In the second case, Exim tries to
45313 deliver the message unauthenticated.
45314 </para>
45315 </listitem>
45316 </itemizedlist>
45317 <para>
45318 <indexterm role="concept">
45319 <primary>AUTH</primary>
45320 <secondary>on MAIL command</secondary>
45321 </indexterm>
45322 When Exim has authenticated itself to a remote server, it adds the AUTH
45323 parameter to the MAIL commands it sends, if it has an authenticated sender for
45324 the message. If the message came from a remote host, the authenticated sender
45325 is the one that was receiving on an incoming MAIL command, provided that the
45326 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45327 allowed the authenticated sender to be retained. If a local process calls Exim
45328 to send a message, the sender address that is built from the login name and
45329 <option>qualify_domain</option> is treated as authenticated. However, if the
45330 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45331 the authenticated sender that was received with the message.
45332 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45333 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45334 </para>
45335 </section>
45336 </chapter>
45337
45338 <chapter id="CHAPplaintext">
45339 <title>The plaintext authenticator</title>
45340 <para>
45341 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45342 <primary><command>plaintext</command> authenticator</primary>
45343 </indexterm>
45344 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45345 <primary>authenticators</primary>
45346 <secondary><command>plaintext</command></secondary>
45347 </indexterm>
45348 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45349 LOGIN authentication mechanisms, both of which transfer authentication data as
45350 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45351 security risk; you are strongly advised to insist on the use of SMTP encryption
45352 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45353 use unencrypted plain text, you should not use the same passwords for SMTP
45354 connections as you do for login accounts.
45355 </para>
45356 <section id="SECID171">
45357 <title>Plaintext options</title>
45358 <para>
45359 <indexterm role="concept">
45360 <primary>options</primary>
45361 <secondary><command>plaintext</command> authenticator (server)</secondary>
45362 </indexterm>
45363 When configured as a server, <command>plaintext</command> uses the following options:
45364 </para>
45365 <para>
45366 <indexterm role="option">
45367 <primary><option>server_condition</option></primary>
45368 </indexterm>
45369 </para>
45370 <informaltable frame="all">
45371 <tgroup cols="4" colsep="0" rowsep="0">
45372 <colspec colwidth="8*" align="left"/>
45373 <colspec colwidth="6*" align="center"/>
45374 <colspec colwidth="6*" align="center"/>
45375 <colspec colwidth="6*" align="right"/>
45376 <tbody>
45377 <row>
45378 <entry><option>server_condition</option></entry>
45379 <entry>Use: <emphasis>authenticators</emphasis></entry>
45380 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45381 <entry>Default: <emphasis>unset</emphasis></entry>
45382 </row>
45383 </tbody>
45384 </tgroup>
45385 </informaltable>
45386 <para>
45387 This is actually a global authentication option, but it must be set in order to
45388 configure the <command>plaintext</command> driver as a server. Its use is described below.
45389 </para>
45390 <para>
45391 <indexterm role="option">
45392 <primary><option>server_prompts</option></primary>
45393 </indexterm>
45394 </para>
45395 <informaltable frame="all">
45396 <tgroup cols="4" colsep="0" rowsep="0">
45397 <colspec colwidth="8*" align="left"/>
45398 <colspec colwidth="6*" align="center"/>
45399 <colspec colwidth="6*" align="center"/>
45400 <colspec colwidth="6*" align="right"/>
45401 <tbody>
45402 <row>
45403 <entry><option>server_prompts</option></entry>
45404 <entry>Use: <emphasis>plaintext</emphasis></entry>
45405 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45406 <entry>Default: <emphasis>unset</emphasis></entry>
45407 </row>
45408 </tbody>
45409 </tgroup>
45410 </informaltable>
45411 <para>
45412 The contents of this option, after expansion, must be a colon-separated list of
45413 prompt strings. If expansion fails, a temporary authentication rejection is
45414 given.
45415 </para>
45416 </section>
45417 <section id="SECTplainserver">
45418 <title>Using plaintext in a server</title>
45419 <para>
45420 <indexterm role="concept">
45421 <primary>AUTH</primary>
45422 <secondary>in <command>plaintext</command> authenticator</secondary>
45423 </indexterm>
45424 <indexterm role="concept">
45425 <primary>binary zero</primary>
45426 <secondary>in <command>plaintext</command> authenticator</secondary>
45427 </indexterm>
45428 <indexterm role="concept">
45429 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45430 <secondary>in <command>plaintext</command> authenticator</secondary>
45431 </indexterm>
45432 <indexterm role="variable">
45433 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45434 </indexterm>
45435 <indexterm role="concept">
45436 <primary>base64 encoding</primary>
45437 <secondary>in <command>plaintext</command> authenticator</secondary>
45438 </indexterm>
45439 </para>
45440 <para>
45441 When running as a server, <command>plaintext</command> performs the authentication test by
45442 expanding a string. The data sent by the client with the AUTH command, or in
45443 response to subsequent prompts, is base64 encoded, and so may contain any byte
45444 values when decoded. If any data is supplied with the command, it is treated as
45445 a list of strings, separated by NULs (binary zeros), the first three of which
45446 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45447 (neither LOGIN nor PLAIN uses more than three strings).
45448 </para>
45449 <para>
45450 For compatibility with previous releases of Exim, the values are also placed in
45451 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45452 variables for this purpose is now deprecated, as it can lead to confusion in
45453 string expansions that also use them for other things.
45454 </para>
45455 <para>
45456 If there are more strings in <option>server_prompts</option> than the number of strings
45457 supplied with the AUTH command, the remaining prompts are used to obtain more
45458 data. Each response from the client may be a list of NUL-separated strings.
45459 </para>
45460 <para>
45461 <indexterm role="variable">
45462 <primary><varname>$authenticated_id</varname></primary>
45463 </indexterm>
45464 Once a sufficient number of data strings have been received,
45465 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45466 authentication fails. Any other expansion failure causes a temporary error code
45467 to be returned. If the result of a successful expansion is an empty string,
45468 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45469 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45470 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45471 For any other result, a temporary error code is returned, with the expanded
45472 string as the error text.
45473 </para>
45474 <para>
45475 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
45476 password, be sure to make the authentication fail if the user is unknown.
45477 There are good and bad examples at the end of the next section.
45478 </para>
45479 </section>
45480 <section id="SECID172">
45481 <title>The PLAIN authentication mechanism</title>
45482 <para>
45483 <indexterm role="concept">
45484 <primary>PLAIN authentication mechanism</primary>
45485 </indexterm>
45486 <indexterm role="concept">
45487 <primary>authentication</primary>
45488 <secondary>PLAIN mechanism</secondary>
45489 </indexterm>
45490 <indexterm role="concept">
45491 <primary>binary zero</primary>
45492 <secondary>in <command>plaintext</command> authenticator</secondary>
45493 </indexterm>
45494 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45495 sent as one item of data (that is, one combined string containing two NUL
45496 separators). The data is sent either as part of the AUTH command, or
45497 subsequently in response to an empty prompt from the server.
45498 </para>
45499 <para>
45500 The second and third strings are a user name and a corresponding password.
45501 Using a single fixed user name and password as an example, this could be
45502 configured as follows:
45503 </para>
45504 <literallayout class="monospaced">
45505 fixed_plain:
45506   driver = plaintext
45507   public_name = PLAIN
45508   server_prompts = :
45509   server_condition = \
45510     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45511   server_set_id = $auth2
45512 </literallayout>
45513 <para>
45514 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45515 are exactly what we want here, so they need not be specified. Obviously, if the
45516 password contains expansion-significant characters such as dollar, backslash,
45517 or closing brace, they have to be escaped.
45518 </para>
45519 <para>
45520 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45521 the end of a string list are ignored). If all the data comes as part of the
45522 AUTH command, as is commonly the case, the prompt is not used. This
45523 authenticator is advertised in the response to EHLO as
45524 </para>
45525 <literallayout class="monospaced">
45526 250-AUTH PLAIN
45527 </literallayout>
45528 <para>
45529 and a client host can authenticate itself by sending the command
45530 </para>
45531 <literallayout class="monospaced">
45532 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45533 </literallayout>
45534 <para>
45535 As this contains three strings (more than the number of prompts), no further
45536 data is required from the client. Alternatively, the client may just send
45537 </para>
45538 <literallayout class="monospaced">
45539 AUTH PLAIN
45540 </literallayout>
45541 <para>
45542 to initiate authentication, in which case the server replies with an empty
45543 prompt. The client must respond with the combined data string.
45544 </para>
45545 <para>
45546 The data string is base64 encoded, as required by the RFC. This example,
45547 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;
45548 represents a zero byte. This is split up into three strings, the first of which
45549 is empty. The <option>server_condition</option> option in the authenticator checks that the
45550 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45551 </para>
45552 <para>
45553 Having just one fixed user name and password, as in this example, is not very
45554 realistic, though for a small organization with only a handful of
45555 authenticating clients it could make sense.
45556 </para>
45557 <para>
45558 A more sophisticated instance of this authenticator could use the user name in
45559 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45560 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45561 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45562 This is an incorrect example:
45563 </para>
45564 <literallayout class="monospaced">
45565 server_condition = \
45566   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45567 </literallayout>
45568 <para>
45569 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45570 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45571 incorrect? It works fine for existing users, but consider what happens if a
45572 non-existent user name is given. The lookup fails, but as no success/failure
45573 strings are given for the lookup, it yields an empty string. Thus, to defeat
45574 the authentication, all a client has to do is to supply a non-existent user
45575 name and an empty password. The correct way of writing this test is:
45576 </para>
45577 <literallayout class="monospaced">
45578 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45579   {${if eq{$value}{$auth3}}} {false}}
45580 </literallayout>
45581 <para>
45582 In this case, if the lookup succeeds, the result is checked; if the lookup
45583 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45584 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45585 always fails if its second argument is empty. However, the second way of
45586 writing the test makes the logic clearer.
45587 </para>
45588 </section>
45589 <section id="SECID173">
45590 <title>The LOGIN authentication mechanism</title>
45591 <para>
45592 <indexterm role="concept">
45593 <primary>LOGIN authentication mechanism</primary>
45594 </indexterm>
45595 <indexterm role="concept">
45596 <primary>authentication</primary>
45597 <secondary>LOGIN mechanism</secondary>
45598 </indexterm>
45599 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45600 in a number of programs. No data is sent with the AUTH command. Instead, a
45601 user name and password are supplied separately, in response to prompts. The
45602 plaintext authenticator can be configured to support this as in this example:
45603 </para>
45604 <literallayout class="monospaced">
45605 fixed_login:
45606   driver = plaintext
45607   public_name = LOGIN
45608   server_prompts = User Name : Password
45609   server_condition = \
45610     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45611   server_set_id = $auth1
45612 </literallayout>
45613 <para>
45614 Because of the way plaintext operates, this authenticator accepts data supplied
45615 with the AUTH command (in contravention of the specification of LOGIN), but
45616 if the client does not supply it (as is the case for LOGIN clients), the prompt
45617 strings are used to obtain two data items.
45618 </para>
45619 <para>
45620 Some clients are very particular about the precise text of the prompts. For
45621 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45622 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45623 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45624 name and password by binding to an LDAP server:
45625 </para>
45626 <literallayout class="monospaced">
45627 login:
45628   driver = plaintext
45629   public_name = LOGIN
45630   server_prompts = Username:: : Password::
45631   server_condition = ${if and{{
45632     !eq{}{$auth1} }{ \
45633     ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45634              pass=${quote:$auth2} \
45635              ldap://ldap.example.org/} }} }
45636   server_set_id = uid=$auth1,ou=people,o=example.org
45637 </literallayout>
45638 <para revisionflag="changed">
45639 We have to check that the username is not empty before using it, because LDAP
45640 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
45641 operator to correctly quote the DN for authentication. However, the basic
45642 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
45643 correct one to use for the password, because quoting is needed only to make
45644 the password conform to the Exim syntax. At the LDAP level, the password is an
45645 uninterpreted string.
45646 </para>
45647 </section>
45648 <section id="SECID174">
45649 <title>Support for different kinds of authentication</title>
45650 <para>
45651 A number of string expansion features are provided for the purpose of
45652 interfacing to different ways of user authentication. These include checking
45653 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45654 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45655 <xref linkend="SECTexpcond"/>.
45656 </para>
45657 </section>
45658 <section id="SECID175">
45659 <title>Using plaintext in a client</title>
45660 <para>
45661 <indexterm role="concept">
45662 <primary>options</primary>
45663 <secondary><command>plaintext</command> authenticator (client)</secondary>
45664 </indexterm>
45665 The <command>plaintext</command> authenticator has two client options:
45666 </para>
45667 <para>
45668 <indexterm role="option">
45669 <primary><option>client_ignore_invalid_base64</option></primary>
45670 </indexterm>
45671 </para>
45672 <informaltable frame="all">
45673 <tgroup cols="4" colsep="0" rowsep="0">
45674 <colspec colwidth="8*" align="left"/>
45675 <colspec colwidth="6*" align="center"/>
45676 <colspec colwidth="6*" align="center"/>
45677 <colspec colwidth="6*" align="right"/>
45678 <tbody>
45679 <row>
45680 <entry><option>client_ignore_invalid_base64</option></entry>
45681 <entry>Use: <emphasis>plaintext</emphasis></entry>
45682 <entry>Type: <emphasis>boolean</emphasis></entry>
45683 <entry>Default: <emphasis>false</emphasis></entry>
45684 </row>
45685 </tbody>
45686 </tgroup>
45687 </informaltable>
45688 <para>
45689 If the client receives a server prompt that is not a valid base64 string,
45690 authentication is abandoned by default. However, if this option is set true,
45691 the error in the challenge is ignored and the client sends the response as
45692 usual.
45693 </para>
45694 <para>
45695 <indexterm role="option">
45696 <primary><option>client_send</option></primary>
45697 </indexterm>
45698 </para>
45699 <informaltable frame="all">
45700 <tgroup cols="4" colsep="0" rowsep="0">
45701 <colspec colwidth="8*" align="left"/>
45702 <colspec colwidth="6*" align="center"/>
45703 <colspec colwidth="6*" align="center"/>
45704 <colspec colwidth="6*" align="right"/>
45705 <tbody>
45706 <row>
45707 <entry><option>client_send</option></entry>
45708 <entry>Use: <emphasis>plaintext</emphasis></entry>
45709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45710 <entry>Default: <emphasis>unset</emphasis></entry>
45711 </row>
45712 </tbody>
45713 </tgroup>
45714 </informaltable>
45715 <para>
45716 The string is a colon-separated list of authentication data strings. Each
45717 string is independently expanded before being sent to the server. The first
45718 string is sent with the AUTH command; any more strings are sent in response
45719 to prompts from the server. Before each string is expanded, the value of the
45720 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
45721 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45722 way. Thus, the prompt that is received in response to sending the first string
45723 (with the AUTH command) can be used in the expansion of the second string, and
45724 so on. If an invalid base64 string is received when
45725 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45726 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
45727 </para>
45728 <para>
45729 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45730 splitting takes priority and happens first.
45731 </para>
45732 <para>
45733 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45734 the data, further processing is applied to each string before it is sent. If
45735 there are any single circumflex characters in the string, they are converted to
45736 NULs. Should an actual circumflex be required as data, it must be doubled in
45737 the string.
45738 </para>
45739 <para>
45740 This is an example of a client configuration that implements the PLAIN
45741 authentication mechanism with a fixed user name and password:
45742 </para>
45743 <literallayout class="monospaced">
45744 fixed_plain:
45745   driver = plaintext
45746   public_name = PLAIN
45747   client_send = ^username^mysecret
45748 </literallayout>
45749 <para>
45750 The lack of colons means that the entire text is sent with the AUTH
45751 command, with the circumflex characters converted to NULs. A similar example
45752 that uses the LOGIN mechanism is:
45753 </para>
45754 <literallayout class="monospaced">
45755 fixed_login:
45756   driver = plaintext
45757   public_name = LOGIN
45758   client_send = : username : mysecret
45759 </literallayout>
45760 <para>
45761 The initial colon means that the first string is empty, so no data is sent with
45762 the AUTH command itself. The remaining strings are sent in response to
45763 prompts.
45764 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
45765 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
45766 </para>
45767 </section>
45768 </chapter>
45769
45770 <chapter id="CHID9">
45771 <title>The cram_md5 authenticator</title>
45772 <para>
45773 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
45774 <primary><command>cram_md5</command> authenticator</primary>
45775 </indexterm>
45776 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
45777 <primary>authenticators</primary>
45778 <secondary><command>cram_md5</command></secondary>
45779 </indexterm>
45780 <indexterm role="concept">
45781 <primary>CRAM-MD5 authentication mechanism</primary>
45782 </indexterm>
45783 <indexterm role="concept">
45784 <primary>authentication</primary>
45785 <secondary>CRAM-MD5 mechanism</secondary>
45786 </indexterm>
45787 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
45788 sends a challenge string to the client, and the response consists of a user
45789 name and the CRAM-MD5 digest of the challenge string combined with a secret
45790 string (password) which is known to both server and client. Thus, the secret
45791 is not sent over the network as plain text, which makes this authenticator more
45792 secure than <command>plaintext</command>. However, the downside is that the secret has to be
45793 available in plain text at either end.
45794 </para>
45795 <section id="SECID176">
45796 <title>Using cram_md5 as a server</title>
45797 <para>
45798 <indexterm role="concept">
45799 <primary>options</primary>
45800 <secondary><command>cram_md5</command> authenticator (server)</secondary>
45801 </indexterm>
45802 This authenticator has one server option, which must be set to configure the
45803 authenticator as a server:
45804 </para>
45805 <para>
45806 <indexterm role="option">
45807 <primary><option>server_secret</option></primary>
45808 </indexterm>
45809 </para>
45810 <informaltable frame="all">
45811 <tgroup cols="4" colsep="0" rowsep="0">
45812 <colspec colwidth="8*" align="left"/>
45813 <colspec colwidth="6*" align="center"/>
45814 <colspec colwidth="6*" align="center"/>
45815 <colspec colwidth="6*" align="right"/>
45816 <tbody>
45817 <row>
45818 <entry><option>server_secret</option></entry>
45819 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45820 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45821 <entry>Default: <emphasis>unset</emphasis></entry>
45822 </row>
45823 </tbody>
45824 </tgroup>
45825 </informaltable>
45826 <para>
45827 <indexterm role="concept">
45828 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45829 <secondary>in <command>cram_md5</command> authenticator</secondary>
45830 </indexterm>
45831 When the server receives the client&#x2019;s response, the user name is placed in
45832 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
45833 obtain the password for that user. The server then computes the CRAM-MD5 digest
45834 that the client should have sent, and checks that it received the correct
45835 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
45836 fails. If the expansion fails for some other reason, a temporary error code is
45837 returned to the client.
45838 </para>
45839 <para>
45840 For compatibility with previous releases of Exim, the user name is also placed
45841 in <varname>$1</varname>. However, the use of this variables for this purpose is now
45842 deprecated, as it can lead to confusion in string expansions that also use
45843 numeric variables for other things.
45844 </para>
45845 <para>
45846 For example, the following authenticator checks that the user name given by the
45847 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
45848 user name, authentication fails.
45849 </para>
45850 <literallayout class="monospaced">
45851 fixed_cram:
45852   driver = cram_md5
45853   public_name = CRAM-MD5
45854   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
45855   server_set_id = $auth1
45856 </literallayout>
45857 <para>
45858 <indexterm role="variable">
45859 <primary><varname>$authenticated_id</varname></primary>
45860 </indexterm>
45861 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
45862 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
45863 secret string in a file, using the user name as the key. For example:
45864 </para>
45865 <literallayout class="monospaced">
45866 lookup_cram:
45867   driver = cram_md5
45868   public_name = CRAM-MD5
45869   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
45870                   {$value}fail}
45871   server_set_id = $auth1
45872 </literallayout>
45873 <para>
45874 Note that this expansion explicitly forces failure if the lookup fails
45875 because <varname>$auth1</varname> contains an unknown user name.
45876 </para>
45877 </section>
45878 <section id="SECID177">
45879 <title>Using cram_md5 as a client</title>
45880 <para>
45881 <indexterm role="concept">
45882 <primary>options</primary>
45883 <secondary><command>cram_md5</command> authenticator (client)</secondary>
45884 </indexterm>
45885 When used as a client, the <command>cram_md5</command> authenticator has two options:
45886 </para>
45887 <para>
45888 <indexterm role="option">
45889 <primary><option>client_name</option></primary>
45890 </indexterm>
45891 </para>
45892 <informaltable frame="all">
45893 <tgroup cols="4" colsep="0" rowsep="0">
45894 <colspec colwidth="8*" align="left"/>
45895 <colspec colwidth="6*" align="center"/>
45896 <colspec colwidth="6*" align="center"/>
45897 <colspec colwidth="6*" align="right"/>
45898 <tbody>
45899 <row>
45900 <entry><option>client_name</option></entry>
45901 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45903 <entry>Default: <emphasis>the primary host name</emphasis></entry>
45904 </row>
45905 </tbody>
45906 </tgroup>
45907 </informaltable>
45908 <para>
45909 This string is expanded, and the result used as the user name data when
45910 computing the response to the server&#x2019;s challenge.
45911 </para>
45912 <para>
45913 <indexterm role="option">
45914 <primary><option>client_secret</option></primary>
45915 </indexterm>
45916 </para>
45917 <informaltable frame="all">
45918 <tgroup cols="4" colsep="0" rowsep="0">
45919 <colspec colwidth="8*" align="left"/>
45920 <colspec colwidth="6*" align="center"/>
45921 <colspec colwidth="6*" align="center"/>
45922 <colspec colwidth="6*" align="right"/>
45923 <tbody>
45924 <row>
45925 <entry><option>client_secret</option></entry>
45926 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45928 <entry>Default: <emphasis>unset</emphasis></entry>
45929 </row>
45930 </tbody>
45931 </tgroup>
45932 </informaltable>
45933 <para>
45934 This option must be set for the authenticator to work as a client. Its value is
45935 expanded and the result used as the secret string when computing the response.
45936 </para>
45937 <para>
45938 <indexterm role="variable">
45939 <primary><varname>$host</varname></primary>
45940 </indexterm>
45941 <indexterm role="variable">
45942 <primary><varname>$host_address</varname></primary>
45943 </indexterm>
45944 Different user names and secrets can be used for different servers by referring
45945 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
45946 expansion string is treated as an indication that this authenticator is not
45947 prepared to handle this case. Exim moves on to the next configured client
45948 authenticator. Any other expansion failure causes Exim to give up trying to
45949 send the message to the current server.
45950 </para>
45951 <para>
45952 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
45953 strings, is:
45954 </para>
45955 <literallayout class="monospaced">
45956 fixed_cram:
45957   driver = cram_md5
45958   public_name = CRAM-MD5
45959   client_name = ph10
45960   client_secret = secret
45961 </literallayout>
45962 <para>
45963 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
45964 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
45965 </para>
45966 </section>
45967 </chapter>
45968
45969 <chapter id="CHID10">
45970 <title>The cyrus_sasl authenticator</title>
45971 <para>
45972 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
45973 <primary><command>cyrus_sasl</command> authenticator</primary>
45974 </indexterm>
45975 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
45976 <primary>authenticators</primary>
45977 <secondary><command>cyrus_sasl</command></secondary>
45978 </indexterm>
45979 <indexterm role="concept">
45980 <primary>Cyrus</primary>
45981 <secondary>SASL library</secondary>
45982 </indexterm>
45983 <indexterm role="concept">
45984 <primary>Kerberos</primary>
45985 </indexterm>
45986 The code for this authenticator was provided by Matthew Byng-Maddick of A L
45987 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
45988 </para>
45989 <para>
45990 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
45991 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
45992 Layer</quote>). This library supports a number of authentication mechanisms,
45993 including PLAIN and LOGIN, but also several others that Exim does not support
45994 directly. In particular, there is support for Kerberos authentication.
45995 </para>
45996 <para>
45997 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
45998 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
45999 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46000 name of the driver to determine which mechanism to support.
46001 </para>
46002 <para>
46003 Where access to some kind of secret file is required, for example in GSSAPI
46004 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46005 user, and that the Cyrus SASL library has no way of escalating privileges
46006 by default. You may also find you need to set environment variables,
46007 depending on the driver you are using.
46008 </para>
46009 <para>
46010 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46011 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46012 Kerberos, note that because of limitations in the GSSAPI interface,
46013 changing the server keytab might need to be communicated down to the Kerberos
46014 layer independently. The mechanism for doing so is dependent upon the Kerberos
46015 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46016 may be set to point to an alternative keytab file. Exim will pass this
46017 variable through from its own inherited environment when started as root or the
46018 Exim user. The keytab file needs to be readable by the Exim user.
46019 </para>
46020 <section id="SECID178">
46021 <title>Using cyrus_sasl as a server</title>
46022 <para>
46023 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46024 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46025 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46026 use of this variable for this purpose is now deprecated, as it can lead to
46027 confusion in string expansions that also use numeric variables for other
46028 things.
46029 </para>
46030 <para>
46031 <indexterm role="option">
46032 <primary><option>server_hostname</option></primary>
46033 </indexterm>
46034 </para>
46035 <informaltable frame="all">
46036 <tgroup cols="4" colsep="0" rowsep="0">
46037 <colspec colwidth="8*" align="left"/>
46038 <colspec colwidth="6*" align="center"/>
46039 <colspec colwidth="6*" align="center"/>
46040 <colspec colwidth="6*" align="right"/>
46041 <tbody>
46042 <row>
46043 <entry><option>server_hostname</option></entry>
46044 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46046 <entry>Default: <emphasis>see below</emphasis></entry>
46047 </row>
46048 </tbody>
46049 </tgroup>
46050 </informaltable>
46051 <para>
46052 This option selects the hostname that is used when communicating with the
46053 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46054 SASL plug-in what it does with this data.
46055 </para>
46056 <para>
46057 <indexterm role="option">
46058 <primary><option>server_mech</option></primary>
46059 </indexterm>
46060 </para>
46061 <informaltable frame="all">
46062 <tgroup cols="4" colsep="0" rowsep="0">
46063 <colspec colwidth="8*" align="left"/>
46064 <colspec colwidth="6*" align="center"/>
46065 <colspec colwidth="6*" align="center"/>
46066 <colspec colwidth="6*" align="right"/>
46067 <tbody>
46068 <row>
46069 <entry><option>server_mech</option></entry>
46070 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46071 <entry>Type: <emphasis>string</emphasis></entry>
46072 <entry>Default: <emphasis>see below</emphasis></entry>
46073 </row>
46074 </tbody>
46075 </tgroup>
46076 </informaltable>
46077 <para>
46078 This option selects the authentication mechanism this driver should use. The
46079 default is the value of the generic <option>public_name</option> option. This option allows
46080 you to use a different underlying mechanism from the advertised name. For
46081 example:
46082 </para>
46083 <literallayout class="monospaced">
46084 sasl:
46085   driver = cyrus_sasl
46086   public_name = X-ANYTHING
46087   server_mech = CRAM-MD5
46088   server_set_id = $auth1
46089 </literallayout>
46090 <para>
46091 <indexterm role="option">
46092 <primary><option>server_realm</option></primary>
46093 </indexterm>
46094 </para>
46095 <informaltable frame="all">
46096 <tgroup cols="4" colsep="0" rowsep="0">
46097 <colspec colwidth="8*" align="left"/>
46098 <colspec colwidth="6*" align="center"/>
46099 <colspec colwidth="6*" align="center"/>
46100 <colspec colwidth="6*" align="right"/>
46101 <tbody>
46102 <row>
46103 <entry><option>server_realm</option></entry>
46104 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46105 <entry>Type: <emphasis>string</emphasis></entry>
46106 <entry>Default: <emphasis>unset</emphasis></entry>
46107 </row>
46108 </tbody>
46109 </tgroup>
46110 </informaltable>
46111 <para>
46112 This specifies the SASL realm that the server claims to be in.
46113 </para>
46114 <para>
46115 <indexterm role="option">
46116 <primary><option>server_service</option></primary>
46117 </indexterm>
46118 </para>
46119 <informaltable frame="all">
46120 <tgroup cols="4" colsep="0" rowsep="0">
46121 <colspec colwidth="8*" align="left"/>
46122 <colspec colwidth="6*" align="center"/>
46123 <colspec colwidth="6*" align="center"/>
46124 <colspec colwidth="6*" align="right"/>
46125 <tbody>
46126 <row>
46127 <entry><option>server_service</option></entry>
46128 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46129 <entry>Type: <emphasis>string</emphasis></entry>
46130 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46131 </row>
46132 </tbody>
46133 </tgroup>
46134 </informaltable>
46135 <para>
46136 This is the SASL service that the server claims to implement.
46137 </para>
46138 <para>
46139 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
46140 private options. All you need to do is to specify an appropriate mechanism as
46141 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46142 PLAIN, you could have two authenticators as follows:
46143 </para>
46144 <literallayout class="monospaced">
46145 sasl_cram_md5:
46146   driver = cyrus_sasl
46147   public_name = CRAM-MD5
46148   server_set_id = $auth1
46149
46150 sasl_plain:
46151   driver = cyrus_sasl
46152   public_name = PLAIN
46153   server_set_id = $auth2
46154 </literallayout>
46155 <para>
46156 Cyrus SASL does implement the LOGIN authentication method, even though it is
46157 not a standard method. It is disabled by default in the source distribution,
46158 but it is present in many binary distributions.
46159 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46160 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46161 </para>
46162 </section>
46163 </chapter>
46164
46165 <chapter id="CHAPdovecot">
46166 <title>The dovecot authenticator</title>
46167 <para>
46168 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46169 <primary><command>dovecot</command> authenticator</primary>
46170 </indexterm>
46171 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46172 <primary>authenticators</primary>
46173 <secondary><command>dovecot</command></secondary>
46174 </indexterm>
46175 This authenticator is an interface to the authentication facility of the
46176 Dovecot POP/IMAP server, which can support a number of authentication methods.
46177 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46178 to use the same mechanisms for SMTP authentication. This is a server
46179 authenticator only. There is only one option:
46180 </para>
46181 <para>
46182 <indexterm role="option">
46183 <primary><option>server_socket</option></primary>
46184 </indexterm>
46185 </para>
46186 <informaltable frame="all">
46187 <tgroup cols="4" colsep="0" rowsep="0">
46188 <colspec colwidth="8*" align="left"/>
46189 <colspec colwidth="6*" align="center"/>
46190 <colspec colwidth="6*" align="center"/>
46191 <colspec colwidth="6*" align="right"/>
46192 <tbody>
46193 <row>
46194 <entry><option>server_socket</option></entry>
46195 <entry>Use: <emphasis>dovecot</emphasis></entry>
46196 <entry>Type: <emphasis>string</emphasis></entry>
46197 <entry>Default: <emphasis>unset</emphasis></entry>
46198 </row>
46199 </tbody>
46200 </tgroup>
46201 </informaltable>
46202 <para>
46203 This option must specify the socket that is the interface to Dovecot
46204 authentication. The <option>public_name</option> option must specify an authentication
46205 mechanism that Dovecot is configured to support. You can have several
46206 authenticators for different mechanisms. For example:
46207 </para>
46208 <literallayout class="monospaced">
46209 dovecot_plain:
46210   driver = dovecot
46211   public_name = PLAIN
46212   server_socket = /var/run/dovecot/auth-client
46213   server_set_id = $auth2
46214
46215 dovecot_ntlm:
46216   driver = dovecot
46217   public_name = NTLM
46218   server_socket = /var/run/dovecot/auth-client
46219   server_set_id = $auth1
46220 </literallayout>
46221 <para>
46222 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46223 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46224 option is passed in the Dovecot authentication command. If, for a TLS
46225 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46226 option is passed. When authentication succeeds, the identity of the user
46227 who authenticated is placed in <varname>$auth1</varname>.
46228 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46229 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46230 </para>
46231 </chapter>
46232
46233 <chapter id="CHAPspa">
46234 <title>The spa authenticator</title>
46235 <para>
46236 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46237 <primary><command>spa</command> authenticator</primary>
46238 </indexterm>
46239 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46240 <primary>authenticators</primary>
46241 <secondary><command>spa</command></secondary>
46242 </indexterm>
46243 <indexterm role="concept">
46244 <primary>authentication</primary>
46245 <secondary>Microsoft Secure Password</secondary>
46246 </indexterm>
46247 <indexterm role="concept">
46248 <primary>authentication</primary>
46249 <secondary>NTLM</secondary>
46250 </indexterm>
46251 <indexterm role="concept">
46252 <primary>Microsoft Secure Password Authentication</primary>
46253 </indexterm>
46254 <indexterm role="concept">
46255 <primary>NTLM authentication</primary>
46256 </indexterm>
46257 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
46258 Password Authentication</emphasis> mechanism,
46259 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46260 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
46261 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46262 server side was subsequently contributed by Tom Kistner. The mechanism works as
46263 follows:
46264 </para>
46265 <itemizedlist>
46266 <listitem>
46267 <para>
46268 After the AUTH command has been accepted, the client sends an SPA
46269 authentication request based on the user name and optional domain.
46270 </para>
46271 </listitem>
46272 <listitem>
46273 <para>
46274 The server sends back a challenge.
46275 </para>
46276 </listitem>
46277 <listitem>
46278 <para>
46279 The client builds a challenge response which makes use of the user&#x2019;s password
46280 and sends it to the server, which then accepts or rejects it.
46281 </para>
46282 </listitem>
46283 </itemizedlist>
46284 <para>
46285 Encryption is used to protect the password in transit.
46286 </para>
46287 <section id="SECID179">
46288 <title>Using spa as a server</title>
46289 <para>
46290 <indexterm role="concept">
46291 <primary>options</primary>
46292 <secondary><command>spa</command> authenticator (server)</secondary>
46293 </indexterm>
46294 The <command>spa</command> authenticator has just one server option:
46295 </para>
46296 <para>
46297 <indexterm role="option">
46298 <primary><option>server_password</option></primary>
46299 </indexterm>
46300 </para>
46301 <informaltable frame="all">
46302 <tgroup cols="4" colsep="0" rowsep="0">
46303 <colspec colwidth="8*" align="left"/>
46304 <colspec colwidth="6*" align="center"/>
46305 <colspec colwidth="6*" align="center"/>
46306 <colspec colwidth="6*" align="right"/>
46307 <tbody>
46308 <row>
46309 <entry><option>server_password</option></entry>
46310 <entry>Use: <emphasis>spa</emphasis></entry>
46311 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46312 <entry>Default: <emphasis>unset</emphasis></entry>
46313 </row>
46314 </tbody>
46315 </tgroup>
46316 </informaltable>
46317 <para>
46318 <indexterm role="concept">
46319 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46320 <secondary>in <command>spa</command> authenticator</secondary>
46321 </indexterm>
46322 This option is expanded, and the result must be the cleartext password for the
46323 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46324 compatibility with previous releases of Exim, the user name is also placed in
46325 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46326 it can lead to confusion in string expansions that also use numeric variables
46327 for other things. For example:
46328 </para>
46329 <literallayout class="monospaced">
46330 spa:
46331   driver = spa
46332   public_name = NTLM
46333   server_password = \
46334     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46335 </literallayout>
46336 <para>
46337 If the expansion is forced to fail, authentication fails. Any other expansion
46338 failure causes a temporary error code to be returned.
46339 </para>
46340 </section>
46341 <section id="SECID180">
46342 <title>Using spa as a client</title>
46343 <para>
46344 <indexterm role="concept">
46345 <primary>options</primary>
46346 <secondary><command>spa</command> authenticator (client)</secondary>
46347 </indexterm>
46348 The <command>spa</command> authenticator has the following client options:
46349 </para>
46350 <para>
46351 <indexterm role="option">
46352 <primary><option>client_domain</option></primary>
46353 </indexterm>
46354 </para>
46355 <informaltable frame="all">
46356 <tgroup cols="4" colsep="0" rowsep="0">
46357 <colspec colwidth="8*" align="left"/>
46358 <colspec colwidth="6*" align="center"/>
46359 <colspec colwidth="6*" align="center"/>
46360 <colspec colwidth="6*" align="right"/>
46361 <tbody>
46362 <row>
46363 <entry><option>client_domain</option></entry>
46364 <entry>Use: <emphasis>spa</emphasis></entry>
46365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46366 <entry>Default: <emphasis>unset</emphasis></entry>
46367 </row>
46368 </tbody>
46369 </tgroup>
46370 </informaltable>
46371 <para>
46372 This option specifies an optional domain for the authentication.
46373 </para>
46374 <para>
46375 <indexterm role="option">
46376 <primary><option>client_password</option></primary>
46377 </indexterm>
46378 </para>
46379 <informaltable frame="all">
46380 <tgroup cols="4" colsep="0" rowsep="0">
46381 <colspec colwidth="8*" align="left"/>
46382 <colspec colwidth="6*" align="center"/>
46383 <colspec colwidth="6*" align="center"/>
46384 <colspec colwidth="6*" align="right"/>
46385 <tbody>
46386 <row>
46387 <entry><option>client_password</option></entry>
46388 <entry>Use: <emphasis>spa</emphasis></entry>
46389 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46390 <entry>Default: <emphasis>unset</emphasis></entry>
46391 </row>
46392 </tbody>
46393 </tgroup>
46394 </informaltable>
46395 <para>
46396 This option specifies the user&#x2019;s password, and must be set.
46397 </para>
46398 <para>
46399 <indexterm role="option">
46400 <primary><option>client_username</option></primary>
46401 </indexterm>
46402 </para>
46403 <informaltable frame="all">
46404 <tgroup cols="4" colsep="0" rowsep="0">
46405 <colspec colwidth="8*" align="left"/>
46406 <colspec colwidth="6*" align="center"/>
46407 <colspec colwidth="6*" align="center"/>
46408 <colspec colwidth="6*" align="right"/>
46409 <tbody>
46410 <row>
46411 <entry><option>client_username</option></entry>
46412 <entry>Use: <emphasis>spa</emphasis></entry>
46413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46414 <entry>Default: <emphasis>unset</emphasis></entry>
46415 </row>
46416 </tbody>
46417 </tgroup>
46418 </informaltable>
46419 <para>
46420 This option specifies the user name, and must be set. Here is an example of a
46421 configuration of this authenticator for use with the mail servers at
46422 <emphasis>msn.com</emphasis>:
46423 </para>
46424 <literallayout class="monospaced">
46425 msn:
46426   driver = spa
46427   public_name = MSN
46428   client_username = msn/msn_username
46429   client_password = msn_plaintext_password
46430   client_domain = DOMAIN_OR_UNSET
46431 </literallayout>
46432 <para>
46433 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46434 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46435 </para>
46436 </section>
46437 </chapter>
46438
46439 <chapter id="CHAPTLS">
46440 <title>Encrypted SMTP connections using TLS/SSL</title>
46441 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46442 <para>
46443 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46444 <primary>encryption</primary>
46445 <secondary>on SMTP connection</secondary>
46446 </indexterm>
46447 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46448 <primary>SMTP</primary>
46449 <secondary>encryption</secondary>
46450 </indexterm>
46451 <indexterm role="concept">
46452 <primary>TLS</primary>
46453 <secondary>on SMTP connection</secondary>
46454 </indexterm>
46455 <indexterm role="concept">
46456 <primary>OpenSSL</primary>
46457 </indexterm>
46458 <indexterm role="concept">
46459 <primary>GnuTLS</primary>
46460 </indexterm>
46461 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46462 Sockets Layer), is implemented by making use of the OpenSSL library or the
46463 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46464 cryptographic code in the Exim distribution itself for implementing TLS. In
46465 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46466 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46467 You also need to understand the basic concepts of encryption at a managerial
46468 level, and in particular, the way that public keys, private keys, and
46469 certificates are used.
46470 </para>
46471 <para>
46472 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46473 connection is established, the client issues a STARTTLS command. If the
46474 server accepts this, the client and the server negotiate an encryption
46475 mechanism. If the negotiation succeeds, the data that subsequently passes
46476 between them is encrypted.
46477 </para>
46478 <para>
46479 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
46480 and if so, what cipher suite is in use, whether the client supplied a
46481 certificate, and whether or not that certificate was verified. This makes it
46482 possible for an Exim server to deny or accept certain commands based on the
46483 encryption state.
46484 </para>
46485 <para>
46486 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46487 disrupt TLS connections. You need to turn off SMTP scanning for these products
46488 in order to get TLS to work.
46489 </para>
46490 <section id="SECID284">
46491 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46492 <para>
46493 <indexterm role="concept">
46494 <primary>ssmtp protocol</primary>
46495 </indexterm>
46496 <indexterm role="concept">
46497 <primary>smtps protocol</primary>
46498 </indexterm>
46499 <indexterm role="concept">
46500 <primary>SMTP</primary>
46501 <secondary>ssmtp protocol</secondary>
46502 </indexterm>
46503 <indexterm role="concept">
46504 <primary>SMTP</primary>
46505 <secondary>smtps protocol</secondary>
46506 </indexterm>
46507 Early implementations of encrypted SMTP used a different TCP port from normal
46508 SMTP, and expected an encryption negotiation to start immediately, instead of
46509 waiting for a STARTTLS command from the client using the standard SMTP
46510 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46511 allocated for this purpose.
46512 </para>
46513 <para>
46514 This approach was abandoned when encrypted SMTP was standardized, but there are
46515 still some legacy clients that use it. Exim supports these clients by means of
46516 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46517 numbers; the most common use is expected to be:
46518 </para>
46519 <literallayout class="monospaced">
46520 tls_on_connect_ports = 465
46521 </literallayout>
46522 <para>
46523 The port numbers specified by this option apply to all SMTP connections, both
46524 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46525 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46526 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46527 an extra port &ndash; rather, it specifies different behaviour on a port that is
46528 defined elsewhere.
46529 </para>
46530 <para>
46531 There is also a <option>-tls-on-connect</option> command line option. This overrides
46532 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46533 </para>
46534 </section>
46535 <section id="SECTopenvsgnu">
46536 <title>OpenSSL vs GnuTLS</title>
46537 <para>
46538 <indexterm role="concept">
46539 <primary>TLS</primary>
46540 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46541 </indexterm>
46542 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46543 followed later, when the first versions of GnuTLS were released. To build Exim
46544 to use GnuTLS, you need to set
46545 </para>
46546 <literallayout class="monospaced">
46547 USE_GNUTLS=yes
46548 </literallayout>
46549 <para>
46550 in Local/Makefile, in addition to
46551 </para>
46552 <literallayout class="monospaced">
46553 SUPPORT_TLS=yes
46554 </literallayout>
46555 <para>
46556 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46557 include files and libraries for GnuTLS can be found.
46558 </para>
46559 <para>
46560 There are some differences in usage when using GnuTLS instead of OpenSSL:
46561 </para>
46562 <itemizedlist>
46563 <listitem>
46564 <para>
46565 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46566 name of a directory (for OpenSSL it can be either).
46567 </para>
46568 </listitem>
46569 <listitem>
46570 <para>
46571 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46572 facility for varying its Diffie-Hellman parameters. I understand that this has
46573 changed, but Exim has not been updated to provide this facility.
46574 </para>
46575 </listitem>
46576 <listitem>
46577 <para>
46578 <indexterm role="variable">
46579 <primary><varname>$tls_peerdn</varname></primary>
46580 </indexterm>
46581 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46582 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46583 affects the value of the <varname>$tls_peerdn</varname> variable.
46584 </para>
46585 </listitem>
46586 <listitem>
46587 <para>
46588 OpenSSL identifies cipher suites using hyphens as separators, for example:
46589 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46590 more, OpenSSL complains if underscores are present in a cipher list. To make
46591 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46592 underscores for GnuTLS when processing lists of cipher suites in the
46593 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46594 option).
46595 </para>
46596 </listitem>
46597 <listitem>
46598 <para>
46599 The <option>tls_require_ciphers</option> options operate differently, as described in the
46600 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46601 </para>
46602 </listitem>
46603 </itemizedlist>
46604 </section>
46605 <section id="SECID181">
46606 <title>GnuTLS parameter computation</title>
46607 <para>
46608 GnuTLS uses D-H parameters that may take a substantial amount of time
46609 to compute. It is unreasonable to re-compute them for every TLS session.
46610 Therefore, Exim keeps this data in a file in its spool directory, called
46611 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46612 its owner. Every Exim process that start up GnuTLS reads the D-H
46613 parameters from this file. If the file does not exist, the first Exim process
46614 that needs it computes the data and writes it to a temporary file which is
46615 renamed once it is complete. It does not matter if several Exim processes do
46616 this simultaneously (apart from wasting a few resources). Once a file is in
46617 place, new Exim processes immediately start using it.
46618 </para>
46619 <para>
46620 For maximum security, the parameters that are stored in this file should be
46621 recalculated periodically, the frequency depending on your paranoia level.
46622 Arranging this is easy in principle; just delete the file when you want new
46623 values to be computed. However, there may be a problem. The calculation of new
46624 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46625 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46626 until enough randomness (entropy) is available. This may cause Exim to hang for
46627 a substantial amount of time, causing timeouts on incoming connections.
46628 </para>
46629 <para>
46630 The solution is to generate the parameters externally to Exim. They are stored
46631 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46632 externally using the <command>certtool</command> command that is part of GnuTLS.
46633 </para>
46634 <para>
46635 To replace the parameters with new ones, instead of deleting the file
46636 and letting Exim re-create it, you can generate new parameters using
46637 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
46638 renaming. The relevant commands are something like this:
46639 </para>
46640 <literallayout class="monospaced">
46641 # rm -f new-params
46642 # touch new-params
46643 # chown exim:exim new-params
46644 # chmod 0400 new-params
46645 # certtool --generate-privkey --bits 512 &gt;new-params
46646 # echo "" &gt;&gt;new-params
46647 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
46648 # mv new-params gnutls-params
46649 </literallayout>
46650 <para>
46651 If Exim never has to generate the parameters itself, the possibility of
46652 stalling is removed.
46653 </para>
46654 </section>
46655 <section id="SECTreqciphssl">
46656 <title>Requiring specific ciphers in OpenSSL</title>
46657 <para>
46658 <indexterm role="concept">
46659 <primary>TLS</primary>
46660 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46661 </indexterm>
46662 <indexterm role="option">
46663 <primary><option>tls_require_ciphers</option></primary>
46664 <secondary>OpenSSL</secondary>
46665 </indexterm>
46666 There is a function in the OpenSSL library that can be passed a list of cipher
46667 suites before the cipher negotiation takes place. This specifies which ciphers
46668 are acceptable. The list is colon separated and may contain names like
46669 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46670 directly to this function call. The following quotation from the OpenSSL
46671 documentation specifies what forms of item are allowed in the cipher string:
46672 </para>
46673 <itemizedlist>
46674 <listitem>
46675 <para>
46676 It can consist of a single cipher suite such as RC4-SHA.
46677 </para>
46678 </listitem>
46679 <listitem>
46680 <para>
46681 It can represent a list of cipher suites containing a certain algorithm,
46682 or cipher suites of a certain type. For example SHA1 represents all
46683 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46684 SSL v3 algorithms.
46685 </para>
46686 </listitem>
46687 <listitem>
46688 <para>
46689 Lists of cipher suites can be combined in a single cipher string using
46690 the + character. This is used as a logical and operation. For example
46691 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46692 algorithms.
46693 </para>
46694 </listitem>
46695 </itemizedlist>
46696 <para>
46697 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46698 <literal>-</literal> or <literal>+</literal>.
46699 </para>
46700 <itemizedlist>
46701 <listitem>
46702 <para>
46703 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46704 ciphers deleted can never reappear in the list even if they are explicitly
46705 stated.
46706 </para>
46707 </listitem>
46708 <listitem>
46709 <para>
46710 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46711 of the ciphers can be added again by later options.
46712 </para>
46713 </listitem>
46714 <listitem>
46715 <para>
46716 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46717 option does not add any new ciphers; it just moves matching existing ones.
46718 </para>
46719 </listitem>
46720 </itemizedlist>
46721 <para>
46722 If none of these characters is present, the string is interpreted as
46723 a list of ciphers to be appended to the current preference list. If the list
46724 includes any ciphers already present they will be ignored: that is, they will
46725 not be moved to the end of the list.
46726 </para>
46727 </section>
46728 <section id="SECTreqciphgnu">
46729 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46730 <para>
46731 <indexterm role="concept">
46732 <primary>GnuTLS</primary>
46733 <secondary>specifying parameters for</secondary>
46734 </indexterm>
46735 <indexterm role="concept">
46736 <primary>TLS</primary>
46737 <secondary>specifying ciphers (GnuTLS)</secondary>
46738 </indexterm>
46739 <indexterm role="concept">
46740 <primary>TLS</primary>
46741 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46742 </indexterm>
46743 <indexterm role="concept">
46744 <primary>TLS</primary>
46745 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46746 </indexterm>
46747 <indexterm role="concept">
46748 <primary>TLS</primary>
46749 <secondary>specifying protocols (GnuTLS)</secondary>
46750 </indexterm>
46751 <indexterm role="option">
46752 <primary><option>tls_require_ciphers</option></primary>
46753 <secondary>GnuTLS</secondary>
46754 </indexterm>
46755 The GnuTLS library allows the caller to specify separate lists of permitted key
46756 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
46757 Unfortunately, these lists are numerical, and the library does not have a
46758 function for turning names into numbers. Consequently, lists of recognized
46759 names have to be built into the application. The permitted key exchange
46760 methods, ciphers, and MAC algorithms may be used in any combination to form a
46761 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
46762 passed to its control function.
46763 </para>
46764 <para>
46765 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
46766 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
46767 option controls only the cipher algorithms. Exim searches each item in the
46768 list for the name of an available algorithm. For example, if the list
46769 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
46770 the same as if just AES were given.
46771 </para>
46772 <para>
46773 <indexterm role="option">
46774 <primary><option>gnutls_require_kx</option></primary>
46775 </indexterm>
46776 <indexterm role="option">
46777 <primary><option>gnutls_require_mac</option></primary>
46778 </indexterm>
46779 <indexterm role="option">
46780 <primary><option>gnutls_require_protocols</option></primary>
46781 </indexterm>
46782 There are additional options called <option>gnutls_require_kx</option>,
46783 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
46784 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
46785 These options are ignored if OpenSSL is in use.
46786 </para>
46787 <para>
46788 All four options are available as global options, controlling how Exim
46789 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
46790 how Exim behaves as a client. All the values are string expanded. After
46791 expansion, the values must be colon-separated lists, though the separator
46792 can be changed in the usual way.
46793 </para>
46794 <para>
46795 Each of the four lists starts out with a default set of algorithms. If the
46796 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
46797 default items are deleted. In this case, only those that are explicitly
46798 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
46799 exclamation mark, the defaults are left on the list.
46800 </para>
46801 <para>
46802 Then, any item that starts with an exclamation mark causes the relevant
46803 entry to be removed from the list, and any item that does not start with an
46804 exclamation mark causes a new entry to be added to the list. Unrecognized
46805 items in the list are ignored. Thus:
46806 </para>
46807 <literallayout class="monospaced">
46808 tls_require_ciphers = !ARCFOUR
46809 </literallayout>
46810 <para>
46811 allows all the defaults except ARCFOUR, whereas
46812 </para>
46813 <literallayout class="monospaced">
46814 tls_require_ciphers = AES : 3DES
46815 </literallayout>
46816 <para>
46817 allows only cipher suites that use AES or 3DES.
46818 </para>
46819 <para>
46820 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
46821 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
46822 the preceding). The default list does not contain all of these; it just has
46823 AES_256, AES_128, 3DES, and ARCFOUR_128.
46824 </para>
46825 <para>
46826 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
46827 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
46828 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
46829 </para>
46830 <para>
46831 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
46832 MD5. The default list contains SHA, MD5.
46833 </para>
46834 <para>
46835 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
46836 The default list contains TLS1, SSL3.
46837 </para>
46838 <para>
46839 In a server, the order of items in these lists is unimportant. The server
46840 advertises the availability of all the relevant cipher suites. However, in a
46841 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
46842 order for the cipher algorithms. The first one in the client&#x2019;s list that is
46843 also advertised by the server is tried first. The default order is as listed
46844 above.
46845 </para>
46846 </section>
46847 <section id="SECID182">
46848 <title>Configuring an Exim server to use TLS</title>
46849 <para>
46850 <indexterm role="concept">
46851 <primary>TLS</primary>
46852 <secondary>configuring an Exim server</secondary>
46853 </indexterm>
46854 When Exim has been built with TLS support, it advertises the availability of
46855 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
46856 but not to any others. The default value of this option is unset, which means
46857 that STARTTLS is not advertised at all. This default is chosen because you
46858 need to set some other options in order to make TLS available, and also it is
46859 sensible for systems that want to use TLS only as a client.
46860 </para>
46861 <para>
46862 If a client issues a STARTTLS command and there is some configuration
46863 problem in the server, the command is rejected with a 454 error. If the client
46864 persists in trying to issue SMTP commands, all except QUIT are rejected
46865 with the error
46866 </para>
46867 <literallayout class="monospaced">
46868 554 Security failure
46869 </literallayout>
46870 <para>
46871 If a STARTTLS command is issued within an existing TLS session, it is
46872 rejected with a 554 error code.
46873 </para>
46874 <para>
46875 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
46876 match some hosts. You can, of course, set it to * to match all hosts.
46877 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
46878 without some further configuration at the server end.
46879 </para>
46880 <para>
46881 It is rumoured that all existing clients that support TLS/SSL use RSA
46882 encryption. To make this work you need to set, in the server,
46883 </para>
46884 <literallayout class="monospaced">
46885 tls_certificate = /some/file/name
46886 tls_privatekey = /some/file/name
46887 </literallayout>
46888 <para>
46889 These options are, in fact, expanded strings, so you can make them depend on
46890 the identity of the client that is connected if you wish. The first file
46891 contains the server&#x2019;s X509 certificate, and the second contains the private key
46892 that goes with it. These files need to be readable by the Exim user, and must
46893 always be given as full path names. They can be the same file if both the
46894 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
46895 set, or if its expansion is forced to fail or results in an empty string, this
46896 is assumed to be the case. The certificate file may also contain intermediate
46897 certificates that need to be sent to the client to enable it to authenticate
46898 the server&#x2019;s certificate.
46899 </para>
46900 <para>
46901 If you do not understand about certificates and keys, please try to find a
46902 source of this background information, which is not Exim-specific. (There are a
46903 few comments below in section <xref linkend="SECTcerandall"/>.)
46904 </para>
46905 <para>
46906 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
46907 they apply only in the case of a server. If you need to use a certificate in an
46908 Exim client, you must set the options of the same names in an <command>smtp</command>
46909 transport.
46910 </para>
46911 <para>
46912 With just these options, an Exim server will be able to use TLS. It does not
46913 require the client to have a certificate (but see below for how to insist on
46914 this). There is one other option that may be needed in other situations. If
46915 </para>
46916 <literallayout class="monospaced">
46917 tls_dhparam = /some/file/name
46918 </literallayout>
46919 <para>
46920 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
46921 with the parameters contained in the file. This increases the set of cipher
46922 suites that the server supports. See the command
46923 </para>
46924 <literallayout class="monospaced">
46925 openssl dhparam
46926 </literallayout>
46927 <para>
46928 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
46929 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
46930 </para>
46931 <para>
46932 The strings supplied for these three options are expanded every time a client
46933 host connects. It is therefore possible to use different certificates and keys
46934 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
46935 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
46936 forced to fail, Exim behaves as if the option is not set.
46937 </para>
46938 <para>
46939 <indexterm role="concept">
46940 <primary>cipher</primary>
46941 <secondary>logging</secondary>
46942 </indexterm>
46943 <indexterm role="concept">
46944 <primary>log</primary>
46945 <secondary>TLS cipher</secondary>
46946 </indexterm>
46947 <indexterm role="variable">
46948 <primary><varname>$tls_cipher</varname></primary>
46949 </indexterm>
46950 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
46951 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
46952 incoming message (by default &ndash; you can, of course, change this), and it is
46953 also included in the log line that records a message&#x2019;s arrival, keyed by
46954 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
46955 condition can be used to test for specific cipher suites in ACLs.
46956 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
46957 <xref linkend="SECID185"/>.)
46958 </para>
46959 <para>
46960 Once TLS has been established, the ACLs that run for subsequent SMTP commands
46961 can check the name of the cipher suite and vary their actions accordingly. The
46962 cipher suite names vary, depending on which TLS library is being used. For
46963 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
46964 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
46965 documentation for more details.
46966 </para>
46967 </section>
46968 <section id="SECID183">
46969 <title>Requesting and verifying client certificates</title>
46970 <para>
46971 <indexterm role="concept">
46972 <primary>certificate</primary>
46973 <secondary>verification of client</secondary>
46974 </indexterm>
46975 <indexterm role="concept">
46976 <primary>TLS</primary>
46977 <secondary>client certificate verification</secondary>
46978 </indexterm>
46979 If you want an Exim server to request a certificate when negotiating a TLS
46980 session with a client, you must set either <option>tls_verify_hosts</option> or
46981 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
46982 apply to all TLS connections. For any host that matches one of these options,
46983 Exim requests a certificate as part of the setup of the TLS session. The
46984 contents of the certificate are verified by comparing it with a list of
46985 expected certificates. These must be available in a file or,
46986 for OpenSSL only (not GnuTLS), a directory, identified by
46987 <option>tls_verify_certificates</option>.
46988 </para>
46989 <para>
46990 A file can contain multiple certificates, concatenated end to end. If a
46991 directory is used
46992 (OpenSSL only),
46993 each certificate must be in a separate file, with a name (or a symbolic link)
46994 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
46995 certificate. You can compute the relevant hash by running the command
46996 </para>
46997 <literallayout class="monospaced">
46998 openssl x509 -hash -noout -in /cert/file
46999 </literallayout>
47000 <para>
47001 where <filename>/cert/file</filename> contains a single certificate.
47002 </para>
47003 <para>
47004 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47005 what happens if the client does not supply a certificate, or if the certificate
47006 does not match any of the certificates in the collection named by
47007 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47008 attempt to set up a TLS session is aborted, and the incoming connection is
47009 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47010 session continues. ACLs that run for subsequent SMTP commands can detect the
47011 fact that no certificate was verified, and vary their actions accordingly. For
47012 example, you can insist on a certificate before accepting a message for
47013 relaying, but not when the message is destined for local delivery.
47014 </para>
47015 <para>
47016 <indexterm role="variable">
47017 <primary><varname>$tls_peerdn</varname></primary>
47018 </indexterm>
47019 When a client supplies a certificate (whether it verifies or not), the value of
47020 the Distinguished Name of the certificate is made available in the variable
47021 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47022 </para>
47023 <para>
47024 <indexterm role="concept">
47025 <primary>log</primary>
47026 <secondary>distinguished name</secondary>
47027 </indexterm>
47028 Because it is often a long text string, it is not included in the log line or
47029 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47030 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47031 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47032 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47033 </para>
47034 </section>
47035 <section id="SECID184">
47036 <title>Revoked certificates</title>
47037 <para>
47038 <indexterm role="concept">
47039 <primary>TLS</primary>
47040 <secondary>revoked certificates</secondary>
47041 </indexterm>
47042 <indexterm role="concept">
47043 <primary>revocation list</primary>
47044 </indexterm>
47045 <indexterm role="concept">
47046 <primary>certificate</primary>
47047 <secondary>revocation list</secondary>
47048 </indexterm>
47049 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47050 certificates are revoked. If you have such a list, you can pass it to an Exim
47051 server using the global option called <option>tls_crl</option> and to an Exim client using
47052 an identically named option for the <command>smtp</command> transport. In each case, the value
47053 of the option is expanded and must then be the name of a file that contains a
47054 CRL in PEM format.
47055 </para>
47056 </section>
47057 <section id="SECID185">
47058 <title>Configuring an Exim client to use TLS</title>
47059 <para>
47060 <indexterm role="concept">
47061 <primary>cipher</primary>
47062 <secondary>logging</secondary>
47063 </indexterm>
47064 <indexterm role="concept">
47065 <primary>log</primary>
47066 <secondary>TLS cipher</secondary>
47067 </indexterm>
47068 <indexterm role="concept">
47069 <primary>log</primary>
47070 <secondary>distinguished name</secondary>
47071 </indexterm>
47072 <indexterm role="concept">
47073 <primary>TLS</primary>
47074 <secondary>configuring an Exim client</secondary>
47075 </indexterm>
47076 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47077 deliveries as well as to incoming, the latter one causing logging of the
47078 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
47079 within the <command>smtp</command> transport.
47080 </para>
47081 <para>
47082 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47083 transport. If Exim is built with TLS support, and TLS is advertised by a
47084 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47085 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47086 transport) to a list of server hosts for which TLS should not be used.
47087 </para>
47088 <para>
47089 If you do not want Exim to attempt to send messages unencrypted when an attempt
47090 to set up an encrypted connection fails in any way, you can set
47091 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47092 those hosts, delivery is always deferred if an encrypted connection cannot be
47093 set up. If there are any other hosts for the address, they are tried in the
47094 usual way.
47095 </para>
47096 <para>
47097 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47098 the message unencrypted. It always does this if the response to STARTTLS is
47099 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47100 session after a success response code, what happens is controlled by the
47101 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47102 delivery to this host is deferred, and other hosts (if available) are tried. If
47103 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47104 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47105 negotiation fails, Exim closes the current connection (because it is in an
47106 unknown state), opens a new one to the same host, and then tries the delivery
47107 unencrypted.
47108 </para>
47109 <para>
47110 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47111 transport provide the client with a certificate, which is passed to the server
47112 if it requests it. If the server is Exim, it will request a certificate only if
47113 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47114 </para>
47115 <para>
47116 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47117 must name a file or,
47118 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47119 expected server certificates. The client verifies the server&#x2019;s certificate
47120 against this collection, taking into account any revoked certificates that are
47121 in the list defined by <option>tls_crl</option>.
47122 </para>
47123 <para>
47124 If
47125 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47126 list of permitted cipher suites. If either of these checks fails, delivery to
47127 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47128 alternative hosts, if any.
47129 </para>
47130 <para revisionflag="changed">
47131  <emphasis role="bold">Note</emphasis>:
47132 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47133 is operating as a client. Exim does not assume that a server certificate (set
47134 by the global options of the same name) should also be used when operating as a
47135 client.
47136 </para>
47137 <para>
47138 <indexterm role="variable">
47139 <primary><varname>$host</varname></primary>
47140 </indexterm>
47141 <indexterm role="variable">
47142 <primary><varname>$host_address</varname></primary>
47143 </indexterm>
47144 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47145 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47146 which the client is connected. Forced failure of an expansion causes Exim to
47147 behave as if the relevant option were unset.
47148 </para>
47149 <para>
47150 <indexterm role="variable">
47151 <primary><varname>$tls_cipher</varname></primary>
47152 </indexterm>
47153 <indexterm role="variable">
47154 <primary><varname>$tls_peerdn</varname></primary>
47155 </indexterm>
47156 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47157 variables are emptied. (Until the first connection, they contain the values
47158 that were set when the message was received.) If STARTTLS is subsequently
47159 successfully obeyed, these variables are set to the relevant values for the
47160 outgoing connection.
47161 </para>
47162 </section>
47163 <section id="SECTmulmessam">
47164 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47165 <para>
47166 <indexterm role="concept">
47167 <primary>multiple SMTP deliveries with TLS</primary>
47168 </indexterm>
47169 <indexterm role="concept">
47170 <primary>TLS</primary>
47171 <secondary>multiple message deliveries</secondary>
47172 </indexterm>
47173 Exim sends multiple messages down the same TCP/IP connection by starting up
47174 an entirely new delivery process for each message, passing the socket from
47175 one process to the next. This implementation does not fit well with the use
47176 of TLS, because there is quite a lot of state information associated with a TLS
47177 connection, not just a socket identification. Passing all the state information
47178 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47179 session before passing the socket to a new process. The new process may then
47180 try to start a new TLS session, and if successful, may try to re-authenticate
47181 if AUTH is in use, before sending the next message.
47182 </para>
47183 <para>
47184 The RFC is not clear as to whether or not an SMTP session continues in clear
47185 after TLS has been shut down, or whether TLS may be restarted again later, as
47186 just described. However, if the server is Exim, this shutdown and
47187 reinitialization works. It is not known which (if any) other servers operate
47188 successfully if the client closes a TLS session and continues with unencrypted
47189 SMTP, but there are certainly some that do not work. For such servers, Exim
47190 should not pass the socket to another process, because the failure of the
47191 subsequent attempt to use it would cause Exim to record a temporary host error,
47192 and delay other deliveries to that host.
47193 </para>
47194 <para>
47195 To test for this case, Exim sends an EHLO command to the server after
47196 closing down the TLS session. If this fails in any way, the connection is
47197 closed instead of being passed to a new delivery process, but no retry
47198 information is recorded.
47199 </para>
47200 <para>
47201 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47202 <command>smtp</command> transport to match those hosts for which Exim should not pass
47203 connections to new processes if TLS has been used.
47204 </para>
47205 </section>
47206 <section id="SECTcerandall">
47207 <title>Certificates and all that</title>
47208 <para>
47209 <indexterm role="concept">
47210 <primary>certificate</primary>
47211 <secondary>references to discussion</secondary>
47212 </indexterm>
47213 In order to understand fully how TLS works, you need to know about
47214 certificates, certificate signing, and certificate authorities. This is not the
47215 place to give a tutorial, especially as I do not know very much about it
47216 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47217 to Apache, currently at
47218 </para>
47219 <literallayout>
47220 <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>
47221 </literallayout>
47222 <para>
47223 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47224 links to further files.
47225 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47226 0-201-61598-3), contains both introductory and more in-depth descriptions.
47227 Some sample programs taken from the book are available from
47228 </para>
47229 <literallayout>
47230 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47231 </literallayout>
47232 </section>
47233 <section id="SECID186">
47234 <title>Certificate chains</title>
47235 <para>
47236 The file named by <option>tls_certificate</option> may contain more than one
47237 certificate. This is useful in the case where the certificate that is being
47238 sent is validated by an intermediate certificate which the other end does
47239 not have. Multiple certificates must be in the correct order in the file.
47240 First the host&#x2019;s certificate itself, then the first intermediate
47241 certificate to validate the issuer of the host certificate, then the next
47242 intermediate certificate to validate the issuer of the first intermediate
47243 certificate, and so on, until finally (optionally) the root certificate.
47244 The root certificate must already be trusted by the recipient for
47245 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
47246 root certificate along with the rest makes it available for the user to
47247 install if the receiving end is a client MUA that can interact with a user.
47248 </para>
47249 </section>
47250 <section id="SECID187">
47251 <title>Self-signed certificates</title>
47252 <para>
47253 <indexterm role="concept">
47254 <primary>certificate</primary>
47255 <secondary>self-signed</secondary>
47256 </indexterm>
47257 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47258 with OpenSSL, like this:
47259 </para>
47260 <literallayout class="monospaced">
47261 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47262             -days 9999 -nodes
47263 </literallayout>
47264 <para>
47265 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47266 delimited and so can be identified independently. The <option>-days</option> option
47267 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47268 important: if you do not set it, the key is encrypted with a passphrase
47269 that you are prompted for, and any use that is made of the key causes more
47270 prompting for the passphrase. This is not helpful if you are going to use
47271 this certificate and key in an MTA, where prompting is not possible.
47272 </para>
47273 <para>
47274 A self-signed certificate made in this way is sufficient for testing, and
47275 may be adequate for all your requirements if you are mainly interested in
47276 encrypting transfers, and not in secure identification.
47277 </para>
47278 <para>
47279 However, many clients require that the certificate presented by the server be a
47280 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47281 certificate. In this situation, the self-signed certificate described above
47282 must be installed on the client host as a trusted root <emphasis>certification
47283 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47284 signed with that self-signed certificate.
47285 </para>
47286 <para>
47287 For information on creating self-signed CA certificates and using them to sign
47288 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47289 Open-source PKI book, available online at
47290 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47291 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47292 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47293 </para>
47294 </section>
47295 </chapter>
47296
47297 <chapter id="CHAPACL">
47298 <title>Access control lists</title>
47299 <para>
47300 <indexterm role="concept" id="IIDacl" class="startofrange">
47301 <primary>access control lists (ACLs)</primary>
47302 <secondary>description</secondary>
47303 </indexterm>
47304 <indexterm role="concept">
47305 <primary>control of incoming mail</primary>
47306 </indexterm>
47307 <indexterm role="concept">
47308 <primary>message</primary>
47309 <secondary>controlling incoming</secondary>
47310 </indexterm>
47311 <indexterm role="concept">
47312 <primary>policy control</primary>
47313 <secondary>access control lists</secondary>
47314 </indexterm>
47315 Access Control Lists (ACLs) are defined in a separate section of the run time
47316 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47317 name, terminated by a colon. Here is a complete ACL section that contains just
47318 one very small ACL:
47319 </para>
47320 <literallayout class="monospaced">
47321 begin acl
47322 small_acl:
47323   accept   hosts = one.host.only
47324 </literallayout>
47325 <para>
47326 You can have as many lists as you like in the ACL section, and the order in
47327 which they appear does not matter. The lists are self-terminating.
47328 </para>
47329 <para>
47330 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
47331 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47332 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47333 option. The most common use is for controlling which recipients are accepted
47334 in incoming messages. In addition, you can define an ACL that is used to check
47335 local non-SMTP messages. The default configuration file contains an example of
47336 a realistic ACL for checking RCPT commands. This is discussed in chapter
47337 <xref linkend="CHAPdefconfil"/>.
47338 </para>
47339 <section id="SECID188">
47340 <title>Testing ACLs</title>
47341 <para>
47342 The <option>-bh</option> command line option provides a way of testing your ACL
47343 configuration locally by running a fake SMTP session with which you interact.
47344 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47345 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47346 </para>
47347 </section>
47348 <section id="SECID189">
47349 <title>Specifying when ACLs are used</title>
47350 <para>
47351 <indexterm role="concept">
47352 <primary>access control lists (ACLs)</primary>
47353 <secondary>options for specifying</secondary>
47354 </indexterm>
47355 In order to cause an ACL to be used, you have to name it in one of the relevant
47356 options in the main part of the configuration. These options are:
47357 <indexterm role="concept">
47358 <primary>AUTH</primary>
47359 <secondary>ACL for</secondary>
47360 </indexterm>
47361 <indexterm role="concept">
47362 <primary>DATA</primary>
47363 <secondary>ACLs for</secondary>
47364 </indexterm>
47365 <indexterm role="concept">
47366 <primary>ETRN</primary>
47367 <secondary>ACL for</secondary>
47368 </indexterm>
47369 <indexterm role="concept">
47370 <primary>EXPN</primary>
47371 <secondary>ACL for</secondary>
47372 </indexterm>
47373 <indexterm role="concept">
47374 <primary>HELO</primary>
47375 <secondary>ACL for</secondary>
47376 </indexterm>
47377 <indexterm role="concept">
47378 <primary>EHLO</primary>
47379 <secondary>ACL for</secondary>
47380 </indexterm>
47381 <indexterm role="concept">
47382 <primary>MAIL</primary>
47383 <secondary>ACL for</secondary>
47384 </indexterm>
47385 <indexterm role="concept">
47386 <primary>QUIT, ACL for</primary>
47387 </indexterm>
47388 <indexterm role="concept">
47389 <primary>RCPT</primary>
47390 <secondary>ACL for</secondary>
47391 </indexterm>
47392 <indexterm role="concept">
47393 <primary>STARTTLS, ACL for</primary>
47394 </indexterm>
47395 <indexterm role="concept">
47396 <primary>VRFY</primary>
47397 <secondary>ACL for</secondary>
47398 </indexterm>
47399 <indexterm role="concept">
47400 <primary>SMTP</primary>
47401 <secondary>connection, ACL for</secondary>
47402 </indexterm>
47403 <indexterm role="concept">
47404 <primary>non-SMTP messages</primary>
47405 <secondary>ACLs for</secondary>
47406 </indexterm>
47407 <indexterm role="concept">
47408 <primary>MIME content scanning</primary>
47409 <secondary>ACL for</secondary>
47410 </indexterm>
47411 </para>
47412 <informaltable frame="none">
47413 <tgroup cols="2" colsep="0" rowsep="0">
47414 <colspec colwidth="140pt" align="left"/>
47415 <colspec colwidth="254pt" align="left"/>
47416 <tbody>
47417 <row>
47418 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
47419 <entry>ACL for non-SMTP messages</entry>
47420 </row>
47421 <row>
47422 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
47423 <entry>ACL for non-SMTP MIME parts</entry>
47424 </row>
47425 <row>
47426 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
47427 <entry>ACL at start of non-SMTP message</entry>
47428 </row>
47429 <row>
47430 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
47431 <entry>ACL for AUTH</entry>
47432 </row>
47433 <row>
47434 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
47435 <entry>ACL for start of SMTP connection</entry>
47436 </row>
47437 <row>
47438 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
47439 <entry>ACL after DATA is complete</entry>
47440 </row>
47441 <row>
47442 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
47443 <entry>ACL for ETRN</entry>
47444 </row>
47445 <row>
47446 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
47447 <entry>ACL for EXPN</entry>
47448 </row>
47449 <row>
47450 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
47451 <entry>ACL for HELO or EHLO</entry>
47452 </row>
47453 <row>
47454 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
47455 <entry>ACL for MAIL</entry>
47456 </row>
47457 <row>
47458 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
47459 <entry>ACL for the AUTH parameter of MAIL</entry>
47460 </row>
47461 <row>
47462 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
47463 <entry>ACL for content-scanning MIME parts</entry>
47464 </row>
47465 <row>
47466 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
47467 <entry>ACL for non-QUIT terminations</entry>
47468 </row>
47469 <row>
47470 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
47471 <entry>ACL at start of DATA command</entry>
47472 </row>
47473 <row>
47474 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
47475 <entry>ACL for QUIT</entry>
47476 </row>
47477 <row>
47478 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
47479 <entry>ACL for RCPT</entry>
47480 </row>
47481 <row>
47482 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
47483 <entry>ACL for STARTTLS</entry>
47484 </row>
47485 <row>
47486 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
47487 <entry>ACL for VRFY</entry>
47488 </row>
47489 </tbody>
47490 </tgroup>
47491 </informaltable>
47492 <para>
47493 For example, if you set
47494 </para>
47495 <literallayout class="monospaced">
47496 acl_smtp_rcpt = small_acl
47497 </literallayout>
47498 <para>
47499 the little ACL defined above is used whenever Exim receives a RCPT command
47500 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47501 done when RCPT commands arrive. A rejection of RCPT should cause the
47502 sending MTA to give up on the recipient address contained in the RCPT
47503 command, whereas rejection at other times may cause the client MTA to keep on
47504 trying to deliver the message. It is therefore recommended that you do as much
47505 testing as possible at RCPT time.
47506 </para>
47507 </section>
47508 <section id="SECID190">
47509 <title>The non-SMTP ACLs</title>
47510 <para>
47511 <indexterm role="concept">
47512 <primary>non-SMTP messages</primary>
47513 <secondary>ACLs for</secondary>
47514 </indexterm>
47515 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47516 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47517 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47518 the state of the SMTP connection such as encryption and authentication) are not
47519 relevant and are forbidden in these ACLs. However, the sender and recipients
47520 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47521 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47522 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47523 in any of these ACLs.
47524 </para>
47525 <para>
47526 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47527 non-SMTP message, before any of the message has been read. (This is the
47528 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47529 batched SMTP input, it runs after the DATA command has been reached. The
47530 result of this ACL is ignored; it cannot be used to reject a message. If you
47531 really need to, you could set a value in an ACL variable here and reject based
47532 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47533 controls, and in particular, it can be used to set
47534 </para>
47535 <literallayout class="monospaced">
47536 control = suppress_local_fixups
47537 </literallayout>
47538 <para>
47539 This cannot be used in the other non-SMTP ACLs because by the time they are
47540 run, it is too late.
47541 </para>
47542 <para>
47543 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47544 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47545 </para>
47546 <para>
47547 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47548 kind of rejection is treated as permanent, because there is no way of sending a
47549 temporary error for these kinds of message.
47550 </para>
47551 </section>
47552 <section id="SECID191">
47553 <title>The SMTP connect ACL</title>
47554 <para>
47555 <indexterm role="concept">
47556 <primary>SMTP</primary>
47557 <secondary>connection, ACL for</secondary>
47558 </indexterm>
47559 <indexterm role="option">
47560 <primary><option>smtp_banner</option></primary>
47561 </indexterm>
47562 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47563 session, after the test specified by <option>host_reject_connection</option> (which is now
47564 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47565 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47566 the message override the banner message that is otherwise specified by the
47567 <option>smtp_banner</option> option.
47568 </para>
47569 </section>
47570 <section id="SECID192">
47571 <title>The EHLO/HELO ACL</title>
47572 <para>
47573 <indexterm role="concept">
47574 <primary>EHLO</primary>
47575 <secondary>ACL for</secondary>
47576 </indexterm>
47577 <indexterm role="concept">
47578 <primary>HELO</primary>
47579 <secondary>ACL for</secondary>
47580 </indexterm>
47581 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47582 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47583 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47584 Note that a client may issue more than one EHLO or HELO command in an SMTP
47585 session, and indeed is required to issue a new EHLO or HELO after successfully
47586 setting up encryption following a STARTTLS command.
47587 </para>
47588 <para>
47589 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47590 modifier, the message may not contain more than one line (it will be truncated
47591 at the first newline and a panic logged if it does). Such a message cannot
47592 affect the EHLO options that are listed on the second and subsequent lines of
47593 an EHLO response.
47594 </para>
47595 </section>
47596 <section id="SECID193">
47597 <title>The DATA ACLs</title>
47598 <para>
47599 <indexterm role="concept">
47600 <primary>DATA</primary>
47601 <secondary>ACLs for</secondary>
47602 </indexterm>
47603 Two ACLs are associated with the DATA command, because it is two-stage
47604 command, with two responses being sent to the client.
47605 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47606 is obeyed. This gives you control after all the RCPT commands, but before
47607 the message itself is received. It offers the opportunity to give a negative
47608 response to the DATA command before the data is transmitted. Header lines
47609 added by MAIL or RCPT ACLs are not visible at this time, but any that
47610 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47611 </para>
47612 <para>
47613 You cannot test the contents of the message, for example, to verify addresses
47614 in the headers, at RCPT time or when the DATA command is received. Such
47615 tests have to appear in the ACL that is run after the message itself has been
47616 received, before the final response to the DATA command is sent. This is
47617 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47618 associated with the DATA command.
47619 </para>
47620 <para>
47621 For both of these ACLs, it is not possible to reject individual recipients. An
47622 error response rejects the entire message. Unfortunately, it is known that some
47623 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47624 before or after the data) correctly &ndash; they keep the message on their queues
47625 and try again later, but that is their problem, though it does waste some of
47626 your resources.
47627 </para>
47628 </section>
47629 <section id="SECID194">
47630 <title>The SMTP MIME ACL</title>
47631 <para>
47632 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47633 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47634 </para>
47635 </section>
47636 <section id="SECTQUITACL">
47637 <title>The QUIT ACL</title>
47638 <para>
47639 <indexterm role="concept">
47640 <primary>QUIT, ACL for</primary>
47641 </indexterm>
47642 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47643 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47644 does not in fact control any access. For this reason, the only verbs that are
47645 permitted are <option>accept</option> and <option>warn</option>.
47646 </para>
47647 <para>
47648 This ACL can be used for tasks such as custom logging at the end of an SMTP
47649 session. For example, you can use ACL variables in other ACLs to count
47650 messages, recipients, etc., and log the totals at QUIT time using one or
47651 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47652 </para>
47653 <para>
47654 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47655 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47656 </para>
47657 <para>
47658 You do not need to have a final <option>accept</option>, but if you do, you can use a
47659 <option>message</option> modifier to specify custom text that is sent as part of the 221
47660 response to QUIT.
47661 </para>
47662 <para>
47663 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47664 failure (for example, failure to open a log file, or when Exim is bombing out
47665 because it has detected an unrecoverable error), all SMTP commands from the
47666 client are given temporary error responses until QUIT is received or the
47667 connection is closed. In these special cases, the QUIT ACL does not run.
47668 </para>
47669 </section>
47670 <section id="SECTNOTQUITACL" revisionflag="changed">
47671 <title>The not-QUIT ACL</title>
47672 <para revisionflag="changed">
47673 <indexterm role="variable">
47674 <primary><varname>$acl_smtp_notquit</varname></primary>
47675 </indexterm>
47676 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
47677 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
47678 trouble, such as being unable to write to its log files, this ACL is not run,
47679 because it might try to do things (such as write to log files) that make the
47680 situation even worse.
47681 </para>
47682 <para>
47683 Like the QUIT ACL, this ACL is provided to make it possible to do customized
47684 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
47685 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
47686 and <option>warn</option>.
47687 </para>
47688 <para>
47689 <indexterm role="variable">
47690 <primary><varname>$smtp_notquit_reason</varname></primary>
47691 </indexterm>
47692 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
47693 to a string that indicates the reason for the termination of the SMTP
47694 connection. The possible values are:
47695 </para>
47696 <informaltable frame="none">
47697 <tgroup cols="2" colsep="0" rowsep="0">
47698 <colspec colwidth="196pt" align="left"/>
47699 <colspec colwidth="254pt" align="left"/>
47700 <tbody>
47701 <row>
47702 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
47703 <entry>Another ACL issued a <option>drop</option> command</entry>
47704 </row>
47705 <row>
47706 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
47707 <entry>Too many unknown or non-mail commands</entry>
47708 </row>
47709 <row>
47710 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
47711 <entry>Timeout while reading SMTP commands</entry>
47712 </row>
47713 <row>
47714 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
47715 <entry>The SMTP connection has been lost</entry>
47716 </row>
47717 <row>
47718 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
47719 <entry>Timeout while reading message data</entry>
47720 </row>
47721 <row>
47722 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
47723 <entry>The <function>local_scan()</function> function crashed</entry>
47724 </row>
47725 <row>
47726 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
47727 <entry>The <function>local_scan()</function> function timed out</entry>
47728 </row>
47729 <row>
47730 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
47731 <entry>SIGTERM or SIGINT</entry>
47732 </row>
47733 <row>
47734 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
47735 <entry>SMTP synchronization error</entry>
47736 </row>
47737 <row>
47738 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
47739 <entry>TLS failed to start</entry>
47740 </row>
47741 </tbody>
47742 </tgroup>
47743 </informaltable>
47744 <para>
47745 In most cases when an SMTP connection is closed without having received QUIT,
47746 Exim sends an SMTP response message before actually closing the connection.
47747 With the exception of the <literal>acl-drop</literal> case, the default message can be
47748 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
47749 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
47750 used.
47751 </para>
47752 </section>
47753 <section id="SECID195">
47754 <title>Finding an ACL to use</title>
47755 <para>
47756 <indexterm role="concept">
47757 <primary>access control lists (ACLs)</primary>
47758 <secondary>finding which to use</secondary>
47759 </indexterm>
47760 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
47761 you can use different ACLs in different circumstances. For example,
47762 </para>
47763 <literallayout class="monospaced">
47764 acl_smtp_rcpt = ${if ={25}{$interface_port} \
47765                      {acl_check_rcpt} {acl_check_rcpt_submit} }
47766 </literallayout>
47767 <para>
47768 In the default configuration file there are some example settings for
47769 providing an RFC 4409 message submission service on port 587 and a
47770 non-standard <quote>smtps</quote> service on port 465. You can use a string
47771 expansion like this to choose an ACL for MUAs on these ports which is
47772 more appropriate for this purpose than the default ACL on port 25.
47773 </para>
47774 <para>
47775 The expanded string does not have to be the name of an ACL in the
47776 configuration file; there are other possibilities. Having expanded the
47777 string, Exim searches for an ACL as follows:
47778 </para>
47779 <itemizedlist>
47780 <listitem>
47781 <para>
47782 If the string begins with a slash, Exim uses it as a file name, and reads its
47783 contents as an ACL. The lines are processed in the same way as lines in the
47784 Exim configuration file. In particular, continuation lines are supported, blank
47785 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
47786 If the file does not exist or cannot be read, an error occurs (typically
47787 causing a temporary failure of whatever caused the ACL to be run). For example:
47788 </para>
47789 <literallayout class="monospaced">
47790 acl_smtp_data = /etc/acls/\
47791   ${lookup{$sender_host_address}lsearch\
47792   {/etc/acllist}{$value}{default}}
47793 </literallayout>
47794 <para>
47795 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
47796 back to a default if the lookup fails. If an ACL is successfully read from a
47797 file, it is retained in memory for the duration of the Exim process, so that it
47798 can be re-used without having to re-read the file.
47799 </para>
47800 </listitem>
47801 <listitem>
47802 <para>
47803 If the string does not start with a slash, and does not contain any spaces,
47804 Exim searches the ACL section of the configuration for an ACL whose name
47805 matches the string.
47806 </para>
47807 </listitem>
47808 <listitem>
47809 <para>
47810 If no named ACL is found, or if the string contains spaces, Exim parses
47811 the string as an inline ACL. This can save typing in cases where you just
47812 want to have something like
47813 </para>
47814 <literallayout class="monospaced">
47815 acl_smtp_vrfy = accept
47816 </literallayout>
47817 <para>
47818 in order to allow free use of the VRFY command. Such a string may contain
47819 newlines; it is processed in the same way as an ACL that is read from a file.
47820 </para>
47821 </listitem>
47822 </itemizedlist>
47823 </section>
47824 <section id="SECID196">
47825 <title>ACL return codes</title>
47826 <para>
47827 <indexterm role="concept">
47828 <primary>access control lists (ACLs)</primary>
47829 <secondary>return codes</secondary>
47830 </indexterm>
47831 Except for the QUIT ACL, which does not affect the SMTP return code (see
47832 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
47833 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
47834 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
47835 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
47836 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
47837 This also causes a 4<emphasis>xx</emphasis> return code.
47838 </para>
47839 <para>
47840 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
47841 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
47842 submitters of non-SMTP messages.
47843 </para>
47844 <para>
47845 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
47846 has the effect of <quote>accept</quote>, but causes either the entire message or an
47847 individual recipient address to be discarded. In other words, it is a
47848 blackholing facility. Use it with care.
47849 </para>
47850 <para>
47851 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
47852 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
47853 RCPT ACL is to discard just the one recipient address. If there are no
47854 recipients left when the message&#x2019;s data is received, the DATA ACL is not
47855 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
47856 remaining recipients. The <quote>discard</quote> return is not permitted for the
47857 <option>acl_smtp_predata</option> ACL.
47858 </para>
47859 <para>
47860 <indexterm role="concept">
47861 <primary><function>local_scan()</function> function</primary>
47862 <secondary>when all recipients discarded</secondary>
47863 </indexterm>
47864 The <function>local_scan()</function> function is always run, even if there are no remaining
47865 recipients; it may create new recipients.
47866 </para>
47867 </section>
47868 <section id="SECID197">
47869 <title>Unset ACL options</title>
47870 <para>
47871 <indexterm role="concept">
47872 <primary>access control lists (ACLs)</primary>
47873 <secondary>unset options</secondary>
47874 </indexterm>
47875 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
47876 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
47877 not defined at all. For any defined ACL, the default action when control
47878 reaches the end of the ACL statements is <quote>deny</quote>.
47879 </para>
47880 <para>
47881 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
47882 these two are ACLs that are used only for their side effects. They cannot be
47883 used to accept or reject anything.
47884 </para>
47885 <para>
47886 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
47887 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
47888 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
47889 when the ACL is not defined is <quote>accept</quote>.
47890 </para>
47891 <para>
47892 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
47893 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
47894 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
47895 messages over an SMTP connection. For an example, see the ACL in the default
47896 configuration file.
47897 </para>
47898 </section>
47899 <section id="SECID198">
47900 <title>Data for message ACLs</title>
47901 <para>
47902 <indexterm role="concept">
47903 <primary>access control lists (ACLs)</primary>
47904 <secondary>data for message ACL</secondary>
47905 </indexterm>
47906 <indexterm role="variable">
47907 <primary><varname>$domain</varname></primary>
47908 </indexterm>
47909 <indexterm role="variable">
47910 <primary><varname>$local_part</varname></primary>
47911 </indexterm>
47912 <indexterm role="variable">
47913 <primary><varname>$sender_address</varname></primary>
47914 </indexterm>
47915 <indexterm role="variable">
47916 <primary><varname>$sender_host_address</varname></primary>
47917 </indexterm>
47918 <indexterm role="variable">
47919 <primary><varname>$smtp_command</varname></primary>
47920 </indexterm>
47921 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
47922 that contain information about the host and the message&#x2019;s sender (for example,
47923 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
47924 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
47925 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
47926 is available in <varname>$smtp_command</varname>.
47927 </para>
47928 <para>
47929 When an ACL for the AUTH parameter of MAIL is running, the variables that
47930 contain information about the host are set, but <varname>$sender_address</varname> is not yet
47931 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
47932 how it is used.
47933 </para>
47934 <para>
47935 <indexterm role="variable">
47936 <primary><varname>$message_size</varname></primary>
47937 </indexterm>
47938 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
47939 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
47940 that parameter is not given. The value is updated to the true message size by
47941 the time the final DATA ACL is run (after the message data has been
47942 received).
47943 </para>
47944 <para>
47945 <indexterm role="variable">
47946 <primary><varname>$rcpt_count</varname></primary>
47947 </indexterm>
47948 <indexterm role="variable">
47949 <primary><varname>$recipients_count</varname></primary>
47950 </indexterm>
47951 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
47952 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
47953 accepted, so while an ACL for RCPT is being processed, it contains the number
47954 of previously accepted recipients. At DATA time (for both the DATA ACLs),
47955 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
47956 <varname>$recipients_count</varname> contains the total number of accepted recipients.
47957 </para>
47958 </section>
47959 <section id="SECTdatfornon">
47960 <title>Data for non-message ACLs</title>
47961 <para>
47962 <indexterm role="concept">
47963 <primary>access control lists (ACLs)</primary>
47964 <secondary>data for non-message ACL</secondary>
47965 </indexterm>
47966 <indexterm role="variable">
47967 <primary><varname>$smtp_command_argument</varname></primary>
47968 </indexterm>
47969 <indexterm role="variable">
47970 <primary><varname>$smtp_command</varname></primary>
47971 </indexterm>
47972 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
47973 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
47974 and the entire SMTP command is available in <varname>$smtp_command</varname>.
47975 These variables can be tested using a <option>condition</option> condition. For example,
47976 here is an ACL for use with AUTH, which insists that either the session is
47977 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
47978 does not permit authentication methods that use cleartext passwords on
47979 unencrypted connections.
47980 </para>
47981 <literallayout class="monospaced">
47982 acl_check_auth:
47983   accept encrypted = *
47984   accept condition = ${if eq{${uc:$smtp_command_argument}}\
47985                      {CRAM-MD5}}
47986   deny   message   = TLS encryption or CRAM-MD5 required
47987 </literallayout>
47988 <para>
47989 (Another way of applying this restriction is to arrange for the authenticators
47990 that use cleartext passwords not to be advertised when the connection is not
47991 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
47992 option to do this.)
47993 </para>
47994 </section>
47995 <section id="SECID199">
47996 <title>Format of an ACL</title>
47997 <para>
47998 <indexterm role="concept">
47999 <primary>access control lists (ACLs)</primary>
48000 <secondary>format of</secondary>
48001 </indexterm>
48002 <indexterm role="concept">
48003 <primary>access control lists (ACLs)</primary>
48004 <secondary>verbs, definition of</secondary>
48005 </indexterm>
48006 An individual ACL consists of a number of statements. Each statement starts
48007 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48008 Modifiers can change the way the verb operates, define error and log messages,
48009 set variables, insert delays, and vary the processing of accepted messages.
48010 </para>
48011 <para>
48012 If all the conditions are met, the verb is obeyed. The same condition may be
48013 used (with different arguments) more than once in the same statement. This
48014 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48015 example:
48016 </para>
48017 <literallayout class="monospaced">
48018 deny  dnslists = list1.example
48019 dnslists = list2.example
48020 </literallayout>
48021 <para>
48022 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48023 the conditions and modifiers when it reaches a condition that fails. What
48024 happens then depends on the verb (and in one case, on a special modifier). Not
48025 all the conditions make sense at every testing point. For example, you cannot
48026 test a sender address in the ACL that is run for a VRFY command.
48027 </para>
48028 </section>
48029 <section id="SECID200">
48030 <title>ACL verbs</title>
48031 <para>
48032 The ACL verbs are as follows:
48033 </para>
48034 <itemizedlist>
48035 <listitem>
48036 <para>
48037 <indexterm role="concept">
48038 <primary><option>accept</option> ACL verb</primary>
48039 </indexterm>
48040 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48041 of the conditions are not met, what happens depends on whether <option>endpass</option>
48042 appears among the conditions (for syntax see below). If the failing condition
48043 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48044 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48045 check a RCPT command:
48046 </para>
48047 <literallayout class="monospaced">
48048 accept domains = +local_domains
48049 endpass
48050 verify = recipient
48051 </literallayout>
48052 <para>
48053 If the recipient domain does not match the <option>domains</option> condition, control
48054 passes to the next statement. If it does match, the recipient is verified, and
48055 the command is accepted if verification succeeds. However, if verification
48056 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48057 <option>endpass</option>.
48058 </para>
48059 <para>
48060 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48061 use is not recommended nowadays. It is always possible to rewrite an ACL so
48062 that <option>endpass</option> is not needed, and it is no longer used in the default
48063 configuration.
48064 </para>
48065 <para>
48066 <indexterm role="concept">
48067 <primary><option>message</option> ACL modifier</primary>
48068 <secondary>with <option>accept</option></secondary>
48069 </indexterm>
48070 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48071 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48072 (when an <option>accept</option> verb either accepts or passes control to the next
48073 statement), <option>message</option> can be used to vary the message that is sent when an
48074 SMTP command is accepted. For example, in a RCPT ACL you could have:
48075 </para>
48076 <literallayout>
48077 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48078 <literal>        message = OK, I will allow you through today</literal>
48079 </literallayout>
48080 <para>
48081 You can specify an SMTP response code, optionally followed by an <quote>extended
48082 response code</quote> at the start of the message, but the first digit must be the
48083 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48084 </para>
48085 <para>
48086 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48087 an error message that is used when access is denied. This behaviour is retained
48088 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48089 of <option>endpass</option>.
48090 </para>
48091 </listitem>
48092 <listitem>
48093 <para>
48094 <indexterm role="concept">
48095 <primary><option>defer</option> ACL verb</primary>
48096 </indexterm>
48097 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48098 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48099 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48100 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48101 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48102 be used in any ACL, and even for a recipient it might be a simpler approach.
48103 </para>
48104 </listitem>
48105 <listitem>
48106 <para>
48107 <indexterm role="concept">
48108 <primary><option>deny</option> ACL verb</primary>
48109 </indexterm>
48110 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48111 the conditions are not met, control is passed to the next ACL statement. For
48112 example,
48113 </para>
48114 <literallayout class="monospaced">
48115 deny dnslists = blackholes.mail-abuse.org
48116 </literallayout>
48117 <para>
48118 rejects commands from hosts that are on a DNS black list.
48119 </para>
48120 </listitem>
48121 <listitem>
48122 <para>
48123 <indexterm role="concept">
48124 <primary><option>discard</option> ACL verb</primary>
48125 </indexterm>
48126 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48127 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48128 that are concerned with receiving messages. When all the conditions are true,
48129 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48130 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48131 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48132 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
48133 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48134 </para>
48135 <para>
48136 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48137 its contents are added to the line that is automatically written to the log.
48138 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48139 </para>
48140 </listitem>
48141 <listitem>
48142 <para>
48143 <indexterm role="concept">
48144 <primary><option>drop</option> ACL verb</primary>
48145 </indexterm>
48146 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48147 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48148 </para>
48149 <literallayout class="monospaced">
48150 drop   message   = I don't take more than 20 RCPTs
48151        condition = ${if &gt; {$rcpt_count}{20}}
48152 </literallayout>
48153 <para>
48154 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48155 The connection is always dropped after sending a 550 response.
48156 </para>
48157 </listitem>
48158 <listitem>
48159 <para>
48160 <indexterm role="concept">
48161 <primary><option>require</option> ACL verb</primary>
48162 </indexterm>
48163 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48164 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48165 example, when checking a RCPT command,
48166 </para>
48167 <literallayout class="monospaced">
48168 require message = Sender did not verify
48169         verify  = sender
48170 </literallayout>
48171 <para>
48172 passes control to subsequent statements only if the message&#x2019;s sender can be
48173 verified. Otherwise, it rejects the command. Note the positioning of the
48174 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48175 discussed in section <xref linkend="SECTcondmodproc"/>.
48176 </para>
48177 </listitem>
48178 <listitem>
48179 <para>
48180 <indexterm role="concept">
48181 <primary><option>warn</option> ACL verb</primary>
48182 </indexterm>
48183 <option>warn</option>: If all the conditions are true, a line specified by the
48184 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
48185 to the next ACL statement. If any condition is false, the log line is not
48186 written. If an identical log line is requested several times in the same
48187 message, only one copy is actually written to the log. If you want to force
48188 duplicates to be written, use the <option>logwrite</option> modifier instead.
48189 </para>
48190 <para>
48191 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48192 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48193 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48194 condition. There is more about adding header lines in section
48195 <xref linkend="SECTaddheadacl"/>.
48196 </para>
48197 <para>
48198 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48199 some sort of defer), the log line specified by <option>log_message</option> is not written.
48200 This does not include the case of a forced failure from a lookup, which
48201 is considered to be a successful completion. After a defer, no further
48202 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48203 is logged, and the ACL continues to be processed, from the next statement
48204 onwards.
48205 </para>
48206 <para>
48207 <indexterm role="variable">
48208 <primary><varname>$acl_verify_message</varname></primary>
48209 </indexterm>
48210 When one of the <option>warn</option> conditions is an address verification that fails, the
48211 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48212 want this logged, you must set it up explicitly. For example:
48213 </para>
48214 <literallayout class="monospaced">
48215 warn   !verify = sender
48216        log_message = sender verify failed: $acl_verify_message
48217 </literallayout>
48218 </listitem>
48219 </itemizedlist>
48220 <para>
48221 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48222 </para>
48223 <para>
48224 As you can see from the examples above, the conditions and modifiers are
48225 written one to a line, with the first one on the same line as the verb, and
48226 subsequent ones on following lines. If you have a very long condition, you can
48227 continue it onto several physical lines by the usual backslash continuation
48228 mechanism. It is conventional to align the conditions vertically.
48229 </para>
48230 </section>
48231 <section id="SECTaclvariables">
48232 <title>ACL variables</title>
48233 <para>
48234 <indexterm role="concept">
48235 <primary>access control lists (ACLs)</primary>
48236 <secondary>variables</secondary>
48237 </indexterm>
48238 There are some special variables that can be set during ACL processing. They
48239 can be used to pass information between different ACLs, different invocations
48240 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48241 transports, and filters that are used to deliver a message. The names of these
48242 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48243 an underscore, but the remainder of the name can be any sequence of
48244 alphanumeric characters and underscores that you choose. There is no limit on
48245 the number of ACL variables. The two sets act as follows:
48246 </para>
48247 <itemizedlist>
48248 <listitem>
48249 <para>
48250 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48251 throughout an SMTP connection. They are never reset. Thus, a value that is set
48252 while receiving one message is still available when receiving the next message
48253 on the same SMTP connection.
48254 </para>
48255 </listitem>
48256 <listitem>
48257 <para>
48258 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48259 while a message is being received. They are reset afterwards. They are also
48260 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48261 </para>
48262 </listitem>
48263 </itemizedlist>
48264 <para>
48265 When a message is accepted, the current values of all the ACL variables are
48266 preserved with the message and are subsequently made available at delivery
48267 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48268 </para>
48269 <literallayout class="monospaced">
48270 accept hosts = whatever
48271        set acl_m4 = some value
48272 accept authenticated = *
48273        set acl_c_auth = yes
48274 </literallayout>
48275 <para>
48276 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48277 be set. If you want to set a variable without taking any action, you can use a
48278 <option>warn</option> verb without any other modifiers or conditions.
48279 </para>
48280 <para>
48281 <indexterm role="option">
48282 <primary><option>strict_acl_vars</option></primary>
48283 </indexterm>
48284 What happens if a syntactically valid but undefined ACL variable is
48285 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48286 false (the default), an empty string is substituted; if it is true, an
48287 error is generated.
48288 </para>
48289 <para>
48290 Versions of Exim before 4.64 have a limited set of numbered variables, but
48291 their names are compatible, so there is no problem with upgrading.
48292 </para>
48293 </section>
48294 <section id="SECTcondmodproc">
48295 <title>Condition and modifier processing</title>
48296 <para>
48297 <indexterm role="concept">
48298 <primary>access control lists (ACLs)</primary>
48299 <secondary>conditions; processing</secondary>
48300 </indexterm>
48301 <indexterm role="concept">
48302 <primary>access control lists (ACLs)</primary>
48303 <secondary>modifiers; processing</secondary>
48304 </indexterm>
48305 An exclamation mark preceding a condition negates its result. For example:
48306 </para>
48307 <literallayout class="monospaced">
48308 deny   domains = *.dom.example
48309       !verify  = recipient
48310 </literallayout>
48311 <para>
48312 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48313 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48314 negation can be used on the right-hand side of a condition. For example, these
48315 two statements are equivalent:
48316 </para>
48317 <literallayout class="monospaced">
48318 deny  hosts = !192.168.3.4
48319 deny !hosts =  192.168.3.4
48320 </literallayout>
48321 <para>
48322 However, for many conditions (<option>verify</option> being a good example), only left-hand
48323 side negation of the whole condition is possible.
48324 </para>
48325 <para>
48326 The arguments of conditions and modifiers are expanded. A forced failure
48327 of an expansion causes a condition to be ignored, that is, it behaves as if the
48328 condition is true. Consider these two statements:
48329 </para>
48330 <literallayout class="monospaced">
48331 accept  senders = ${lookup{$host_name}lsearch\
48332                   {/some/file}{$value}fail}
48333 accept  senders = ${lookup{$host_name}lsearch\
48334                   {/some/file}{$value}{}}
48335 </literallayout>
48336 <para>
48337 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48338 the returned list is searched, but if the lookup fails the behaviour is
48339 different in the two cases. The <option>fail</option> in the first statement causes the
48340 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48341 therefore succeeds. The second statement, however, generates an empty list when
48342 the lookup fails. No sender can match an empty list, so the condition fails,
48343 and therefore the <option>accept</option> also fails.
48344 </para>
48345 <para>
48346 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48347 specify actions that are taken as the conditions for a statement are checked;
48348 others specify text for messages that are used when access is denied or a
48349 warning is generated. The <option>control</option> modifier affects the way an incoming
48350 message is handled.
48351 </para>
48352 <para>
48353 The positioning of the modifiers in an ACL statement important, because the
48354 processing of a verb ceases as soon as its outcome is known. Only those
48355 modifiers that have already been encountered will take effect. For example,
48356 consider this use of the <option>message</option> modifier:
48357 </para>
48358 <literallayout class="monospaced">
48359 require message = Can't verify sender
48360         verify  = sender
48361         message = Can't verify recipient
48362         verify  = recipient
48363         message = This message cannot be used
48364 </literallayout>
48365 <para>
48366 If sender verification fails, Exim knows that the result of the statement is
48367 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48368 so its text is used as the error message. If sender verification succeeds, but
48369 recipient verification fails, the second message is used. If recipient
48370 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48371 because there are no more conditions to cause failure.
48372 </para>
48373 <para>
48374 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48375 modifier that is used, because all the conditions must be true for rejection to
48376 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48377 the message can even be specified after all the conditions. For example:
48378 </para>
48379 <literallayout class="monospaced">
48380 deny   hosts = ...
48381       !senders = *@my.domain.example
48382        message = Invalid sender from client host
48383 </literallayout>
48384 <para>
48385 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48386 by which time Exim has set up the message.
48387 </para>
48388 </section>
48389 <section id="SECTACLmodi">
48390 <title>ACL modifiers</title>
48391 <para>
48392 <indexterm role="concept">
48393 <primary>access control lists (ACLs)</primary>
48394 <secondary>modifiers; list of</secondary>
48395 </indexterm>
48396 The ACL modifiers are as follows:
48397 </para>
48398 <variablelist>
48399 <varlistentry>
48400 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48401 <listitem>
48402 <para>
48403 This modifier specifies one or more header lines that are to be added to an
48404 incoming message, assuming, of course, that the message is ultimately
48405 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48406 </para>
48407 </listitem></varlistentry>
48408 <varlistentry>
48409 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48410 <listitem>
48411 <para>
48412 <indexterm role="concept">
48413 <primary><option>continue</option> ACL modifier</primary>
48414 </indexterm>
48415 <indexterm role="concept">
48416 <primary>database</primary>
48417 <secondary>updating in ACL</secondary>
48418 </indexterm>
48419 This modifier does nothing of itself, and processing of the ACL always
48420 continues with the next condition or modifier. The value of <option>continue</option> is in
48421 the side effects of expanding its argument. Typically this could be used to
48422 update a database. It is really just a syntactic tidiness, to avoid having to
48423 write rather ugly lines like this:
48424 </para>
48425 <literallayout>
48426 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
48427 </literallayout>
48428 <para>
48429 Instead, all you need is
48430 </para>
48431 <literallayout>
48432 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
48433 </literallayout>
48434 </listitem></varlistentry>
48435 <varlistentry>
48436 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48437 <listitem>
48438 <para>
48439 <indexterm role="concept">
48440 <primary><option>control</option> ACL modifier</primary>
48441 </indexterm>
48442 This modifier affects the subsequent processing of the SMTP connection or of an
48443 incoming message that is accepted. The effect of the first type of control
48444 lasts for the duration of the connection, whereas the effect of the second type
48445 lasts only until the current message has been received. The message-specific
48446 controls always apply to the whole message, not to individual recipients,
48447 even if the <option>control</option> modifier appears in a RCPT ACL.
48448 </para>
48449 <para>
48450 As there are now quite a few controls that can be applied, they are described
48451 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48452 in several different ways. For example:
48453 </para>
48454 <itemizedlist>
48455 <listitem>
48456 <para>
48457 It can be at the end of an <option>accept</option> statement:
48458 </para>
48459 <literallayout class="monospaced">
48460     accept  ...some conditions
48461             control = queue_only
48462 </literallayout>
48463 <para>
48464 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48465 other words, when the conditions are all true.
48466 </para>
48467 </listitem>
48468 <listitem>
48469 <para>
48470 It can be in the middle of an <option>accept</option> statement:
48471 </para>
48472 <literallayout class="monospaced">
48473     accept  ...some conditions...
48474             control = queue_only
48475             ...some more conditions...
48476 </literallayout>
48477 <para>
48478 If the first set of conditions are true, the control is applied, even if the
48479 statement does not accept because one of the second set of conditions is false.
48480 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48481 to be relevant.
48482 </para>
48483 </listitem>
48484 <listitem>
48485 <para>
48486 It can be used with <option>warn</option> to apply the control, leaving the
48487 decision about accepting or denying to a subsequent verb. For
48488 example:
48489 </para>
48490 <literallayout class="monospaced">
48491     warn    ...some conditions...
48492             control = freeze
48493     accept  ...
48494 </literallayout>
48495 <para>
48496 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48497 <option>logwrite</option>, so it does not add anything to the message and does not write a
48498 log entry.
48499 </para>
48500 </listitem>
48501 <listitem>
48502 <para>
48503 If you want to apply a control unconditionally, you can use it with a
48504 <option>require</option> verb. For example:
48505 </para>
48506 <literallayout class="monospaced">
48507     require  control = no_multiline_responses
48508 </literallayout>
48509 </listitem>
48510 </itemizedlist>
48511 </listitem></varlistentry>
48512 <varlistentry>
48513 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
48514 <listitem>
48515 <para>
48516 <indexterm role="concept">
48517 <primary><option>delay</option> ACL modifier</primary>
48518 </indexterm>
48519 <indexterm role="option">
48520 <primary><option>-bh</option></primary>
48521 </indexterm>
48522 This modifier may appear in any ACL. It causes Exim to wait for the time
48523 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48524 option, the delay is not actually imposed (an appropriate message is output
48525 instead). The time is given in the usual Exim notation, and the delay happens
48526 as soon as the modifier is processed. In an SMTP session, pending output is
48527 flushed before the delay is imposed.
48528 </para>
48529 <para>
48530 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48531 example:
48532 </para>
48533 <literallayout class="monospaced">
48534 deny    ...some conditions...
48535         delay = 30s
48536 </literallayout>
48537 <para>
48538 The delay happens if all the conditions are true, before the statement returns
48539 <quote>deny</quote>. Compare this with:
48540 </para>
48541 <literallayout class="monospaced">
48542 deny    delay = 30s
48543         ...some conditions...
48544 </literallayout>
48545 <para>
48546 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48547 can also be used with <option>warn</option> and together with <option>control</option>:
48548 </para>
48549 <literallayout class="monospaced">
48550 warn    ...some conditions...
48551         delay = 2m
48552         control = freeze
48553 accept  ...
48554 </literallayout>
48555 <para>
48556 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48557 responses to several commands are no longer buffered and sent in one packet (as
48558 they would normally be) because all output is flushed before imposing the
48559 delay. This optimization is disabled so that a number of small delays do not
48560 appear to the client as one large aggregated delay that might provoke an
48561 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48562 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48563 </para>
48564 </listitem></varlistentry>
48565 <varlistentry>
48566 <term><emphasis role="bold">endpass</emphasis></term>
48567 <listitem>
48568 <para>
48569 <indexterm role="concept">
48570 <primary><option>endpass</option> ACL modifier</primary>
48571 </indexterm>
48572 This modifier, which has no argument, is recognized only in <option>accept</option> and
48573 <option>discard</option> statements. It marks the boundary between the conditions whose
48574 failure causes control to pass to the next statement, and the conditions whose
48575 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48576 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48577 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48578 </para>
48579 </listitem></varlistentry>
48580 <varlistentry>
48581 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48582 <listitem>
48583 <para>
48584 <indexterm role="concept">
48585 <primary><option>log_message</option> ACL modifier</primary>
48586 </indexterm>
48587 This modifier sets up a message that is used as part of the log message if the
48588 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
48589 </para>
48590 <literallayout class="monospaced">
48591 require log_message = wrong cipher suite $tls_cipher
48592         encrypted   = DES-CBC3-SHA
48593 </literallayout>
48594 <para>
48595 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48596 example:
48597 </para>
48598 <literallayout>
48599 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48600 <literal>        log_message = Discarded $local_part@$domain because...</literal>
48601 </literallayout>
48602 <para>
48603 When access is denied, <option>log_message</option> adds to any underlying error message
48604 that may exist because of a condition failure. For example, while verifying a
48605 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48606 message.
48607 </para>
48608 <para>
48609 The message may be defined before the conditions to which it applies, because
48610 the string expansion does not happen until Exim decides that access is to be
48611 denied. This means that any variables that are set by the condition are
48612 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
48613 variables are set after a DNS black list lookup succeeds. If the expansion of
48614 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48615 ignored.
48616 </para>
48617 <para>
48618 <indexterm role="variable">
48619 <primary><varname>$acl_verify_message</varname></primary>
48620 </indexterm>
48621 If you want to use a <option>warn</option> statement to log the result of an address
48622 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48623 error message.
48624 </para>
48625 <para>
48626 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48627 the start of the logged message. If the same warning log message is requested
48628 more than once while receiving  a single email message, only one copy is
48629 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48630 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48631 is logged for a successful <option>warn</option> statement.
48632 </para>
48633 <para>
48634 If <option>log_message</option> is not present and there is no underlying error message (for
48635 example, from the failure of address verification), but <option>message</option> is present,
48636 the <option>message</option> text is used for logging rejections. However, if any text for
48637 logging contains newlines, only the first line is logged. In the absence of
48638 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48639 logging rejections.
48640 </para>
48641 </listitem></varlistentry>
48642 <varlistentry>
48643 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
48644 <listitem>
48645 <para>
48646 <indexterm role="concept">
48647 <primary><option>log_reject_target</option> ACL modifier</primary>
48648 </indexterm>
48649 <indexterm role="concept">
48650 <primary>logging in ACL</primary>
48651 <secondary>specifying which log</secondary>
48652 </indexterm>
48653 This modifier makes it possible to specify which logs are used for messages
48654 about ACL rejections. Its argument is a colon-separated list of words that can
48655 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48656 may be empty, in which case a rejection is not logged at all. For example, this
48657 ACL fragment writes no logging information when access is denied:
48658 </para>
48659 <literallayout>
48660 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48661 <literal>     log_reject_target =</literal>
48662 </literallayout>
48663 <para>
48664 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48665 permanent and temporary rejections. Its effect lasts for the rest of the
48666 current ACL.
48667 </para>
48668 </listitem></varlistentry>
48669 <varlistentry>
48670 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48671 <listitem>
48672 <para>
48673 <indexterm role="concept">
48674 <primary><option>logwrite</option> ACL modifier</primary>
48675 </indexterm>
48676 <indexterm role="concept">
48677 <primary>logging in ACL</primary>
48678 <secondary>immediate</secondary>
48679 </indexterm>
48680 This modifier writes a message to a log file as soon as it is encountered when
48681 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48682 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48683 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48684 ACLs. For example:
48685 </para>
48686 <literallayout>
48687 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
48688 <literal>       control  = freeze</literal>
48689 <literal>       logwrite = froze message because ...</literal>
48690 </literallayout>
48691 <para>
48692 By default, the message is written to the main log. However, it may begin
48693 with a colon, followed by a comma-separated list of log names, and then
48694 another colon, to specify exactly which logs are to be written. For
48695 example:
48696 </para>
48697 <literallayout class="monospaced">
48698 logwrite = :main,reject: text for main and reject logs
48699 logwrite = :panic: text for panic log only
48700 </literallayout>
48701 </listitem></varlistentry>
48702 <varlistentry>
48703 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48704 <listitem>
48705 <para>
48706 <indexterm role="concept">
48707 <primary><option>message</option> ACL modifier</primary>
48708 </indexterm>
48709 This modifier sets up a text string that is expanded and used as a response
48710 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48711 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48712 there is some complication if <option>endpass</option> is involved; see the description of
48713 <option>accept</option> for details.)
48714 </para>
48715 <para>
48716 The expansion of the message happens at the time Exim decides that the ACL is
48717 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48718 generates an empty string, the modifier is ignored. Here is an example where
48719 <option>message</option> must be specified first, because the ACL ends with a rejection if
48720 the <option>hosts</option> condition fails:
48721 </para>
48722 <literallayout class="monospaced">
48723 require  message = Host not recognized
48724          hosts = 10.0.0.0/8
48725 </literallayout>
48726 <para>
48727 (Once a condition has failed, no further conditions or modifiers are
48728 processed.)
48729 </para>
48730 <para>
48731 <indexterm role="concept">
48732 <primary>SMTP</primary>
48733 <secondary>error codes</secondary>
48734 </indexterm>
48735 <indexterm role="option">
48736 <primary><option>smtp_banner</option></primary>
48737 </indexterm>
48738 For ACLs that are triggered by SMTP commands, the message is returned as part
48739 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48740 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48741 is accepted. In the case of the connect ACL, accepting with a message modifier
48742 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48743 accept message may not contain more than one line (otherwise it will be
48744 truncated at the first newline and a panic logged), and it cannot affect the
48745 EHLO options.
48746 </para>
48747 <para>
48748 When SMTP is involved, the message may begin with an overriding response code,
48749 consisting of three digits optionally followed by an <quote>extended response code</quote>
48750 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
48751 </para>
48752 <literallayout class="monospaced">
48753 deny  message = 599 1.2.3 Host not welcome
48754       hosts = 192.168.34.0/24
48755 </literallayout>
48756 <para>
48757 The first digit of the supplied response code must be the same as would be sent
48758 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
48759 access, but for the predata ACL, note that the default success code is 354, not
48760 2<emphasis>xx</emphasis>.
48761 </para>
48762 <para>
48763 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
48764 the message modifier cannot override the 221 response code.
48765 </para>
48766 <para>
48767 The text in a <option>message</option> modifier is literal; any quotes are taken as
48768 literals, but because the string is expanded, backslash escapes are processed
48769 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
48770 response.
48771 </para>
48772 <para>
48773 <indexterm role="variable">
48774 <primary><varname>$acl_verify_message</varname></primary>
48775 </indexterm>
48776 If <option>message</option> is used on a statement that verifies an address, the message
48777 specified overrides any message that is generated by the verification process.
48778 However, the original message is available in the variable
48779 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
48780 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
48781 routers to be passed back as part of the SMTP response, you should either not
48782 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
48783 </para>
48784 <para>
48785 For compatibility with previous releases of Exim, a <option>message</option> modifier that
48786 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
48787 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
48788 all the conditions are true, wherever it appears in an ACL command, whereas
48789 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
48790 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
48791 effect.
48792 </para>
48793 </listitem></varlistentry>
48794 <varlistentry>
48795 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
48796 <listitem>
48797 <para>
48798 <indexterm role="concept">
48799 <primary><option>set</option> ACL modifier</primary>
48800 </indexterm>
48801 This modifier puts a value into one of the ACL variables (see section
48802 <xref linkend="SECTaclvariables"/>).
48803 </para>
48804 </listitem></varlistentry>
48805 </variablelist>
48806 </section>
48807 <section id="SECTcontrols">
48808 <title>Use of the control modifier</title>
48809 <para>
48810 <indexterm role="concept">
48811 <primary><option>control</option> ACL modifier</primary>
48812 </indexterm>
48813 The <option>control</option> modifier supports the following settings:
48814 </para>
48815 <variablelist>
48816 <varlistentry>
48817 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
48818 <listitem>
48819 <para>
48820 This modifier allows a client host to use the SMTP AUTH command even when it
48821 has not been advertised in response to EHLO. Furthermore, because there are
48822 apparently some really broken clients that do this, Exim will accept AUTH after
48823 HELO (rather than EHLO) when this control is set. It should be used only if you
48824 really need it, and you should limit its use to those broken clients that do
48825 not work without it. For example:
48826 </para>
48827 <literallayout class="monospaced">
48828 warn hosts   = 192.168.34.25
48829      control = allow_auth_unadvertised
48830 </literallayout>
48831 <para>
48832 Normally, when an Exim server receives an AUTH command, it checks the name of
48833 the authentication mechanism that is given in the command to ensure that it
48834 matches an advertised mechanism. When this control is set, the check that a
48835 mechanism has been advertised is bypassed. Any configured mechanism can be used
48836 by the client. This control is permitted only in the connection and HELO ACLs.
48837 </para>
48838 </listitem></varlistentry>
48839 <varlistentry>
48840 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
48841 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
48842 <listitem>
48843 <para>
48844 <indexterm role="concept">
48845 <primary>access control lists (ACLs)</primary>
48846 <secondary>case of local part in</secondary>
48847 </indexterm>
48848 <indexterm role="concept">
48849 <primary>case of local parts</primary>
48850 </indexterm>
48851 <indexterm role="variable">
48852 <primary><varname>$local_part</varname></primary>
48853 </indexterm>
48854 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
48855 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
48856 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
48857 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
48858 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
48859 is encountered.
48860 </para>
48861 <para>
48862 These controls affect only the current recipient. Moreover, they apply only to
48863 local part handling that takes place directly in the ACL (for example, as a key
48864 in lookups). If a test to verify the recipient is obeyed, the case-related
48865 handling of the local part during the verification is controlled by the router
48866 configuration (see the <option>caseful_local_part</option> generic router option).
48867 </para>
48868 <para>
48869 This facility could be used, for example, to add a spam score to local parts
48870 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
48871 spam score:
48872 </para>
48873 <literallayout class="monospaced">
48874 warn  control = caseful_local_part
48875       set acl_m4 = ${eval:\
48876                      $acl_m4 + \
48877                      ${if match{$local_part}{[A-Z]}{1}{0}}\
48878                     }
48879       control = caselower_local_part
48880 </literallayout>
48881 <para>
48882 Notice that we put back the lower cased version afterwards, assuming that
48883 is what is wanted for subsequent tests.
48884 </para>
48885 </listitem></varlistentry>
48886 <varlistentry>
48887 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
48888 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
48889 <listitem>
48890 <para>
48891 <indexterm role="concept">
48892 <primary>SMTP</primary>
48893 <secondary>synchronization checking</secondary>
48894 </indexterm>
48895 <indexterm role="concept">
48896 <primary>synchronization checking in SMTP</primary>
48897 </indexterm>
48898 These controls make it possible to be selective about when SMTP synchronization
48899 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
48900 state of the switch (it is true by default). See the description of this option
48901 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
48902 </para>
48903 <para>
48904 The effect of these two controls lasts for the remainder of the SMTP
48905 connection. They can appear in any ACL except the one for the non-SMTP
48906 messages. The most straightforward place to put them is in the ACL defined by
48907 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
48908 before the first synchronization check. The expected use is to turn off the
48909 synchronization checks for badly-behaved hosts that you nevertheless need to
48910 work with.
48911 </para>
48912 </listitem></varlistentry>
48913 <varlistentry>
48914 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48915 <listitem>
48916 <para>
48917 <indexterm role="concept">
48918 <primary>fake defer</primary>
48919 </indexterm>
48920 <indexterm role="concept">
48921 <primary>defer, fake</primary>
48922 </indexterm>
48923 This control works in exactly the same way as <option>fakereject</option> (described below)
48924 except that it causes an SMTP 450 response after the message data instead of a
48925 550 response. You must take care when using <option>fakedefer</option> because it causes the
48926 messages to be duplicated when the sender retries. Therefore, you should not
48927 use <option>fakedefer</option> if the message is to be delivered normally.
48928 </para>
48929 </listitem></varlistentry>
48930 <varlistentry>
48931 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48932 <listitem>
48933 <para>
48934 <indexterm role="concept">
48935 <primary>fake rejection</primary>
48936 </indexterm>
48937 <indexterm role="concept">
48938 <primary>rejection, fake</primary>
48939 </indexterm>
48940 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
48941 words, only when an SMTP message is being received. If Exim accepts the
48942 message, instead the final 250 response, a 550 rejection message is sent.
48943 However, Exim proceeds to deliver the message as normal. The control applies
48944 only to the current message, not to any subsequent ones that may be received in
48945 the same SMTP connection.
48946 </para>
48947 <para>
48948 The text for the 550 response is taken from the <option>control</option> modifier. If no
48949 message is supplied, the following is used:
48950 </para>
48951 <literallayout class="monospaced">
48952 550-Your message has been rejected but is being
48953 550-kept for evaluation.
48954 550-If it was a legitimate message, it may still be
48955 550 delivered to the target recipient(s).
48956 </literallayout>
48957 <para>
48958 This facility should be used with extreme caution.
48959 </para>
48960 </listitem></varlistentry>
48961 <varlistentry>
48962 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
48963 <listitem>
48964 <para>
48965 <indexterm role="concept">
48966 <primary>frozen messages</primary>
48967 <secondary>forcing in ACL</secondary>
48968 </indexterm>
48969 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
48970 other words, only when a message is being received. If the message is accepted,
48971 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
48972 current message, not to any subsequent ones that may be received in the same
48973 SMTP connection.
48974 </para>
48975 <para>
48976 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
48977 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
48978 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
48979 are obeyed for the current message have the <literal>/no_tell</literal> option.
48980 </para>
48981 </listitem></varlistentry>
48982 <varlistentry>
48983 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
48984 <listitem>
48985 <para>
48986 <indexterm role="concept">
48987 <primary>SMTP</primary>
48988 <secondary>output flushing, disabling for delay</secondary>
48989 </indexterm>
48990 Exim normally flushes SMTP output before implementing a delay in an ACL, to
48991 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
48992 use. This control, as long as it is encountered before the <option>delay</option> modifier,
48993 disables such output flushing.
48994 </para>
48995 </listitem></varlistentry>
48996 <varlistentry>
48997 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
48998 <listitem>
48999 <para>
49000 <indexterm role="concept">
49001 <primary>SMTP</primary>
49002 <secondary>output flushing, disabling for callout</secondary>
49003 </indexterm>
49004 Exim normally flushes SMTP output before performing a callout in an ACL, to
49005 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49006 use. This control, as long as it is encountered before the <option>verify</option> condition
49007 that causes the callout, disables such output flushing.
49008 </para>
49009 </listitem></varlistentry>
49010 <varlistentry>
49011 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
49012 <listitem>
49013 <para>
49014 This control is available when Exim is compiled with the content scanning
49015 extension. Content scanning may require a copy of the current message, or parts
49016 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49017 or spam scanner. Normally, such copies are deleted when they are no longer
49018 needed. If this control is set, the copies are not deleted. The control applies
49019 only to the current message, not to any subsequent ones that may be received in
49020 the same SMTP connection. It is provided for debugging purposes and is unlikely
49021 to be useful in production.
49022 </para>
49023 </listitem></varlistentry>
49024 <varlistentry>
49025 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
49026 <listitem>
49027 <para>
49028 <indexterm role="concept">
49029 <primary>multiline responses, suppressing</primary>
49030 </indexterm>
49031 This control is permitted for any ACL except the one for non-SMTP messages.
49032 It seems that there are broken clients in use that cannot handle multiline
49033 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49034 </para>
49035 <para>
49036 If this control is set, multiline SMTP responses from ACL rejections are
49037 suppressed. One way of doing this would have been to put out these responses as
49038 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49039 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
49040 responses might get close to that. So this facility, which is after all only a
49041 sop to broken clients, is implemented by doing two very easy things:
49042 </para>
49043 <itemizedlist>
49044 <listitem>
49045 <para>
49046 Extra information that is normally output as part of a rejection caused by
49047 sender verification failure is omitted. Only the final line (typically <quote>sender
49048 verification failed</quote>) is sent.
49049 </para>
49050 </listitem>
49051 <listitem>
49052 <para>
49053 If a <option>message</option> modifier supplies a multiline response, only the first
49054 line is output.
49055 </para>
49056 </listitem>
49057 </itemizedlist>
49058 <para>
49059 The setting of the switch can, of course, be made conditional on the
49060 calling host. Its effect lasts until the end of the SMTP connection.
49061 </para>
49062 </listitem></varlistentry>
49063 <varlistentry>
49064 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
49065 <listitem>
49066 <para>
49067 <indexterm role="concept">
49068 <primary>PIPELINING</primary>
49069 <secondary>suppressing advertising</secondary>
49070 </indexterm>
49071 This control turns off the advertising of the PIPELINING extension to SMTP in
49072 the current session. To be useful, it must be obeyed before Exim sends its
49073 response to an EHLO command. Therefore, it should normally appear in an ACL
49074 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49075 <option>pipelining_advertise_hosts</option>.
49076 </para>
49077 </listitem></varlistentry>
49078 <varlistentry>
49079 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
49080 <listitem>
49081 <para>
49082 <indexterm role="option">
49083 <primary><option>queue_only</option></primary>
49084 </indexterm>
49085 <indexterm role="concept">
49086 <primary>queueing incoming messages</primary>
49087 </indexterm>
49088 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49089 other words, only when a message is being received. If the message is accepted,
49090 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
49091 runner. No immediate delivery process is started. In other words, it has the
49092 effect as the <option>queue_only</option> global option. However, the control applies only
49093 to the current message, not to any subsequent ones that may be received in the
49094 same SMTP connection.
49095 </para>
49096 </listitem></varlistentry>
49097 <varlistentry>
49098 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49099 <listitem>
49100 <para>
49101 <indexterm role="concept">
49102 <primary>message</primary>
49103 <secondary>submission</secondary>
49104 </indexterm>
49105 <indexterm role="concept">
49106 <primary>submission mode</primary>
49107 </indexterm>
49108 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49109 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49110 the current message is a submission from a local MUA. In this case, Exim
49111 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49112 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49113 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49114 late (the message has already been created).
49115 </para>
49116 <para>
49117 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49118 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49119 submission mode; the available options for this control are described there.
49120 The control applies only to the current message, not to any subsequent ones
49121 that may be received in the same SMTP connection.
49122 </para>
49123 </listitem></varlistentry>
49124 <varlistentry>
49125 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
49126 <listitem>
49127 <para>
49128 <indexterm role="concept">
49129 <primary>submission fixups, suppressing</primary>
49130 </indexterm>
49131 This control applies to locally submitted (non TCP/IP) messages, and is the
49132 complement of <literal>control = submission</literal>. It disables the fixups that are
49133 normally applied to locally-submitted messages. Specifically:
49134 </para>
49135 <itemizedlist>
49136 <listitem>
49137 <para>
49138 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49139 dynamic version of <option>local_sender_retain</option>).
49140 </para>
49141 </listitem>
49142 <listitem>
49143 <para>
49144 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49145 </para>
49146 </listitem>
49147 <listitem>
49148 <para>
49149 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49150 </para>
49151 </listitem>
49152 </itemizedlist>
49153 <para>
49154 This control may be useful when a remotely-originated message is accepted,
49155 passed to some scanning program, and then re-submitted for delivery. It can be
49156 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49157 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
49158 data is read.
49159 </para>
49160 <para>
49161 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49162 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49163 </para>
49164 </listitem></varlistentry>
49165 </variablelist>
49166 </section>
49167 <section id="SECTsummesfix">
49168 <title>Summary of message fixup control</title>
49169 <para>
49170 All four possibilities for message fixups can be specified:
49171 </para>
49172 <itemizedlist>
49173 <listitem>
49174 <para>
49175 Locally submitted, fixups applied: the default.
49176 </para>
49177 </listitem>
49178 <listitem>
49179 <para>
49180 Locally submitted, no fixups applied: use
49181 <literal>control = suppress_local_fixups</literal>.
49182 </para>
49183 </listitem>
49184 <listitem>
49185 <para>
49186 Remotely submitted, no fixups applied: the default.
49187 </para>
49188 </listitem>
49189 <listitem>
49190 <para>
49191 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49192 </para>
49193 </listitem>
49194 </itemizedlist>
49195 </section>
49196 <section id="SECTaddheadacl">
49197 <title>Adding header lines in ACLs</title>
49198 <para>
49199 <indexterm role="concept">
49200 <primary>header lines</primary>
49201 <secondary>adding in an ACL</secondary>
49202 </indexterm>
49203 <indexterm role="concept">
49204 <primary>header lines</primary>
49205 <secondary>position of added lines</secondary>
49206 </indexterm>
49207 <indexterm role="concept">
49208 <primary><option>message</option> ACL modifier</primary>
49209 </indexterm>
49210 The <option>add_header</option> modifier can be used to add one or more extra header lines
49211 to an incoming message, as in this example:
49212 </para>
49213 <literallayout class="monospaced">
49214 warn dnslists = sbl.spamhaus.org : \
49215                 dialup.mail-abuse.org
49216      add_header = X-blacklisted-at: $dnslist_domain
49217 </literallayout>
49218 <para>
49219 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49220 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49221 receiving a message). The message must ultimately be accepted for
49222 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49223 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49224 RCPT ACL).
49225 </para>
49226 <para>
49227 If the data for the <option>add_header</option> modifier contains one or more newlines that
49228 are not followed by a space or a tab, it is assumed to contain multiple header
49229 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49230 front of any line that is not a valid header line.
49231 </para>
49232 <para>
49233 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49234 They are added to the message before processing the DATA and MIME ACLs.
49235 However, if an identical header line is requested more than once, only one copy
49236 is actually added to the message. Further header lines may be accumulated
49237 during the DATA and MIME ACLs, after which they are added to the message, again
49238 with duplicates suppressed. Thus, it is possible to add two identical header
49239 lines to an SMTP message, but only if one is added before DATA and one after.
49240 In the case of non-SMTP messages, new headers are accumulated during the
49241 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49242 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49243 are included in the entry that is written to the reject log.
49244 </para>
49245 <para>
49246 <indexterm role="concept">
49247 <primary>header lines</primary>
49248 <secondary>added; visibility of</secondary>
49249 </indexterm>
49250 Header lines are not visible in string expansions until they are added to the
49251 message. It follows that header lines defined in the MAIL, RCPT, and predata
49252 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49253 header lines that are added by the DATA or MIME ACLs are not visible in those
49254 ACLs. Because of this restriction, you cannot use header lines as a way of
49255 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49256 this, you can use ACL variables, as described in section
49257 <xref linkend="SECTaclvariables"/>.
49258 </para>
49259 <para>
49260 The <option>add_header</option> modifier acts immediately it is encountered during the
49261 processing of an ACL. Notice the difference between these two cases:
49262 </para>
49263 <literallayout>
49264 <literal>accept add_header = ADDED: some text</literal>
49265 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
49266
49267 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
49268 <literal>       add_header = ADDED: some text</literal>
49269 </literallayout>
49270 <para>
49271 In the first case, the header line is always added, whether or not the
49272 condition is true. In the second case, the header line is added only if the
49273 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49274 ACL statement. All those that are encountered before a condition fails are
49275 honoured.
49276 </para>
49277 <para>
49278 <indexterm role="concept">
49279 <primary><option>warn</option> ACL verb</primary>
49280 </indexterm>
49281 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49282 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49283 effect only if all the conditions are true, even if it appears before some of
49284 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49285 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49286 are present on a <option>warn</option> verb, both are processed according to their
49287 specifications.
49288 </para>
49289 <para>
49290 By default, new header lines are added to a message at the end of the existing
49291 header lines. However, you can specify that any particular header line should
49292 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49293 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49294 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49295 </para>
49296 <para>
49297 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49298 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49299 header line, respectively. (Header text cannot start with a colon, as there has
49300 to be a header name first.) For example:
49301 </para>
49302 <literallayout class="monospaced">
49303 warn add_header = \
49304        :after_received:X-My-Header: something or other...
49305 </literallayout>
49306 <para>
49307 If more than one header line is supplied in a single <option>add_header</option> modifier,
49308 each one is treated independently and can therefore be placed differently. If
49309 you add more than one line at the start, or after the Received: block, they end
49310 up in reverse order.
49311 </para>
49312 <para>
49313 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49314 added in an ACL. It does NOT work for header lines that are added in a
49315 system filter or in a router or transport.
49316 </para>
49317 </section>
49318 <section id="SECTaclconditions">
49319 <title>ACL conditions</title>
49320 <para>
49321 <indexterm role="concept">
49322 <primary>access control lists (ACLs)</primary>
49323 <secondary>conditions; list of</secondary>
49324 </indexterm>
49325 Some of conditions listed in this section are available only when Exim is
49326 compiled with the content-scanning extension. They are included here briefly
49327 for completeness. More detailed descriptions can be found in the discussion on
49328 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49329 </para>
49330 <para>
49331 Not all conditions are relevant in all circumstances. For example, testing
49332 senders and recipients does not make sense in an ACL that is being run as the
49333 result of the arrival of an ETRN command, and checks on message headers can be
49334 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49335 can use the same condition (with different parameters) more than once in the
49336 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49337 The conditions are as follows:
49338 </para>
49339 <variablelist>
49340 <varlistentry>
49341 <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>
49342 <listitem>
49343 <para>
49344 <indexterm role="concept">
49345 <primary>access control lists (ACLs)</primary>
49346 <secondary>nested</secondary>
49347 </indexterm>
49348 <indexterm role="concept">
49349 <primary>access control lists (ACLs)</primary>
49350 <secondary>indirect</secondary>
49351 </indexterm>
49352 <indexterm role="concept">
49353 <primary><option>acl</option> ACL condition</primary>
49354 </indexterm>
49355 The possible values of the argument are the same as for the
49356 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49357 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49358 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49359 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49360 condition false. This means that further processing of the <option>warn</option> verb
49361 ceases, but processing of the ACL continues.
49362 </para>
49363 <para>
49364 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49365 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49366 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
49367 conditions are tested.
49368 </para>
49369 <para>
49370 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49371 loops. This condition allows you to use different ACLs in different
49372 circumstances. For example, different ACLs can be used to handle RCPT commands
49373 for different local users or different local domains.
49374 </para>
49375 </listitem></varlistentry>
49376 <varlistentry>
49377 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49378 <listitem>
49379 <para>
49380 <indexterm role="concept">
49381 <primary><option>authenticated</option> ACL condition</primary>
49382 </indexterm>
49383 <indexterm role="concept">
49384 <primary>authentication</primary>
49385 <secondary>ACL checking</secondary>
49386 </indexterm>
49387 <indexterm role="concept">
49388 <primary>access control lists (ACLs)</primary>
49389 <secondary>testing for authentication</secondary>
49390 </indexterm>
49391 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49392 the name of the authenticator is tested against the list. To test for
49393 authentication by any authenticator, you can set
49394 </para>
49395 <literallayout class="monospaced">
49396 authenticated = *
49397 </literallayout>
49398 </listitem></varlistentry>
49399 <varlistentry>
49400 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
49401 <listitem>
49402 <para>
49403 <indexterm role="concept">
49404 <primary><option>condition</option> ACL condition</primary>
49405 </indexterm>
49406 <indexterm role="concept">
49407 <primary>customizing</primary>
49408 <secondary>ACL condition</secondary>
49409 </indexterm>
49410 <indexterm role="concept">
49411 <primary>access control lists (ACLs)</primary>
49412 <secondary>customized test</secondary>
49413 </indexterm>
49414 <indexterm role="concept">
49415 <primary>access control lists (ACLs)</primary>
49416 <secondary>testing, customized</secondary>
49417 </indexterm>
49418 This feature allows you to make up custom conditions. If the result of
49419 expanding the string is an empty string, the number zero, or one of the strings
49420 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49421 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49422 any other value, some error is assumed to have occurred, and the ACL returns
49423 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49424 ignored. The effect is to treat it as true, whether it is positive or
49425 negative.
49426 </para>
49427 </listitem></varlistentry>
49428 <varlistentry>
49429 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
49430 <listitem>
49431 <para>
49432 <indexterm role="concept">
49433 <primary><option>decode</option> ACL condition</primary>
49434 </indexterm>
49435 This condition is available only when Exim is compiled with the
49436 content-scanning extension, and it is allowed only in the ACL defined by
49437 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49438 If all goes well, the condition is true. It is false only if there are
49439 problems such as a syntax error or a memory shortage. For more details, see
49440 chapter <xref linkend="CHAPexiscan"/>.
49441 </para>
49442 </listitem></varlistentry>
49443 <varlistentry>
49444 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
49445 <listitem>
49446 <para>
49447 <indexterm role="concept">
49448 <primary><option>demime</option> ACL condition</primary>
49449 </indexterm>
49450 This condition is available only when Exim is compiled with the
49451 content-scanning extension. Its use is described in section
49452 <xref linkend="SECTdemimecond"/>.
49453 </para>
49454 </listitem></varlistentry>
49455 <varlistentry>
49456 <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>
49457 <listitem>
49458 <para>
49459 <indexterm role="concept">
49460 <primary><option>dnslists</option> ACL condition</primary>
49461 </indexterm>
49462 <indexterm role="concept">
49463 <primary>DNS list</primary>
49464 <secondary>in ACL</secondary>
49465 </indexterm>
49466 <indexterm role="concept">
49467 <primary>black list (DNS)</primary>
49468 </indexterm>
49469 <indexterm role="concept">
49470 <primary>access control lists (ACLs)</primary>
49471 <secondary>testing a DNS list</secondary>
49472 </indexterm>
49473 This condition checks for entries in DNS black lists. These are also known as
49474 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49475 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49476 different variants of this condition to describe briefly here. See sections
49477 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
49478 </para>
49479 </listitem></varlistentry>
49480 <varlistentry>
49481 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49482 <listitem>
49483 <para>
49484 <indexterm role="concept">
49485 <primary><option>domains</option> ACL condition</primary>
49486 </indexterm>
49487 <indexterm role="concept">
49488 <primary>domain</primary>
49489 <secondary>ACL checking</secondary>
49490 </indexterm>
49491 <indexterm role="concept">
49492 <primary>access control lists (ACLs)</primary>
49493 <secondary>testing a recipient domain</secondary>
49494 </indexterm>
49495 <indexterm role="variable">
49496 <primary><varname>$domain_data</varname></primary>
49497 </indexterm>
49498 This condition is relevant only after a RCPT command. It checks that the domain
49499 of the recipient address is in the domain list. If percent-hack processing is
49500 enabled, it is done before this test is done. If the check succeeds with a
49501 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49502 <option>domains</option> test.
49503 </para>
49504 <para>
49505 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49506 use <option>domains</option> in a DATA ACL.
49507 </para>
49508 </listitem></varlistentry>
49509 <varlistentry>
49510 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49511 <listitem>
49512 <para>
49513 <indexterm role="concept">
49514 <primary><option>encrypted</option> ACL condition</primary>
49515 </indexterm>
49516 <indexterm role="concept">
49517 <primary>encryption</primary>
49518 <secondary>checking in an ACL</secondary>
49519 </indexterm>
49520 <indexterm role="concept">
49521 <primary>access control lists (ACLs)</primary>
49522 <secondary>testing for encryption</secondary>
49523 </indexterm>
49524 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49525 name of the cipher suite in use is tested against the list. To test for
49526 encryption without testing for any specific cipher suite(s), set
49527 </para>
49528 <literallayout class="monospaced">
49529 encrypted = *
49530 </literallayout>
49531 </listitem></varlistentry>
49532 <varlistentry>
49533 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
49534 <listitem>
49535 <para>
49536 <indexterm role="concept">
49537 <primary><option>hosts</option> ACL condition</primary>
49538 </indexterm>
49539 <indexterm role="concept">
49540 <primary>host</primary>
49541 <secondary>ACL checking</secondary>
49542 </indexterm>
49543 <indexterm role="concept">
49544 <primary>access control lists (ACLs)</primary>
49545 <secondary>testing the client host</secondary>
49546 </indexterm>
49547 This condition tests that the calling host matches the host list. If you have
49548 name lookups or wildcarded host names and IP addresses in the same host list,
49549 you should normally put the IP addresses first. For example, you could have:
49550 </para>
49551 <literallayout class="monospaced">
49552 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49553 </literallayout>
49554 <para>
49555 The lookup in this example uses the host name for its key. This is implied by
49556 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49557 and it wouldn&#x2019;t matter which way round you had these two items.)
49558 </para>
49559 <para>
49560 The reason for the problem with host names lies in the left-to-right way that
49561 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49562 but when it reaches an item that requires a host name, it fails if it cannot
49563 find a host name to compare with the pattern. If the above list is given in the
49564 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49565 found, even if its IP address is 10.9.8.7.
49566 </para>
49567 <para>
49568 If you really do want to do the name check first, and still recognize the IP
49569 address even if the name lookup fails, you can rewrite the ACL like this:
49570 </para>
49571 <literallayout class="monospaced">
49572 accept hosts = dbm;/etc/friendly/hosts
49573 accept hosts = 10.9.8.7
49574 </literallayout>
49575 <para>
49576 The default action on failing to find the host name is to assume that the host
49577 is not in the list, so the first <option>accept</option> statement fails. The second
49578 statement can then check the IP address.
49579 </para>
49580 <para>
49581 <indexterm role="variable">
49582 <primary><varname>$host_data</varname></primary>
49583 </indexterm>
49584 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49585 of the lookup is made available in the <varname>$host_data</varname> variable. This
49586 allows you, for example, to set up a statement like this:
49587 </para>
49588 <literallayout class="monospaced">
49589 deny  hosts = net-lsearch;/some/file
49590 message = $host_data
49591 </literallayout>
49592 <para>
49593 which gives a custom error message for each denied host.
49594 </para>
49595 </listitem></varlistentry>
49596 <varlistentry>
49597 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
49598 <listitem>
49599 <para>
49600 <indexterm role="concept">
49601 <primary><option>local_parts</option> ACL condition</primary>
49602 </indexterm>
49603 <indexterm role="concept">
49604 <primary>local part</primary>
49605 <secondary>ACL checking</secondary>
49606 </indexterm>
49607 <indexterm role="concept">
49608 <primary>access control lists (ACLs)</primary>
49609 <secondary>testing a local part</secondary>
49610 </indexterm>
49611 <indexterm role="variable">
49612 <primary><varname>$local_part_data</varname></primary>
49613 </indexterm>
49614 This condition is relevant only after a RCPT command. It checks that the local
49615 part of the recipient address is in the list. If percent-hack processing is
49616 enabled, it is done before this test. If the check succeeds with a lookup, the
49617 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49618 the next <option>local_parts</option> test.
49619 </para>
49620 </listitem></varlistentry>
49621 <varlistentry>
49622 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
49623 <listitem>
49624 <para>
49625 <indexterm role="concept">
49626 <primary><option>malware</option> ACL condition</primary>
49627 </indexterm>
49628 <indexterm role="concept">
49629 <primary>access control lists (ACLs)</primary>
49630 <secondary>virus scanning</secondary>
49631 </indexterm>
49632 <indexterm role="concept">
49633 <primary>access control lists (ACLs)</primary>
49634 <secondary>scanning for viruses</secondary>
49635 </indexterm>
49636 This condition is available only when Exim is compiled with the
49637 content-scanning extension. It causes the incoming message to be scanned for
49638 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49639 </para>
49640 </listitem></varlistentry>
49641 <varlistentry>
49642 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49643 <listitem>
49644 <para>
49645 <indexterm role="concept">
49646 <primary><option>mime_regex</option> ACL condition</primary>
49647 </indexterm>
49648 <indexterm role="concept">
49649 <primary>access control lists (ACLs)</primary>
49650 <secondary>testing by regex matching</secondary>
49651 </indexterm>
49652 This condition is available only when Exim is compiled with the
49653 content-scanning extension, and it is allowed only in the ACL defined by
49654 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49655 with any of the regular expressions. For details, see chapter
49656 <xref linkend="CHAPexiscan"/>.
49657 </para>
49658 </listitem></varlistentry>
49659 <varlistentry>
49660 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
49661 <listitem>
49662 <para>
49663 <indexterm role="concept">
49664 <primary>rate limiting</primary>
49665 </indexterm>
49666 This condition can be used to limit the rate at which a user or host submits
49667 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49668 </para>
49669 </listitem></varlistentry>
49670 <varlistentry>
49671 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49672 <listitem>
49673 <para>
49674 <indexterm role="concept">
49675 <primary><option>recipients</option> ACL condition</primary>
49676 </indexterm>
49677 <indexterm role="concept">
49678 <primary>recipient</primary>
49679 <secondary>ACL checking</secondary>
49680 </indexterm>
49681 <indexterm role="concept">
49682 <primary>access control lists (ACLs)</primary>
49683 <secondary>testing a recipient</secondary>
49684 </indexterm>
49685 This condition is relevant only after a RCPT command. It checks the entire
49686 recipient address against a list of recipients.
49687 </para>
49688 </listitem></varlistentry>
49689 <varlistentry>
49690 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49691 <listitem>
49692 <para>
49693 <indexterm role="concept">
49694 <primary><option>regex</option> ACL condition</primary>
49695 </indexterm>
49696 <indexterm role="concept">
49697 <primary>access control lists (ACLs)</primary>
49698 <secondary>testing by regex matching</secondary>
49699 </indexterm>
49700 This condition is available only when Exim is compiled with the
49701 content-scanning extension, and is available only in the DATA, MIME, and
49702 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49703 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49704 </para>
49705 </listitem></varlistentry>
49706 <varlistentry>
49707 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49708 <listitem>
49709 <para>
49710 <indexterm role="concept">
49711 <primary><option>sender_domains</option> ACL condition</primary>
49712 </indexterm>
49713 <indexterm role="concept">
49714 <primary>sender</primary>
49715 <secondary>ACL checking</secondary>
49716 </indexterm>
49717 <indexterm role="concept">
49718 <primary>access control lists (ACLs)</primary>
49719 <secondary>testing a sender domain</secondary>
49720 </indexterm>
49721 <indexterm role="variable">
49722 <primary><varname>$domain</varname></primary>
49723 </indexterm>
49724 <indexterm role="variable">
49725 <primary><varname>$sender_address_domain</varname></primary>
49726 </indexterm>
49727 This condition tests the domain of the sender of the message against the given
49728 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
49729 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
49730 of this condition. This is an exception to the general rule for testing domain
49731 lists. It is done this way so that, if this condition is used in an ACL for a
49732 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
49733 influence the sender checking.
49734 </para>
49735 <para>
49736 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49737 relaying, because sender addresses are easily, and commonly, forged.
49738 </para>
49739 </listitem></varlistentry>
49740 <varlistentry>
49741 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49742 <listitem>
49743 <para>
49744 <indexterm role="concept">
49745 <primary><option>senders</option> ACL condition</primary>
49746 </indexterm>
49747 <indexterm role="concept">
49748 <primary>sender</primary>
49749 <secondary>ACL checking</secondary>
49750 </indexterm>
49751 <indexterm role="concept">
49752 <primary>access control lists (ACLs)</primary>
49753 <secondary>testing a sender</secondary>
49754 </indexterm>
49755 This condition tests the sender of the message against the given list. To test
49756 for a bounce message, which has an empty sender, set
49757 </para>
49758 <literallayout class="monospaced">
49759 senders = :
49760 </literallayout>
49761 <para>
49762 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49763 relaying, because sender addresses are easily, and commonly, forged.
49764 </para>
49765 </listitem></varlistentry>
49766 <varlistentry>
49767 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
49768 <listitem>
49769 <para>
49770 <indexterm role="concept">
49771 <primary><option>spam</option> ACL condition</primary>
49772 </indexterm>
49773 <indexterm role="concept">
49774 <primary>access control lists (ACLs)</primary>
49775 <secondary>scanning for spam</secondary>
49776 </indexterm>
49777 This condition is available only when Exim is compiled with the
49778 content-scanning extension. It causes the incoming message to be scanned by
49779 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
49780 </para>
49781 </listitem></varlistentry>
49782 <varlistentry>
49783 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
49784 <listitem>
49785 <para>
49786 <indexterm role="concept">
49787 <primary><option>verify</option> ACL condition</primary>
49788 </indexterm>
49789 <indexterm role="concept">
49790 <primary>TLS</primary>
49791 <secondary>client certificate verification</secondary>
49792 </indexterm>
49793 <indexterm role="concept">
49794 <primary>certificate</primary>
49795 <secondary>verification of client</secondary>
49796 </indexterm>
49797 <indexterm role="concept">
49798 <primary>access control lists (ACLs)</primary>
49799 <secondary>certificate verification</secondary>
49800 </indexterm>
49801 <indexterm role="concept">
49802 <primary>access control lists (ACLs)</primary>
49803 <secondary>testing a TLS certificate</secondary>
49804 </indexterm>
49805 This condition is true in an SMTP session if the session is encrypted, and a
49806 certificate was received from the client, and the certificate was verified. The
49807 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
49808 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
49809 </para>
49810 </listitem></varlistentry>
49811 <varlistentry>
49812 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
49813 <listitem>
49814 <para>
49815 <indexterm role="concept">
49816 <primary>CSA verification</primary>
49817 </indexterm>
49818 This condition checks whether the sending host (the client) is authorized to
49819 send email. Details of how this works are given in section
49820 <xref linkend="SECTverifyCSA"/>.
49821 </para>
49822 </listitem></varlistentry>
49823 <varlistentry>
49824 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49825 <listitem>
49826 <para>
49827 <indexterm role="concept">
49828 <primary><option>verify</option> ACL condition</primary>
49829 </indexterm>
49830 <indexterm role="concept">
49831 <primary>access control lists (ACLs)</primary>
49832 <secondary>verifying sender in the header</secondary>
49833 </indexterm>
49834 <indexterm role="concept">
49835 <primary>header lines</primary>
49836 <secondary>verifying the sender in</secondary>
49837 </indexterm>
49838 <indexterm role="concept">
49839 <primary>sender</primary>
49840 <secondary>verifying in header</secondary>
49841 </indexterm>
49842 <indexterm role="concept">
49843 <primary>verifying</primary>
49844 <secondary>sender in header</secondary>
49845 </indexterm>
49846 This condition is relevant only in an ACL that is run after a message has been
49847 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49848 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
49849 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
49850 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
49851 However, an address that appears in one of these headers need not be an address
49852 that accepts bounce messages; only sender addresses in envelopes are required
49853 to accept bounces. Therefore, if you use the callout option on this check, you
49854 might want to arrange for a non-empty address in the MAIL command.
49855 </para>
49856 <para>
49857 Details of address verification and the options are given later, starting at
49858 section <xref linkend="SECTaddressverification"/> (callouts are described in section
49859 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
49860 condition to restrict it to bounce messages only:
49861 </para>
49862 <literallayout class="monospaced">
49863 deny    senders = :
49864         message = A valid sender header is required for bounces
49865        !verify  = header_sender
49866 </literallayout>
49867 </listitem></varlistentry>
49868 <varlistentry>
49869 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
49870 <listitem>
49871 <para>
49872 <indexterm role="concept">
49873 <primary><option>verify</option> ACL condition</primary>
49874 </indexterm>
49875 <indexterm role="concept">
49876 <primary>access control lists (ACLs)</primary>
49877 <secondary>verifying header syntax</secondary>
49878 </indexterm>
49879 <indexterm role="concept">
49880 <primary>header lines</primary>
49881 <secondary>verifying syntax</secondary>
49882 </indexterm>
49883 <indexterm role="concept">
49884 <primary>verifying</primary>
49885 <secondary>header syntax</secondary>
49886 </indexterm>
49887 This condition is relevant only in an ACL that is run after a message has been
49888 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49889 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
49890 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
49891 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
49892 permitted only in locally generated messages and from hosts that match
49893 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49894 appropriate.
49895 </para>
49896 <para>
49897 Note that this condition is a syntax check only. However, a common spamming
49898 ploy used to be to send syntactically invalid headers such as
49899 </para>
49900 <literallayout class="monospaced">
49901 To: @
49902 </literallayout>
49903 <para>
49904 and this condition can be used to reject such messages, though they are not as
49905 common as they used to be.
49906 </para>
49907 </listitem></varlistentry>
49908 <varlistentry>
49909 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
49910 <listitem>
49911 <para>
49912 <indexterm role="concept">
49913 <primary><option>verify</option> ACL condition</primary>
49914 </indexterm>
49915 <indexterm role="concept">
49916 <primary>access control lists (ACLs)</primary>
49917 <secondary>verifying HELO/EHLO</secondary>
49918 </indexterm>
49919 <indexterm role="concept">
49920 <primary>HELO</primary>
49921 <secondary>verifying</secondary>
49922 </indexterm>
49923 <indexterm role="concept">
49924 <primary>EHLO</primary>
49925 <secondary>verifying</secondary>
49926 </indexterm>
49927 <indexterm role="concept">
49928 <primary>verifying</primary>
49929 <secondary>EHLO</secondary>
49930 </indexterm>
49931 <indexterm role="concept">
49932 <primary>verifying</primary>
49933 <secondary>HELO</secondary>
49934 </indexterm>
49935 This condition is true if a HELO or EHLO command has been received from the
49936 client host, and its contents have been verified. If there has been no previous
49937 attempt to verify the HELO/EHLO contents, it is carried out when this
49938 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
49939 <option>helo_try_verify_hosts</option> options for details of how to request verification
49940 independently of this condition.
49941 </para>
49942 <para>
49943 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
49944 option), this condition is always true.
49945 </para>
49946 </listitem></varlistentry>
49947 <varlistentry>
49948 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
49949 <listitem>
49950 <para>
49951 <indexterm role="concept">
49952 <primary>verifying</primary>
49953 <secondary>not blind</secondary>
49954 </indexterm>
49955 <indexterm role="concept">
49956 <primary>bcc recipients, verifying none</primary>
49957 </indexterm>
49958 This condition checks that there are no blind (bcc) recipients in the message.
49959 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
49960 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
49961 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
49962 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
49963 used only in a DATA or non-SMTP ACL.
49964 </para>
49965 <para>
49966 There are, of course, many legitimate messages that make use of blind (bcc)
49967 recipients. This check should not be used on its own for blocking messages.
49968 </para>
49969 </listitem></varlistentry>
49970 <varlistentry>
49971 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49972 <listitem>
49973 <para>
49974 <indexterm role="concept">
49975 <primary><option>verify</option> ACL condition</primary>
49976 </indexterm>
49977 <indexterm role="concept">
49978 <primary>access control lists (ACLs)</primary>
49979 <secondary>verifying recipient</secondary>
49980 </indexterm>
49981 <indexterm role="concept">
49982 <primary>recipient</primary>
49983 <secondary>verifying</secondary>
49984 </indexterm>
49985 <indexterm role="concept">
49986 <primary>verifying</primary>
49987 <secondary>recipient</secondary>
49988 </indexterm>
49989 <indexterm role="variable">
49990 <primary><varname>$address_data</varname></primary>
49991 </indexterm>
49992 This condition is relevant only after a RCPT command. It verifies the current
49993 recipient. Details of address verification are given later, starting at section
49994 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
49995 of <varname>$address_data</varname> is the last value that was set while routing the address.
49996 This applies even if the verification fails. When an address that is being
49997 verified is redirected to a single address, verification continues with the new
49998 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
49999 value for the child address.
50000 </para>
50001 </listitem></varlistentry>
50002 <varlistentry>
50003 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
50004 <listitem>
50005 <para>
50006 <indexterm role="concept">
50007 <primary><option>verify</option> ACL condition</primary>
50008 </indexterm>
50009 <indexterm role="concept">
50010 <primary>access control lists (ACLs)</primary>
50011 <secondary>verifying host reverse lookup</secondary>
50012 </indexterm>
50013 <indexterm role="concept">
50014 <primary>host</primary>
50015 <secondary>verifying reverse lookup</secondary>
50016 </indexterm>
50017 This condition ensures that a verified host name has been looked up from the IP
50018 address of the client host. (This may have happened already if the host name
50019 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50020 Verification ensures that the host name obtained from a reverse DNS lookup, or
50021 one of its aliases, does, when it is itself looked up in the DNS, yield the
50022 original IP address.
50023 </para>
50024 <para>
50025 If this condition is used for a locally generated message (that is, when there
50026 is no client host involved), it always succeeds.
50027 </para>
50028 </listitem></varlistentry>
50029 <varlistentry>
50030 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50031 <listitem>
50032 <para>
50033 <indexterm role="concept">
50034 <primary><option>verify</option> ACL condition</primary>
50035 </indexterm>
50036 <indexterm role="concept">
50037 <primary>access control lists (ACLs)</primary>
50038 <secondary>verifying sender</secondary>
50039 </indexterm>
50040 <indexterm role="concept">
50041 <primary>sender</primary>
50042 <secondary>verifying</secondary>
50043 </indexterm>
50044 <indexterm role="concept">
50045 <primary>verifying</primary>
50046 <secondary>sender</secondary>
50047 </indexterm>
50048 This condition is relevant only after a MAIL or RCPT command, or after a
50049 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50050 the message&#x2019;s sender is empty (that is, this is a bounce message), the
50051 condition is true. Otherwise, the sender address is verified.
50052 </para>
50053 <para>
50054 <indexterm role="variable">
50055 <primary><varname>$address_data</varname></primary>
50056 </indexterm>
50057 <indexterm role="variable">
50058 <primary><varname>$sender_address_data</varname></primary>
50059 </indexterm>
50060 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50061 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50062 value can be used in subsequent conditions and modifiers in the same ACL
50063 statement. It does not persist after the end of the current statement. If you
50064 want to preserve the value for longer, you can save it in an ACL variable.
50065 </para>
50066 <para>
50067 Details of verification are given later, starting at section
50068 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50069 to avoid doing it more than once per message.
50070 </para>
50071 </listitem></varlistentry>
50072 <varlistentry>
50073 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50074 <listitem>
50075 <para>
50076 <indexterm role="concept">
50077 <primary><option>verify</option> ACL condition</primary>
50078 </indexterm>
50079 This is a variation of the previous option, in which a modified address is
50080 verified as a sender.
50081 </para>
50082 </listitem></varlistentry>
50083 </variablelist>
50084 </section>
50085 <section id="SECTmorednslists">
50086 <title>Using DNS lists</title>
50087 <para>
50088 <indexterm role="concept">
50089 <primary>DNS list</primary>
50090 <secondary>in ACL</secondary>
50091 </indexterm>
50092 <indexterm role="concept">
50093 <primary>black list (DNS)</primary>
50094 </indexterm>
50095 <indexterm role="concept">
50096 <primary>access control lists (ACLs)</primary>
50097 <secondary>testing a DNS list</secondary>
50098 </indexterm>
50099 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50100 is on at least one of a number of DNS lists by looking up the inverted IP
50101 address in one or more DNS domains. (Note that DNS list domains are not mail
50102 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
50103 special options instead.) For example, if the calling host&#x2019;s IP
50104 address is 192.168.62.43, and the ACL statement is
50105 </para>
50106 <literallayout class="monospaced">
50107 deny dnslists = blackholes.mail-abuse.org : \
50108                 dialups.mail-abuse.org
50109 </literallayout>
50110 <para>
50111 the following records are looked up:
50112 </para>
50113 <literallayout class="monospaced">
50114 43.62.168.192.blackholes.mail-abuse.org
50115 43.62.168.192.dialups.mail-abuse.org
50116 </literallayout>
50117 <para>
50118 As soon as Exim finds an existing DNS record, processing of the list stops.
50119 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50120 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50121 use two separate conditions:
50122 </para>
50123 <literallayout class="monospaced">
50124 deny dnslists = blackholes.mail-abuse.org
50125      dnslists = dialups.mail-abuse.org
50126 </literallayout>
50127 <para>
50128 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50129 behaves as if the host does not match the list item, that is, as if the DNS
50130 record does not exist. If there are further items in the DNS list, they are
50131 processed.
50132 </para>
50133 <para>
50134 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50135 (which is the most common usage), because it prevents a DNS failure from
50136 blocking mail. However, you can change this behaviour by putting one of the
50137 following special items in the list:
50138 </para>
50139 <literallayout>
50140 <literal>+include_unknown </literal>   behave as if the item is on the list
50141 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
50142 <literal>+defer_unknown   </literal>   give a temporary error
50143 </literallayout>
50144 <para>
50145 <indexterm role="concept">
50146 <primary><literal>+include_unknown</literal></primary>
50147 </indexterm>
50148 <indexterm role="concept">
50149 <primary><literal>+exclude_unknown</literal></primary>
50150 </indexterm>
50151 <indexterm role="concept">
50152 <primary><literal>+defer_unknown</literal></primary>
50153 </indexterm>
50154 Each of these applies to any subsequent items on the list. For example:
50155 </para>
50156 <literallayout class="monospaced">
50157 deny dnslists = +defer_unknown : foo.bar.example
50158 </literallayout>
50159 <para>
50160 Testing the list of domains stops as soon as a match is found. If you want to
50161 warn for one list and block for another, you can use two different statements:
50162 </para>
50163 <literallayout class="monospaced">
50164 deny  dnslists = blackholes.mail-abuse.org
50165 warn  message  = X-Warn: sending host is on dialups list
50166       dnslists = dialups.mail-abuse.org
50167 </literallayout>
50168 <para>
50169 DNS list lookups are cached by Exim for the duration of the SMTP session,
50170 so a lookup based on the IP address is done at most once for any incoming
50171 connection. Exim does not share information between multiple incoming
50172 connections (but your local name server cache should be active).
50173 </para>
50174 </section>
50175 <section id="SECID201">
50176 <title>Specifying the IP address for a DNS list lookup</title>
50177 <para>
50178 <indexterm role="concept">
50179 <primary>DNS list</primary>
50180 <secondary>keyed by explicit IP address</secondary>
50181 </indexterm>
50182 By default, the IP address that is used in a DNS list lookup is the IP address
50183 of the calling host. However, you can specify another IP address by listing it
50184 after the domain name, introduced by a slash. For example:
50185 </para>
50186 <literallayout class="monospaced">
50187 deny dnslists = black.list.tld/192.168.1.2
50188 </literallayout>
50189 <para>
50190 This feature is not very helpful with explicit IP addresses; it is intended for
50191 use with IP addresses that are looked up, for example, the IP addresses of the
50192 MX hosts or nameservers of an email sender address. For an example, see section
50193 <xref linkend="SECTmulkeyfor"/> below.
50194 </para>
50195 </section>
50196 <section id="SECID202">
50197 <title>DNS lists keyed on domain names</title>
50198 <para>
50199 <indexterm role="concept">
50200 <primary>DNS list</primary>
50201 <secondary>keyed by domain name</secondary>
50202 </indexterm>
50203 There are some lists that are keyed on domain names rather than inverted IP
50204 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50205 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50206 with these lists. You can change the name that is looked up in a DNS list by
50207 listing it after the domain name, introduced by a slash. For example,
50208 </para>
50209 <literallayout class="monospaced">
50210 deny  message  = Sender's domain is listed at $dnslist_domain
50211       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50212 </literallayout>
50213 <para>
50214 This particular example is useful only in ACLs that are obeyed after the
50215 RCPT or DATA commands, when a sender address is available. If (for
50216 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50217 up by this example is
50218 </para>
50219 <literallayout class="monospaced">
50220 tld.example.dsn.rfc-ignorant.org
50221 </literallayout>
50222 <para>
50223 A single <option>dnslists</option> condition can contain entries for both names and IP
50224 addresses. For example:
50225 </para>
50226 <literallayout class="monospaced">
50227 deny dnslists = sbl.spamhaus.org : \
50228                 dsn.rfc-ignorant.org/$sender_address_domain
50229 </literallayout>
50230 <para>
50231 The first item checks the sending host&#x2019;s IP address; the second checks a domain
50232 name. The whole condition is true if either of the DNS lookups succeeds.
50233 </para>
50234 </section>
50235 <section id="SECTmulkeyfor">
50236 <title>Multiple explicit keys for a DNS list</title>
50237 <para>
50238 <indexterm role="concept">
50239 <primary>DNS list</primary>
50240 <secondary>multiple keys for</secondary>
50241 </indexterm>
50242 The syntax described above for looking up explicitly-defined values (either
50243 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50244 name for the DNS list, what follows the slash can in fact be a list of items.
50245 As with all lists in Exim, the default separator is a colon. However, because
50246 this is a sublist within the list of DNS blacklist domains, it is necessary
50247 either to double the separators like this:
50248 </para>
50249 <literallayout class="monospaced">
50250 dnslists = black.list.tld/name.1::name.2
50251 </literallayout>
50252 <para>
50253 or to change the separator character, like this:
50254 </para>
50255 <literallayout class="monospaced">
50256 dnslists = black.list.tld/&lt;;name.1;name.2
50257 </literallayout>
50258 <para>
50259 If an item in the list is an IP address, it is inverted before the DNS
50260 blacklist domain is appended. If it is not an IP address, no inversion
50261 occurs. Consider this condition:
50262 </para>
50263 <literallayout class="monospaced">
50264 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
50265 </literallayout>
50266 <para>
50267 The DNS lookups that occur are:
50268 </para>
50269 <literallayout class="monospaced">
50270 2.1.168.192.black.list.tld
50271 a.domain.black.list.tld
50272 </literallayout>
50273 <para>
50274 Once a DNS record has been found (that matches a specific IP return
50275 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
50276 are done. If there is a temporary DNS error, the rest of the sublist of domains
50277 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50278 only if no other DNS lookup in this sublist succeeds. In other words, a
50279 successful lookup for any of the items in the sublist overrides a temporary
50280 error for a previous item.
50281 </para>
50282 <para>
50283 The ability to supply a list of items after the slash is in some sense just a
50284 syntactic convenience. These two examples have the same effect:
50285 </para>
50286 <literallayout class="monospaced">
50287 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50288 dnslists = black.list.tld/a.domain::b.domain
50289 </literallayout>
50290 <para>
50291 However, when the data for the list is obtained from a lookup, the second form
50292 is usually much more convenient. Consider this example:
50293 </para>
50294 <literallayout class="monospaced">
50295 deny message  = The mail servers for the domain \
50296                 $sender_address_domain \
50297                 are listed at $dnslist_domain ($dnslist_value); \
50298                 see $dnslist_text.
50299      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
50300                                    ${lookup dnsdb {&gt;|mxh=\
50301                                    $sender_address_domain} }} }
50302 </literallayout>
50303 <para>
50304 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
50305 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50306 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50307 of expanding the condition might be something like this:
50308 </para>
50309 <literallayout class="monospaced">
50310 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
50311 </literallayout>
50312 <para>
50313 Thus, this example checks whether or not the IP addresses of the sender
50314 domain&#x2019;s mail servers are on the Spamhaus black list.
50315 </para>
50316 <para>
50317 The key that was used for a successful DNS list lookup is put into the variable
50318 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50319 </para>
50320 </section>
50321 <section id="SECID203">
50322 <title>Data returned by DNS lists</title>
50323 <para>
50324 <indexterm role="concept">
50325 <primary>DNS list</primary>
50326 <secondary>data returned from</secondary>
50327 </indexterm>
50328 DNS lists are constructed using address records in the DNS. The original RBL
50329 just used the address 127.0.0.1 on the right hand side of each record, but the
50330 RBL+ list and some other lists use a number of values with different meanings.
50331 The values used on the RBL+ list are:
50332 </para>
50333 <literallayout>
50334 127.1.0.1  RBL
50335 127.1.0.2  DUL
50336 127.1.0.3  DUL and RBL
50337 127.1.0.4  RSS
50338 127.1.0.5  RSS and RBL
50339 127.1.0.6  RSS and DUL
50340 127.1.0.7  RSS and DUL and RBL
50341 </literallayout>
50342 <para>
50343 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50344 different values. Some DNS lists may return more than one address record;
50345 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50346 </para>
50347 </section>
50348 <section id="SECID204">
50349 <title>Variables set from DNS lists</title>
50350 <para>
50351 <indexterm role="concept">
50352 <primary>expansion</primary>
50353 <secondary>variables, set from DNS list</secondary>
50354 </indexterm>
50355 <indexterm role="concept">
50356 <primary>DNS list</primary>
50357 <secondary>variables set from</secondary>
50358 </indexterm>
50359 <indexterm role="variable">
50360 <primary><varname>$dnslist_domain</varname></primary>
50361 </indexterm>
50362 <indexterm role="variable">
50363 <primary><varname>$dnslist_matched</varname></primary>
50364 </indexterm>
50365 <indexterm role="variable">
50366 <primary><varname>$dnslist_text</varname></primary>
50367 </indexterm>
50368 <indexterm role="variable">
50369 <primary><varname>$dnslist_value</varname></primary>
50370 </indexterm>
50371 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50372 the name of the overall domain that matched (for example,
50373 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50374 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50375 the DNS record. When the key is an IP address, it is not reversed in
50376 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50377 cases, for example:
50378 </para>
50379 <literallayout class="monospaced">
50380 deny dnslists = spamhaus.example
50381 </literallayout>
50382 <para>
50383 the key is also available in another variable (in this case,
50384 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50385 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50386 might generate a dnslists lookup like this:
50387 </para>
50388 <literallayout class="monospaced">
50389 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
50390 </literallayout>
50391 <para>
50392 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50393 <literal>192.168.6.7</literal> (for example).
50394 </para>
50395 <para>
50396 If more than one address record is returned by the DNS lookup, all the IP
50397 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50398 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50399 record. For lists such as RBL+ the TXT record for a merged entry is often not
50400 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50401 information.
50402 </para>
50403 <para>
50404 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50405 &ndash; although these appear before the condition in the ACL, they are not
50406 expanded until after it has failed. For example:
50407 </para>
50408 <literallayout class="monospaced">
50409 deny    hosts = !+local_networks
50410         message = $sender_host_address is listed \
50411                   at $dnslist_domain
50412         dnslists = rbl-plus.mail-abuse.example
50413 </literallayout>
50414 </section>
50415 <section id="SECTaddmatcon">
50416 <title>Additional matching conditions for DNS lists</title>
50417 <para>
50418 <indexterm role="concept">
50419 <primary>DNS list</primary>
50420 <secondary>matching specific returned data</secondary>
50421 </indexterm>
50422 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50423 in order to restrict its action to DNS records with a matching right hand side.
50424 For example,
50425 </para>
50426 <literallayout class="monospaced">
50427 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50428 </literallayout>
50429 <para>
50430 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50431 any address record is considered to be a match. For the moment, we assume
50432 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50433 describes how multiple records are handled.
50434 </para>
50435 <para>
50436 More than one IP address may be given for checking, using a comma as a
50437 separator. These are alternatives &ndash; if any one of them matches, the
50438 <option>dnslists</option> condition is true. For example:
50439 </para>
50440 <literallayout class="monospaced">
50441 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50442 </literallayout>
50443 <para>
50444 If you want to specify a constraining address list and also specify names or IP
50445 addresses to be looked up, the constraining address list must be specified
50446 first. For example:
50447 </para>
50448 <literallayout class="monospaced">
50449 deny dnslists = dsn.rfc-ignorant.org\
50450                 =127.0.0.2/$sender_address_domain
50451 </literallayout>
50452 <para>
50453 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
50454 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50455 In other words, the listed addresses are used as bit masks. The comparison is
50456 true if all the bits in the mask are present in the address that is being
50457 tested. For example:
50458 </para>
50459 <literallayout class="monospaced">
50460 dnslists = a.b.c&amp;0.0.0.3
50461 </literallayout>
50462 <para>
50463 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
50464 want to test whether one bit or another bit is present (as opposed to both
50465 being present), you must use multiple values. For example:
50466 </para>
50467 <literallayout class="monospaced">
50468 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
50469 </literallayout>
50470 <para>
50471 matches if the final component of the address is an odd number or two times
50472 an odd number.
50473 </para>
50474 </section>
50475 <section id="SECID205">
50476 <title>Negated DNS matching conditions</title>
50477 <para>
50478 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50479 condition. Whereas
50480 </para>
50481 <literallayout class="monospaced">
50482 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50483 </literallayout>
50484 <para>
50485 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50486 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50487 </para>
50488 <literallayout class="monospaced">
50489 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
50490 </literallayout>
50491 <para>
50492 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50493 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50494 words, the result of the test is inverted if an exclamation mark appears before
50495 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
50496 </para>
50497 <para>
50498 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50499 host, or address list (which is why the syntax is different).
50500 </para>
50501 <para>
50502 If you are using just one list, the negation syntax does not gain you much. The
50503 previous example is precisely equivalent to
50504 </para>
50505 <literallayout class="monospaced">
50506 deny  dnslists = a.b.c
50507      !dnslists = a.b.c=127.0.0.2,127.0.0.3
50508 </literallayout>
50509 <para>
50510 However, if you are using multiple lists, the negation syntax is clearer.
50511 Consider this example:
50512 </para>
50513 <literallayout class="monospaced">
50514 deny  dnslists = sbl.spamhaus.org : \
50515                  list.dsbl.org : \
50516                  dnsbl.njabl.org!=127.0.0.3 : \
50517                  relays.ordb.org
50518 </literallayout>
50519 <para>
50520 Using only positive lists, this would have to be:
50521 </para>
50522 <literallayout class="monospaced">
50523 deny  dnslists = sbl.spamhaus.org : \
50524                  list.dsbl.org
50525 deny  dnslists = dnsbl.njabl.org
50526      !dnslists = dnsbl.njabl.org=127.0.0.3
50527 deny  dnslists = relays.ordb.org
50528 </literallayout>
50529 <para>
50530 which is less clear, and harder to maintain.
50531 </para>
50532 </section>
50533 <section id="SECThanmuldnsrec">
50534 <title>Handling multiple DNS records from a DNS list</title>
50535 <para>
50536 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50537 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50538 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
50539 the match to specific results from the DNS lookup, there are two ways in which
50540 the checking can be handled. For example, consider the condition:
50541 </para>
50542 <literallayout class="monospaced">
50543 dnslists = a.b.c=127.0.0.1
50544 </literallayout>
50545 <para>
50546 What happens if the DNS lookup for the incoming IP address yields both
50547 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50548 condition true because at least one given value was found, or is it false
50549 because at least one of the found values was not listed? And how does this
50550 affect negated conditions? Both possibilities are provided for with the help of
50551 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
50552 </para>
50553 <itemizedlist>
50554 <listitem>
50555 <para>
50556 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
50557 IP addresses matches one of the listed addresses. For the example above, the
50558 condition is true because 127.0.0.1 matches.
50559 </para>
50560 </listitem>
50561 <listitem>
50562 <para>
50563 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
50564 looked up IP addresses matches one of the listed addresses. If the condition is
50565 changed to:
50566 </para>
50567 <literallayout class="monospaced">
50568 dnslists = a.b.c==127.0.0.1
50569 </literallayout>
50570 <para>
50571 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50572 false because 127.0.0.2 is not listed. You would need to have:
50573 </para>
50574 <literallayout class="monospaced">
50575 dnslists = a.b.c==127.0.0.1,127.0.0.2
50576 </literallayout>
50577 <para>
50578 for the condition to be true.
50579 </para>
50580 </listitem>
50581 </itemizedlist>
50582 <para>
50583 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50584 the precise opposite of the behaviour above. Thus:
50585 </para>
50586 <itemizedlist>
50587 <listitem>
50588 <para>
50589 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
50590 addresses matches one of the listed addresses. Consider:
50591 </para>
50592 <literallayout class="monospaced">
50593 dnslists = a.b.c!&amp;0.0.0.1
50594 </literallayout>
50595 <para>
50596 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50597 false because 127.0.0.1 matches.
50598 </para>
50599 </listitem>
50600 <listitem>
50601 <para>
50602 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
50603 looked up IP address that does not match. Consider:
50604 </para>
50605 <literallayout class="monospaced">
50606 dnslists = a.b.c!=&amp;0.0.0.1
50607 </literallayout>
50608 <para>
50609 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50610 true, because 127.0.0.2 does not match. You would need to have:
50611 </para>
50612 <literallayout class="monospaced">
50613 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
50614 </literallayout>
50615 <para>
50616 for the condition to be false.
50617 </para>
50618 </listitem>
50619 </itemizedlist>
50620 <para>
50621 When the DNS lookup yields only a single IP address, there is no difference
50622 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
50623 </para>
50624 </section>
50625 <section id="SECTmordetinf">
50626 <title>Detailed information from merged DNS lists</title>
50627 <para>
50628 <indexterm role="concept">
50629 <primary>DNS list</primary>
50630 <secondary>information from merged</secondary>
50631 </indexterm>
50632 When the facility for restricting the matching IP values in a DNS list is used,
50633 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50634 the true reason for rejection. This happens when lists are merged and the IP
50635 address in the A record is used to distinguish them; unfortunately there is
50636 only one TXT record. One way round this is not to use merged lists, but that
50637 can be inefficient because it requires multiple DNS lookups where one would do
50638 in the vast majority of cases when the host of interest is not on any of the
50639 lists.
50640 </para>
50641 <para>
50642 A less inefficient way of solving this problem is available. If
50643 two domain names, comma-separated, are given, the second is used first to
50644 do an initial check, making use of any IP value restrictions that are set.
50645 If there is a match, the first domain is used, without any IP value
50646 restrictions, to get the TXT record. As a byproduct of this, there is also
50647 a check that the IP being tested is indeed on the first list. The first
50648 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
50649 </para>
50650 <literallayout class="monospaced">
50651 reject message  = \
50652          rejected because $sender_host_address is blacklisted \
50653          at $dnslist_domain\n$dnslist_text
50654        dnslists = \
50655          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50656          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50657 </literallayout>
50658 <para>
50659 For the first blacklist item, this starts by doing a lookup in
50660 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50661 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50662 value, and as long as something is found, it looks for the corresponding TXT
50663 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50664 The second blacklist item is processed similarly.
50665 </para>
50666 <para>
50667 If you are interested in more than one merged list, the same list must be
50668 given several times, but because the results of the DNS lookups are cached,
50669 the DNS calls themselves are not repeated. For example:
50670 </para>
50671 <literallayout class="monospaced">
50672 reject dnslists = \
50673          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50674          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50675          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50676          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50677 </literallayout>
50678 <para>
50679 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50680 values matches (or if no record is found), this is the only lookup that is
50681 done. Only if there is a match is one of the more specific lists consulted.
50682 </para>
50683 </section>
50684 <section id="SECTmorednslistslast">
50685 <title>DNS lists and IPv6</title>
50686 <para>
50687 <indexterm role="concept">
50688 <primary>IPv6</primary>
50689 <secondary>DNS black lists</secondary>
50690 </indexterm>
50691 <indexterm role="concept">
50692 <primary>DNS list</primary>
50693 <secondary>IPv6 usage</secondary>
50694 </indexterm>
50695 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50696 nibble by nibble. For example, if the calling host&#x2019;s IP address is
50697 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50698 </para>
50699 <literallayout class="monospaced">
50700 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50701   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50702 </literallayout>
50703 <para>
50704 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50705 lists contain wildcard records, intended for IPv4, that interact badly with
50706 IPv6. For example, the DNS entry
50707 </para>
50708 <literallayout class="monospaced">
50709 *.3.some.list.example.    A    127.0.0.1
50710 </literallayout>
50711 <para>
50712 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50713 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50714 </para>
50715 <para>
50716 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50717 <option>condition</option> condition, as in this example:
50718 </para>
50719 <literallayout class="monospaced">
50720 deny   condition = ${if isip4{$sender_host_address}}
50721        dnslists  = some.list.example
50722 </literallayout>
50723 </section>
50724 <section id="SECTratelimiting">
50725 <title>Rate limiting incoming messages</title>
50726 <para>
50727 <indexterm role="concept">
50728 <primary>rate limiting</primary>
50729 <secondary>client sending</secondary>
50730 </indexterm>
50731 <indexterm role="concept">
50732 <primary>limiting client sending rates</primary>
50733 </indexterm>
50734 <indexterm role="option">
50735 <primary><option>smtp_ratelimit_*</option></primary>
50736 </indexterm>
50737 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
50738 which clients can send email. This is more powerful than the
50739 <option>smtp_ratelimit_*</option> options, because those options control the rate of
50740 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
50741 works across all connections (concurrent and sequential) from the same client
50742 host. The syntax of the <option>ratelimit</option> condition is:
50743 </para>
50744 <literallayout>
50745 <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;
50746 </literallayout>
50747 <para>
50748 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
50749 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
50750 </para>
50751 <para>
50752 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
50753 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
50754 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
50755 of <emphasis>p</emphasis>.
50756 </para>
50757 <para>
50758 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
50759 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
50760 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
50761 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
50762 send in each time interval. It also specifies the number of messages permitted
50763 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
50764 constant, you can allow a client to send more messages in a burst without
50765 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
50766 both small, messages must be sent at an even rate.
50767 </para>
50768 <para>
50769 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
50770 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
50771 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
50772 instructions when it is run with no arguments.
50773 </para>
50774 <para>
50775 The key is used to look up the data for calculating the client&#x2019;s average
50776 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
50777 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
50778 which means Exim computes the sending rate of each client host IP address.
50779 By changing the key you can change how Exim identifies clients for the purpose
50780 of ratelimiting. For example, to limit the sending rate of each authenticated
50781 user, independent of the computer they are sending from, set the key to
50782 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
50783 example, <varname>$authenticated_id</varname> is only meaningful if the client has
50784 authenticated (which you can check with the <option>authenticated</option> ACL condition).
50785 </para>
50786 <para>
50787 The lookup key does not have to identify clients: If you want to limit the
50788 rate at which a recipient receives messages, you can use the key
50789 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
50790 ACL.
50791 </para>
50792 <para>
50793 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
50794 lookup key because they alter the meaning of the stored data. This is not true
50795 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
50796 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
50797 parameters Exim forgets past behaviour.
50798 </para>
50799 <para>
50800 Each <option>ratelimit</option> condition can have up to three options. One option
50801 specifies what Exim measures the rate of, and the second specifies how Exim
50802 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
50803 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
50804 The options are separated by a slash, like the other parameters. They may
50805 appear in any order.
50806 </para>
50807 </section>
50808 <section id="ratoptmea">
50809 <title>Ratelimit options for what is being measured</title>
50810 <para>
50811 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
50812 </para>
50813 <para>
50814 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
50815 the default if none of the <option>per_*</option> options is specified.
50816 </para>
50817 <para>
50818 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
50819 best to use this option in the DATA ACL; if it is used in an earlier ACL it
50820 relies on the SIZE parameter specified by the client in its MAIL command,
50821 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
50822 in the configuration with K, M, or G to specify limits in kilobytes,
50823 megabytes, or gigabytes, respectively.
50824 </para>
50825 <para>
50826 The <option>per_rcpt</option> option causes Exim to limit the rate at which
50827 recipients are accepted. To be effective, it would need to be used in
50828 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
50829 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
50830 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
50831 the number of recipients is incremented by the <option>$recipients_count</option>
50832 for the entire message. Note that in either case the rate limiting
50833 engine will see a message with many recipients as a large high-speed
50834 burst.
50835 </para>
50836 <para>
50837 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
50838 condition is processed. This can be used to limit the SMTP command rate.
50839 This command is essentially an alias of <option>per_rcpt</option> to make it clear
50840 that the effect is to limit the rate at which individual commands,
50841 rather than recipients, are accepted.
50842 </para>
50843 </section>
50844 <section id="ratophanfas">
50845 <title>Ratelimit options for handling fast clients</title>
50846 <para>
50847 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
50848 engine can react in two possible ways, depending on the presence of the
50849 <option>strict</option> or <option>leaky</option> options. This is independent of the other
50850 counter-measures (such as rejecting the message) that may be specified by the
50851 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
50852 over-aggressive retry rate preventing it from getting any email through.
50853 </para>
50854 <para>
50855 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
50856 updated. The effect of this is that Exim measures the client&#x2019;s average rate
50857 of attempts to send email, which can be much higher than the maximum it is
50858 actually allowed. If the client is over the limit it may be subjected to
50859 counter-measures by the ACL until it slows down below the maximum rate. If
50860 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
50861 parameter then its computed rate will decay exponentially to 37% of its peak
50862 value. You can work out the time (the number of smoothing periods) that a
50863 client is subjected to counter-measures after an over-limit burst with this
50864 formula:
50865 </para>
50866 <literallayout class="monospaced">
50867         ln(peakrate/maxrate)
50868 </literallayout>
50869 <para>
50870 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
50871 updated if it is above the limit. The effect of this is that Exim measures the
50872 client&#x2019;s average rate of successfully sent email, which cannot be greater than
50873 the maximum allowed. If the client is over the limit it may suffer some
50874 counter-measures (as specified in the ACL), but it will still be able to send
50875 email at the configured maximum rate, whatever the rate of its attempts. This
50876 is generally the better choice if you have clients that retry automatically.
50877 </para>
50878 </section>
50879 <section id="useratlim">
50880 <title>Using rate limiting</title>
50881 <para>
50882 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
50883 when the rate limit is exceeded. This might be anything from logging a warning
50884 (for example, while measuring existing sending rates in order to define
50885 policy), through time delays to slow down fast senders, up to rejecting the
50886 message. For example:
50887 </para>
50888 <literallayout class="monospaced">
50889 # Log all senders' rates
50890 warn ratelimit = 0 / 1h / strict
50891      log_message = Sender rate $sender_rate / $sender_rate_period
50892
50893 # Slow down fast senders; note the need to truncate $sender_rate
50894 # at the decimal point.
50895 warn ratelimit = 100 / 1h / per_rcpt / strict
50896      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
50897                    $sender_rate_limit }s
50898
50899 # Keep authenticated users under control
50900 deny authenticated = *
50901      ratelimit = 100 / 1d / strict / $authenticated_id
50902
50903 # System-wide rate limit
50904 defer message = Sorry, too busy. Try again later.
50905      ratelimit = 10 / 1s / $primary_hostname
50906
50907 # Restrict incoming rate from each host, with a default
50908 # set using a macro and special cases looked up in a table.
50909 defer message = Sender rate exceeds $sender_rate_limit \
50910                messages per $sender_rate_period
50911      ratelimit = ${lookup {$sender_host_address} \
50912                    cdb {DB/ratelimits.cdb} \
50913                    {$value} {RATELIMIT} }
50914 </literallayout>
50915 <para>
50916 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
50917 especially with the <option>per_rcpt</option> option, you may suffer from a performance
50918 bottleneck caused by locking on the ratelimit hints database. Apart from
50919 making your ACLs less complicated, you can reduce the problem by using a
50920 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
50921 this means that Exim will lose its hints data after a reboot (including retry
50922 hints, the callout cache, and ratelimit data).
50923 </para>
50924 </section>
50925 <section id="rearatdat">
50926 <title>Reading ratelimit data without updating</title>
50927 <para>
50928 <indexterm role="concept">
50929 <primary>rate limitint</primary>
50930 <secondary>reading data without updating</secondary>
50931 </indexterm>
50932 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
50933 computes the rate and checks the limit as normal, but it does not update the
50934 saved data. This means that, in relevant ACLs, it is possible to lookup the
50935 existence of a specified (or auto-generated) ratelimit key without incrementing
50936 the ratelimit counter for that key. In order for this to be useful, another ACL
50937 entry must set the rate for the same key (otherwise it will always be zero).
50938 For example:
50939 </para>
50940 <literallayout class="monospaced">
50941 acl_check_connect:
50942   deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
50943        log_message = RATE: $sender_rate/$sender_rate_period \
50944                      (max $sender_rate_limit)
50945 </literallayout>
50946 <literallayout>
50947 <emphasis>... some other logic and tests...</emphasis>
50948 </literallayout>
50949 <literallayout class="monospaced">
50950 acl_check_mail:
50951   warn ratelimit = 100 / 5m / strict / per_cmd
50952        condition = ${if le{$sender_rate}{$sender_rate_limit}}
50953        logwrite  = RATE UPDATE: $sender_rate/$sender_rate_period \
50954                      (max $sender_rate_limit)
50955 </literallayout>
50956 <para>
50957 In this example, the rate is tested and used to deny access (when it is too
50958 high) in the connect ACL, but the actual computation of the remembered rate
50959 happens later, on a per-command basis, in another ACL.
50960 </para>
50961 </section>
50962 <section id="SECTaddressverification">
50963 <title>Address verification</title>
50964 <para>
50965 <indexterm role="concept">
50966 <primary>verifying address</primary>
50967 <secondary>options for</secondary>
50968 </indexterm>
50969 <indexterm role="concept">
50970 <primary>policy control</primary>
50971 <secondary>address verification</secondary>
50972 </indexterm>
50973 Several of the <option>verify</option> conditions described in section
50974 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
50975 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
50976 The verification conditions can be followed by options that modify the
50977 verification process. The options are separated from the keyword and from each
50978 other by slashes, and some of them contain parameters. For example:
50979 </para>
50980 <literallayout class="monospaced">
50981 verify = sender/callout
50982 verify = recipient/defer_ok/callout=10s,defer_ok
50983 </literallayout>
50984 <para>
50985 The first stage of address verification, which always happens, is to run the
50986 address through the routers, in <quote>verify mode</quote>. Routers can detect the
50987 difference between verification and routing for delivery, and their actions can
50988 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
50989 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
50990 The available options are as follows:
50991 </para>
50992 <itemizedlist>
50993 <listitem>
50994 <para>
50995 If the <option>callout</option> option is specified, successful routing to one or more
50996 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
50997 check. Callouts and their sub-options are discussed in the next section.
50998 </para>
50999 </listitem>
51000 <listitem>
51001 <para>
51002 If there is a defer error while doing verification routing, the ACL
51003 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51004 options, the condition is forced to be true instead. Note that this is a main
51005 verification option as well as a suboption for callouts.
51006 </para>
51007 </listitem>
51008 <listitem>
51009 <para>
51010 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51011 discusses the reporting of sender address verification failures.
51012 </para>
51013 </listitem>
51014 <listitem>
51015 <para>
51016 The <option>success_on_redirect</option> option causes verification always to succeed
51017 immediately after a successful redirection. By default, if a redirection
51018 generates just one address, that address is also verified. See further
51019 discussion in section <xref linkend="SECTredirwhilveri"/>.
51020 </para>
51021 </listitem>
51022 </itemizedlist>
51023 <para>
51024 <indexterm role="concept">
51025 <primary>verifying address</primary>
51026 <secondary>differentiating failures</secondary>
51027 </indexterm>
51028 <indexterm role="variable">
51029 <primary><varname>$recipient_verify_failure</varname></primary>
51030 </indexterm>
51031 <indexterm role="variable">
51032 <primary><varname>$sender_verify_failure</varname></primary>
51033 </indexterm>
51034 <indexterm role="variable">
51035 <primary><varname>$acl_verify_message</varname></primary>
51036 </indexterm>
51037 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51038 error message that is associated with the failure. It can be preserved by
51039 coding like this:
51040 </para>
51041 <literallayout class="monospaced">
51042 warn  !verify = sender
51043        set acl_m0 = $acl_verify_message
51044 </literallayout>
51045 <para>
51046 If you are writing your own custom rejection message or log message when
51047 denying access, you can use this variable to include information about the
51048 verification failure.
51049 </para>
51050 <para>
51051 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51052 appropriate) contains one of the following words:
51053 </para>
51054 <itemizedlist>
51055 <listitem>
51056 <para>
51057 <option>qualify</option>: The address was unqualified (no domain), and the message
51058 was neither local nor came from an exempted host.
51059 </para>
51060 </listitem>
51061 <listitem>
51062 <para>
51063 <option>route</option>: Routing failed.
51064 </para>
51065 </listitem>
51066 <listitem>
51067 <para>
51068 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51069 occurred at or before the MAIL command (that is, on initial
51070 connection, HELO, or MAIL).
51071 </para>
51072 </listitem>
51073 <listitem>
51074 <para>
51075 <option>recipient</option>: The RCPT command in a callout was rejected.
51076 </para>
51077 </listitem>
51078 <listitem>
51079 <para>
51080 <option>postmaster</option>: The postmaster check in a callout was rejected.
51081 </para>
51082 </listitem>
51083 </itemizedlist>
51084 <para>
51085 The main use of these variables is expected to be to distinguish between
51086 rejections of MAIL and rejections of RCPT in callouts.
51087 </para>
51088 </section>
51089 <section id="SECTcallver">
51090 <title>Callout verification</title>
51091 <para>
51092 <indexterm role="concept">
51093 <primary>verifying address</primary>
51094 <secondary>by callout</secondary>
51095 </indexterm>
51096 <indexterm role="concept">
51097 <primary>callout</primary>
51098 <secondary>verification</secondary>
51099 </indexterm>
51100 <indexterm role="concept">
51101 <primary>SMTP</primary>
51102 <secondary>callout verification</secondary>
51103 </indexterm>
51104 For non-local addresses, routing verifies the domain, but is unable to do any
51105 checking of the local part. There are situations where some means of verifying
51106 the local part is desirable. One way this can be done is to make an SMTP
51107 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51108 a subsequent host for a recipient address, to see if the host accepts the
51109 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51110 sender address, the callback is not to the client host that is trying to
51111 deliver the message, but to one of the hosts that accepts incoming mail for the
51112 sender&#x2019;s domain.
51113 </para>
51114 <para>
51115 Exim does not do callouts by default. If you want them to happen, you must
51116 request them by setting appropriate options on the <option>verify</option> condition, as
51117 described below. This facility should be used with care, because it can add a
51118 lot of resource usage to the cost of verifying an address. However, Exim does
51119 cache the results of callouts, which helps to reduce the cost. Details of
51120 caching are in section <xref linkend="SECTcallvercache"/>.
51121 </para>
51122 <para>
51123 Recipient callouts are usually used only between hosts that are controlled by
51124 the same administration. For example, a corporate gateway host could use
51125 callouts to check for valid recipients on an internal mailserver. A successful
51126 callout does not guarantee that a real delivery to the address would succeed;
51127 on the other hand, a failing callout does guarantee that a delivery would fail.
51128 </para>
51129 <para>
51130 If the <option>callout</option> option is present on a condition that verifies an address, a
51131 second stage of verification occurs if the address is successfully routed to
51132 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51133 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51134 router that does not set up hosts routes to an <command>smtp</command> transport with a
51135 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
51136 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51137 supplies a host list.
51138 </para>
51139 <para>
51140 The port that is used is taken from the transport, if it is specified and is a
51141 remote transport. (For routers that do verification only, no transport need be
51142 specified.) Otherwise, the default SMTP port is used. If a remote transport
51143 specifies an outgoing interface, this is used; otherwise the interface is not
51144 specified. Likewise, the text that is used for the HELO command is taken from
51145 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
51146 <varname>$smtp_active_hostname</varname> is used.
51147 </para>
51148 <para>
51149 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51150 test whether a bounce message could be delivered to the sender address. The
51151 following SMTP commands are sent:
51152 </para>
51153 <literallayout>
51154 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
51155 <literal>MAIL FROM:&lt;&gt;</literal>
51156 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
51157 <literal>QUIT</literal>
51158 </literallayout>
51159 <para>
51160 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
51161 set to <quote>lmtp</quote>.
51162 </para>
51163 <para>
51164 A recipient callout check is similar. By default, it also uses an empty address
51165 for the sender. This default is chosen because most hosts do not make use of
51166 the sender address when verifying a recipient. Using the same address means
51167 that a single cache entry can be used for each recipient. Some sites, however,
51168 do make use of the sender address when verifying. These are catered for by the
51169 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51170 </para>
51171 <para>
51172 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51173 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51174 Exim tries the next host, if any. If there is a problem with all the remote
51175 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51176 <option>callout</option> option is given, in which case the condition is forced to succeed.
51177 </para>
51178 <para>
51179 <indexterm role="concept">
51180 <primary>SMTP</primary>
51181 <secondary>output flushing, disabling for callout</secondary>
51182 </indexterm>
51183 A callout may take a little time. For this reason, Exim normally flushes SMTP
51184 output before performing a callout in an ACL, to avoid unexpected timeouts in
51185 clients when the SMTP PIPELINING extension is in use. The flushing can be
51186 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51187 </para>
51188 </section>
51189 <section id="CALLaddparcall">
51190 <title>Additional parameters for callouts</title>
51191 <para>
51192 <indexterm role="concept">
51193 <primary>callout</primary>
51194 <secondary>additional parameters for</secondary>
51195 </indexterm>
51196 The <option>callout</option> option can be followed by an equals sign and a number of
51197 optional parameters, separated by commas. For example:
51198 </para>
51199 <literallayout class="monospaced">
51200 verify = recipient/callout=10s,defer_ok
51201 </literallayout>
51202 <para>
51203 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51204 separate verify options, is retained for backwards compatibility, but is now
51205 deprecated. The additional parameters for <option>callout</option> are as follows:
51206 </para>
51207 <variablelist>
51208 <varlistentry>
51209 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
51210 <listitem>
51211 <para>
51212 <indexterm role="concept">
51213 <primary>callout</primary>
51214 <secondary>timeout, specifying</secondary>
51215 </indexterm>
51216 This specifies the timeout that applies for the callout attempt to each host.
51217 For example:
51218 </para>
51219 <literallayout class="monospaced">
51220 verify = sender/callout=5s
51221 </literallayout>
51222 <para>
51223 The default is 30 seconds. The timeout is used for each response from the
51224 remote host. It is also used for the initial connection, unless overridden by
51225 the <option>connect</option> parameter.
51226 </para>
51227 </listitem></varlistentry>
51228 <varlistentry>
51229 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51230 <listitem>
51231 <para>
51232 <indexterm role="concept">
51233 <primary>callout</primary>
51234 <secondary>connection timeout, specifying</secondary>
51235 </indexterm>
51236 This parameter makes it possible to set a different (usually smaller) timeout
51237 for making the SMTP connection. For example:
51238 </para>
51239 <literallayout class="monospaced">
51240 verify = sender/callout=5s,connect=1s
51241 </literallayout>
51242 <para>
51243 If not specified, this timeout defaults to the general timeout value.
51244 </para>
51245 </listitem></varlistentry>
51246 <varlistentry>
51247 <term><emphasis role="bold">defer_ok</emphasis></term>
51248 <listitem>
51249 <para>
51250 <indexterm role="concept">
51251 <primary>callout</primary>
51252 <secondary>defer, action on</secondary>
51253 </indexterm>
51254 When this parameter is present, failure to contact any host, or any other kind
51255 of temporary error, is treated as success by the ACL. However, the cache is not
51256 updated in this circumstance.
51257 </para>
51258 </listitem></varlistentry>
51259 <varlistentry>
51260 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51261 <listitem>
51262 <para>
51263 <indexterm role="concept">
51264 <primary>callout</primary>
51265 <secondary>full postmaster check</secondary>
51266 </indexterm>
51267 This operates like the <option>postmaster</option> option (see below), but if the check for
51268 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51269 accordance with the specification in RFC 2821. The RFC states that the
51270 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51271 </para>
51272 </listitem></varlistentry>
51273 <varlistentry>
51274 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51275 <listitem>
51276 <para>
51277 <indexterm role="concept">
51278 <primary>callout</primary>
51279 <secondary>sender when verifying header</secondary>
51280 </indexterm>
51281 When verifying addresses in header lines using the <option>header_sender</option>
51282 verification option, Exim behaves by default as if the addresses are envelope
51283 sender addresses from a message. Callout verification therefore tests to see
51284 whether a bounce message could be delivered, by using an empty address in the
51285 MAIL command. However, it is arguable that these addresses might never be used
51286 as envelope senders, and could therefore justifiably reject bounce messages
51287 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51288 address to use in the MAIL command. For example:
51289 </para>
51290 <literallayout class="monospaced">
51291 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
51292 </literallayout>
51293 <para>
51294 This parameter is available only for the <option>header_sender</option> verification option.
51295 </para>
51296 </listitem></varlistentry>
51297 <varlistentry>
51298 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51299 <listitem>
51300 <para>
51301 <indexterm role="concept">
51302 <primary>callout</primary>
51303 <secondary>overall timeout, specifying</secondary>
51304 </indexterm>
51305 This parameter sets an overall timeout for performing a callout verification.
51306 For example:
51307 </para>
51308 <literallayout class="monospaced">
51309 verify = sender/callout=5s,maxwait=30s
51310 </literallayout>
51311 <para>
51312 This timeout defaults to four times the callout timeout for individual SMTP
51313 commands. The overall timeout applies when there is more than one host that can
51314 be tried. The timeout is checked before trying the next host. This prevents
51315 very long delays if there are a large number of hosts and all are timing out
51316 (for example, when network connections are timing out).
51317 </para>
51318 </listitem></varlistentry>
51319 <varlistentry>
51320 <term><emphasis role="bold">no_cache</emphasis></term>
51321 <listitem>
51322 <para>
51323 <indexterm role="concept">
51324 <primary>callout</primary>
51325 <secondary>cache, suppressing</secondary>
51326 </indexterm>
51327 <indexterm role="concept">
51328 <primary>caching callout, suppressing</primary>
51329 </indexterm>
51330 When this parameter is given, the callout cache is neither read nor updated.
51331 </para>
51332 </listitem></varlistentry>
51333 <varlistentry>
51334 <term><emphasis role="bold">postmaster</emphasis></term>
51335 <listitem>
51336 <para>
51337 <indexterm role="concept">
51338 <primary>callout</primary>
51339 <secondary>postmaster; checking</secondary>
51340 </indexterm>
51341 When this parameter is set, a successful callout check is followed by a similar
51342 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51343 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51344 the postmaster check is recorded in a cache record; if it is a failure, this is
51345 used to fail subsequent callouts for the domain without a connection being
51346 made, until the cache record expires.
51347 </para>
51348 </listitem></varlistentry>
51349 <varlistentry>
51350 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51351 <listitem>
51352 <para>
51353 The postmaster check uses an empty sender in the MAIL command by default.
51354 You can use this parameter to do a postmaster check using a different address.
51355 For example:
51356 </para>
51357 <literallayout class="monospaced">
51358 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51359 </literallayout>
51360 <para>
51361 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51362 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51363 </para>
51364 <literallayout class="monospaced">
51365 require  verify = sender/callout=postmaster_mailfrom=
51366 </literallayout>
51367 <para>
51368 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51369 account of the sender address. It is assumed that either the empty address or
51370 a fixed non-empty address will be used. All that Exim remembers is that the
51371 postmaster check for the domain succeeded or failed.
51372 </para>
51373 </listitem></varlistentry>
51374 <varlistentry>
51375 <term><emphasis role="bold">random</emphasis></term>
51376 <listitem>
51377 <para>
51378 <indexterm role="concept">
51379 <primary>callout</primary>
51380 <secondary><quote>random</quote> check</secondary>
51381 </indexterm>
51382 When this parameter is set, before doing the normal callout check, Exim does a
51383 check for a <quote>random</quote> local part at the same domain. The local part is not
51384 really random &ndash; it is defined by the expansion of the option
51385 <option>callout_random_local_part</option>, which defaults to
51386 </para>
51387 <literallayout class="monospaced">
51388 $primary_host_name-$tod_epoch-testing
51389 </literallayout>
51390 <para>
51391 The idea here is to try to determine whether the remote host accepts all local
51392 parts without checking. If it does, there is no point in doing callouts for
51393 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51394 a cache record, and used to force the current and subsequent callout checks to
51395 succeed without a connection being made, until the cache record expires.
51396 </para>
51397 </listitem></varlistentry>
51398 <varlistentry>
51399 <term><emphasis role="bold">use_postmaster</emphasis></term>
51400 <listitem>
51401 <para>
51402 <indexterm role="concept">
51403 <primary>callout</primary>
51404 <secondary>sender for recipient check</secondary>
51405 </indexterm>
51406 This parameter applies to recipient callouts only. For example:
51407 </para>
51408 <literallayout class="monospaced">
51409 deny  !verify = recipient/callout=use_postmaster
51410 </literallayout>
51411 <para>
51412 <indexterm role="variable">
51413 <primary><varname>$qualify_domain</varname></primary>
51414 </indexterm>
51415 It causes a non-empty postmaster address to be used in the MAIL command when
51416 performing the callout for the recipient, and also for a <quote>random</quote> check if
51417 that is configured. The local part of the address is <literal>postmaster</literal> and the
51418 domain is the contents of <varname>$qualify_domain</varname>.
51419 </para>
51420 </listitem></varlistentry>
51421 <varlistentry>
51422 <term><emphasis role="bold">use_sender</emphasis></term>
51423 <listitem>
51424 <para>
51425 This option applies to recipient callouts only. For example:
51426 </para>
51427 <literallayout class="monospaced">
51428 require  verify = recipient/callout=use_sender
51429 </literallayout>
51430 <para>
51431 It causes the message&#x2019;s actual sender address to be used in the MAIL
51432 command when performing the callout, instead of an empty address. There is no
51433 need to use this option unless you know that the called hosts make use of the
51434 sender when checking recipients. If used indiscriminately, it reduces the
51435 usefulness of callout caching.
51436 </para>
51437 </listitem></varlistentry>
51438 </variablelist>
51439 <para>
51440 If you use any of the parameters that set a non-empty sender for the MAIL
51441 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51442 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51443 usually done between two hosts that are under the same management, and the host
51444 that receives the callouts is not normally configured to do callouts itself.
51445 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51446 these circumstances.
51447 </para>
51448 <para>
51449 However, if you use a non-empty sender address for a callout to an arbitrary
51450 host, there is the likelihood that the remote host will itself initiate a
51451 callout check back to your host. As it is checking what appears to be a message
51452 sender, it is likely to use an empty address in MAIL, thus avoiding a
51453 callout loop. However, to be on the safe side it would be best to set up your
51454 own ACLs so that they do not do sender verification checks when the recipient
51455 is the address you use for header sender or postmaster callout checking.
51456 </para>
51457 <para>
51458 Another issue to think about when using non-empty senders for callouts is
51459 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51460 by the sender/recipient combination; thus, for any given recipient, many more
51461 actual callouts are performed than when an empty sender or postmaster is used.
51462 </para>
51463 </section>
51464 <section id="SECTcallvercache">
51465 <title>Callout caching</title>
51466 <para>
51467 <indexterm role="concept">
51468 <primary>hints database</primary>
51469 <secondary>callout cache</secondary>
51470 </indexterm>
51471 <indexterm role="concept">
51472 <primary>callout</primary>
51473 <secondary>cache, description of</secondary>
51474 </indexterm>
51475 <indexterm role="concept">
51476 <primary>caching</primary>
51477 <secondary>callout</secondary>
51478 </indexterm>
51479 Exim caches the results of callouts in order to reduce the amount of resources
51480 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51481 option. A hints database called <quote>callout</quote> is used for the cache. Two
51482 different record types are used: one records the result of a callout check for
51483 a specific address, and the other records information that applies to the
51484 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51485 </para>
51486 <para>
51487 When an original callout fails, a detailed SMTP error message is given about
51488 the failure. However, for subsequent failures use the cache data, this message
51489 is not available.
51490 </para>
51491 <para>
51492 The expiry times for negative and positive address cache records are
51493 independent, and can be set by the global options <option>callout_negative_expire</option>
51494 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51495 </para>
51496 <para>
51497 If a host gives a negative response to an SMTP connection, or rejects any
51498 commands up to and including
51499 </para>
51500 <literallayout class="monospaced">
51501 MAIL FROM:&lt;&gt;
51502 </literallayout>
51503 <para>
51504 (but not including the MAIL command with a non-empty address),
51505 any callout attempt is bound to fail. Exim remembers such failures in a
51506 domain cache record, which it uses to fail callouts for the domain without
51507 making new connections, until the domain record times out. There are two
51508 separate expiry times for domain cache records:
51509 <option>callout_domain_negative_expire</option> (default 3h) and
51510 <option>callout_domain_positive_expire</option> (default 7d).
51511 </para>
51512 <para>
51513 Domain records expire when the negative expiry time is reached if callouts
51514 cannot be made for the domain, or if the postmaster check failed.
51515 Otherwise, they expire when the positive expiry time is reached. This
51516 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51517 will eventually be noticed.
51518 </para>
51519 <para>
51520 The callout caching mechanism is based on the domain of the address that is
51521 being tested. If the domain routes to several hosts, it is assumed that their
51522 behaviour will be the same.
51523 </para>
51524 </section>
51525 <section id="SECTsenaddver">
51526 <title>Sender address verification reporting</title>
51527 <para>
51528 <indexterm role="concept">
51529 <primary>verifying</primary>
51530 <secondary>suppressing error details</secondary>
51531 </indexterm>
51532 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51533 verification. When sender verification fails in an ACL, the details of the
51534 failure are given as additional output lines before the 550 response to the
51535 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51536 you might see:
51537 </para>
51538 <literallayout class="monospaced">
51539 MAIL FROM:&lt;xyz@abc.example&gt;
51540 250 OK
51541 RCPT TO:&lt;pqr@def.example&gt;
51542 550-Verification failed for &lt;xyz@abc.example&gt;
51543 550-Called:   192.168.34.43
51544 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
51545 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
51546 550 Sender verification failed
51547 </literallayout>
51548 <para>
51549 If more than one RCPT command fails in the same way, the details are given
51550 only for the first of them. However, some administrators do not want to send
51551 out this much information. You can suppress the details by adding
51552 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51553 example:
51554 </para>
51555 <literallayout class="monospaced">
51556 verify = sender/no_details
51557 </literallayout>
51558 </section>
51559 <section id="SECTredirwhilveri">
51560 <title>Redirection while verifying</title>
51561 <para>
51562 <indexterm role="concept">
51563 <primary>verifying</primary>
51564 <secondary>redirection while</secondary>
51565 </indexterm>
51566 <indexterm role="concept">
51567 <primary>address redirection</primary>
51568 <secondary>while verifying</secondary>
51569 </indexterm>
51570 A dilemma arises when a local address is redirected by aliasing or forwarding
51571 during verification: should the generated addresses themselves be verified,
51572 or should the successful expansion of the original address be enough to verify
51573 it? By default, Exim takes the following pragmatic approach:
51574 </para>
51575 <itemizedlist>
51576 <listitem>
51577 <para>
51578 When an incoming address is redirected to just one child address, verification
51579 continues with the child address, and if that fails to verify, the original
51580 verification also fails.
51581 </para>
51582 </listitem>
51583 <listitem>
51584 <para>
51585 When an incoming address is redirected to more than one child address,
51586 verification does not continue. A success result is returned.
51587 </para>
51588 </listitem>
51589 </itemizedlist>
51590 <para>
51591 This seems the most reasonable behaviour for the common use of aliasing as a
51592 way of redirecting different local parts to the same mailbox. It means, for
51593 example, that a pair of alias entries of the form
51594 </para>
51595 <literallayout class="monospaced">
51596 A.Wol:   aw123
51597 aw123:   :fail: Gone away, no forwarding address
51598 </literallayout>
51599 <para>
51600 work as expected, with both local parts causing verification failure. When a
51601 redirection generates more than one address, the behaviour is more like a
51602 mailing list, where the existence of the alias itself is sufficient for
51603 verification to succeed.
51604 </para>
51605 <para>
51606 It is possible, however, to change the default behaviour so that all successful
51607 redirections count as successful verifications, however many new addresses are
51608 generated. This is specified by the <option>success_on_redirect</option> verification
51609 option. For example:
51610 </para>
51611 <literallayout class="monospaced">
51612 require verify = recipient/success_on_redirect/callout=10s
51613 </literallayout>
51614 <para>
51615 In this example, verification succeeds if a router generates a new address, and
51616 the callout does not occur, because no address was routed to a remote host.
51617 </para>
51618 <para>
51619 When verification is being tested via the <option>-bv</option> option, the treatment of
51620 redirections is as just described, unless the <option>-v</option> or any debugging option is
51621 also specified. In that case, full verification is done for every generated
51622 address and a report is output for each of them.
51623 </para>
51624 </section>
51625 <section id="SECTverifyCSA">
51626 <title>Client SMTP authorization (CSA)</title>
51627 <para>
51628 <indexterm role="concept">
51629 <primary>CSA</primary>
51630 <secondary>verifying</secondary>
51631 </indexterm>
51632 Client SMTP Authorization is a system that allows a site to advertise
51633 which machines are and are not permitted to send email. This is done by placing
51634 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
51635 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51636 Authorization checks in Exim are performed by the ACL condition:
51637 </para>
51638 <literallayout class="monospaced">
51639 verify = csa
51640 </literallayout>
51641 <para>
51642 This fails if the client is not authorized. If there is a DNS problem, or if no
51643 valid CSA SRV record is found, or if the client is authorized, the condition
51644 succeeds. These three cases can be distinguished using the expansion variable
51645 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
51646 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
51647 be likely to cause problems for legitimate email.
51648 </para>
51649 <para>
51650 The error messages produced by the CSA code include slightly more
51651 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
51652 looking up the CSA SRV record, or problems looking up the CSA target
51653 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
51654 </para>
51655 <itemizedlist>
51656 <listitem>
51657 <para>
51658 The client&#x2019;s host name is explicitly not authorized.
51659 </para>
51660 </listitem>
51661 <listitem>
51662 <para>
51663 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
51664 </para>
51665 </listitem>
51666 <listitem>
51667 <para>
51668 The client&#x2019;s host name is authorized but it has no valid target IP addresses
51669 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
51670 </para>
51671 </listitem>
51672 <listitem>
51673 <para>
51674 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
51675 that all subdomains must be explicitly authorized.
51676 </para>
51677 </listitem>
51678 </itemizedlist>
51679 <para>
51680 The <option>csa</option> verification condition can take an argument which is the domain to
51681 use for the DNS query. The default is:
51682 </para>
51683 <literallayout class="monospaced">
51684 verify = csa/$sender_helo_name
51685 </literallayout>
51686 <para>
51687 This implementation includes an extension to CSA. If the query domain
51688 is an address literal such as [192.0.2.95], or if it is a bare IP
51689 address, Exim searches for CSA SRV records in the reverse DNS as if
51690 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
51691 meaningful to say:
51692 </para>
51693 <literallayout class="monospaced">
51694 verify = csa/$sender_host_address
51695 </literallayout>
51696 <para>
51697 In fact, this is the check that Exim performs if the client does not say HELO.
51698 This extension can be turned off by setting the main configuration option
51699 <option>dns_csa_use_reverse</option> to be false.
51700 </para>
51701 <para>
51702 If a CSA SRV record is not found for the domain itself, a search
51703 is performed through its parent domains for a record which might be
51704 making assertions about subdomains. The maximum depth of this search is limited
51705 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
51706 default. Exim does not look for CSA SRV records in a top level domain, so the
51707 default settings handle HELO domains as long as seven
51708 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
51709 of legitimate HELO domains.
51710 </para>
51711 <para>
51712 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
51713 direct SRV lookups, this is not sufficient because of the extra parent domain
51714 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
51715 addresses into lookups in the reverse DNS space. The result of a successful
51716 lookup such as:
51717 </para>
51718 <literallayout class="monospaced">
51719 ${lookup dnsdb {csa=$sender_helo_name}}
51720 </literallayout>
51721 <para>
51722 has two space-separated fields: an authorization code and a target host name.
51723 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
51724 authorization required but absent, or <quote>?</quote> for unknown.
51725 </para>
51726 </section>
51727 <section id="SECTverifyPRVS">
51728 <title>Bounce address tag validation</title>
51729 <para>
51730 <indexterm role="concept">
51731 <primary>BATV, verifying</primary>
51732 </indexterm>
51733 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
51734 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
51735 Genuine incoming bounce messages should therefore always be addressed to
51736 recipients that have a valid tag. This scheme is a way of detecting unwanted
51737 bounce messages caused by sender address forgeries (often called <quote>collateral
51738 spam</quote>), because the recipients of such messages do not include valid tags.
51739 </para>
51740 <para>
51741 There are two expansion items to help with the implementation of the BATV
51742 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
51743 the original envelope sender address by using a simple key to add a hash of the
51744 address and some time-based randomizing information. The <option>prvs</option> expansion
51745 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
51746 The syntax of these expansion items is described in section
51747 <xref linkend="SECTexpansionitems"/>.
51748 </para>
51749 <para>
51750 As an example, suppose the secret per-address keys are stored in an MySQL
51751 database. A query to look up the key for an address could be defined as a macro
51752 like this:
51753 </para>
51754 <literallayout class="monospaced">
51755 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
51756                 WHERE sender='${quote_mysql:$prvscheck_address}'\
51757                 }{$value}}
51758 </literallayout>
51759 <para>
51760 Suppose also that the senders who make use of BATV are defined by an address
51761 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
51762 use this:
51763 </para>
51764 <literallayout class="monospaced">
51765 # Bounces: drop unsigned addresses for BATV senders
51766 deny message = This address does not send an unsigned reverse path
51767      senders = :
51768      recipients = +batv_senders
51769
51770 # Bounces: In case of prvs-signed address, check signature.
51771 deny message = Invalid reverse path signature.
51772      senders = :
51773      condition  = ${prvscheck {$local_part@$domain}\
51774                   {PRVSCHECK_SQL}{1}}
51775      !condition = $prvscheck_result
51776 </literallayout>
51777 <para>
51778 The first statement rejects recipients for bounce messages that are addressed
51779 to plain BATV sender addresses, because it is known that BATV senders do not
51780 send out messages with plain sender addresses. The second statement rejects
51781 recipients that are prvs-signed, but with invalid signatures (either because
51782 the key is wrong, or the signature has timed out).
51783 </para>
51784 <para>
51785 A non-prvs-signed address is not rejected by the second statement, because the
51786 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
51787 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
51788 the first argument is a syntactically valid prvs-signed address, the yield is
51789 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
51790 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
51791 of the checks (empty for failure, <quote>1</quote> for success).
51792 </para>
51793 <para revisionflag="changed">
51794 There is one more issue you must consider when implementing prvs-signing:
51795 you have to ensure that the routers accept prvs-signed addresses and
51796 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
51797 router to remove the signature with a configuration along these lines:
51798 </para>
51799 <literallayout class="monospaced">
51800 batv_redirect:
51801   driver = redirect
51802   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
51803 </literallayout>
51804 <para>
51805 This works because, if the third argument of <option>prvscheck</option> is empty, the result
51806 of the expansion of a prvs-signed address is the decoded value of the original
51807 address. This router should probably be the first of your routers that handles
51808 local addresses.
51809 </para>
51810 <para>
51811 To create BATV-signed addresses in the first place, a transport of this form
51812 can be used:
51813 </para>
51814 <literallayout class="monospaced">
51815 external_smtp_batv:
51816   driver = smtp
51817   return_path = ${prvs {$return_path} \
51818                        {${lookup mysql{SELECT \
51819                        secret FROM batv_prvs WHERE \
51820                        sender='${quote_mysql:$sender_address}'} \
51821                        {$value}fail}}}
51822 </literallayout>
51823 <para>
51824 If no key can be found for the existing return path, no signing takes place.
51825 </para>
51826 </section>
51827 <section id="SECTrelaycontrol">
51828 <title>Using an ACL to control relaying</title>
51829 <para>
51830 <indexterm role="concept">
51831 <primary>access control lists (ACLs)</primary>
51832 <secondary>relay control</secondary>
51833 </indexterm>
51834 <indexterm role="concept">
51835 <primary>relaying</primary>
51836 <secondary>control by ACL</secondary>
51837 </indexterm>
51838 <indexterm role="concept">
51839 <primary>policy control</primary>
51840 <secondary>relay control</secondary>
51841 </indexterm>
51842 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
51843 delivers it directly to another host as a result of a remote address contained
51844 within it. Redirecting a local address via an alias or forward file and then
51845 passing the message on to another host is not relaying,
51846 <indexterm role="concept">
51847 <primary><quote>percent hack</quote></primary>
51848 </indexterm>
51849 but a redirection as a result of the <quote>percent hack</quote> is.
51850 </para>
51851 <para>
51852 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
51853 A host which is acting as a gateway or an MX backup is concerned with incoming
51854 relaying from arbitrary hosts to a specific set of domains. On the other hand,
51855 a host which is acting as a smart host for a number of clients is concerned
51856 with outgoing relaying from those clients to the Internet at large. Often the
51857 same host is fulfilling both functions,
51858 but in principle these two kinds of relaying are entirely independent. What is
51859 not wanted is the transmission of mail from arbitrary remote hosts through your
51860 system to arbitrary domains.
51861 </para>
51862 <para>
51863 You can implement relay control by means of suitable statements in the ACL that
51864 runs for each RCPT command. For convenience, it is often easiest to use
51865 Exim&#x2019;s named list facility to define the domains and hosts involved. For
51866 example, suppose you want to do the following:
51867 </para>
51868 <itemizedlist>
51869 <listitem>
51870 <para>
51871 Deliver a number of domains to mailboxes on the local host (or process them
51872 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
51873 <emphasis>my.dom2.example</emphasis>.
51874 </para>
51875 </listitem>
51876 <listitem>
51877 <para>
51878 Relay mail for a number of other domains for which you are the secondary MX.
51879 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
51880 </para>
51881 </listitem>
51882 <listitem>
51883 <para>
51884 Relay mail from the hosts on your local LAN, to whatever domains are involved.
51885 Suppose your LAN is 192.168.45.0/24.
51886 </para>
51887 </listitem>
51888 </itemizedlist>
51889 <para>
51890 In the main part of the configuration, you put the following definitions:
51891 </para>
51892 <literallayout class="monospaced">
51893 domainlist local_domains = my.dom1.example : my.dom2.example
51894 domainlist relay_domains = friend1.example : friend2.example
51895 hostlist   relay_hosts   = 192.168.45.0/24
51896 </literallayout>
51897 <para>
51898 Now you can use these definitions in the ACL that is run for every RCPT
51899 command:
51900 </para>
51901 <literallayout class="monospaced">
51902 acl_check_rcpt:
51903   accept domains = +local_domains : +relay_domains
51904   accept hosts   = +relay_hosts
51905 </literallayout>
51906 <para>
51907 The first statement accepts any RCPT command that contains an address in
51908 the local or relay domains. For any other domain, control passes to the second
51909 statement, which accepts the command only if it comes from one of the relay
51910 hosts. In practice, you will probably want to make your ACL more sophisticated
51911 than this, for example, by including sender and recipient verification. The
51912 default configuration includes a more comprehensive example, which is described
51913 in chapter <xref linkend="CHAPdefconfil"/>.
51914 </para>
51915 </section>
51916 <section id="SECTcheralcon">
51917 <title>Checking a relay configuration</title>
51918 <para>
51919 <indexterm role="concept">
51920 <primary>relaying</primary>
51921 <secondary>checking control of</secondary>
51922 </indexterm>
51923 You can check the relay characteristics of your configuration in the same way
51924 that you can test any ACL behaviour for an incoming SMTP connection, by using
51925 the <option>-bh</option> option to run a fake SMTP session with which you interact.
51926 </para>
51927 <para>
51928 For specifically testing for unwanted relaying, the host
51929 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
51930 host from the host on which Exim is running, using the normal telnet port, you
51931 will see a normal telnet connection message and then quite a long delay. Be
51932 patient. The remote host is making an SMTP connection back to your host, and
51933 trying a number of common probes to test for open relay vulnerability. The
51934 results of the tests will eventually appear on your terminal.
51935 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
51936 </para>
51937 </section>
51938 </chapter>
51939
51940 <chapter id="CHAPexiscan">
51941 <title>Content scanning at ACL time</title>
51942 <para>
51943 <indexterm role="concept" id="IIDcosca" class="startofrange">
51944 <primary>content scanning</primary>
51945 <secondary>at ACL time</secondary>
51946 </indexterm>
51947 The extension of Exim to include content scanning at ACL time, formerly known
51948 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
51949 was integrated into the main source for Exim release 4.50, and Tom continues to
51950 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
51951 specification.
51952 </para>
51953 <para>
51954 It is also possible to scan the content of messages at other times. The
51955 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
51956 scanning after all the ACLs have run. A transport filter can be used to scan
51957 messages at delivery time (see the <option>transport_filter</option> option, described in
51958 chapter <xref linkend="CHAPtransportgeneric"/>).
51959 </para>
51960 <para>
51961 If you want to include the ACL-time content-scanning features when you compile
51962 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
51963 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
51964 </para>
51965 <itemizedlist>
51966 <listitem>
51967 <para>
51968 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
51969 for all MIME parts for SMTP and non-SMTP messages, respectively.
51970 </para>
51971 </listitem>
51972 <listitem>
51973 <para>
51974 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
51975 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
51976 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
51977 </para>
51978 </listitem>
51979 <listitem>
51980 <para>
51981 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
51982 of messages, or parts of messages, for debugging purposes.
51983 </para>
51984 </listitem>
51985 <listitem>
51986 <para>
51987 Additional expansion variables that are set in the new ACL and by the new
51988 conditions.
51989 </para>
51990 </listitem>
51991 <listitem>
51992 <para>
51993 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
51994 </para>
51995 </listitem>
51996 </itemizedlist>
51997 <para>
51998 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
51999 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52000 condition is compiled, in addition to all the other content-scanning features.
52001 </para>
52002 <para>
52003 Content-scanning is continually evolving, and new features are still being
52004 added. While such features are still unstable and liable to incompatible
52005 changes, they are made available in Exim by setting options whose names begin
52006 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52007 this manual. You can find out about them by reading the file called
52008 <filename>doc/experimental.txt</filename>.
52009 </para>
52010 <para>
52011 All the content-scanning facilities work on a MBOX copy of the message that is
52012 temporarily created in a file called:
52013 </para>
52014 <literallayout>
52015 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
52016 </literallayout>
52017 <para>
52018 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52019 expect an MBOX-like structure inside that file. The file is created when the
52020 first content scanning facility is called. Subsequent calls to content
52021 scanning conditions open the same file again. The directory is recursively
52022 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52023 </para>
52024 <literallayout class="monospaced">
52025 control = no_mbox_unspool
52026 </literallayout>
52027 <para>
52028 has been encountered. When the MIME ACL decodes files, they are put into the
52029 same directory by default.
52030 </para>
52031 <section id="SECTscanvirus">
52032 <title>Scanning for viruses</title>
52033 <para>
52034 <indexterm role="concept">
52035 <primary>virus scanning</primary>
52036 </indexterm>
52037 <indexterm role="concept">
52038 <primary>content scanning</primary>
52039 <secondary>for viruses</secondary>
52040 </indexterm>
52041 <indexterm role="concept">
52042 <primary>content scanning</primary>
52043 <secondary>the <option>malware</option> condition</secondary>
52044 </indexterm>
52045 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52046 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52047 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52048 in memory and thus are much faster.
52049 </para>
52050 <para>
52051 <indexterm role="option">
52052 <primary><option>av_scanner</option></primary>
52053 </indexterm>
52054 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52055 file to specify which scanner to use, together with any additional options that
52056 are needed. The basic syntax is as follows:
52057 </para>
52058 <literallayout>
52059 <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>
52060 </literallayout>
52061 <para>
52062 If you do not set <option>av_scanner</option>, it defaults to
52063 </para>
52064 <literallayout class="monospaced">
52065 av_scanner = sophie:/var/run/sophie
52066 </literallayout>
52067 <para>
52068 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
52069 before use. The following scanner types are supported in this release:
52070 </para>
52071 <variablelist>
52072 <varlistentry>
52073 <term><option>aveserver</option></term>
52074 <listitem>
52075 <para>
52076 <indexterm role="concept">
52077 <primary>virus scanners</primary>
52078 <secondary>Kaspersky</secondary>
52079 </indexterm>
52080 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52081 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52082 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
52083 example:
52084 </para>
52085 <literallayout class="monospaced">
52086 av_scanner = aveserver:/var/run/aveserver
52087 </literallayout>
52088 </listitem></varlistentry>
52089 <varlistentry>
52090 <term><option>clamd</option></term>
52091 <listitem>
52092 <para>
52093 <indexterm role="concept">
52094 <primary>virus scanners</primary>
52095 <secondary>clamd</secondary>
52096 </indexterm>
52097 This daemon-type scanner is GPL and free. You can get it at
52098 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52099 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52100 in the MIME ACL. This no longer believed to be necessary. One option is
52101 required: either the path and name of a UNIX socket file, or a hostname or IP
52102 number, and a port, separated by space, as in the second of these examples:
52103 </para>
52104 <literallayout class="monospaced">
52105 av_scanner = clamd:/opt/clamd/socket
52106 av_scanner = clamd:192.168.2.100 1234
52107 </literallayout>
52108 <para>
52109 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52110 contributing the code for this scanner.
52111 </para>
52112 </listitem></varlistentry>
52113 <varlistentry>
52114 <term><option>cmdline</option></term>
52115 <listitem>
52116 <para>
52117 <indexterm role="concept">
52118 <primary>virus scanners</primary>
52119 <secondary>command line interface</secondary>
52120 </indexterm>
52121 This is the keyword for the generic command line scanner interface. It can be
52122 used to attach virus scanners that are invoked from the shell. This scanner
52123 type takes 3 mandatory options:
52124 </para>
52125 <orderedlist numeration="arabic">
52126 <listitem>
52127 <para>
52128 The full path and name of the scanner binary, with all command line options,
52129 and a placeholder (<literal>%s</literal>) for the directory to scan.
52130 </para>
52131 </listitem>
52132 <listitem>
52133 <para>
52134 A regular expression to match against the STDOUT and STDERR output of the
52135 virus scanner. If the expression matches, a virus was found. You must make
52136 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52137 the <quote>trigger</quote> expression.
52138 </para>
52139 </listitem>
52140 <listitem>
52141 <para>
52142 Another regular expression, containing exactly one pair of parentheses, to
52143 match the name of the virus found in the scanners output. This is called the
52144 <quote>name</quote> expression.
52145 </para>
52146 </listitem>
52147 </orderedlist>
52148 <para>
52149 For example, Sophos Sweep reports a virus on a line like this:
52150 </para>
52151 <literallayout class="monospaced">
52152 Virus 'W32/Magistr-B' found in file ./those.bat
52153 </literallayout>
52154 <para>
52155 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52156 name expression, we want to extract the W32/Magistr-B string, so we can match
52157 for the single quotes left and right of it. Altogether, this makes the
52158 configuration setting:
52159 </para>
52160 <literallayout class="monospaced">
52161 av_scanner = cmdline:\
52162              /path/to/sweep -ss -all -rec -archive %s:\
52163              found in file:'(.+)'
52164 </literallayout>
52165 </listitem></varlistentry>
52166 <varlistentry>
52167 <term><option>drweb</option></term>
52168 <listitem>
52169 <para>
52170 <indexterm role="concept">
52171 <primary>virus scanners</primary>
52172 <secondary>DrWeb</secondary>
52173 </indexterm>
52174 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52175 argument, either a full path to a UNIX socket, or an IP address and port
52176 separated by white space, as in these examples:
52177 </para>
52178 <literallayout class="monospaced">
52179 av_scanner = drweb:/var/run/drwebd.sock
52180 av_scanner = drweb:192.168.2.20 31337
52181 </literallayout>
52182 <para>
52183 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52184 is used. Thanks to Alex Miller for contributing the code for this scanner.
52185 </para>
52186 </listitem></varlistentry>
52187 <varlistentry>
52188 <term><option>fsecure</option></term>
52189 <listitem>
52190 <para>
52191 <indexterm role="concept">
52192 <primary>virus scanners</primary>
52193 <secondary>F-Secure</secondary>
52194 </indexterm>
52195 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52196 argument which is the path to a UNIX socket. For example:
52197 </para>
52198 <literallayout class="monospaced">
52199 av_scanner = fsecure:/path/to/.fsav
52200 </literallayout>
52201 <para>
52202 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52203 Thelmen for contributing the code for this scanner.
52204 </para>
52205 </listitem></varlistentry>
52206 <varlistentry>
52207 <term><option>kavdaemon</option></term>
52208 <listitem>
52209 <para>
52210 <indexterm role="concept">
52211 <primary>virus scanners</primary>
52212 <secondary>Kaspersky</secondary>
52213 </indexterm>
52214 This is the scanner daemon of Kaspersky Version 4. This version of the
52215 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52216 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
52217 For example:
52218 </para>
52219 <literallayout class="monospaced">
52220 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52221 </literallayout>
52222 <para>
52223 The default path is <filename>/var/run/AvpCtl</filename>.
52224 </para>
52225 </listitem></varlistentry>
52226 <varlistentry>
52227 <term><option>mksd</option></term>
52228 <listitem>
52229 <para>
52230 <indexterm role="concept">
52231 <primary>virus scanners</primary>
52232 <secondary>mksd</secondary>
52233 </indexterm>
52234 This is a daemon type scanner that is aimed mainly at Polish users, though some
52235 parts of documentation are now available in English. You can get it at
52236 <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
52237 the maximum number of processes used simultaneously to scan the attachments,
52238 provided that the demime facility is employed and also provided that mksd has
52239 been run with at least the same number of child processes. For example:
52240 </para>
52241 <literallayout class="monospaced">
52242 av_scanner = mksd:2
52243 </literallayout>
52244 <para>
52245 You can safely omit this option (the default value is 1).
52246 </para>
52247 </listitem></varlistentry>
52248 <varlistentry>
52249 <term><option>sophie</option></term>
52250 <listitem>
52251 <para>
52252 <indexterm role="concept">
52253 <primary>virus scanners</primary>
52254 <secondary>Sophos and Sophie</secondary>
52255 </indexterm>
52256 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
52257 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
52258 for this scanner type is the path to the UNIX socket that Sophie uses for
52259 client communication. For example:
52260 </para>
52261 <literallayout class="monospaced">
52262 av_scanner = sophie:/tmp/sophie
52263 </literallayout>
52264 <para>
52265 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52266 the option.
52267 </para>
52268 </listitem></varlistentry>
52269 </variablelist>
52270 <para>
52271 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52272 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52273 ACL.
52274 </para>
52275 <para>
52276 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52277 makes it possible to use different scanners. See further below for an example.
52278 The <option>malware</option> condition caches its results, so when you use it multiple times
52279 for the same message, the actual scanning process is only carried out once.
52280 However, using expandable items in <option>av_scanner</option> disables this caching, in
52281 which case each use of the <option>malware</option> condition causes a new scan of the
52282 message.
52283 </para>
52284 <para>
52285 The <option>malware</option> condition takes a right-hand argument that is expanded before
52286 use. It can then be one of
52287 </para>
52288 <itemizedlist>
52289 <listitem>
52290 <para>
52291 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52292 The condition succeeds if a virus was found, and fail otherwise. This is the
52293 recommended usage.
52294 </para>
52295 </listitem>
52296 <listitem>
52297 <para>
52298 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52299 the condition fails immediately.
52300 </para>
52301 </listitem>
52302 <listitem>
52303 <para>
52304 A regular expression, in which case the message is scanned for viruses. The
52305 condition succeeds if a virus is found and its name matches the regular
52306 expression. This allows you to take special actions on certain types of virus.
52307 </para>
52308 </listitem>
52309 </itemizedlist>
52310 <para>
52311 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52312 even if there is a problem with the virus scanner. Otherwise, such a problem
52313 causes the ACL to defer.
52314 </para>
52315 <para>
52316 <indexterm role="variable">
52317 <primary><varname>$malware_name</varname></primary>
52318 </indexterm>
52319 When a virus is found, the condition sets up an expansion variable called
52320 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52321 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52322 logging data.
52323 </para>
52324 <para>
52325 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52326 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52327 <option>malware</option> condition.
52328 </para>
52329 <para>
52330 Here is a very simple scanning example:
52331 </para>
52332 <literallayout class="monospaced">
52333 deny message = This message contains malware ($malware_name)
52334      demime = *
52335      malware = *
52336 </literallayout>
52337 <para>
52338 The next example accepts messages when there is a problem with the scanner:
52339 </para>
52340 <literallayout class="monospaced">
52341 deny message = This message contains malware ($malware_name)
52342      demime = *
52343      malware = */defer_ok
52344 </literallayout>
52345 <para>
52346 The next example shows how to use an ACL variable to scan with both sophie and
52347 aveserver. It assumes you have set:
52348 </para>
52349 <literallayout class="monospaced">
52350 av_scanner = $acl_m0
52351 </literallayout>
52352 <para>
52353 in the main Exim configuration.
52354 </para>
52355 <literallayout class="monospaced">
52356 deny message = This message contains malware ($malware_name)
52357      set acl_m0 = sophie
52358      malware = *
52359
52360 deny message = This message contains malware ($malware_name)
52361      set acl_m0 = aveserver
52362      malware = *
52363 </literallayout>
52364 </section>
52365 <section id="SECTscanspamass">
52366 <title>Scanning with SpamAssassin</title>
52367 <para>
52368 <indexterm role="concept">
52369 <primary>content scanning</primary>
52370 <secondary>for spam</secondary>
52371 </indexterm>
52372 <indexterm role="concept">
52373 <primary>spam scanning</primary>
52374 </indexterm>
52375 <indexterm role="concept">
52376 <primary>SpamAssassin</primary>
52377 </indexterm>
52378 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
52379 score and a report for the message. You can get SpamAssassin at
52380 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52381 installation, you can use CPAN by running:
52382 </para>
52383 <literallayout class="monospaced">
52384 perl -MCPAN -e 'install Mail::SpamAssassin'
52385 </literallayout>
52386 <para>
52387 SpamAssassin has its own set of configuration files. Please review its
52388 documentation to see how you can tweak it. The default installation should work
52389 nicely, however.
52390 </para>
52391 <para>
52392 <indexterm role="option">
52393 <primary><option>spamd_address</option></primary>
52394 </indexterm>
52395 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52396 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52397 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52398 part of the Exim configuration as follows (example):
52399 </para>
52400 <literallayout class="monospaced">
52401 spamd_address = 192.168.99.45 387
52402 </literallayout>
52403 <para>
52404 You do not need to set this option if you use the default. As of version 2.60,
52405 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52406 these, supply <option>spamd_address</option> with an absolute file name instead of a
52407 address/port pair:
52408 </para>
52409 <literallayout class="monospaced">
52410 spamd_address = /var/run/spamd_socket
52411 </literallayout>
52412 <para>
52413 You can have multiple <option>spamd</option> servers to improve scalability. These can
52414 reside on other hardware reachable over the network. To specify multiple
52415 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52416 option, separated with colons:
52417 </para>
52418 <literallayout class="monospaced">
52419 spamd_address = 192.168.2.10 783 : \
52420                 192.168.2.11 783 : \
52421                 192.168.2.12 783
52422 </literallayout>
52423 <para>
52424 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52425 fashion. When a server fails to respond to the connection attempt, all other
52426 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52427 condition defers.
52428 </para>
52429 <para>
52430 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52431 multiple <option>spamd</option> servers.
52432 </para>
52433 <para>
52434 The <option>spamd_address</option> variable is expanded before use if it starts with
52435 a dollar sign. In this case, the expansion may return a string that is
52436 used as the list so that multiple spamd servers can be the result of an
52437 expansion.
52438 </para>
52439 </section>
52440 <section id="SECID206">
52441 <title>Calling SpamAssassin from an Exim ACL</title>
52442 <para>
52443 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52444 </para>
52445 <literallayout class="monospaced">
52446 deny message = This message was classified as SPAM
52447      spam = joe
52448 </literallayout>
52449 <para>
52450 The right-hand side of the <option>spam</option> condition specifies a name. This is
52451 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52452 to scan using a specific profile, but rather use the SpamAssassin system-wide
52453 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52454 However, you must put something on the right-hand side.
52455 </para>
52456 <para>
52457 The name allows you to use per-domain or per-user antispam profiles in
52458 principle, but this is not straightforward in practice, because a message may
52459 have multiple recipients, not necessarily all in the same domain. Because the
52460 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52461 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52462 are not set.
52463 </para>
52464 <para>
52465 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52466 you can put lookups or conditions there. When the right-hand side evaluates to
52467 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52468 </para>
52469 <para>
52470 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52471 large ones may cause significant performance degradation. As most spam messages
52472 are quite small, it is recommended that you do not scan the big ones. For
52473 example:
52474 </para>
52475 <literallayout class="monospaced">
52476 deny message = This message was classified as SPAM
52477      condition = ${if &lt; {$message_size}{10K}}
52478      spam = nobody
52479 </literallayout>
52480 <para>
52481 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
52482 SpamAssassin profile has been matched or exceeded. If you want to use the
52483 <option>spam</option> condition for its side effects (see the variables below), you can make
52484 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52485 </para>
52486 <para>
52487 <indexterm role="concept">
52488 <primary>spam scanning</primary>
52489 <secondary>returned variables</secondary>
52490 </indexterm>
52491 When the <option>spam</option> condition is run, it sets up a number of expansion
52492 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
52493 within ACLs; their values are not retained with the message and so cannot be
52494 used at delivery time.
52495 </para>
52496 <variablelist>
52497 <varlistentry>
52498 <term><varname>$spam_score</varname></term>
52499 <listitem>
52500 <para>
52501 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52502 for inclusion in log or reject messages.
52503 </para>
52504 </listitem></varlistentry>
52505 <varlistentry>
52506 <term><varname>$spam_score_int</varname></term>
52507 <listitem>
52508 <para>
52509 The spam score of the message, multiplied by ten, as an integer value. For
52510 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
52511 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
52512 The integer value is useful for numeric comparisons in
52513 conditions. This variable is special; its value is saved with the message, and
52514 written to Exim&#x2019;s spool file. This means that it can be used during the whole
52515 life of the message on your Exim system, in particular, in routers or
52516 transports during the later delivery phase.
52517 </para>
52518 </listitem></varlistentry>
52519 <varlistentry>
52520 <term><varname>$spam_bar</varname></term>
52521 <listitem>
52522 <para>
52523 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52524 integer part of the spam score value. A spam score of 4.4 would have a
52525 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52526 headers, since MUAs can match on such strings.
52527 </para>
52528 </listitem></varlistentry>
52529 <varlistentry>
52530 <term><varname>$spam_report</varname></term>
52531 <listitem>
52532 <para>
52533 A multiline text table, containing the full SpamAssassin report for the
52534 message. Useful for inclusion in headers or reject messages.
52535 </para>
52536 </listitem></varlistentry>
52537 </variablelist>
52538 <para>
52539 The <option>spam</option> condition caches its results unless expansion in
52540 spamd_address was used. If you call it again with the same user name, it
52541 does not scan again, but rather returns the same values as before.
52542 </para>
52543 <para>
52544 The <option>spam</option> condition returns DEFER if there is any error while running
52545 the message through SpamAssassin or if the expansion of spamd_address
52546 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
52547 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
52548 spam condition, like this:
52549 </para>
52550 <literallayout class="monospaced">
52551 deny message = This message was classified as SPAM
52552      spam    = joe/defer_ok
52553 </literallayout>
52554 <para>
52555 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52556 </para>
52557 <para>
52558 Here is a longer, commented example of the use of the <option>spam</option>
52559 condition:
52560 </para>
52561 <literallayout class="monospaced">
52562 # put headers in all messages (no matter if spam or not)
52563 warn  spam = nobody:true
52564       add_header = X-Spam-Score: $spam_score ($spam_bar)
52565       add_header = X-Spam-Report: $spam_report
52566
52567 # add second subject line with *SPAM* marker when message
52568 # is over threshold
52569 warn  spam = nobody
52570       add_header = Subject: *SPAM* $h_Subject:
52571
52572 # reject spam at high scores (&gt; 12)
52573 deny  message = This message scored $spam_score spam points.
52574       spam = nobody:true
52575       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
52576 </literallayout>
52577 </section>
52578 <section id="SECTscanmimepart">
52579 <title>Scanning MIME parts</title>
52580 <para>
52581 <indexterm role="concept">
52582 <primary>content scanning</primary>
52583 <secondary>MIME parts</secondary>
52584 </indexterm>
52585 <indexterm role="concept">
52586 <primary>MIME content scanning</primary>
52587 </indexterm>
52588 <indexterm role="option">
52589 <primary><option>acl_smtp_mime</option></primary>
52590 </indexterm>
52591 <indexterm role="option">
52592 <primary><option>acl_not_smtp_mime</option></primary>
52593 </indexterm>
52594 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52595 each MIME part of an SMTP message, including multipart types, in the sequence
52596 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52597 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52598 options may both refer to the same ACL if you want the same processing in both
52599 cases.
52600 </para>
52601 <para>
52602 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52603 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52604 the case of a non-SMTP message. However, a MIME ACL is called only if the
52605 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
52606 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52607 result code is sent to the client. In the case of an SMTP message, the
52608 <option>acl_smtp_data</option> ACL is not called when this happens.
52609 </para>
52610 <para>
52611 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52612 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52613 condition to match against the raw MIME part. You can also use the
52614 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52615 <xref linkend="SECTscanregex"/>).
52616 </para>
52617 <para>
52618 At the start of a MIME ACL, a number of variables are set from the header
52619 information for the relevant MIME part. These are described below. The contents
52620 of the MIME part are not by default decoded into a disk file except for MIME
52621 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52622 part into a disk file, you can use the <option>decode</option> condition. The general
52623 syntax is:
52624 </para>
52625 <literallayout>
52626 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
52627 </literallayout>
52628 <para>
52629 The right hand side is expanded before use. After expansion,
52630 the value can be:
52631 </para>
52632 <orderedlist numeration="arabic">
52633 <listitem>
52634 <para>
52635 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
52636 </para>
52637 </listitem>
52638 <listitem>
52639 <para>
52640 The string <quote>default</quote>. In that case, the file is put in the temporary
52641 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
52642 a sequential file name consisting of the message id and a sequence number. The
52643 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
52644 </para>
52645 </listitem>
52646 <listitem>
52647 <para>
52648 A full path name starting with a slash. If the full name is an existing
52649 directory, it is used as a replacement for the default directory. The filename
52650 is then sequentially assigned. If the path does not exist, it is used as
52651 the full path and file name.
52652 </para>
52653 </listitem>
52654 <listitem>
52655 <para>
52656 If the string does not start with a slash, it is used as the
52657 filename, and the default path is then used.
52658 </para>
52659 </listitem>
52660 </orderedlist>
52661 <para>
52662 The <option>decode</option> condition normally succeeds. It is only false for syntax
52663 errors or unusual circumstances such as memory shortages. You can easily decode
52664 a file with its original, proposed filename using
52665 </para>
52666 <literallayout class="monospaced">
52667 decode = $mime_filename
52668 </literallayout>
52669 <para>
52670 However, you should keep in mind that <varname>$mime_filename</varname> might contain
52671 anything. If you place files outside of the default path, they are not
52672 automatically unlinked.
52673 </para>
52674 <para>
52675 For RFC822 attachments (these are messages attached to messages, with a
52676 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
52677 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
52678 variable is set (see below). Attached messages are always decoded to disk
52679 before being checked, and the files are unlinked once the check is done.
52680 </para>
52681 <para>
52682 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
52683 used to match regular expressions against raw and decoded MIME parts,
52684 respectively. They are described in section <xref linkend="SECTscanregex"/>.
52685 </para>
52686 <para>
52687 <indexterm role="concept">
52688 <primary>MIME content scanning</primary>
52689 <secondary>returned variables</secondary>
52690 </indexterm>
52691 The following list describes all expansion variables that are
52692 available in the MIME ACL:
52693 </para>
52694 <variablelist>
52695 <varlistentry>
52696 <term><varname>$mime_boundary</varname></term>
52697 <listitem>
52698 <para>
52699 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
52700 have a boundary string, which is stored in this variable. If the current part
52701 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
52702 contains the empty string.
52703 </para>
52704 </listitem></varlistentry>
52705 <varlistentry>
52706 <term><varname>$mime_charset</varname></term>
52707 <listitem>
52708 <para>
52709 This variable contains the character set identifier, if one was found in the
52710 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
52711 </para>
52712 <literallayout class="monospaced">
52713 us-ascii
52714 gb2312 (Chinese)
52715 iso-8859-1
52716 </literallayout>
52717 <para>
52718 Please note that this value is not normalized, so you should do matches
52719 case-insensitively.
52720 </para>
52721 </listitem></varlistentry>
52722 <varlistentry>
52723 <term><varname>$mime_content_description</varname></term>
52724 <listitem>
52725 <para>
52726 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
52727 header. It can contain a human-readable description of the parts content. Some
52728 implementations repeat the filename for attachments here, but they are usually
52729 only used for display purposes.
52730 </para>
52731 </listitem></varlistentry>
52732 <varlistentry>
52733 <term><varname>$mime_content_disposition</varname></term>
52734 <listitem>
52735 <para>
52736 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
52737 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
52738 </para>
52739 </listitem></varlistentry>
52740 <varlistentry>
52741 <term><varname>$mime_content_id</varname></term>
52742 <listitem>
52743 <para>
52744 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
52745 This is a unique ID that can be used to reference a part from another part.
52746 </para>
52747 </listitem></varlistentry>
52748 <varlistentry>
52749 <term><varname>$mime_content_size</varname></term>
52750 <listitem>
52751 <para>
52752 This variable is set only after the <option>decode</option> modifier (see above) has been
52753 successfully run. It contains the size of the decoded part in kilobytes. The
52754 size is always rounded up to full kilobytes, so only a completely empty part
52755 has a <varname>$mime_content_size</varname> of zero.
52756 </para>
52757 </listitem></varlistentry>
52758 <varlistentry>
52759 <term><varname>$mime_content_transfer_encoding</varname></term>
52760 <listitem>
52761 <para>
52762 This variable contains the normalized content of the
52763 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
52764 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
52765 </para>
52766 </listitem></varlistentry>
52767 <varlistentry>
52768 <term><varname>$mime_content_type</varname></term>
52769 <listitem>
52770 <para>
52771 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
52772 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
52773 are some examples of popular MIME types, as they may appear in this variable:
52774 </para>
52775 <literallayout class="monospaced">
52776 text/plain
52777 text/html
52778 application/octet-stream
52779 image/jpeg
52780 audio/midi
52781 </literallayout>
52782 <para>
52783 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
52784 empty string.
52785 </para>
52786 </listitem></varlistentry>
52787 <varlistentry>
52788 <term><varname>$mime_decoded_filename</varname></term>
52789 <listitem>
52790 <para>
52791 This variable is set only after the <option>decode</option> modifier (see above) has been
52792 successfully run. It contains the full path and file name of the file
52793 containing the decoded data.
52794 </para>
52795 </listitem></varlistentry>
52796 </variablelist>
52797 <para>
52798 <indexterm role="concept">
52799 <primary>RFC 2047</primary>
52800 </indexterm>
52801 </para>
52802 <variablelist>
52803 <varlistentry>
52804 <term><varname>$mime_filename</varname></term>
52805 <listitem>
52806 <para>
52807 This is perhaps the most important of the MIME variables. It contains a
52808 proposed filename for an attachment, if one was found in either the
52809 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
52810 RFC2047 decoded, but no additional sanity checks are done. If no filename was
52811 found, this variable contains the empty string.
52812 </para>
52813 </listitem></varlistentry>
52814 <varlistentry>
52815 <term><varname>$mime_is_coverletter</varname></term>
52816 <listitem>
52817 <para>
52818 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
52819 attached data. It can be used to clamp down on flashy or unnecessarily encoded
52820 content in the cover letter, while not restricting attachments at all.
52821 </para>
52822 <para>
52823 The variable contains 1 (true) for a MIME part believed to be part of the
52824 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
52825 follows:
52826 </para>
52827 <orderedlist numeration="arabic">
52828 <listitem>
52829 <para>
52830 The outermost MIME part of a message is always a cover letter.
52831 </para>
52832 </listitem>
52833 <listitem>
52834 <para>
52835 If a multipart/alternative or multipart/related MIME part is a cover letter,
52836 so are all MIME subparts within that multipart.
52837 </para>
52838 </listitem>
52839 <listitem>
52840 <para>
52841 If any other multipart is a cover letter, the first subpart is a cover letter,
52842 and the rest are attachments.
52843 </para>
52844 </listitem>
52845 <listitem>
52846 <para>
52847 All parts contained within an attachment multipart are attachments.
52848 </para>
52849 </listitem>
52850 </orderedlist>
52851 <para>
52852 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
52853 alternative plain text), while allowing HTML files to be attached. HTML
52854 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
52855 </para>
52856 <literallayout class="monospaced">
52857 deny message = HTML mail is not accepted here
52858 !condition = $mime_is_rfc822
52859 condition = $mime_is_coverletter
52860 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
52861 </literallayout>
52862 </listitem></varlistentry>
52863 <varlistentry>
52864 <term><varname>$mime_is_multipart</varname></term>
52865 <listitem>
52866 <para>
52867 This variable has the value 1 (true) when the current part has the main type
52868 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
52869 Since multipart entities only serve as containers for other parts, you may not
52870 want to carry out specific actions on them.
52871 </para>
52872 </listitem></varlistentry>
52873 <varlistentry>
52874 <term><varname>$mime_is_rfc822</varname></term>
52875 <listitem>
52876 <para>
52877 This variable has the value 1 (true) if the current part is not a part of the
52878 checked message itself, but part of an attached message. Attached message
52879 decoding is fully recursive.
52880 </para>
52881 </listitem></varlistentry>
52882 <varlistentry>
52883 <term><varname>$mime_part_count</varname></term>
52884 <listitem>
52885 <para>
52886 This variable is a counter that is raised for each processed MIME part. It
52887 starts at zero for the very first part (which is usually a multipart). The
52888 counter is per-message, so it is reset when processing RFC822 attachments (see
52889 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
52890 complete, so you can use it in the DATA ACL to determine the number of MIME
52891 parts of a message. For non-MIME messages, this variable contains the value -1.
52892 </para>
52893 </listitem></varlistentry>
52894 </variablelist>
52895 </section>
52896 <section id="SECTscanregex">
52897 <title>Scanning with regular expressions</title>
52898 <para>
52899 <indexterm role="concept">
52900 <primary>content scanning</primary>
52901 <secondary>with regular expressions</secondary>
52902 </indexterm>
52903 <indexterm role="concept">
52904 <primary>regular expressions</primary>
52905 <secondary>content scanning with</secondary>
52906 </indexterm>
52907 You can specify your own custom regular expression matches on the full body of
52908 the message, or on individual MIME parts.
52909 </para>
52910 <para>
52911 The <option>regex</option> condition takes one or more regular expressions as arguments and
52912 matches them against the full message (when called in the DATA ACL) or a raw
52913 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
52914 linewise, with a maximum line length of 32K characters. That means you cannot
52915 have multiline matches with the <option>regex</option> condition.
52916 </para>
52917 <para>
52918 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
52919 to 32K of decoded content (the whole content at once, not linewise). If the
52920 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
52921 is decoded automatically when <option>mime_regex</option> is executed (using default path
52922 and filename values). If the decoded data is larger than  32K, only the first
52923 32K characters are checked.
52924 </para>
52925 <para>
52926 The regular expressions are passed as a colon-separated list. To include a
52927 literal colon, you must double it. Since the whole right-hand side string is
52928 expanded before being used, you must also escape dollar signs and backslashes
52929 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
52930 Here is a simple example that contains two regular expressions:
52931 </para>
52932 <literallayout class="monospaced">
52933 deny message = contains blacklisted regex ($regex_match_string)
52934      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
52935 </literallayout>
52936 <para>
52937 The conditions returns true if any one of the regular expressions matches. The
52938 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
52939 matching regular expression.
52940 </para>
52941 <para>
52942 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
52943 CPU-intensive.
52944 </para>
52945 </section>
52946 <section id="SECTdemimecond">
52947 <title>The demime condition</title>
52948 <para>
52949 <indexterm role="concept">
52950 <primary>content scanning</primary>
52951 <secondary>MIME checking</secondary>
52952 </indexterm>
52953 <indexterm role="concept">
52954 <primary>MIME content scanning</primary>
52955 </indexterm>
52956 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
52957 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
52958 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
52959 ACL functionality, but provides no additional facilities. Please note that this
52960 condition is deprecated and kept only for backward compatibility. You must set
52961 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
52962 use the <option>demime</option> condition.
52963 </para>
52964 <para>
52965 The <option>demime</option> condition unpacks MIME containers in the message. It detects
52966 errors in MIME containers and can match file extensions found in the message
52967 against a list. Using this facility produces files containing the unpacked MIME
52968 parts of the message in the temporary scan directory. If you do antivirus
52969 scanning, it is recommended that you use the <option>demime</option> condition before the
52970 antivirus (<option>malware</option>) condition.
52971 </para>
52972 <para>
52973 On the right-hand side of the <option>demime</option> condition you can pass a
52974 colon-separated list of file extensions that it should match against. For
52975 example:
52976 </para>
52977 <literallayout class="monospaced">
52978 deny message = Found blacklisted file attachment
52979      demime  = vbs:com:bat:pif:prf:lnk
52980 </literallayout>
52981 <para>
52982 If one of the file extensions is found, the condition is true, otherwise it is
52983 false. If there is a temporary error while demimeing (for example, <quote>disk
52984 full</quote>), the condition defers, and the message is temporarily rejected (unless
52985 the condition is on a <option>warn</option> verb).
52986 </para>
52987 <para>
52988 The right-hand side is expanded before being treated as a list, so you can have
52989 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
52990 zero (<quote>0</quote>), no demimeing is done and the condition is false.
52991 </para>
52992 <para>
52993 The <option>demime</option> condition set the following variables:
52994 </para>
52995 <variablelist>
52996 <varlistentry>
52997 <term><varname>$demime_errorlevel</varname></term>
52998 <listitem>
52999 <para>
53000 <indexterm role="variable">
53001 <primary><varname>$demime_errorlevel</varname></primary>
53002 </indexterm>
53003 When an error is detected in a MIME container, this variable contains the
53004 severity of the error, as an integer number. The higher the value, the more
53005 severe the error (the current maximum value is 3). If this variable is unset or
53006 zero, no error occurred.
53007 </para>
53008 </listitem></varlistentry>
53009 <varlistentry>
53010 <term><varname>$demime_reason</varname></term>
53011 <listitem>
53012 <para>
53013 <indexterm role="variable">
53014 <primary><varname>$demime_reason</varname></primary>
53015 </indexterm>
53016 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53017 human-readable text string describing the MIME error that occurred.
53018 </para>
53019 </listitem></varlistentry>
53020 </variablelist>
53021 <variablelist>
53022 <varlistentry>
53023 <term><varname>$found_extension</varname></term>
53024 <listitem>
53025 <para>
53026 <indexterm role="variable">
53027 <primary><varname>$found_extension</varname></primary>
53028 </indexterm>
53029 When the <option>demime</option> condition is true, this variable contains the file
53030 extension it found.
53031 </para>
53032 </listitem></varlistentry>
53033 </variablelist>
53034 <para>
53035 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53036 the <option>demime</option> condition, and are not changed on subsequent calls.
53037 </para>
53038 <para>
53039 If you do not want to check for file extensions, but rather use the <option>demime</option>
53040 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53041 right-hand side value. Here is a more elaborate example of how to use this
53042 facility:
53043 </para>
53044 <literallayout class="monospaced">
53045 # Reject messages with serious MIME container errors
53046 deny  message = Found MIME error ($demime_reason).
53047       demime = *
53048       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
53049
53050 # Reject known virus spreading file extensions.
53051 # Accepting these is pretty much braindead.
53052 deny  message = contains $found_extension file (blacklisted).
53053       demime  = com:vbs:bat:pif:scr
53054
53055 # Freeze .exe and .doc files. Postmaster can
53056 # examine them and eventually thaw them.
53057 deny  log_message = Another $found_extension file.
53058       demime = exe:doc
53059       control = freeze
53060 </literallayout>
53061 <para>
53062 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53063 </para>
53064 </section>
53065 </chapter>
53066
53067 <chapter id="CHAPlocalscan">
53068 <title>Adding a local scan function to Exim</title>
53069 <titleabbrev>Local scan function</titleabbrev>
53070 <para>
53071 <indexterm role="concept" id="IIDlosca" class="startofrange">
53072 <primary><function>local_scan()</function> function</primary>
53073 <secondary>description of</secondary>
53074 </indexterm>
53075 <indexterm role="concept">
53076 <primary>customizing</primary>
53077 <secondary>input scan using C function</secondary>
53078 </indexterm>
53079 <indexterm role="concept">
53080 <primary>policy control</primary>
53081 <secondary>by local scan function</secondary>
53082 </indexterm>
53083 In these days of email worms, viruses, and ever-increasing spam, some sites
53084 want to apply a lot of checking to messages before accepting them.
53085 </para>
53086 <para>
53087 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53088 passing messages to external virus and spam scanning software. You can also do
53089 a certain amount in Exim itself through string expansions and the <option>condition</option>
53090 condition in the ACL that runs after the SMTP DATA command or the ACL for
53091 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53092 </para>
53093 <para>
53094 To allow for further customization to a site&#x2019;s own requirements, there is the
53095 possibility of linking Exim with a private message scanning function, written
53096 in C. If you want to run code that is written in something other than C, you
53097 can of course use a little C stub to call it.
53098 </para>
53099 <para>
53100 The local scan function is run once for every incoming message, at the point
53101 when Exim is just about to accept the message.
53102 It can therefore be used to control non-SMTP messages from local processes as
53103 well as messages arriving via SMTP.
53104 </para>
53105 <para>
53106 Exim applies a timeout to calls of the local scan function, and there is an
53107 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53108 Zero means <quote>no timeout</quote>.
53109 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53110 before calling the local scan function, so that the most common types of crash
53111 are caught. If the timeout is exceeded or one of those signals is caught, the
53112 incoming message is rejected with a temporary error if it is an SMTP message.
53113 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53114 code. The incident is logged on the main and reject logs.
53115 </para>
53116 <section id="SECID207">
53117 <title>Building Exim to use a local scan function</title>
53118 <para>
53119 <indexterm role="concept">
53120 <primary><function>local_scan()</function> function</primary>
53121 <secondary>building Exim to use</secondary>
53122 </indexterm>
53123 To make use of the local scan function feature, you must tell Exim where your
53124 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53125 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53126 directory, so you might set
53127 </para>
53128 <literallayout class="monospaced">
53129 LOCAL_SCAN_SOURCE=Local/local_scan.c
53130 </literallayout>
53131 <para>
53132 for example. The function must be called <function>local_scan()</function>. It is called by
53133 Exim after it has received a message, when the success return code is about to
53134 be sent. This is after all the ACLs have been run. The return code from your
53135 function controls whether the message is actually accepted or not. There is a
53136 commented template function (that just accepts the message) in the file
53137 _src/local_scan.c_.
53138 </para>
53139 <para>
53140 If you want to make use of Exim&#x2019;s run time configuration file to set options
53141 for your <function>local_scan()</function> function, you must also set
53142 </para>
53143 <literallayout class="monospaced">
53144 LOCAL_SCAN_HAS_OPTIONS=yes
53145 </literallayout>
53146 <para>
53147 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53148 </para>
53149 </section>
53150 <section id="SECTapiforloc">
53151 <title>API for local_scan()</title>
53152 <para>
53153 <indexterm role="concept">
53154 <primary><function>local_scan()</function> function</primary>
53155 <secondary>API description</secondary>
53156 </indexterm>
53157 You must include this line near the start of your code:
53158 </para>
53159 <literallayout class="monospaced">
53160 #include "local_scan.h"
53161 </literallayout>
53162 <para>
53163 This header file defines a number of variables and other values, and the
53164 prototype for the function itself. Exim is coded to use unsigned char values
53165 almost exclusively, and one of the things this header defines is a shorthand
53166 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53167 It also contains the following macro definitions, to simplify casting character
53168 strings and pointers to character strings:
53169 </para>
53170 <literallayout class="monospaced">
53171 #define CS   (char *)
53172 #define CCS  (const char *)
53173 #define CSS  (char **)
53174 #define US   (unsigned char *)
53175 #define CUS  (const unsigned char *)
53176 #define USS  (unsigned char **)
53177 </literallayout>
53178 <para>
53179 The function prototype for <function>local_scan()</function> is:
53180 </para>
53181 <literallayout class="monospaced">
53182 extern int local_scan(int fd, uschar **return_text);
53183 </literallayout>
53184 <para>
53185 The arguments are as follows:
53186 </para>
53187 <itemizedlist>
53188 <listitem>
53189 <para>
53190 <option>fd</option> is a file descriptor for the file that contains the body of the message
53191 (the -D file). The file is open for reading and writing, but updating it is not
53192 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53193 </para>
53194 <para>
53195 The descriptor is positioned at character 19 of the file, which is the first
53196 character of the body itself, because the first 19 characters are the message
53197 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53198 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53199 case this changes in some future version.
53200 </para>
53201 </listitem>
53202 <listitem>
53203 <para>
53204 <option>return_text</option> is an address which you can use to return a pointer to a text
53205 string at the end of the function. The value it points to on entry is NULL.
53206 </para>
53207 </listitem>
53208 </itemizedlist>
53209 <para>
53210 The function must return an <option>int</option> value which is one of the following macros:
53211 </para>
53212 <variablelist>
53213 <varlistentry>
53214 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53215 <listitem>
53216 <para>
53217 <indexterm role="variable">
53218 <primary><varname>$local_scan_data</varname></primary>
53219 </indexterm>
53220 The message is accepted. If you pass back a string of text, it is saved with
53221 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53222 newlines are permitted (if there are any, they are turned into spaces) and the
53223 maximum length of text is 1000 characters.
53224 </para>
53225 </listitem></varlistentry>
53226 <varlistentry>
53227 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53228 <listitem>
53229 <para>
53230 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53231 queued without immediate delivery, and is frozen.
53232 </para>
53233 </listitem></varlistentry>
53234 <varlistentry>
53235 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53236 <listitem>
53237 <para>
53238 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53239 queued without immediate delivery.
53240 </para>
53241 </listitem></varlistentry>
53242 <varlistentry>
53243 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53244 <listitem>
53245 <para>
53246 The message is rejected; the returned text is used as an error message which is
53247 passed back to the sender and which is also logged. Newlines are permitted &ndash;
53248 they cause a multiline response for SMTP rejections, but are converted to
53249 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53250 used.
53251 </para>
53252 </listitem></varlistentry>
53253 <varlistentry>
53254 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53255 <listitem>
53256 <para>
53257 The message is temporarily rejected; the returned text is used as an error
53258 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53259 problem</quote> is used.
53260 </para>
53261 </listitem></varlistentry>
53262 <varlistentry>
53263 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53264 <listitem>
53265 <para>
53266 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53267 message is not written to the reject log. It has the effect of unsetting the
53268 <option>rejected_header</option> log selector for just this rejection. If
53269 <option>rejected_header</option> is already unset (see the discussion of the
53270 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53271 same as LOCAL_SCAN_REJECT.
53272 </para>
53273 </listitem></varlistentry>
53274 <varlistentry>
53275 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53276 <listitem>
53277 <para>
53278 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53279 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53280 </para>
53281 </listitem></varlistentry>
53282 </variablelist>
53283 <para>
53284 If the message is not being received by interactive SMTP, rejections are
53285 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53286 <option>-oe</option> command line options.
53287 </para>
53288 </section>
53289 <section id="SECTconoptloc">
53290 <title>Configuration options for local_scan()</title>
53291 <para>
53292 <indexterm role="concept">
53293 <primary><function>local_scan()</function> function</primary>
53294 <secondary>configuration options</secondary>
53295 </indexterm>
53296 It is possible to have option settings in the main configuration file
53297 that set values in static variables in the <function>local_scan()</function> module. If you
53298 want to do this, you must have the line
53299 </para>
53300 <literallayout class="monospaced">
53301 LOCAL_SCAN_HAS_OPTIONS=yes
53302 </literallayout>
53303 <para>
53304 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53305 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53306 file, you must define static variables to hold the option values, and a table
53307 to define them.
53308 </para>
53309 <para>
53310 The table must be a vector called <option>local_scan_options</option>, of type
53311 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53312 and a pointer to the variable that holds the value. The entries must appear in
53313 alphabetical order. Following <option>local_scan_options</option> you must also define a
53314 variable called <option>local_scan_options_count</option> that contains the number of
53315 entries in the table. Here is a short example, showing two kinds of option:
53316 </para>
53317 <literallayout class="monospaced">
53318 static int my_integer_option = 42;
53319 static uschar *my_string_option = US"a default string";
53320
53321 optionlist local_scan_options[] = {
53322   { "my_integer", opt_int,       &amp;my_integer_option },
53323   { "my_string",  opt_stringptr, &amp;my_string_option }
53324 };
53325
53326 int local_scan_options_count =
53327   sizeof(local_scan_options)/sizeof(optionlist);
53328 </literallayout>
53329 <para>
53330 The values of the variables can now be changed from Exim&#x2019;s runtime
53331 configuration file by including a local scan section as in this example:
53332 </para>
53333 <literallayout class="monospaced">
53334 begin local_scan
53335 my_integer = 99
53336 my_string = some string of text...
53337 </literallayout>
53338 <para>
53339 The available types of option data are as follows:
53340 </para>
53341 <variablelist>
53342 <varlistentry>
53343 <term><emphasis role="bold">opt_bool</emphasis></term>
53344 <listitem>
53345 <para>
53346 This specifies a boolean (true/false) option. The address should point to a
53347 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53348 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53349 whether such a variable has been set at all, you can initialize it to
53350 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53351 values.)
53352 </para>
53353 </listitem></varlistentry>
53354 <varlistentry>
53355 <term><emphasis role="bold">opt_fixed</emphasis></term>
53356 <listitem>
53357 <para>
53358 This specifies a fixed point number, such as is used for load averages.
53359 The address should point to a variable of type <literal>int</literal>. The value is stored
53360 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53361 </para>
53362 </listitem></varlistentry>
53363 <varlistentry>
53364 <term><emphasis role="bold">opt_int</emphasis></term>
53365 <listitem>
53366 <para>
53367 This specifies an integer; the address should point to a variable of type
53368 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53369 Exim.
53370 </para>
53371 </listitem></varlistentry>
53372 <varlistentry>
53373 <term><emphasis role="bold">opt_mkint</emphasis></term>
53374 <listitem>
53375 <para>
53376 This is the same as <option>opt_int</option>, except that when such a value is output in a
53377 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53378 printed with the suffix K or M.
53379 </para>
53380 </listitem></varlistentry>
53381 <varlistentry>
53382 <term><emphasis role="bold">opt_octint</emphasis></term>
53383 <listitem>
53384 <para>
53385 This also specifies an integer, but the value is always interpreted as an
53386 octal integer, whether or not it starts with the digit zero, and it is
53387 always output in octal.
53388 </para>
53389 </listitem></varlistentry>
53390 <varlistentry>
53391 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53392 <listitem>
53393 <para>
53394 This specifies a string value; the address must be a pointer to a
53395 variable that points to a string (for example, of type <literal>uschar *</literal>).
53396 </para>
53397 </listitem></varlistentry>
53398 <varlistentry>
53399 <term><emphasis role="bold">opt_time</emphasis></term>
53400 <listitem>
53401 <para>
53402 This specifies a time interval value. The address must point to a variable of
53403 type <literal>int</literal>. The value that is placed there is a number of seconds.
53404 </para>
53405 </listitem></varlistentry>
53406 </variablelist>
53407 <para>
53408 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53409 out the values of all the <function>local_scan()</function> options.
53410 </para>
53411 </section>
53412 <section id="SECID208">
53413 <title>Available Exim variables</title>
53414 <para>
53415 <indexterm role="concept">
53416 <primary><function>local_scan()</function> function</primary>
53417 <secondary>available Exim variables</secondary>
53418 </indexterm>
53419 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53420 are the only ones that are guaranteed to be maintained from release to release.
53421 Note, however, that you can obtain the value of any Exim expansion variable,
53422 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53423 C variables are as follows:
53424 </para>
53425 <variablelist>
53426 <varlistentry>
53427 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
53428 <listitem>
53429 <para>
53430 This variable contains the number of lines in the message&#x2019;s body.
53431 </para>
53432 </listitem></varlistentry>
53433 <varlistentry>
53434 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
53435 <listitem>
53436 <para>
53437 This variable contains the number of binary zero bytes in the message&#x2019;s body.
53438 </para>
53439 </listitem></varlistentry>
53440 <varlistentry>
53441 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
53442 <listitem>
53443 <para>
53444 This variable is set to zero when no debugging is taking place. Otherwise, it
53445 is a bitmap of debugging selectors. Two bits are identified for use in
53446 <function>local_scan()</function>; they are defined as macros:
53447 </para>
53448 <itemizedlist>
53449 <listitem>
53450 <para>
53451 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53452 testing option that is not privileged &ndash; any caller may set it. All the
53453 other selector bits can be set only by admin users.
53454 </para>
53455 </listitem>
53456 <listitem>
53457 <para>
53458 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53459 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53460 of debugging bits.
53461 </para>
53462 </listitem>
53463 </itemizedlist>
53464 <para>
53465 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53466 selected, you should use code like this:
53467 </para>
53468 <literallayout class="monospaced">
53469 if ((debug_selector &amp; D_local_scan) != 0)
53470   debug_printf("xxx", ...);
53471 </literallayout>
53472 </listitem></varlistentry>
53473 <varlistentry>
53474 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
53475 <listitem>
53476 <para>
53477 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53478 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53479 </para>
53480 </listitem></varlistentry>
53481 <varlistentry>
53482 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
53483 <listitem>
53484 <para>
53485 A pointer to a chain of header lines. The <option>header_line</option> structure is
53486 discussed below.
53487 </para>
53488 </listitem></varlistentry>
53489 <varlistentry>
53490 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
53491 <listitem>
53492 <para>
53493 A pointer to the last of the header lines.
53494 </para>
53495 </listitem></varlistentry>
53496 <varlistentry>
53497 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
53498 <listitem>
53499 <para>
53500 The value of the <option>headers_charset</option> configuration option.
53501 </para>
53502 </listitem></varlistentry>
53503 <varlistentry>
53504 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
53505 <listitem>
53506 <para>
53507 This variable is TRUE during a host checking session that is initiated by the
53508 <option>-bh</option> command line option.
53509 </para>
53510 </listitem></varlistentry>
53511 <varlistentry>
53512 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
53513 <listitem>
53514 <para>
53515 The IP address of the interface that received the message, as a string. This
53516 is NULL for locally submitted messages.
53517 </para>
53518 </listitem></varlistentry>
53519 <varlistentry>
53520 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
53521 <listitem>
53522 <para>
53523 The port on which this message was received. When testing with the <option>-bh</option>
53524 command line option, the value of this variable is -1 unless a port has been
53525 specified via the <option>-oMi</option> option.
53526 </para>
53527 </listitem></varlistentry>
53528 <varlistentry>
53529 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
53530 <listitem>
53531 <para>
53532 This variable contains Exim&#x2019;s message id for the incoming message (the value of
53533 <varname>$message_exim_id</varname>) as a zero-terminated string.
53534 </para>
53535 </listitem></varlistentry>
53536 <varlistentry>
53537 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
53538 <listitem>
53539 <para>
53540 The name of the protocol by which the message was received.
53541 </para>
53542 </listitem></varlistentry>
53543 <varlistentry>
53544 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
53545 <listitem>
53546 <para>
53547 The number of accepted recipients.
53548 </para>
53549 </listitem></varlistentry>
53550 <varlistentry>
53551 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
53552 <listitem>
53553 <para>
53554 <indexterm role="concept">
53555 <primary>recipient</primary>
53556 <secondary>adding in local scan</secondary>
53557 </indexterm>
53558 <indexterm role="concept">
53559 <primary>recipient</primary>
53560 <secondary>removing in local scan</secondary>
53561 </indexterm>
53562 The list of accepted recipients, held in a vector of length
53563 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53564 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53565 below). You can delete recipients by removing them from the vector and
53566 adjusting the value in <option>recipients_count</option>. In particular, by setting
53567 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53568 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53569 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53570 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53571 </para>
53572 </listitem></varlistentry>
53573 <varlistentry>
53574 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
53575 <listitem>
53576 <para>
53577 The envelope sender address. For bounce messages this is the empty string.
53578 </para>
53579 </listitem></varlistentry>
53580 <varlistentry>
53581 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
53582 <listitem>
53583 <para>
53584 The IP address of the sending host, as a string. This is NULL for
53585 locally-submitted messages.
53586 </para>
53587 </listitem></varlistentry>
53588 <varlistentry>
53589 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
53590 <listitem>
53591 <para>
53592 The name of the authentication mechanism that was used, or NULL if the message
53593 was not received over an authenticated SMTP connection.
53594 </para>
53595 </listitem></varlistentry>
53596 <varlistentry>
53597 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
53598 <listitem>
53599 <para>
53600 The name of the sending host, if known.
53601 </para>
53602 </listitem></varlistentry>
53603 <varlistentry>
53604 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
53605 <listitem>
53606 <para>
53607 The port on the sending host.
53608 </para>
53609 </listitem></varlistentry>
53610 <varlistentry>
53611 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
53612 <listitem>
53613 <para>
53614 This variable is TRUE for all SMTP input, including BSMTP.
53615 </para>
53616 </listitem></varlistentry>
53617 <varlistentry>
53618 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
53619 <listitem>
53620 <para>
53621 This variable is TRUE for BSMTP input.
53622 </para>
53623 </listitem></varlistentry>
53624 <varlistentry>
53625 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
53626 <listitem>
53627 <para>
53628 The contents of this variable control which pool of memory is used for new
53629 requests. See section <xref linkend="SECTmemhanloc"/> for details.
53630 </para>
53631 </listitem></varlistentry>
53632 </variablelist>
53633 </section>
53634 <section id="SECID209">
53635 <title>Structure of header lines</title>
53636 <para>
53637 The <option>header_line</option> structure contains the members listed below.
53638 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
53639 (see below). You can cause header lines to be ignored (deleted) by setting
53640 their type to *.
53641 </para>
53642 <variablelist>
53643 <varlistentry>
53644 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
53645 <listitem>
53646 <para>
53647 A pointer to the next header line, or NULL for the last line.
53648 </para>
53649 </listitem></varlistentry>
53650 <varlistentry>
53651 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
53652 <listitem>
53653 <para>
53654 A code identifying certain headers that Exim recognizes. The codes are printing
53655 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
53656 Notice in particular that any header line whose type is * is not transmitted
53657 with the message. This flagging is used for header lines that have been
53658 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
53659 lines.) Effectively, * means <quote>deleted</quote>.
53660 </para>
53661 </listitem></varlistentry>
53662 <varlistentry>
53663 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
53664 <listitem>
53665 <para>
53666 The number of characters in the header line, including the terminating and any
53667 internal newlines.
53668 </para>
53669 </listitem></varlistentry>
53670 <varlistentry>
53671 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
53672 <listitem>
53673 <para>
53674 A pointer to the text of the header. It always ends with a newline, followed by
53675 a zero byte. Internal newlines are preserved.
53676 </para>
53677 </listitem></varlistentry>
53678 </variablelist>
53679 </section>
53680 <section id="SECID210">
53681 <title>Structure of recipient items</title>
53682 <para>
53683 The <option>recipient_item</option> structure contains these members:
53684 </para>
53685 <variablelist>
53686 <varlistentry>
53687 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
53688 <listitem>
53689 <para>
53690 This is a pointer to the recipient address as it was received.
53691 </para>
53692 </listitem></varlistentry>
53693 <varlistentry>
53694 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
53695 <listitem>
53696 <para>
53697 This is used in later Exim processing when top level addresses are created by
53698 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
53699 and must always contain -1 at this stage.
53700 </para>
53701 </listitem></varlistentry>
53702 <varlistentry>
53703 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
53704 <listitem>
53705 <para>
53706 If this value is not NULL, bounce messages caused by failing to deliver to the
53707 recipient are sent to the address it contains. In other words, it overrides the
53708 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
53709 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
53710 an unqualified address, Exim qualifies it using the domain from
53711 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
53712 is NULL for all recipients.
53713 </para>
53714 </listitem></varlistentry>
53715 </variablelist>
53716 </section>
53717 <section id="SECID211">
53718 <title>Available Exim functions</title>
53719 <para>
53720 <indexterm role="concept">
53721 <primary><function>local_scan()</function> function</primary>
53722 <secondary>available Exim functions</secondary>
53723 </indexterm>
53724 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
53725 These are the only ones that are guaranteed to be maintained from release to
53726 release:
53727 </para>
53728 <variablelist>
53729 <varlistentry>
53730 <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>
53731 <listitem>
53732 <para>
53733 This function creates a child process that runs the command specified by
53734 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
53735 be NULL if no environment variables are to be passed. A new umask is supplied
53736 for the process in <option>newumask</option>.
53737 </para>
53738 <para>
53739 Pipes to the standard input and output of the new process are set up
53740 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
53741 standard error is cloned to the standard output. If there are any file
53742 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
53743 argument is TRUE, the new process is made into a process group leader.
53744 </para>
53745 <para>
53746 The function returns the pid of the new process, or -1 if things go wrong.
53747 </para>
53748 </listitem></varlistentry>
53749 <varlistentry>
53750 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
53751 <listitem>
53752 <para>
53753 This function waits for a child process to terminate, or for a timeout (in
53754 seconds) to expire. A timeout value of zero means wait as long as it takes. The
53755 return value is as follows:
53756 </para>
53757 <itemizedlist>
53758 <listitem>
53759 <para>
53760 &gt;= 0
53761 </para>
53762 <para>
53763 The process terminated by a normal exit and the value is the process
53764 ending status.
53765 </para>
53766 </listitem>
53767 <listitem>
53768 <para>
53769 &lt; 0 and &gt; &ndash;256
53770 </para>
53771 <para>
53772 The process was terminated by a signal and the value is the negation of the
53773 signal number.
53774 </para>
53775 </listitem>
53776 <listitem>
53777 <para>
53778 &ndash;256
53779 </para>
53780 <para>
53781 The process timed out.
53782 </para>
53783 </listitem>
53784 <listitem>
53785 <para>
53786 &ndash;257
53787 </para>
53788 <para>
53789 The was some other error in wait(); <option>errno</option> is still set.
53790 </para>
53791 </listitem>
53792 </itemizedlist>
53793 </listitem></varlistentry>
53794 <varlistentry>
53795 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
53796 <listitem>
53797 <para>
53798 This function provide you with a means of submitting a new message to
53799 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
53800 want, but this packages it all up for you.) The function creates a pipe,
53801 forks a subprocess that is running
53802 </para>
53803 <literallayout class="monospaced">
53804 exim -t -oem -oi -f &lt;&gt;
53805 </literallayout>
53806 <para>
53807 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
53808 that is connected to the standard input. The yield of the function is the PID
53809 of the subprocess. You can then write a message to the file descriptor, with
53810 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
53811 </para>
53812 <para>
53813 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
53814 finish and to collect its ending status. A timeout value of zero is usually
53815 fine in this circumstance. Unless you have made a mistake with the recipient
53816 addresses, you should get a return code of zero.
53817 </para>
53818 </listitem></varlistentry>
53819 <varlistentry>
53820 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
53821 <listitem>
53822 <para>
53823 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
53824 that it runs is:
53825 </para>
53826 <literallayout>
53827 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
53828 </literallayout>
53829 <para>
53830 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
53831 </para>
53832 </listitem></varlistentry>
53833 <varlistentry>
53834 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
53835 <listitem>
53836 <para>
53837 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
53838 output is written to the standard error stream. If no debugging is selected,
53839 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
53840 conditional on the <literal>local_scan</literal> debug selector by coding like this:
53841 </para>
53842 <literallayout class="monospaced">
53843 if ((debug_selector &amp; D_local_scan) != 0)
53844   debug_printf("xxx", ...);
53845 </literallayout>
53846 </listitem></varlistentry>
53847 <varlistentry>
53848 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
53849 <listitem>
53850 <para>
53851 This is an interface to Exim&#x2019;s string expansion code. The return value is the
53852 expanded string, or NULL if there was an expansion failure.
53853 The C variable <option>expand_string_message</option> contains an error message after an
53854 expansion failure. If expansion does not change the string, the return value is
53855 the pointer to the input string. Otherwise, the return value points to a new
53856 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
53857 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
53858 </para>
53859 </listitem></varlistentry>
53860 <varlistentry>
53861 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53862 <listitem>
53863 <para>
53864 This function allows you to an add additional header line at the end of the
53865 existing ones. The first argument is the type, and should normally be a space
53866 character. The second argument is a format string and any number of
53867 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
53868 if you want, and you must ensure that the string ends with a newline.
53869 </para>
53870 </listitem></varlistentry>
53871 <varlistentry>
53872 <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>
53873 <listitem>
53874 <para>
53875 This function adds a new header line at a specified point in the header
53876 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
53877 </para>
53878 <para>
53879 If <option>name</option> is NULL, the new header is added at the end of the chain if
53880 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
53881 NULL, the header lines are searched for the first non-deleted header that
53882 matches the name. If one is found, the new header is added before it if
53883 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
53884 found header and any adjacent subsequent ones with the same name (even if
53885 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
53886 option controls where the header is added. If it is true, addition is at the
53887 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
53888 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
53889 </para>
53890 <literallayout class="monospaced">
53891 header_add_at_position(TRUE, US"Received", TRUE,
53892   ' ', "X-xxx: ...");
53893 </literallayout>
53894 <para>
53895 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
53896 there may not be if <option>received_header_text</option> expands to an empty string.
53897 </para>
53898 </listitem></varlistentry>
53899 <varlistentry>
53900 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
53901 <listitem>
53902 <para>
53903 This function removes header lines. If <option>occurrence</option> is zero or negative, all
53904 occurrences of the header are removed. If occurrence is greater than zero, that
53905 particular instance of the header is removed. If no header(s) can be found that
53906 match the specification, the function does nothing.
53907 </para>
53908 </listitem></varlistentry>
53909 <varlistentry>
53910 <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>
53911 <listitem>
53912 <para>
53913 This function tests whether the given header has the given name. It is not just
53914 a string comparison, because white space is permitted between the name and the
53915 colon. If the <option>notdel</option> argument is true, a false return is forced for all
53916 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
53917 </para>
53918 <literallayout class="monospaced">
53919 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
53920 </literallayout>
53921 </listitem></varlistentry>
53922 <varlistentry>
53923 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
53924 <listitem>
53925 <para>
53926 <indexterm role="concept">
53927 <primary>base64 encoding</primary>
53928 <secondary>functions for <function>local_scan()</function> use</secondary>
53929 </indexterm>
53930 This function base64-encodes a string, which is passed by address and length.
53931 The text may contain bytes of any value, including zero. The result is passed
53932 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
53933 zero-terminated.
53934 </para>
53935 </listitem></varlistentry>
53936 <varlistentry>
53937 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
53938 <listitem>
53939 <para>
53940 This function decodes a base64-encoded string. Its arguments are a
53941 zero-terminated base64-encoded string and the address of a variable that is set
53942 to point to the result, which is in dynamic memory. The length of the decoded
53943 string is the yield of the function. If the input is invalid base64 data, the
53944 yield is -1. A zero byte is added to the end of the output string to make it
53945 easy to interpret as a C string (assuming it contains no zeros of its own). The
53946 added zero byte is not included in the returned count.
53947 </para>
53948 </listitem></varlistentry>
53949 <varlistentry>
53950 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
53951 <listitem>
53952 <para>
53953 This function checks for a match in a domain list. Domains are always
53954 matched caselessly. The return value is one of the following:
53955 </para>
53956 <literallayout>
53957 <literal>OK     </literal> match succeeded
53958 <literal>FAIL   </literal> match failed
53959 <literal>DEFER  </literal> match deferred
53960 </literallayout>
53961 <para>
53962 DEFER is usually caused by some kind of lookup defer, such as the
53963 inability to contact a database.
53964 </para>
53965 </listitem></varlistentry>
53966 <varlistentry>
53967 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53968 <listitem>
53969 <para>
53970 This function checks for a match in a local part list. The third argument
53971 controls case-sensitivity. The return values are as for
53972 <emphasis>lss_match_domain()</emphasis>.
53973 </para>
53974 </listitem></varlistentry>
53975 <varlistentry>
53976 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53977 <listitem>
53978 <para>
53979 This function checks for a match in an address list. The third argument
53980 controls the case-sensitivity of the local part match. The domain is always
53981 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
53982 </para>
53983 </listitem></varlistentry>
53984 <varlistentry>
53985 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
53986 <listitem>
53987 <para>
53988 This function checks for a match in a host list. The most common usage is
53989 expected to be
53990 </para>
53991 <literallayout class="monospaced">
53992 lss_match_host(sender_host_name, sender_host_address, ...)
53993 </literallayout>
53994 <para>
53995 <indexterm role="variable">
53996 <primary><varname>$sender_host_address</varname></primary>
53997 </indexterm>
53998 An empty address field matches an empty item in the host list. If the host name
53999 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54000 looked up if a host name is required to match an item in the list. The return
54001 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54002 returns ERROR in the case when it had to look up a host name, but the lookup
54003 failed.
54004 </para>
54005 </listitem></varlistentry>
54006 <varlistentry>
54007 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54008 <listitem>
54009 <para>
54010 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
54011 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54012 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54013 them. It specifies to which log or logs the message is written. The remaining
54014 arguments are a format and relevant insertion arguments. The string should not
54015 contain any newlines, not even at the end.
54016 </para>
54017 </listitem></varlistentry>
54018 <varlistentry>
54019 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
54020 <listitem>
54021 <para>
54022 This function adds an additional recipient to the message. The first argument
54023 is the recipient address. If it is unqualified (has no domain), it is qualified
54024 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54025 </para>
54026 <para>
54027 This function does not allow you to specify a private <option>errors_to</option> address (as
54028 described with the structure of <option>recipient_item</option> above), because it pre-dates
54029 the addition of that field to the structure. However, it is easy to add such a
54030 value afterwards. For example:
54031 </para>
54032 <literallayout class="monospaced">
54033  receive_add_recipient(US"monitor@mydom.example", -1);
54034  recipients_list[recipients_count-1].errors_to =
54035    US"postmaster@mydom.example";
54036 </literallayout>
54037 </listitem></varlistentry>
54038 <varlistentry>
54039 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
54040 <listitem>
54041 <para>
54042 This is a convenience function to remove a named recipient from the list of
54043 recipients. It returns true if a recipient was removed, and false if no
54044 matching recipient could be found. The argument must be a complete email
54045 address.
54046 </para>
54047 </listitem></varlistentry>
54048 </variablelist>
54049 <para>
54050 <indexterm role="concept">
54051 <primary>RFC 2047</primary>
54052 </indexterm>
54053 </para>
54054 <variablelist>
54055 <varlistentry>
54056 <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>
54057 <listitem>
54058 <para>
54059 This function decodes strings that are encoded according to RFC 2047. Typically
54060 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54061 from the Q or B encoding into a byte-string. Then, if provided with the name of
54062 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54063 made  to translate the result to the named character set. If this fails, the
54064 binary string is returned with an error message.
54065 </para>
54066 <para>
54067 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54068 maximum MIME word length is enforced. The third argument is the target
54069 encoding, or NULL if no translation is wanted.
54070 </para>
54071 <para>
54072 <indexterm role="concept">
54073 <primary>binary zero</primary>
54074 <secondary>in RFC 2047 decoding</secondary>
54075 </indexterm>
54076 <indexterm role="concept">
54077 <primary>RFC 2047</primary>
54078 <secondary>binary zero in</secondary>
54079 </indexterm>
54080 If a binary zero is encountered in the decoded string, it is replaced by the
54081 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54082 not be 0 because header lines are handled as zero-terminated strings.
54083 </para>
54084 <para>
54085 The function returns the result of processing the string, zero-terminated; if
54086 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54087 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54088 </para>
54089 <para>
54090 If an error is encountered, the function returns NULL and uses the <option>error</option>
54091 argument to return an error message. The variable pointed to by <option>error</option> is
54092 set to NULL if there is no error; it may be set non-NULL even when the function
54093 returns a non-NULL value if decoding was successful, but there was a problem
54094 with translation.
54095 </para>
54096 </listitem></varlistentry>
54097 <varlistentry>
54098 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
54099 <listitem>
54100 <para>
54101 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54102 below.
54103 </para>
54104 </listitem></varlistentry>
54105 <varlistentry>
54106 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54107 <listitem>
54108 <para>
54109 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54110 output stream. You should use this function only when there is an SMTP output
54111 stream, that is, when the incoming message is being received via interactive
54112 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54113 is FALSE. If you want to test for an incoming message from another host (as
54114 opposed to a local process that used the <option>-bs</option> command line option), you can
54115 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54116 is involved.
54117 </para>
54118 <para>
54119 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54120 output function, so it can be used for all forms of SMTP connection.
54121 </para>
54122 <para>
54123 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54124 must start with an appropriate response code: 550 if you are going to return
54125 LOCAL_SCAN_REJECT, 451 if you are going to return
54126 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54127 initial lines of a multi-line response, the code must be followed by a hyphen
54128 to indicate that the line is not the final response line. You must also ensure
54129 that the lines you write terminate with CRLF. For example:
54130 </para>
54131 <literallayout class="monospaced">
54132 smtp_printf("550-this is some extra info\r\n");
54133 return LOCAL_SCAN_REJECT;
54134 </literallayout>
54135 <para>
54136 Note that you can also create multi-line responses by including newlines in
54137 the data returned via the <option>return_text</option> argument. The added value of using
54138 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54139 multiple output lines.
54140 </para>
54141 <para>
54142 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54143 does not automatically flush pending output, and therefore does not test
54144 the state of the stream. (In the main code of Exim, flushing and error
54145 detection is done when Exim is ready for the next SMTP input command.) If
54146 you want to flush the output and check for an error (for example, the
54147 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54148 arguments. It flushes the output stream, and returns a non-zero value if there
54149 is an error.
54150 </para>
54151 </listitem></varlistentry>
54152 <varlistentry>
54153 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
54154 <listitem>
54155 <para>
54156 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
54157 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54158 runs out of memory. See the next section for a discussion of memory handling.
54159 </para>
54160 </listitem></varlistentry>
54161 <varlistentry>
54162 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
54163 <listitem>
54164 <para>
54165 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54166 permanent pool. See the next section for a discussion of memory handling.
54167 </para>
54168 </listitem></varlistentry>
54169 <varlistentry>
54170 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
54171 <listitem>
54172 <para>
54173 See below.
54174 </para>
54175 </listitem></varlistentry>
54176 <varlistentry>
54177 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
54178 <listitem>
54179 <para>
54180 See below.
54181 </para>
54182 </listitem></varlistentry>
54183 <varlistentry>
54184 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
54185 <listitem>
54186 <para>
54187 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
54188 The first makes a copy of an entire string. The second copies up to a maximum
54189 number of characters, indicated by the second argument. The third uses a format
54190 and insertion arguments to create a new string. In each case, the result is a
54191 pointer to a new string in the current memory pool. See the next section for
54192 more discussion.
54193 </para>
54194 </listitem></varlistentry>
54195 </variablelist>
54196 </section>
54197 <section id="SECTmemhanloc">
54198 <title>More about Exim&#x2019;s memory handling</title>
54199 <para>
54200 <indexterm role="concept">
54201 <primary><function>local_scan()</function> function</primary>
54202 <secondary>memory handling</secondary>
54203 </indexterm>
54204 No function is provided for freeing memory, because that is never needed.
54205 The dynamic memory that Exim uses when receiving a message is automatically
54206 recycled if another message is received by the same process (this applies only
54207 to incoming SMTP connections &ndash; other input methods can supply only one
54208 message at a time). After receiving the last message, a reception process
54209 terminates.
54210 </para>
54211 <para>
54212 Because it is recycled, the normal dynamic memory cannot be used for holding
54213 data that must be preserved over a number of incoming messages on the same SMTP
54214 connection. However, Exim in fact uses two pools of dynamic memory; the second
54215 one is not recycled, and can be used for this purpose.
54216 </para>
54217 <para>
54218 If you want to allocate memory that remains available for subsequent messages
54219 in the same SMTP connection, you should set
54220 </para>
54221 <literallayout class="monospaced">
54222 store_pool = POOL_PERM
54223 </literallayout>
54224 <para>
54225 before calling the function that does the allocation. There is no need to
54226 restore the value if you do not need to; however, if you do want to revert to
54227 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54228 set it explicitly to POOL_MAIN.
54229 </para>
54230 <para>
54231 The pool setting applies to all functions that get dynamic memory, including
54232 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54233 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54234 block of memory from the permanent pool while preserving the value of
54235 <option>store_pool</option>.
54236 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54237 </para>
54238 </section>
54239 </chapter>
54240
54241 <chapter id="CHAPsystemfilter">
54242 <title>System-wide message filtering</title>
54243 <para>
54244 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54245 <primary>filter</primary>
54246 <secondary>system filter</secondary>
54247 </indexterm>
54248 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54249 <primary>filtering all mail</primary>
54250 </indexterm>
54251 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54252 <primary>system filter</primary>
54253 </indexterm>
54254 The previous chapters (on ACLs and the local scan function) describe checks
54255 that can be applied to messages before they are accepted by a host. There is
54256 also a mechanism for checking messages once they have been received, but before
54257 they are delivered. This is called the <emphasis>system filter</emphasis>.
54258 </para>
54259 <para>
54260 The system filter operates in a similar manner to users&#x2019; filter files, but it
54261 is run just once per message (however many recipients the message has).
54262 It should not normally be used as a substitute for routing, because <option>deliver</option>
54263 commands in a system router provide new envelope recipient addresses.
54264 The system filter must be an Exim filter. It cannot be a Sieve filter.
54265 </para>
54266 <para>
54267 The system filter is run at the start of a delivery attempt, before any routing
54268 is done. If a message fails to be completely delivered at the first attempt,
54269 the system filter is run again at the start of every retry.
54270 If you want your filter to do something only once per message, you can make use
54271 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54272 prevent it happening on retries.
54273 </para>
54274 <para>
54275 <indexterm role="variable">
54276 <primary><varname>$domain</varname></primary>
54277 </indexterm>
54278 <indexterm role="variable">
54279 <primary><varname>$local_part</varname></primary>
54280 </indexterm>
54281 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54282 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54283 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54284 you want to run a centrally-specified filter for each recipient address
54285 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54286 described in section <xref linkend="SECTperaddfil"/> below.
54287 </para>
54288 <section id="SECID212">
54289 <title>Specifying a system filter</title>
54290 <para>
54291 <indexterm role="concept">
54292 <primary>uid (user id)</primary>
54293 <secondary>system filter</secondary>
54294 </indexterm>
54295 <indexterm role="concept">
54296 <primary>gid (group id)</primary>
54297 <secondary>system filter</secondary>
54298 </indexterm>
54299 The name of the file that contains the system filter must be specified by
54300 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54301 other than root, you must also set <option>system_filter_user</option> and
54302 <option>system_filter_group</option> as appropriate. For example:
54303 </para>
54304 <literallayout class="monospaced">
54305 system_filter = /etc/mail/exim.filter
54306 system_filter_user = exim
54307 </literallayout>
54308 <para>
54309 If a system filter generates any deliveries directly to files or pipes (via the
54310 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54311 specified by setting <option>system_filter_file_transport</option> and
54312 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54313 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54314 by the <option>reply</option> command.
54315 </para>
54316 </section>
54317 <section id="SECID213">
54318 <title>Testing a system filter</title>
54319 <para>
54320 You can run simple tests of a system filter in the same way as for a user
54321 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54322 are permitted only in system filters are recognized.
54323 </para>
54324 <para>
54325 If you want to test the combined effect of a system filter and a user filter,
54326 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54327 </para>
54328 </section>
54329 <section id="SECID214">
54330 <title>Contents of a system filter</title>
54331 <para>
54332 The language used to specify system filters is the same as for users&#x2019; filter
54333 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
54334 mail filtering</emphasis>. However, there are some additional features that are
54335 available only in system filters; these are described in subsequent sections.
54336 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
54337 they cause errors.
54338 </para>
54339 <para>
54340 <indexterm role="concept">
54341 <primary>frozen messages</primary>
54342 <secondary>manual thaw; testing in filter</secondary>
54343 </indexterm>
54344 There are two special conditions which, though available in users&#x2019; filter
54345 files, are designed for use in system filters. The condition <option>first_delivery</option>
54346 is true only for the first attempt at delivering a message, and
54347 <option>manually_thawed</option> is true only if the message has been frozen, and
54348 subsequently thawed by an admin user. An explicit forced delivery counts as a
54349 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54350 </para>
54351 <para>
54352 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54353 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54354 succeed, it will not be tried again.
54355 If you want Exim to retry an unseen delivery until it succeeds, you should
54356 arrange to set it up every time the filter runs.
54357 </para>
54358 <para>
54359 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
54360 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
54361 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54362 to which users&#x2019; filter files can refer.
54363 </para>
54364 </section>
54365 <section id="SECID215">
54366 <title>Additional variable for system filters</title>
54367 <para>
54368 <indexterm role="variable">
54369 <primary><varname>$recipients</varname></primary>
54370 </indexterm>
54371 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54372 of the message (separated by commas and white space), is available in system
54373 filters. It is not available in users&#x2019; filters for privacy reasons.
54374 </para>
54375 </section>
54376 <section id="SECID216">
54377 <title>Defer, freeze, and fail commands for system filters</title>
54378 <para>
54379 <indexterm role="concept">
54380 <primary>freezing messages</primary>
54381 </indexterm>
54382 <indexterm role="concept">
54383 <primary>message</primary>
54384 <secondary>freezing</secondary>
54385 </indexterm>
54386 <indexterm role="concept">
54387 <primary>message</primary>
54388 <secondary>forced failure</secondary>
54389 </indexterm>
54390 <indexterm role="concept">
54391 <primary><option>fail</option></primary>
54392 <secondary>in system filter</secondary>
54393 </indexterm>
54394 <indexterm role="concept">
54395 <primary><option>freeze</option> in system filter</primary>
54396 </indexterm>
54397 <indexterm role="concept">
54398 <primary><option>defer</option> in system filter</primary>
54399 </indexterm>
54400 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54401 always available in system filters, but are not normally enabled in users&#x2019;
54402 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54403 for the <command>redirect</command> router.) These commands can optionally be followed by the
54404 word <option>text</option> and a string containing an error message, for example:
54405 </para>
54406 <literallayout class="monospaced">
54407 fail text "this message looks like spam to me"
54408 </literallayout>
54409 <para>
54410 The keyword <option>text</option> is optional if the next character is a double quote.
54411 </para>
54412 <para>
54413 The <option>defer</option> command defers delivery of the original recipients of the
54414 message. The <option>fail</option> command causes all the original recipients to be failed,
54415 and a bounce message to be created. The <option>freeze</option> command suspends all
54416 delivery attempts for the original recipients. In all cases, any new deliveries
54417 that are specified by the filter are attempted as normal after the filter has
54418 run.
54419 </para>
54420 <para>
54421 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54422 not manually frozen since. This means that automatic freezing by a system
54423 filter can be used as a way of checking out suspicious messages. If a message
54424 is found to be all right, manually unfreezing it allows it to be delivered.
54425 </para>
54426 <para>
54427 <indexterm role="concept">
54428 <primary>log</primary>
54429 <secondary><option>fail</option> command log line</secondary>
54430 </indexterm>
54431 <indexterm role="concept">
54432 <primary><option>fail</option></primary>
54433 <secondary>log line; reducing</secondary>
54434 </indexterm>
54435 The text given with a fail command is used as part of the bounce message as
54436 well as being written to the log. If the message is quite long, this can fill
54437 up a lot of log space when such failures are common. To reduce the size of the
54438 log message, Exim interprets the text in a special way if it starts with the
54439 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
54440 strings is written to the log, and the rest of the text is used in the bounce
54441 message. For example:
54442 </para>
54443 <literallayout class="monospaced">
54444 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
54445      because it contains attachments that we are \
54446      not prepared to receive."
54447 </literallayout>
54448 <para>
54449 <indexterm role="concept">
54450 <primary>loop</primary>
54451 <secondary>caused by <option>fail</option></secondary>
54452 </indexterm>
54453 Take great care with the <option>fail</option> command when basing the decision to fail on
54454 the contents of the message, because the bounce message will of course include
54455 the contents of the original message and will therefore trigger the <option>fail</option>
54456 command again (causing a mail loop) unless steps are taken to prevent this.
54457 Testing the <option>error_message</option> condition is one way to prevent this. You could
54458 use, for example
54459 </para>
54460 <literallayout class="monospaced">
54461 if $message_body contains "this is spam" and not error_message
54462 then fail text "spam is not wanted here" endif
54463 </literallayout>
54464 <para>
54465 though of course that might let through unwanted bounce messages. The
54466 alternative is clever checking of the body and/or headers to detect bounces
54467 generated by the filter.
54468 </para>
54469 <para>
54470 The interpretation of a system filter file ceases after a
54471 <option>defer</option>,
54472 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54473 set up earlier in the filter file are honoured, so you can use a sequence such
54474 as
54475 </para>
54476 <literallayout class="monospaced">
54477 mail ...
54478 freeze
54479 </literallayout>
54480 <para>
54481 to send a specified message when the system filter is freezing (or deferring or
54482 failing) a message. The normal deliveries for the message do not, of course,
54483 take place.
54484 </para>
54485 </section>
54486 <section id="SECTaddremheasys">
54487 <title>Adding and removing headers in a system filter</title>
54488 <para>
54489 <indexterm role="concept">
54490 <primary>header lines</primary>
54491 <secondary>adding; in system filter</secondary>
54492 </indexterm>
54493 <indexterm role="concept">
54494 <primary>header lines</primary>
54495 <secondary>removing; in system filter</secondary>
54496 </indexterm>
54497 <indexterm role="concept">
54498 <primary>filter</primary>
54499 <secondary>header lines; adding/removing</secondary>
54500 </indexterm>
54501 Two filter commands that are available only in system filters are:
54502 </para>
54503 <literallayout class="monospaced">
54504 headers add &lt;string&gt;
54505 headers remove &lt;string&gt;
54506 </literallayout>
54507 <para>
54508 The argument for the <option>headers add</option> is a string that is expanded and then
54509 added to the end of the message&#x2019;s headers. It is the responsibility of the
54510 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54511 space is ignored, and if the string is otherwise empty, or if the expansion is
54512 forced to fail, the command has no effect.
54513 </para>
54514 <para>
54515 You can use <quote>\n</quote> within the string, followed by white space, to specify
54516 continued header lines. More than one header may be added in one command by
54517 including <quote>\n</quote> within the string without any following white space. For
54518 example:
54519 </para>
54520 <literallayout class="monospaced">
54521 headers add "X-header-1: ....\n  \
54522              continuation of X-header-1 ...\n\
54523              X-header-2: ...."
54524 </literallayout>
54525 <para>
54526 Note that the header line continuation white space after the first newline must
54527 be placed before the backslash that continues the input string, because white
54528 space after input continuations is ignored.
54529 </para>
54530 <para>
54531 The argument for <option>headers remove</option> is a colon-separated list of header names.
54532 This command applies only to those headers that are stored with the message;
54533 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54534 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54535 header with the same name, they are all removed.
54536 </para>
54537 <para>
54538 The <option>headers</option> command in a system filter makes an immediate change to the set
54539 of header lines that was received with the message (with possible additions
54540 from ACL processing). Subsequent commands in the system filter operate on the
54541 modified set, which also forms the basis for subsequent message delivery.
54542 Unless further modified during routing or transporting, this set of headers is
54543 used for all recipients of the message.
54544 </para>
54545 <para>
54546 During routing and transporting, the variables that refer to the contents of
54547 header lines refer only to those lines that are in this set. Thus, header lines
54548 that are added by a system filter are visible to users&#x2019; filter files and to all
54549 routers and transports. This contrasts with the manipulation of header lines by
54550 routers and transports, which is not immediate, but which instead is saved up
54551 until the message is actually being written (see section
54552 <xref linkend="SECTheadersaddrem"/>).
54553 </para>
54554 <para>
54555 If the message is not delivered at the first attempt, header lines that were
54556 added by the system filter are stored with the message, and so are still
54557 present at the next delivery attempt. Header lines that were removed are still
54558 present, but marked <quote>deleted</quote> so that they are not transported with the
54559 message. For this reason, it is usual to make the <option>headers</option> command
54560 conditional on <option>first_delivery</option> so that the set of header lines is not
54561 modified more than once.
54562 </para>
54563 <para>
54564 Because header modification in a system filter acts immediately, you have to
54565 use an indirect approach if you want to modify the contents of a header line.
54566 For example:
54567 </para>
54568 <literallayout class="monospaced">
54569 headers add "Old-Subject: $h_subject:"
54570 headers remove "Subject"
54571 headers add "Subject: new subject (was: $h_old-subject:)"
54572 headers remove "Old-Subject"
54573 </literallayout>
54574 </section>
54575 <section id="SECID217">
54576 <title>Setting an errors address in a system filter</title>
54577 <para>
54578 <indexterm role="concept">
54579 <primary>envelope sender</primary>
54580 </indexterm>
54581 In a system filter, if a <option>deliver</option> command is followed by
54582 </para>
54583 <literallayout class="monospaced">
54584 errors_to &lt;some address&gt;
54585 </literallayout>
54586 <para>
54587 in order to change the envelope sender (and hence the error reporting) for that
54588 delivery, any address may be specified. (In a user filter, only the current
54589 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
54590 might use
54591 </para>
54592 <literallayout class="monospaced">
54593 unseen deliver monitor@spying.example errors_to root@local.example
54594 </literallayout>
54595 <para>
54596 to take a copy which would not be sent back to the normal error reporting
54597 address if its delivery failed.
54598 </para>
54599 </section>
54600 <section id="SECTperaddfil">
54601 <title>Per-address filtering</title>
54602 <para>
54603 <indexterm role="variable">
54604 <primary><varname>$domain</varname></primary>
54605 </indexterm>
54606 <indexterm role="variable">
54607 <primary><varname>$local_part</varname></primary>
54608 </indexterm>
54609 In contrast to the system filter, which is run just once per message for each
54610 delivery attempt, it is also possible to set up a system-wide filtering
54611 operation that runs once for each recipient address. In this case, variables
54612 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54613 filter file could be made dependent on them. This is an example of a router
54614 which implements such a filter:
54615 </para>
54616 <literallayout class="monospaced">
54617 central_filter:
54618   check_local_user
54619   driver = redirect
54620   domains = +local_domains
54621   file = /central/filters/$local_part
54622   no_verify
54623   allow_filter
54624   allow_freeze
54625 </literallayout>
54626 <para>
54627 The filter is run in a separate process under its own uid. Therefore, either
54628 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54629 the local user, or the <option>user</option> option must be used to specify which user to
54630 use. If both are set, <option>user</option> overrides.
54631 </para>
54632 <para>
54633 Care should be taken to ensure that none of the commands in the filter file
54634 specify a significant delivery if the message is to go on to be delivered to
54635 its intended recipient. The router will not then claim to have dealt with the
54636 address, so it will be passed on to subsequent routers to be delivered in the
54637 normal way.
54638 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
54639 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
54640 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
54641 </para>
54642 </section>
54643 </chapter>
54644
54645 <chapter id="CHAPmsgproc">
54646 <title>Message processing</title>
54647 <para>
54648 <indexterm role="concept" id="IIDmesproc" class="startofrange">
54649 <primary>message</primary>
54650 <secondary>general processing</secondary>
54651 </indexterm>
54652 Exim performs various transformations on the sender and recipient addresses of
54653 all messages that it handles, and also on the messages&#x2019; header lines. Some of
54654 these are optional and configurable, while others always take place. All of
54655 this processing, except rewriting as a result of routing, and the addition or
54656 removal of header lines while delivering, happens when a message is received,
54657 before it is placed on Exim&#x2019;s queue.
54658 </para>
54659 <para>
54660 Some of the automatic processing takes place by default only for
54661 <quote>locally-originated</quote> messages. This adjective is used to describe messages
54662 that are not received over TCP/IP, but instead are passed to an Exim process on
54663 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
54664 set up by the <option>-bs</option> command line option.
54665 </para>
54666 <para>
54667 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
54668 or ::1) are not considered to be locally-originated. Exim does not treat the
54669 loopback interface specially in any way.
54670 </para>
54671 <para>
54672 If you want the loopback interface to be treated specially, you must ensure
54673 that there are appropriate entries in your ACLs.
54674 </para>
54675 <section id="SECTsubmodnon">
54676 <title>Submission mode for non-local messages</title>
54677 <para>
54678 <indexterm role="concept">
54679 <primary>message</primary>
54680 <secondary>submission</secondary>
54681 </indexterm>
54682 <indexterm role="concept">
54683 <primary>submission mode</primary>
54684 </indexterm>
54685 Processing that happens automatically for locally-originated messages (unless
54686 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
54687 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
54688 state. Submission mode is set by the modifier
54689 </para>
54690 <literallayout class="monospaced">
54691 control = submission
54692 </literallayout>
54693 <para>
54694 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
54695 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
54696 a local submission, and is normally used when the source of the message is
54697 known to be an MUA running on a client host (as opposed to an MTA). For
54698 example, to set submission mode for messages originating on the IPv4 loopback
54699 interface, you could include the following in the MAIL ACL:
54700 </para>
54701 <literallayout class="monospaced">
54702 warn  hosts = 127.0.0.1
54703       control = submission
54704 </literallayout>
54705 <para>
54706 <indexterm role="concept">
54707 <primary><option>sender_retain</option> submission option</primary>
54708 </indexterm>
54709 There are some options that can be used when setting submission mode. A slash
54710 is used to separate options. For example:
54711 </para>
54712 <literallayout class="monospaced">
54713 control = submission/sender_retain
54714 </literallayout>
54715 <para>
54716 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
54717 true and <option>local_from_check</option> false for the current incoming message. The first
54718 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
54719 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
54720 authenticated sender. With this setting, Exim still fixes up messages by adding
54721 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
54722 attempt to check sender authenticity in header lines.
54723 </para>
54724 <para>
54725 When <option>sender_retain</option> is not set, a submission mode setting may specify a
54726 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
54727 example:
54728 </para>
54729 <literallayout class="monospaced">
54730 control = submission/domain=some.domain
54731 </literallayout>
54732 <para>
54733 The domain may be empty. How this value is used is described in sections
54734 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
54735 that allows you to specify the user&#x2019;s full name for inclusion in a created
54736 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
54737 </para>
54738 <literallayout class="monospaced">
54739 accept authenticated = *
54740        control = submission/domain=wonderland.example/\
54741                             name=${lookup {$authenticated_id} \
54742                                    lsearch {/etc/exim/namelist}}
54743 </literallayout>
54744 <para>
54745 Because the name may contain any characters, including slashes, the <option>name</option>
54746 option must be given last. The remainder of the string is used as the name. For
54747 the example above, if <filename>/etc/exim/namelist</filename> contains:
54748 </para>
54749 <literallayout class="monospaced">
54750 bigegg:  Humpty Dumpty
54751 </literallayout>
54752 <para>
54753 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
54754 line would be:
54755 </para>
54756 <literallayout class="monospaced">
54757 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
54758 </literallayout>
54759 <para>
54760 <indexterm role="concept">
54761 <primary>return path</primary>
54762 <secondary>in submission mode</secondary>
54763 </indexterm>
54764 By default, submission mode forces the return path to the same address as is
54765 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
54766 specified, the return path is also left unchanged.
54767 </para>
54768 <para>
54769 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
54770 ACL. This means that any sender checks performed before the fix-ups use the
54771 untrusted sender address specified by the user, not the trusted sender address
54772 specified by submission mode. Although this might be slightly unexpected, it
54773 does mean that you can configure ACL checks to spot that a user is trying to
54774 spoof another&#x2019;s address.
54775 </para>
54776 </section>
54777 <section id="SECTlineendings">
54778 <title>Line endings</title>
54779 <para>
54780 <indexterm role="concept">
54781 <primary>line endings</primary>
54782 </indexterm>
54783 <indexterm role="concept">
54784 <primary>carriage return</primary>
54785 </indexterm>
54786 <indexterm role="concept">
54787 <primary>linefeed</primary>
54788 </indexterm>
54789 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
54790 linefeed) is the line ending for messages transmitted over the Internet using
54791 SMTP over TCP/IP. However, within individual operating systems, different
54792 conventions are used. For example, Unix-like systems use just LF, but others
54793 use CRLF or just CR.
54794 </para>
54795 <para>
54796 Exim was designed for Unix-like systems, and internally, it stores messages
54797 using the system&#x2019;s convention of a single LF as a line terminator. When
54798 receiving a message, all line endings are translated to this standard format.
54799 Originally, it was thought that programs that passed messages directly to an
54800 MTA within an operating system would use that system&#x2019;s convention. Experience
54801 has shown that this is not the case; for example, there are Unix applications
54802 that use CRLF in this circumstance. For this reason, and for compatibility with
54803 other MTAs, the way Exim handles line endings for all messages is now as
54804 follows:
54805 </para>
54806 <itemizedlist>
54807 <listitem>
54808 <para>
54809 LF not preceded by CR is treated as a line ending.
54810 </para>
54811 </listitem>
54812 <listitem>
54813 <para>
54814 CR is treated as a line ending; if it is immediately followed by LF, the LF
54815 is ignored.
54816 </para>
54817 </listitem>
54818 <listitem>
54819 <para>
54820 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
54821 nor a local message in the state where a line containing only a dot is a
54822 terminator.
54823 </para>
54824 </listitem>
54825 <listitem>
54826 <para>
54827 If a bare CR is encountered within a header line, an extra space is added after
54828 the line terminator so as not to end the header line. The reasoning behind this
54829 is that bare CRs in header lines are most likely either to be mistakes, or
54830 people trying to play silly games.
54831 </para>
54832 </listitem>
54833 <listitem>
54834 <para>
54835 If the first header line received in a message ends with CRLF, a subsequent
54836 bare LF in a header line is treated in the same way as a bare CR in a header
54837 line.
54838 </para>
54839 </listitem>
54840 </itemizedlist>
54841 </section>
54842 <section id="SECID218">
54843 <title>Unqualified addresses</title>
54844 <para>
54845 <indexterm role="concept">
54846 <primary>unqualified addresses</primary>
54847 </indexterm>
54848 <indexterm role="concept">
54849 <primary>address</primary>
54850 <secondary>qualification</secondary>
54851 </indexterm>
54852 By default, Exim expects every envelope address it receives from an external
54853 host to be fully qualified. Unqualified addresses cause negative responses to
54854 SMTP commands. However, because SMTP is used as a means of transporting
54855 messages from MUAs running on personal workstations, there is sometimes a
54856 requirement to accept unqualified addresses from specific hosts or IP networks.
54857 </para>
54858 <para>
54859 Exim has two options that separately control which hosts may send unqualified
54860 sender or recipient addresses in SMTP commands, namely
54861 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
54862 cases, if an unqualified address is accepted, it is qualified by adding the
54863 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
54864 </para>
54865 <para>
54866 <indexterm role="option">
54867 <primary><option>qualify_domain</option></primary>
54868 </indexterm>
54869 <indexterm role="option">
54870 <primary><option>qualify_recipient</option></primary>
54871 </indexterm>
54872 Unqualified addresses in header lines are automatically qualified for messages
54873 that are locally originated, unless the <option>-bnq</option> option is given on the command
54874 line. For messages received over SMTP, unqualified addresses in header lines
54875 are qualified only if unqualified addresses are permitted in SMTP commands. In
54876 other words, such qualification is also controlled by
54877 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
54878 </para>
54879 </section>
54880 <section id="SECID219">
54881 <title>The UUCP From line</title>
54882 <para>
54883 <indexterm role="concept">
54884 <primary><quote>From</quote> line</primary>
54885 </indexterm>
54886 <indexterm role="concept">
54887 <primary>UUCP</primary>
54888 <secondary><quote>From</quote> line</secondary>
54889 </indexterm>
54890 <indexterm role="concept">
54891 <primary>sender</primary>
54892 <secondary>address</secondary>
54893 </indexterm>
54894 <indexterm role="option">
54895 <primary><option>uucp_from_pattern</option></primary>
54896 </indexterm>
54897 <indexterm role="option">
54898 <primary><option>uucp_from_sender</option></primary>
54899 </indexterm>
54900 <indexterm role="concept">
54901 <primary>envelope sender</primary>
54902 </indexterm>
54903 <indexterm role="concept">
54904 <primary>Sendmail compatibility</primary>
54905 <secondary><quote>From</quote> line</secondary>
54906 </indexterm>
54907 Messages that have come from UUCP (and some other applications) often begin
54908 with a line containing the envelope sender and a timestamp, following the word
54909 <quote>From</quote>. Examples of two common formats are:
54910 </para>
54911 <literallayout class="monospaced">
54912 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
54913 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
54914 </literallayout>
54915 <para>
54916 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
54917 Exim recognizes such lines at the start of messages that are submitted to it
54918 via the command line (that is, on the standard input). It does not recognize
54919 such lines in incoming SMTP messages, unless the sending host matches
54920 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
54921 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
54922 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
54923 default value matches the two common cases shown above and puts the address
54924 that follows <quote>From</quote> into <varname>$1</varname>.
54925 </para>
54926 <para>
54927 <indexterm role="concept">
54928 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54929 <secondary>in <quote>From </quote> line handling</secondary>
54930 </indexterm>
54931 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
54932 a trusted user, the message&#x2019;s sender address is constructed by expanding the
54933 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
54934 then parsed as an RFC 2822 address. If there is no domain, the local part is
54935 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
54936 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
54937 </para>
54938 <para>
54939 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
54940 sender address is not changed. This is also the case for incoming SMTP messages
54941 that are permitted to contain <quote>From</quote> lines.
54942 </para>
54943 <para>
54944 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
54945 treated as a data line that starts the body of the message, as it is not valid
54946 as a header line. This also happens if a <quote>From</quote> line is present in an
54947 incoming SMTP message from a source that is not permitted to send them.
54948 </para>
54949 </section>
54950 <section id="SECID220">
54951 <title>Resent- header lines</title>
54952 <para>
54953 <indexterm role="concept">
54954 <primary><option>Resent-</option> header lines</primary>
54955 </indexterm>
54956 RFC 2822 makes provision for sets of header lines starting with the string
54957 <literal>Resent-</literal> to be added to a message when it is resent by the original
54958 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
54959 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
54960 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
54961 </para>
54962 <blockquote>
54963 <para>
54964 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
54965 processing of replies or other such automatic actions on messages.</emphasis>
54966 </para>
54967 </blockquote>
54968 <para>
54969 This leaves things a bit vague as far as other processing actions such as
54970 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
54971 follows:
54972 </para>
54973 <itemizedlist>
54974 <listitem>
54975 <para>
54976 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
54977 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
54978 </para>
54979 </listitem>
54980 <listitem>
54981 <para>
54982 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
54983 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
54984 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
54985 </para>
54986 </listitem>
54987 <listitem>
54988 <para>
54989 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
54990 also removed.
54991 </para>
54992 </listitem>
54993 <listitem>
54994 <para>
54995 For a locally-submitted message,
54996 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
54997 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
54998 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
54999 included in log lines in this case.
55000 </para>
55001 </listitem>
55002 <listitem>
55003 <para>
55004 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55005 <option>Resent-</option> header lines are present.
55006 </para>
55007 </listitem>
55008 </itemizedlist>
55009 </section>
55010 <section id="SECID221">
55011 <title>The Auto-Submitted: header line</title>
55012 <para>
55013 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55014 includes the header line:
55015 </para>
55016 <literallayout class="monospaced">
55017 Auto-Submitted: auto-replied
55018 </literallayout>
55019 </section>
55020 <section id="SECID222">
55021 <title>The Bcc: header line</title>
55022 <para>
55023 <indexterm role="concept">
55024 <primary><emphasis>Bcc:</emphasis> header line</primary>
55025 </indexterm>
55026 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55027 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55028 extracting its addresses). If <option>-t</option> is not present on the command line, any
55029 existing <emphasis>Bcc:</emphasis> is not removed.
55030 </para>
55031 </section>
55032 <section id="SECID223">
55033 <title>The Date: header line</title>
55034 <para>
55035 <indexterm role="concept">
55036 <primary><emphasis>Date:</emphasis> header line</primary>
55037 </indexterm>
55038 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55039 Exim adds one, using the current date and time, unless the
55040 <option>suppress_local_fixups</option> control has been specified.
55041 </para>
55042 </section>
55043 <section id="SECID224">
55044 <title>The Delivery-date: header line</title>
55045 <para>
55046 <indexterm role="concept">
55047 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55048 </indexterm>
55049 <indexterm role="option">
55050 <primary><option>delivery_date_remove</option></primary>
55051 </indexterm>
55052 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55053 set. Exim can be configured to add them to the final delivery of messages. (See
55054 the generic <option>delivery_date_add</option> transport option.) They should not be present
55055 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55056 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55057 messages.
55058 </para>
55059 </section>
55060 <section id="SECID225">
55061 <title>The Envelope-to: header line</title>
55062 <para>
55063 <indexterm role="concept">
55064 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55065 </indexterm>
55066 <indexterm role="option">
55067 <primary><option>envelope_to_remove</option></primary>
55068 </indexterm>
55069 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55070 Exim can be configured to add them to the final delivery of messages. (See the
55071 generic <option>envelope_to_add</option> transport option.) They should not be present in
55072 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55073 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55074 messages.
55075 </para>
55076 </section>
55077 <section id="SECTthefrohea">
55078 <title>The From: header line</title>
55079 <para>
55080 <indexterm role="concept">
55081 <primary><emphasis>From:</emphasis> header line</primary>
55082 </indexterm>
55083 <indexterm role="concept">
55084 <primary>Sendmail compatibility</primary>
55085 <secondary><quote>From</quote> line</secondary>
55086 </indexterm>
55087 <indexterm role="concept">
55088 <primary>message</primary>
55089 <secondary>submission</secondary>
55090 </indexterm>
55091 <indexterm role="concept">
55092 <primary>submission mode</primary>
55093 </indexterm>
55094 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55095 adds one if either of the following conditions is true:
55096 </para>
55097 <itemizedlist>
55098 <listitem>
55099 <para>
55100 The envelope sender address is not empty (that is, this is not a bounce
55101 message). The added header line copies the envelope sender address.
55102 </para>
55103 </listitem>
55104 <listitem>
55105 <para>
55106 <indexterm role="variable">
55107 <primary><varname>$authenticated_id</varname></primary>
55108 </indexterm>
55109 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55110 </para>
55111 <orderedlist numeration="arabic">
55112 <listitem>
55113 <para>
55114 <indexterm role="variable">
55115 <primary><varname>$qualify_domain</varname></primary>
55116 </indexterm>
55117 If no domain is specified by the submission control, the local part is
55118 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55119 </para>
55120 </listitem>
55121 <listitem>
55122 <para>
55123 If a non-empty domain is specified by the submission control, the local
55124 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55125 </para>
55126 </listitem>
55127 <listitem>
55128 <para>
55129 If an empty domain is specified by the submission control,
55130 <varname>$authenticated_id</varname> is assumed to be the complete address.
55131 </para>
55132 </listitem>
55133 </orderedlist>
55134 </listitem>
55135 </itemizedlist>
55136 <para>
55137 A non-empty envelope sender takes precedence.
55138 </para>
55139 <para>
55140 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55141 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55142 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
55143 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55144 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55145 <option>unknown_login</option> configuration option). The address is qualified with
55146 <option>qualify_domain</option>.
55147 </para>
55148 <para>
55149 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55150 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55151 user, this is replaced by an address containing the user&#x2019;s login name and full
55152 name as described in section <xref linkend="SECTconstr"/>.
55153 </para>
55154 </section>
55155 <section id="SECID226">
55156 <title>The Message-ID: header line</title>
55157 <para>
55158 <indexterm role="concept">
55159 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55160 </indexterm>
55161 <indexterm role="concept">
55162 <primary>message</primary>
55163 <secondary>submission</secondary>
55164 </indexterm>
55165 <indexterm role="option">
55166 <primary><option>message_id_header_text</option></primary>
55167 </indexterm>
55168 If a locally-generated or submission-mode incoming message does not contain a
55169 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55170 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55171 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55172 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
55173 message id, preceded by the letter E to ensure it starts with a letter, and
55174 followed by @ and the primary host name. Additional information can be included
55175 in this header line by setting the <option>message_id_header_text</option> and/or
55176 <option>message_id_header_domain</option> options.
55177 </para>
55178 </section>
55179 <section id="SECID227">
55180 <title>The Received: header line</title>
55181 <para>
55182 <indexterm role="concept">
55183 <primary><emphasis>Received:</emphasis> header line</primary>
55184 </indexterm>
55185 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55186 contents are defined by the <option>received_header_text</option> configuration option, and
55187 Exim automatically adds a semicolon and a timestamp to the configured string.
55188 </para>
55189 <para>
55190 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
55191 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55192 line is the time that the message started to be received. This is the value
55193 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55194 </para>
55195 <para>
55196 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55197 changed to the time of acceptance, which is (apart from a small delay while the
55198 -H spool file is written) the earliest time at which delivery could start.
55199 </para>
55200 </section>
55201 <section id="SECID228">
55202 <title>The References: header line</title>
55203 <para>
55204 <indexterm role="concept">
55205 <primary><emphasis>References:</emphasis> header line</primary>
55206 </indexterm>
55207 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55208 header line. This is constructed according to the rules that are described in
55209 section 3.64 of RFC 2822 (which states that replies should contain such a
55210 header line), and section 3.14 of RFC 3834 (which states that automatic
55211 responses are not different in this respect). However, because some mail
55212 processing software does not cope well with very long header lines, no more
55213 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55214 incoming message. If there are more than 12, the first one and then the final
55215 11 are copied, before adding the message ID of the incoming message.
55216 </para>
55217 </section>
55218 <section id="SECID229">
55219 <title>The Return-path: header line</title>
55220 <para>
55221 <indexterm role="concept">
55222 <primary><emphasis>Return-path:</emphasis> header line</primary>
55223 </indexterm>
55224 <indexterm role="option">
55225 <primary><option>return_path_remove</option></primary>
55226 </indexterm>
55227 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55228 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55229 transport option.) Therefore, they should not be present in messages in
55230 transit. If the <option>return_path_remove</option> configuration option is set (the
55231 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55232 </para>
55233 </section>
55234 <section id="SECTthesenhea">
55235 <title>The Sender: header line</title>
55236 <para>
55237 <indexterm role="concept">
55238 <primary><emphasis>Sender:</emphasis> header line</primary>
55239 </indexterm>
55240 <indexterm role="concept">
55241 <primary>message</primary>
55242 <secondary>submission</secondary>
55243 </indexterm>
55244 For a locally-originated message from an untrusted user, Exim may remove an
55245 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55246 these actions by setting the <option>local_sender_retain</option> option true, the
55247 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55248 control setting.
55249 </para>
55250 <para>
55251 When a local message is received from an untrusted user and
55252 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55253 control has not been set, a check is made to see if the address given in the
55254 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55255 that is expected has the login name as the local part and the value of
55256 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55257 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55258 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55259 line is added to the message.
55260 </para>
55261 <para>
55262 If you set <option>local_from_check</option> false, this checking does not occur. However,
55263 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55264 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55265 options true at the same time.
55266 </para>
55267 <para>
55268 <indexterm role="concept">
55269 <primary>submission mode</primary>
55270 </indexterm>
55271 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55272 received over TCP/IP or for messages submitted by trusted users. However, when
55273 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55274 not specified on the submission control, the following processing takes place:
55275 </para>
55276 <para>
55277 <indexterm role="variable">
55278 <primary><varname>$authenticated_id</varname></primary>
55279 </indexterm>
55280 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55281 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55282 created as follows:
55283 </para>
55284 <itemizedlist>
55285 <listitem>
55286 <para>
55287 <indexterm role="variable">
55288 <primary><varname>$qualify_domain</varname></primary>
55289 </indexterm>
55290 If no domain is specified by the submission control, the local part is
55291 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55292 </para>
55293 </listitem>
55294 <listitem>
55295 <para>
55296 If a non-empty domain is specified by the submission control, the local part
55297 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55298 </para>
55299 </listitem>
55300 <listitem>
55301 <para>
55302 If an empty domain is specified by the submission control,
55303 <varname>$authenticated_id</varname> is assumed to be the complete address.
55304 </para>
55305 </listitem>
55306 </itemizedlist>
55307 <para>
55308 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55309 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55310 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55311 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55312 </para>
55313 <para>
55314 <indexterm role="concept">
55315 <primary>return path</primary>
55316 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55317 </indexterm>
55318 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55319 the message (the envelope sender address) is changed to be the same address,
55320 except in the case of submission mode when <option>sender_retain</option> is specified.
55321 </para>
55322 </section>
55323 <section id="SECTheadersaddrem">
55324 <title>Adding and removing header lines in routers and transports</title>
55325 <para>
55326 <indexterm role="concept">
55327 <primary>header lines</primary>
55328 <secondary>adding; in router or transport</secondary>
55329 </indexterm>
55330 <indexterm role="concept">
55331 <primary>header lines</primary>
55332 <secondary>removing; in router or transport</secondary>
55333 </indexterm>
55334 When a message is delivered, the addition and removal of header lines can be
55335 specified in a system filter, or on any of the routers and transports that
55336 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55337 modifying headers in a system filter. Header lines can also be added in an ACL
55338 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55339 </para>
55340 <para>
55341 In contrast to what happens in a system filter, header modifications that are
55342 specified on routers and transports apply only to the particular recipient
55343 addresses that are being processed by those routers and transports. These
55344 changes do not actually take place until a copy of the message is being
55345 transported. Therefore, they do not affect the basic set of header lines, and
55346 they do not affect the values of the variables that refer to header lines.
55347 </para>
55348 <para>
55349 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55350 the transport cannot refer to the modified header lines, because such
55351 expansions all occur before the message is actually transported.
55352 </para>
55353 <para>
55354 For both routers and transports, the result of expanding a <option>headers_add</option>
55355 option must be in the form of one or more RFC 2822 header lines, separated by
55356 newlines (coded as <quote>\n</quote>). For example:
55357 </para>
55358 <literallayout class="monospaced">
55359 headers_add = X-added-header: added by $primary_hostname\n\
55360               X-added-second: another added header line
55361 </literallayout>
55362 <para>
55363 Exim does not check the syntax of these added header lines.
55364 </para>
55365 <para>
55366 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55367 list of header names. This is confusing, because header names themselves are
55368 often terminated by colons. In this case, the colons are the list separators,
55369 not part of the names. For example:
55370 </para>
55371 <literallayout class="monospaced">
55372 headers_remove = return-receipt-to:acknowledge-to
55373 </literallayout>
55374 <para>
55375 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55376 is expanded at routing time, and then associated with all addresses that are
55377 accepted by that router, and also with any new addresses that it generates. If
55378 an address passes through several routers as a result of aliasing or
55379 forwarding, the changes are cumulative.
55380 </para>
55381 <para>
55382 <indexterm role="option">
55383 <primary><option>unseen</option></primary>
55384 </indexterm>
55385 However, this does not apply to multiple routers that result from the use of
55386 the <option>unseen</option> option. Any header modifications that were specified by the
55387 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55388 </para>
55389 <para>
55390 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55391 settings cannot be delivered together in a batch, so a transport is always
55392 dealing with a set of addresses that have the same header-processing
55393 requirements.
55394 </para>
55395 <para>
55396 The transport starts by writing the original set of header lines that arrived
55397 with the message, possibly modified by the system filter. As it writes out
55398 these lines, it consults the list of header names that were attached to the
55399 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55400 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
55401 names are on either of these lists are not written out. If there are multiple
55402 instances of any listed header, they are all skipped.
55403 </para>
55404 <para>
55405 After the remaining original header lines have been written, new header
55406 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
55407 the order in which they were attached to the address. These are followed by any
55408 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
55409 </para>
55410 <para>
55411 This way of handling header line modifications in routers and transports has
55412 the following consequences:
55413 </para>
55414 <itemizedlist>
55415 <listitem>
55416 <para>
55417 The original set of header lines, possibly modified by the system filter,
55418 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55419 to it, at all times.
55420 </para>
55421 </listitem>
55422 <listitem>
55423 <para>
55424 Header lines that are added by a router&#x2019;s
55425 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55426 expansion syntax in subsequent routers or the transport.
55427 </para>
55428 </listitem>
55429 <listitem>
55430 <para>
55431 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55432 in a router remain visible to subsequent routers and the transport.
55433 </para>
55434 </listitem>
55435 <listitem>
55436 <para>
55437 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55438 a later router or by a transport.
55439 </para>
55440 </listitem>
55441 <listitem>
55442 <para>
55443 An added header can refer to the contents of an original header that is to be
55444 removed, even it has the same name as the added header. For example:
55445 </para>
55446 <literallayout class="monospaced">
55447 headers_remove = subject
55448 headers_add = Subject: new subject (was: $h_subject:)
55449 </literallayout>
55450 </listitem>
55451 </itemizedlist>
55452 <para>
55453 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55454 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55455 </para>
55456 </section>
55457 <section id="SECTconstr">
55458 <title>Constructed addresses</title>
55459 <para>
55460 <indexterm role="concept">
55461 <primary>address</primary>
55462 <secondary>constructed</secondary>
55463 </indexterm>
55464 <indexterm role="concept">
55465 <primary>constructed address</primary>
55466 </indexterm>
55467 When Exim constructs a sender address for a locally-generated message, it uses
55468 the form
55469 </para>
55470 <literallayout>
55471 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
55472 </literallayout>
55473 <para>
55474 For example:
55475 </para>
55476 <literallayout class="monospaced">
55477 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
55478 </literallayout>
55479 <para>
55480 The user name is obtained from the <option>-F</option> command line option if set, or
55481 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55482 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55483 ampersand character, this is replaced by the login name with the first letter
55484 upper cased, as is conventional in a number of operating systems. See the
55485 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55486 The <option>unknown_username</option> option can be used to specify user names in cases when
55487 there is no password file entry.
55488 </para>
55489 <para>
55490 <indexterm role="concept">
55491 <primary>RFC 2047</primary>
55492 </indexterm>
55493 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55494 parts of it if necessary. In addition, if it contains any non-printing
55495 characters, it is encoded as described in RFC 2047, which defines a way of
55496 including non-ASCII characters in header lines. The value of the
55497 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55498 characters are assumed to be in this encoding). The setting of
55499 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55500 is, with codes greater than 127) count as printing characters or not.
55501 </para>
55502 </section>
55503 <section id="SECID230">
55504 <title>Case of local parts</title>
55505 <para>
55506 <indexterm role="concept">
55507 <primary>case of local parts</primary>
55508 </indexterm>
55509 <indexterm role="concept">
55510 <primary>local part</primary>
55511 <secondary>case of</secondary>
55512 </indexterm>
55513 RFC 2822 states that the case of letters in the local parts of addresses cannot
55514 be assumed to be non-significant. Exim preserves the case of local parts of
55515 addresses, but by default it uses a lower-cased form when it is routing,
55516 because on most Unix systems, usernames are in lower case and case-insensitive
55517 routing is required. However, any particular router can be made to use the
55518 original case for local parts by setting the <option>caseful_local_part</option> generic
55519 router option.
55520 </para>
55521 <para>
55522 <indexterm role="concept">
55523 <primary>mixed-case login names</primary>
55524 </indexterm>
55525 If you must have mixed-case user names on your system, the best way to proceed,
55526 assuming you want case-independent handling of incoming email, is to set up
55527 your first router to convert incoming local parts in your domains to the
55528 correct case by means of a file lookup. For example:
55529 </para>
55530 <literallayout class="monospaced">
55531 correct_case:
55532   driver = redirect
55533   domains = +local_domains
55534   data = ${lookup{$local_part}cdb\
55535               {/etc/usercased.cdb}{$value}fail}\
55536               @$domain
55537 </literallayout>
55538 <para>
55539 For this router, the local part is forced to lower case by the default action
55540 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55541 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55542 on any subsequent routers which process your domains, they will operate on
55543 local parts with the correct case in a case-sensitive manner.
55544 </para>
55545 </section>
55546 <section id="SECID231">
55547 <title>Dots in local parts</title>
55548 <para>
55549 <indexterm role="concept">
55550 <primary>dot</primary>
55551 <secondary>in local part</secondary>
55552 </indexterm>
55553 <indexterm role="concept">
55554 <primary>local part</primary>
55555 <secondary>dots in</secondary>
55556 </indexterm>
55557 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55558 part may not begin or end with a dot, nor have two consecutive dots in the
55559 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55560 empty components for compatibility.
55561 </para>
55562 </section>
55563 <section id="SECID232">
55564 <title>Rewriting addresses</title>
55565 <para>
55566 <indexterm role="concept">
55567 <primary>rewriting</primary>
55568 <secondary>addresses</secondary>
55569 </indexterm>
55570 Rewriting of sender and recipient addresses, and addresses in headers, can
55571 happen automatically, or as the result of configuration options, as described
55572 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55573 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55574 </para>
55575 <para>
55576 Automatic rewriting includes qualification, as mentioned above. The other case
55577 in which it can happen is when an incomplete non-local domain is given. The
55578 routing process may cause this to be expanded into the full domain name. For
55579 example, a header such as
55580 </para>
55581 <literallayout class="monospaced">
55582 To: hare@teaparty
55583 </literallayout>
55584 <para>
55585 might get rewritten as
55586 </para>
55587 <literallayout class="monospaced">
55588 To: hare@teaparty.wonderland.fict.example
55589 </literallayout>
55590 <para>
55591 Rewriting as a result of routing is the one kind of message processing that
55592 does not happen at input time, as it cannot be done until the address has
55593 been routed.
55594 </para>
55595 <para>
55596 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55597 addresses have been routed, in case any of the headers get changed as a
55598 result of routing. However, doing this in practice would hold up many
55599 deliveries for unreasonable amounts of time, just because one address could not
55600 immediately be routed. Exim therefore does not delay other deliveries when
55601 routing of one or more addresses is deferred.
55602 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55603 </para>
55604 </section>
55605 </chapter>
55606
55607 <chapter id="CHAPSMTP">
55608 <title>SMTP processing</title>
55609 <para>
55610 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55611 <primary>SMTP</primary>
55612 <secondary>processing details</secondary>
55613 </indexterm>
55614 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55615 <primary>LMTP</primary>
55616 <secondary>processing details</secondary>
55617 </indexterm>
55618 Exim supports a number of different ways of using the SMTP protocol, and its
55619 LMTP variant, which is an interactive protocol for transferring messages into a
55620 closed mail store application. This chapter contains details of how SMTP is
55621 processed. For incoming mail, the following are available:
55622 </para>
55623 <itemizedlist>
55624 <listitem>
55625 <para>
55626 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
55627 </para>
55628 </listitem>
55629 <listitem>
55630 <para>
55631 SMTP over the standard input and output (the <option>-bs</option> option);
55632 </para>
55633 </listitem>
55634 <listitem>
55635 <para>
55636 Batched SMTP on the standard input (the <option>-bS</option> option).
55637 </para>
55638 </listitem>
55639 </itemizedlist>
55640 <para>
55641 For mail delivery, the following are available:
55642 </para>
55643 <itemizedlist>
55644 <listitem>
55645 <para>
55646 SMTP over TCP/IP (the <command>smtp</command> transport);
55647 </para>
55648 </listitem>
55649 <listitem>
55650 <para>
55651 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
55652 <quote>lmtp</quote>);
55653 </para>
55654 </listitem>
55655 <listitem>
55656 <para>
55657 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
55658 transport);
55659 </para>
55660 </listitem>
55661 <listitem>
55662 <para>
55663 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
55664 the <option>use_bsmtp</option> option set).
55665 </para>
55666 </listitem>
55667 </itemizedlist>
55668 <para>
55669 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
55670 stored in or read from files (or pipes), in a format in which SMTP commands are
55671 used to contain the envelope information.
55672 </para>
55673 <section id="SECToutSMTPTCP">
55674 <title>Outgoing SMTP and LMTP over TCP/IP</title>
55675 <para>
55676 <indexterm role="concept">
55677 <primary>SMTP</primary>
55678 <secondary>outgoing over TCP/IP</secondary>
55679 </indexterm>
55680 <indexterm role="concept">
55681 <primary>outgoing SMTP over TCP/IP</primary>
55682 </indexterm>
55683 <indexterm role="concept">
55684 <primary>LMTP</primary>
55685 <secondary>over TCP/IP</secondary>
55686 </indexterm>
55687 <indexterm role="concept">
55688 <primary>outgoing LMTP over TCP/IP</primary>
55689 </indexterm>
55690 <indexterm role="concept">
55691 <primary>EHLO</primary>
55692 </indexterm>
55693 <indexterm role="concept">
55694 <primary>HELO</primary>
55695 </indexterm>
55696 <indexterm role="concept">
55697 <primary>SIZE option on MAIL command</primary>
55698 </indexterm>
55699 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
55700 The <option>protocol</option> option selects which protocol is to be used, but the actual
55701 processing is the same in both cases.
55702 </para>
55703 <para>
55704 If, in response to its EHLO command, Exim is told that the SIZE
55705 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
55706 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
55707 <option>size_addition</option> option (default 1024) to allow for additions to the message
55708 such as per-transport header lines, or changes made in a
55709 <indexterm role="concept">
55710 <primary>transport</primary>
55711 <secondary>filter</secondary>
55712 </indexterm>
55713 <indexterm role="concept">
55714 <primary>filter</primary>
55715 <secondary>transport filter</secondary>
55716 </indexterm>
55717 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
55718 suppressed.
55719 </para>
55720 <para>
55721 If the remote server advertises support for PIPELINING, Exim uses the
55722 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
55723 required for the transaction.
55724 </para>
55725 <para>
55726 If the remote server advertises support for the STARTTLS command, and Exim
55727 was built to support TLS encryption, it tries to start a TLS session unless the
55728 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
55729 </para>
55730 <para>
55731 If the remote server advertises support for the AUTH command, Exim scans
55732 the authenticators configuration for any suitable client settings, as described
55733 in chapter <xref linkend="CHAPSMTPAUTH"/>.
55734 </para>
55735 <para>
55736 <indexterm role="concept">
55737 <primary>carriage return</primary>
55738 </indexterm>
55739 <indexterm role="concept">
55740 <primary>linefeed</primary>
55741 </indexterm>
55742 Responses from the remote host are supposed to be terminated by CR followed by
55743 LF. However, there are known to be hosts that do not send CR characters, so in
55744 order to be able to interwork with such hosts, Exim treats LF on its own as a
55745 line terminator.
55746 </para>
55747 <para>
55748 If a message contains a number of different addresses, all those with the same
55749 characteristics (for example, the same envelope sender) that resolve to the
55750 same set of hosts, in the same order, are sent in a single SMTP transaction,
55751 even if they are for different domains, unless there are more than the setting
55752 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
55753 they are split into groups containing no more than <option>max_rcpts</option> addresses
55754 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
55755 in parallel sessions. The order of hosts with identical MX values is not
55756 significant when checking whether addresses can be batched in this way.
55757 </para>
55758 <para>
55759 When the <command>smtp</command> transport suffers a temporary failure that is not
55760 message-related, Exim updates its transport-specific database, which contains
55761 records indexed by host name that remember which messages are waiting for each
55762 particular host. It also updates the retry database with new retry times.
55763 </para>
55764 <para>
55765 <indexterm role="concept">
55766 <primary>hints database</primary>
55767 <secondary>retry keys</secondary>
55768 </indexterm>
55769 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
55770 a multi-homed host is broken, it will soon be skipped most of the time.
55771 See the next section for more detail about error handling.
55772 </para>
55773 <para>
55774 <indexterm role="concept">
55775 <primary>SMTP</primary>
55776 <secondary>passed connection</secondary>
55777 </indexterm>
55778 <indexterm role="concept">
55779 <primary>SMTP</primary>
55780 <secondary>batching over TCP/IP</secondary>
55781 </indexterm>
55782 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
55783 looks in the hints database for the transport to see if there are any queued
55784 messages waiting for the host to which it is connected. If it finds one, it
55785 creates a new Exim process using the <option>-MC</option> option (which can only be used by
55786 a process running as root or the Exim user) and passes the TCP/IP socket to it
55787 so that it can deliver another message using the same socket. The new process
55788 does only those deliveries that are routed to the connected host, and may in
55789 turn pass the socket on to a third process, and so on.
55790 </para>
55791 <para>
55792 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
55793 limit the number of messages sent down a single TCP/IP connection.
55794 </para>
55795 <para>
55796 <indexterm role="concept">
55797 <primary>asterisk</primary>
55798 <secondary>after IP address</secondary>
55799 </indexterm>
55800 The second and subsequent messages delivered down an existing connection are
55801 identified in the main log by the addition of an asterisk after the closing
55802 square bracket of the IP address.
55803 </para>
55804 </section>
55805 <section id="SECToutSMTPerr">
55806 <title>Errors in outgoing SMTP</title>
55807 <para>
55808 <indexterm role="concept">
55809 <primary>error</primary>
55810 <secondary>in outgoing SMTP</secondary>
55811 </indexterm>
55812 <indexterm role="concept">
55813 <primary>SMTP</primary>
55814 <secondary>errors in outgoing</secondary>
55815 </indexterm>
55816 <indexterm role="concept">
55817 <primary>host</primary>
55818 <secondary>error</secondary>
55819 </indexterm>
55820 Three different kinds of error are recognized for outgoing SMTP: host errors,
55821 message errors, and recipient errors.
55822 </para>
55823 <variablelist>
55824 <varlistentry>
55825 <term><emphasis role="bold">Host errors</emphasis></term>
55826 <listitem>
55827 <para>
55828 A host error is not associated with a particular message or with a
55829 particular recipient of a message. The host errors are:
55830 </para>
55831 <itemizedlist>
55832 <listitem>
55833 <para>
55834 Connection refused or timed out,
55835 </para>
55836 </listitem>
55837 <listitem>
55838 <para>
55839 Any error response code on connection,
55840 </para>
55841 </listitem>
55842 <listitem>
55843 <para>
55844 Any error response code to EHLO or HELO,
55845 </para>
55846 </listitem>
55847 <listitem>
55848 <para>
55849 Loss of connection at any time, except after <quote>.</quote>,
55850 </para>
55851 </listitem>
55852 <listitem>
55853 <para>
55854 I/O errors at any time,
55855 </para>
55856 </listitem>
55857 <listitem>
55858 <para>
55859 Timeouts during the session, other than in response to MAIL, RCPT or
55860 the <quote>.</quote> at the end of the data.
55861 </para>
55862 </listitem>
55863 </itemizedlist>
55864 <para>
55865 For a host error, a permanent error response on connection, or in response to
55866 EHLO, causes all addresses routed to the host to be failed. Any other host
55867 error causes all addresses to be deferred, and retry data to be created for the
55868 host. It is not tried again, for any message, until its retry time arrives. If
55869 the current set of addresses are not all delivered in this run (to some
55870 alternative host), the message is added to the list of those waiting for this
55871 host, so if it is still undelivered when a subsequent successful delivery is
55872 made to the host, it will be sent down the same SMTP connection.
55873 </para>
55874 </listitem></varlistentry>
55875 <varlistentry>
55876 <term><emphasis role="bold">Message errors</emphasis></term>
55877 <listitem>
55878 <para>
55879 <indexterm role="concept">
55880 <primary>message</primary>
55881 <secondary>error</secondary>
55882 </indexterm>
55883 A message error is associated with a particular message when sent to a
55884 particular host, but not with a particular recipient of the message. The
55885 message errors are:
55886 </para>
55887 <itemizedlist>
55888 <listitem>
55889 <para>
55890 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
55891 the data,
55892 </para>
55893 </listitem>
55894 <listitem>
55895 <para>
55896 Timeout after MAIL,
55897 </para>
55898 </listitem>
55899 <listitem>
55900 <para>
55901 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
55902 timeout after the DATA command itself is treated as a host error, as is loss of
55903 connection at any other time.
55904 </para>
55905 </listitem>
55906 </itemizedlist>
55907 <para>
55908 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
55909 to be failed, and a delivery error report to be returned to the sender. A
55910 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
55911 addresses to be deferred. Retry data is not created for the host, but instead,
55912 a retry record for the combination of host plus message id is created. The
55913 message is not added to the list of those waiting for this host. This ensures
55914 that the failing message will not be sent to this host again until the retry
55915 time arrives. However, other messages that are routed to the host are not
55916 affected, so if it is some property of the message that is causing the error,
55917 it will not stop the delivery of other mail.
55918 </para>
55919 <para>
55920 If the remote host specified support for the SIZE parameter in its response
55921 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
55922 over-large message will cause a message error because the error arrives as a
55923 response to MAIL.
55924 </para>
55925 </listitem></varlistentry>
55926 <varlistentry>
55927 <term><emphasis role="bold">Recipient errors</emphasis></term>
55928 <listitem>
55929 <para>
55930 <indexterm role="concept">
55931 <primary>recipient</primary>
55932 <secondary>error</secondary>
55933 </indexterm>
55934 A recipient error is associated with a particular recipient of a message. The
55935 recipient errors are:
55936 </para>
55937 <itemizedlist>
55938 <listitem>
55939 <para>
55940 Any error response to RCPT,
55941 </para>
55942 </listitem>
55943 <listitem>
55944 <para>
55945 Timeout after RCPT.
55946 </para>
55947 </listitem>
55948 </itemizedlist>
55949 <para>
55950 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
55951 recipient address to be failed, and a bounce message to be returned to the
55952 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
55953 address to be deferred, and routing retry data to be created for it. This is
55954 used to delay processing of the address in subsequent queue runs, until its
55955 routing retry time arrives. This applies to all messages, but because it
55956 operates only in queue runs, one attempt will be made to deliver a new message
55957 to the failing address before the delay starts to operate. This ensures that,
55958 if the failure is really related to the message rather than the recipient
55959 (<quote>message too big for this recipient</quote> is a possible example), other messages
55960 have a chance of getting delivered. If a delivery to the address does succeed,
55961 the retry information gets cleared, so all stuck messages get tried again, and
55962 the retry clock is reset.
55963 </para>
55964 <para>
55965 The message is not added to the list of those waiting for this host. Use of the
55966 host for other messages is unaffected, and except in the case of a timeout,
55967 other recipients are processed independently, and may be successfully delivered
55968 in the current SMTP session. After a timeout it is of course impossible to
55969 proceed with the session, so all addresses get deferred. However, those other
55970 than the one that failed do not suffer any subsequent retry delays. Therefore,
55971 if one recipient is causing trouble, the others have a chance of getting
55972 through when a subsequent delivery attempt occurs before the failing
55973 recipient&#x2019;s retry time.
55974 </para>
55975 </listitem></varlistentry>
55976 </variablelist>
55977 <para>
55978 In all cases, if there are other hosts (or IP addresses) available for the
55979 current set of addresses (for example, from multiple MX records), they are
55980 tried in this run for any undelivered addresses, subject of course to their
55981 own retry data. In other words, recipient error retry data does not take effect
55982 until the next delivery attempt.
55983 </para>
55984 <para>
55985 Some hosts have been observed to give temporary error responses to every
55986 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
55987 would be nice if such circumstances could be recognized, and defer data for the
55988 host itself created, but this is not possible within the current Exim design.
55989 What actually happens is that retry data for every (host, message) combination
55990 is created.
55991 </para>
55992 <para>
55993 The reason that timeouts after MAIL and RCPT are treated specially is that
55994 these can sometimes arise as a result of the remote host&#x2019;s verification
55995 procedures. Exim makes this assumption, and treats them as if a temporary error
55996 response had been received. A timeout after <quote>.</quote> is treated specially because
55997 it is known that some broken implementations fail to recognize the end of the
55998 message if the last character of the last line is a binary zero. Thus, it is
55999 helpful to treat this case as a message error.
56000 </para>
56001 <para>
56002 Timeouts at other times are treated as host errors, assuming a problem with the
56003 host, or the connection to it. If a timeout after MAIL, RCPT,
56004 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56005 the timeout is likely to occur at some other point in the dialogue, causing it
56006 then to be treated as a host error.
56007 </para>
56008 <para>
56009 There is experimental evidence that some MTAs drop the connection after the
56010 terminating <quote>.</quote> if they do not like the contents of the message for some
56011 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56012 should be given. That is why Exim treats this case as a message rather than a
56013 host error, in order not to delay other messages to the same host.
56014 </para>
56015 </section>
56016 <section id="SECID233">
56017 <title>Incoming SMTP messages over TCP/IP</title>
56018 <para>
56019 <indexterm role="concept">
56020 <primary>SMTP</primary>
56021 <secondary>incoming over TCP/IP</secondary>
56022 </indexterm>
56023 <indexterm role="concept">
56024 <primary>incoming SMTP over TCP/IP</primary>
56025 </indexterm>
56026 <indexterm role="concept">
56027 <primary>inetd</primary>
56028 </indexterm>
56029 <indexterm role="concept">
56030 <primary>daemon</primary>
56031 </indexterm>
56032 Incoming SMTP messages can be accepted in one of two ways: by running a
56033 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56034 <filename>/etc/inetd.conf</filename> should be like this:
56035 </para>
56036 <literallayout class="monospaced">
56037 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56038 </literallayout>
56039 <para>
56040 Exim distinguishes between this case and the case of a locally running user
56041 agent using the <option>-bs</option> option by checking whether or not the standard input is
56042 a socket. When it is, either the port must be privileged (less than 1024), or
56043 the caller must be root or the Exim user. If any other user passes a socket
56044 with an unprivileged port number, Exim prints a message on the standard error
56045 stream and exits with an error code.
56046 </para>
56047 <para>
56048 By default, Exim does not make a log entry when a remote host connects or
56049 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56050 unexpected. It can be made to write such log entries by setting the
56051 <option>smtp_connection</option> log selector.
56052 </para>
56053 <para>
56054 <indexterm role="concept">
56055 <primary>carriage return</primary>
56056 </indexterm>
56057 <indexterm role="concept">
56058 <primary>linefeed</primary>
56059 </indexterm>
56060 Commands from the remote host are supposed to be terminated by CR followed by
56061 LF. However, there are known to be hosts that do not send CR characters. In
56062 order to be able to interwork with such hosts, Exim treats LF on its own as a
56063 line terminator.
56064 Furthermore, because common code is used for receiving messages from all
56065 sources, a CR on its own is also interpreted as a line terminator. However, the
56066 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56067 </para>
56068 <para>
56069 <indexterm role="concept">
56070 <primary>EHLO</primary>
56071 <secondary>invalid data</secondary>
56072 </indexterm>
56073 <indexterm role="concept">
56074 <primary>HELO</primary>
56075 <secondary>invalid data</secondary>
56076 </indexterm>
56077 One area that sometimes gives rise to problems concerns the EHLO or
56078 HELO commands. Some clients send syntactically invalid versions of these
56079 commands, which Exim rejects by default. (This is nothing to do with verifying
56080 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56081 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56082 match the broken hosts that send invalid commands.
56083 </para>
56084 <para>
56085 <indexterm role="concept">
56086 <primary>SIZE option on MAIL command</primary>
56087 </indexterm>
56088 <indexterm role="concept">
56089 <primary>MAIL</primary>
56090 <secondary>SIZE option</secondary>
56091 </indexterm>
56092 The amount of disk space available is checked whenever SIZE is received on
56093 a MAIL command, independently of whether <option>message_size_limit</option> or
56094 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56095 false. A temporary error is given if there is not enough space. If
56096 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56097 value given with SIZE, that is, it checks that the addition of the incoming
56098 message will not reduce the space below the threshold.
56099 </para>
56100 <para>
56101 When a message is successfully received, Exim includes the local message id in
56102 its response to the final <quote>.</quote> that terminates the data. If the remote host
56103 logs this text it can help with tracing what has happened to a message.
56104 </para>
56105 <para>
56106 The Exim daemon can limit the number of simultaneous incoming connections it is
56107 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56108 number of simultaneous incoming connections from a single remote host (see the
56109 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56110 rejected using the SMTP temporary error code 421.
56111 </para>
56112 <para>
56113 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56114 subprocess has finished, as this can get lost at busy times. Instead, it looks
56115 for completed subprocesses every time it wakes up. Provided there are other
56116 things happening (new incoming calls, starts of queue runs), completed
56117 processes will be noticed and tidied away. On very quiet systems you may
56118 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56119 it will be noticed when the daemon next wakes up.
56120 </para>
56121 <para>
56122 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56123 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56124 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
56125 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56126 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56127 </para>
56128 <para>
56129 Exim normally starts a delivery process for each message received, though this
56130 can be varied by means of the <option>-odq</option> command line option and the
56131 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56132 number of simultaneously running delivery processes started in this way from
56133 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56134 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56135 subsequently received messages are just put on the input queue without starting
56136 a delivery process.
56137 </para>
56138 <para>
56139 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56140 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56141 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56142 handled by an entirely independent Exim process. Control by load average is,
56143 however, available with <emphasis>inetd</emphasis>.
56144 </para>
56145 <para>
56146 Exim can be configured to verify addresses in incoming SMTP commands as they
56147 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56148 to rewrite addresses at this time &ndash; before any syntax checking is done. See
56149 section <xref linkend="SECTrewriteS"/>.
56150 </para>
56151 <para>
56152 Exim can also be configured to limit the rate at which a client host submits
56153 MAIL and RCPT commands in a single SMTP session. See the
56154 <option>smtp_ratelimit_hosts</option> option.
56155 </para>
56156 </section>
56157 <section id="SECID234">
56158 <title>Unrecognized SMTP commands</title>
56159 <para>
56160 <indexterm role="concept">
56161 <primary>SMTP</primary>
56162 <secondary>unrecognized commands</secondary>
56163 </indexterm>
56164 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56165 commands during a single SMTP connection, it drops the connection after sending
56166 the error response to the last command. The default value for
56167 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56168 abuse that subvert web servers into making connections to SMTP ports; in these
56169 circumstances, a number of non-SMTP lines are sent first.
56170 </para>
56171 </section>
56172 <section id="SECID235">
56173 <title>Syntax and protocol errors in SMTP commands</title>
56174 <para>
56175 <indexterm role="concept">
56176 <primary>SMTP</primary>
56177 <secondary>syntax errors</secondary>
56178 </indexterm>
56179 <indexterm role="concept">
56180 <primary>SMTP</primary>
56181 <secondary>protocol errors</secondary>
56182 </indexterm>
56183 A syntax error is detected if an SMTP command is recognized, but there is
56184 something syntactically wrong with its data, for example, a malformed email
56185 address in a RCPT command. Protocol errors include invalid command
56186 sequencing such as RCPT before MAIL. If Exim receives more than
56187 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56188 drops the connection after sending the error response to the last command. The
56189 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56190 broken clients that loop sending bad commands (yes, it has been seen).
56191 </para>
56192 </section>
56193 <section id="SECID236">
56194 <title>Use of non-mail SMTP commands</title>
56195 <para>
56196 <indexterm role="concept">
56197 <primary>SMTP</primary>
56198 <secondary>non-mail commands</secondary>
56199 </indexterm>
56200 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56201 DATA. Exim counts such commands, and drops the connection if there are too
56202 many of them in a single SMTP session. This action catches some
56203 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56204 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56205 defines what <quote>too many</quote> means. Its default value is 10.
56206 </para>
56207 <para>
56208 When a new message is expected, one occurrence of RSET is not counted. This
56209 allows a client to send one RSET between messages (this is not necessary,
56210 but some clients do it). Exim also allows one uncounted occurrence of HELO
56211 or EHLO, and one occurrence of STARTTLS between messages. After
56212 starting up a TLS session, another EHLO is expected, and so it too is not
56213 counted.
56214 </para>
56215 <para>
56216 The first occurrence of AUTH in a connection, or immediately following
56217 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56218 RCPT, DATA, and QUIT are counted.
56219 </para>
56220 <para>
56221 You can control which hosts are subject to the limit set by
56222 <option>smtp_accept_max_nonmail</option> by setting
56223 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56224 the limit apply to all hosts. This option means that you can exclude any
56225 specific badly-behaved hosts that you have to live with.
56226 </para>
56227 </section>
56228 <section id="SECID237">
56229 <title>The VRFY and EXPN commands</title>
56230 <para>
56231 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56232 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56233 appropriate) in order to decide whether the command should be accepted or not.
56234 If no ACL is defined, the command is rejected.
56235 </para>
56236 <para>
56237 <indexterm role="concept">
56238 <primary>VRFY</primary>
56239 <secondary>processing</secondary>
56240 </indexterm>
56241 When VRFY is accepted, it runs exactly the same code as when Exim is
56242 called with the <option>-bv</option> option.
56243 </para>
56244 <para>
56245 <indexterm role="concept">
56246 <primary>EXPN</primary>
56247 <secondary>processing</secondary>
56248 </indexterm>
56249 When EXPN is accepted, a single-level expansion of the address is done.
56250 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56251 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56252 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56253 of VRFY and EXPN commands are logged on the main and reject logs, and
56254 VRFY verification failures are logged on the main log for consistency with
56255 RCPT failures.
56256 </para>
56257 </section>
56258 <section id="SECTETRN">
56259 <title>The ETRN command</title>
56260 <para>
56261 <indexterm role="concept">
56262 <primary>ETRN</primary>
56263 <secondary>processing</secondary>
56264 </indexterm>
56265 RFC 1985 describes an SMTP command called ETRN that is designed to
56266 overcome the security problems of the TURN command (which has fallen into
56267 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56268 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56269 should be accepted or not. If no ACL is defined, the command is rejected.
56270 </para>
56271 <para>
56272 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56273 delivery to certain hosts. As Exim does not organize its message queue by host,
56274 the only form of ETRN that is supported by default is the one where the
56275 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56276 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56277 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56278 argument. For example,
56279 </para>
56280 <literallayout class="monospaced">
56281 ETRN #brigadoon
56282 </literallayout>
56283 <para>
56284 runs the command
56285 </para>
56286 <literallayout class="monospaced">
56287 exim -R brigadoon
56288 </literallayout>
56289 <para>
56290 which causes a delivery attempt on all messages with undelivered addresses
56291 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56292 default), Exim prevents the simultaneous execution of more than one queue run
56293 for the same argument string as a result of an ETRN command. This stops
56294 a misbehaving client from starting more than one queue runner at once.
56295 </para>
56296 <para>
56297 <indexterm role="concept">
56298 <primary>hints database</primary>
56299 <secondary>ETRN serialization</secondary>
56300 </indexterm>
56301 Exim implements the serialization by means of a hints database in which a
56302 record is written whenever a process is started by ETRN, and deleted when
56303 the process completes. However, Exim does not keep the SMTP session waiting for
56304 the ETRN process to complete. Once ETRN is accepted, the client is sent
56305 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56306 left lying around if there is a system or program crash. To guard against this,
56307 Exim ignores any records that are more than six hours old.
56308 </para>
56309 <para>
56310 <indexterm role="option">
56311 <primary><option>smtp_etrn_command</option></primary>
56312 </indexterm>
56313 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56314 used. This specifies a command that is run whenever ETRN is received,
56315 whatever the form of its argument. For
56316 example:
56317 </para>
56318 <literallayout class="monospaced">
56319 smtp_etrn_command = /etc/etrn_command $domain \
56320                     $sender_host_address
56321 </literallayout>
56322 <para>
56323 <indexterm role="variable">
56324 <primary><varname>$domain</varname></primary>
56325 </indexterm>
56326 The string is split up into arguments which are independently expanded. The
56327 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56328 and no syntax checking is done on the contents of this argument. Exim does not
56329 wait for the command to complete, so its status code is not checked. Exim runs
56330 under its own uid and gid when receiving incoming SMTP, so it is not possible
56331 for it to change them before running the command.
56332 </para>
56333 </section>
56334 <section id="SECID238">
56335 <title>Incoming local SMTP</title>
56336 <para>
56337 <indexterm role="concept">
56338 <primary>SMTP</primary>
56339 <secondary>local incoming</secondary>
56340 </indexterm>
56341 Some user agents use SMTP to pass messages to their local MTA using the
56342 standard input and output, as opposed to passing the envelope on the command
56343 line and writing the message to the standard input. This is supported by the
56344 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56345 messages over TCP/IP (including the use of ACLs), except that the envelope
56346 sender given in a MAIL command is ignored unless the caller is trusted. In
56347 an ACL you can detect this form of SMTP input by testing for an empty host
56348 identification. It is common to have this as the first line in the ACL that
56349 runs for RCPT commands:
56350 </para>
56351 <literallayout class="monospaced">
56352 accept hosts = :
56353 </literallayout>
56354 <para>
56355 This accepts SMTP messages from local processes without doing any other tests.
56356 </para>
56357 </section>
56358 <section id="SECTbatchSMTP">
56359 <title>Outgoing batched SMTP</title>
56360 <para>
56361 <indexterm role="concept">
56362 <primary>SMTP</primary>
56363 <secondary>batched outgoing</secondary>
56364 </indexterm>
56365 <indexterm role="concept">
56366 <primary>batched SMTP output</primary>
56367 </indexterm>
56368 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56369 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56370 be output in BSMTP format. No SMTP responses are possible for this form of
56371 delivery. All it is doing is using SMTP commands as a way of transmitting the
56372 envelope along with the message.
56373 </para>
56374 <para>
56375 The message is written to the file or pipe preceded by the SMTP commands
56376 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56377 the message that start with a dot have an extra dot added. The SMTP command
56378 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56379 can be used to specify it.
56380 </para>
56381 <para>
56382 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56383 one recipient address at a time by default. However, you can arrange for them
56384 to handle several addresses at once by setting the <option>batch_max</option> option. When
56385 this is done for BSMTP, messages may contain multiple RCPT commands. See
56386 chapter <xref linkend="CHAPbatching"/> for more details.
56387 </para>
56388 <para>
56389 <indexterm role="variable">
56390 <primary><varname>$host</varname></primary>
56391 </indexterm>
56392 When one or more addresses are routed to a BSMTP transport by a router that
56393 sets up a host list, the name of the first host on the list is available to the
56394 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56395 router:
56396 </para>
56397 <literallayout class="monospaced">
56398 begin routers
56399 route_append:
56400   driver = manualroute
56401   transport = smtp_appendfile
56402   route_list = domain.example  batch.host.example
56403
56404 begin transports
56405 smtp_appendfile:
56406   driver = appendfile
56407   directory = /var/bsmtp/$host
56408   batch_max = 1000
56409   use_bsmtp
56410   user = exim
56411 </literallayout>
56412 <para>
56413 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56414 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56415 message (unless there are more than 1000 recipients).
56416 </para>
56417 </section>
56418 <section id="SECTincomingbatchedSMTP">
56419 <title>Incoming batched SMTP</title>
56420 <para>
56421 <indexterm role="concept">
56422 <primary>SMTP</primary>
56423 <secondary>batched incoming</secondary>
56424 </indexterm>
56425 <indexterm role="concept">
56426 <primary>batched SMTP input</primary>
56427 </indexterm>
56428 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56429 reading SMTP on the standard input, but to generate no responses. If the caller
56430 is trusted, the senders in the MAIL commands are believed; otherwise the
56431 sender is always the caller of Exim. Unqualified senders and receivers are not
56432 rejected (there seems little point) but instead just get qualified. HELO
56433 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
56434 as NOOP; QUIT quits.
56435 </para>
56436 <para>
56437 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
56438 In this respect it is like non-SMTP local input.
56439 </para>
56440 <para>
56441 If an error is detected while reading a message, including a missing <quote>.</quote> at
56442 the end, Exim gives up immediately. It writes details of the error to the
56443 standard output in a stylized way that the calling program should be able to
56444 make some use of automatically, for example:
56445 </para>
56446 <literallayout class="monospaced">
56447 554 Unexpected end of file
56448 Transaction started in line 10
56449 Error detected in line 14
56450 </literallayout>
56451 <para>
56452 It writes a more verbose version, for human consumption, to the standard error
56453 file, for example:
56454 </para>
56455 <literallayout class="monospaced">
56456 An error was detected while processing a file of BSMTP input.
56457 The error message was:
56458
56459 501 '&gt;' missing at end of address
56460
56461 The SMTP transaction started in line 10.
56462 The error was detected in line 12.
56463 The SMTP command at fault was:
56464
56465 rcpt to:&lt;malformed@in.com.plete
56466
56467 1 previous message was successfully processed.
56468 The rest of the batch was abandoned.
56469 </literallayout>
56470 <para>
56471 The return code from Exim is zero only if there were no errors. It is 1 if some
56472 messages were accepted before an error was detected, and 2 if no messages were
56473 accepted.
56474 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56475 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56476 </para>
56477 </section>
56478 </chapter>
56479
56480 <chapter id="CHAPemsgcust">
56481 <title>Customizing bounce and warning messages</title>
56482 <titleabbrev>Customizing messages</titleabbrev>
56483 <para>
56484 When a message fails to be delivered, or remains on the queue for more than a
56485 configured amount of time, Exim sends a message to the original sender, or
56486 to an alternative configured address. The text of these messages is built into
56487 the code of Exim, but it is possible to change it, either by adding a single
56488 string, or by replacing each of the paragraphs by text supplied in a file.
56489 </para>
56490 <para>
56491 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56492 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56493 option. Exim also adds the line
56494 </para>
56495 <literallayout class="monospaced">
56496 Auto-Submitted: auto-generated
56497 </literallayout>
56498 <para>
56499 to all warning and bounce messages,
56500 </para>
56501 <section id="SECID239">
56502 <title>Customizing bounce messages</title>
56503 <para>
56504 <indexterm role="concept">
56505 <primary>customizing</primary>
56506 <secondary>bounce message</secondary>
56507 </indexterm>
56508 <indexterm role="concept">
56509 <primary>bounce message</primary>
56510 <secondary>customizing</secondary>
56511 </indexterm>
56512 If <option>bounce_message_text</option> is set, its contents are included in the default
56513 message immediately after <quote>This message was created automatically by mail
56514 delivery software.</quote> The string is not expanded. It is not used if
56515 <option>bounce_message_file</option> is set.
56516 </para>
56517 <para>
56518 When <option>bounce_message_file</option> is set, it must point to a template file for
56519 constructing error messages. The file consists of a series of text items,
56520 separated by lines consisting of exactly four asterisks. If the file cannot be
56521 opened, default text is used and a message is written to the main and panic
56522 logs. If any text item in the file is empty, default text is used for that
56523 item.
56524 </para>
56525 <para>
56526 <indexterm role="variable">
56527 <primary><varname>$bounce_recipient</varname></primary>
56528 </indexterm>
56529 <indexterm role="variable">
56530 <primary><varname>$bounce_return_size_limit</varname></primary>
56531 </indexterm>
56532 Each item of text that is read from the file is expanded, and there are two
56533 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56534 the recipient of an error message while it is being created, and
56535 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56536 option, rounded to a whole number.
56537 </para>
56538 <para>
56539 The items must appear in the file in the following order:
56540 </para>
56541 <itemizedlist>
56542 <listitem>
56543 <para>
56544 The first item is included in the headers, and should include at least a
56545 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56546 </para>
56547 </listitem>
56548 <listitem>
56549 <para>
56550 The second item forms the start of the error message. After it, Exim lists the
56551 failing addresses with their error messages.
56552 </para>
56553 </listitem>
56554 <listitem>
56555 <para>
56556 The third item is used to introduce any text from pipe transports that is to be
56557 returned to the sender. It is omitted if there is no such text.
56558 </para>
56559 </listitem>
56560 <listitem>
56561 <para>
56562 The fourth item is used to introduce the copy of the message that is returned
56563 as part of the error report.
56564 </para>
56565 </listitem>
56566 <listitem>
56567 <para>
56568 The fifth item is added after the fourth one if the returned message is
56569 truncated because it is bigger than <option>return_size_limit</option>.
56570 </para>
56571 </listitem>
56572 <listitem>
56573 <para>
56574 The sixth item is added after the copy of the original message.
56575 </para>
56576 </listitem>
56577 </itemizedlist>
56578 <para>
56579 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56580 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56581 other lines have been split in order to fit them on the page:
56582 </para>
56583 <literallayout class="monospaced">
56584 Subject: Mail delivery failed
56585   ${if eq{$sender_address}{$bounce_recipient}
56586   {: returning message to sender}}
56587 ****
56588 This message was created automatically by mail delivery software.
56589
56590 A message ${if eq{$sender_address}{$bounce_recipient}
56591   {that you sent }{sent by
56592
56593 &lt;$sender_address&gt;
56594
56595 }}could not be delivered to all of its recipients.
56596 This is a permanent error. The following address(es) failed:
56597 ****
56598 The following text was generated during the delivery attempt(s):
56599 ****
56600 ------ This is a copy of the message, including all the headers.
56601   ------
56602 ****
56603 ------ The body of the message is $message_size characters long;
56604   only the first
56605 ------ $bounce_return_size_limit or so are included here.
56606 ****
56607 </literallayout>
56608 </section>
56609 <section id="SECTcustwarn">
56610 <title>Customizing warning messages</title>
56611 <para>
56612 <indexterm role="concept">
56613 <primary>customizing</primary>
56614 <secondary>warning message</secondary>
56615 </indexterm>
56616 <indexterm role="concept">
56617 <primary>warning of delay</primary>
56618 <secondary>customizing the message</secondary>
56619 </indexterm>
56620 The option <option>warn_message_file</option> can be pointed at a template file for use when
56621 warnings about message delays are created. In this case there are only three
56622 text sections:
56623 </para>
56624 <itemizedlist>
56625 <listitem>
56626 <para>
56627 The first item is included in the headers, and should include at least a
56628 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56629 </para>
56630 </listitem>
56631 <listitem>
56632 <para>
56633 The second item forms the start of the warning message. After it, Exim lists
56634 the delayed addresses.
56635 </para>
56636 </listitem>
56637 <listitem>
56638 <para>
56639 The third item then ends the message.
56640 </para>
56641 </listitem>
56642 </itemizedlist>
56643 <para>
56644 The default state is equivalent to the following file, except that some lines
56645 have been split here, in order to fit them on the page:
56646 </para>
56647 <literallayout class="monospaced">
56648 Subject: Warning: message $message_exim_id delayed
56649   $warn_message_delay
56650 ****
56651 This message was created automatically by mail delivery software.
56652
56653 A message ${if eq{$sender_address}{$warn_message_recipients}
56654 {that you sent }{sent by
56655
56656 &lt;$sender_address&gt;
56657
56658 }}has not been delivered to all of its recipients after
56659 more than $warn_message_delay on the queue on $primary_hostname.
56660
56661 The message identifier is:     $message_exim_id
56662 The subject of the message is: $h_subject
56663 The date of the message is:    $h_date
56664
56665 The following address(es) have not yet been delivered:
56666 ****
56667 No action is required on your part. Delivery attempts will
56668 continue for some time, and this warning may be repeated at
56669 intervals if the message remains undelivered. Eventually the
56670 mail delivery software will give up, and when that happens,
56671 the message will be returned to you.
56672 </literallayout>
56673 <para>
56674 <indexterm role="variable">
56675 <primary><varname>$warn_message_delay</varname></primary>
56676 </indexterm>
56677 <indexterm role="variable">
56678 <primary><varname>$warn_message_recipients</varname></primary>
56679 </indexterm>
56680 However, in the default state the subject and date lines are omitted if no
56681 appropriate headers exist. During the expansion of this file,
56682 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
56683 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
56684 of recipients for the warning message. There may be more than one if there are
56685 multiple addresses with different <option>errors_to</option> settings on the routers that
56686 handled them.
56687 </para>
56688 </section>
56689 </chapter>
56690
56691 <chapter id="CHAPcomconreq">
56692 <title>Some common configuration settings</title>
56693 <para>
56694 This chapter discusses some configuration settings that seem to be fairly
56695 common. More examples and discussion can be found in the Exim book.
56696 </para>
56697 <section id="SECID240">
56698 <title>Sending mail to a smart host</title>
56699 <para>
56700 <indexterm role="concept">
56701 <primary>smart host</primary>
56702 <secondary>example router</secondary>
56703 </indexterm>
56704 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
56705 should replace the default <command>dnslookup</command> router with a router which does the
56706 routing explicitly:
56707 </para>
56708 <literallayout class="monospaced">
56709 send_to_smart_host:
56710   driver = manualroute
56711   route_list = !+local_domains smart.host.name
56712   transport = remote_smtp
56713 </literallayout>
56714 <para>
56715 You can use the smart host&#x2019;s IP address instead of the name if you wish.
56716 If you are using Exim only to submit messages to a smart host, and not for
56717 receiving incoming messages, you can arrange for it to do the submission
56718 synchronously by setting the <option>mua_wrapper</option> option (see chapter
56719 <xref linkend="CHAPnonqueueing"/>).
56720 </para>
56721 </section>
56722 <section id="SECTmailinglists">
56723 <title>Using Exim to handle mailing lists</title>
56724 <para>
56725 <indexterm role="concept">
56726 <primary>mailing lists</primary>
56727 </indexterm>
56728 Exim can be used to run simple mailing lists, but for large and/or complicated
56729 requirements, the use of additional specialized mailing list software such as
56730 Majordomo or Mailman is recommended.
56731 </para>
56732 <para>
56733 The <command>redirect</command> router can be used to handle mailing lists where each list
56734 is maintained in a separate file, which can therefore be managed by an
56735 independent manager. The <option>domains</option> router option can be used to run these
56736 lists in a separate domain from normal mail. For example:
56737 </para>
56738 <literallayout class="monospaced">
56739 lists:
56740   driver = redirect
56741   domains = lists.example
56742   file = /usr/lists/$local_part
56743   forbid_pipe
56744   forbid_file
56745   errors_to = $local_part-request@lists.example
56746   no_more
56747 </literallayout>
56748 <para>
56749 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
56750 in that domain, it looks for a file that matches the local part. If there is no
56751 such file, the router declines, but because <option>no_more</option> is set, no subsequent
56752 routers are tried, and so the whole delivery fails.
56753 </para>
56754 <para>
56755 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
56756 expanded into a file name or a pipe delivery, which is usually inappropriate in
56757 a mailing list.
56758 </para>
56759 <para>
56760 <indexterm role="option">
56761 <primary><option>errors_to</option></primary>
56762 </indexterm>
56763 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
56764 taken from a mailing list are to be sent to the given address rather than the
56765 original sender of the message. However, before acting on this, Exim verifies
56766 the error address, and ignores it if verification fails.
56767 </para>
56768 <para>
56769 For example, using the configuration above, mail sent to
56770 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
56771 <filename>/usr/lists/dicts</filename>, with error reports directed to
56772 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
56773 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
56774 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
56775 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
56776 or <option>local_part_suffix</option> options) to handle addresses of the form
56777 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
56778 </para>
56779 </section>
56780 <section id="SECID241">
56781 <title>Syntax errors in mailing lists</title>
56782 <para>
56783 <indexterm role="concept">
56784 <primary>mailing lists</primary>
56785 <secondary>syntax errors in</secondary>
56786 </indexterm>
56787 If an entry in redirection data contains a syntax error, Exim normally defers
56788 delivery of the original address. That means that a syntax error in a mailing
56789 list holds up all deliveries to the list. This may not be appropriate when a
56790 list is being maintained automatically from data supplied by users, and the
56791 addresses are not rigorously checked.
56792 </para>
56793 <para>
56794 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
56795 entries that fail to parse, noting the incident in the log. If in addition
56796 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
56797 whenever a broken address is skipped. It is usually appropriate to set
56798 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
56799 </para>
56800 </section>
56801 <section id="SECID242">
56802 <title>Re-expansion of mailing lists</title>
56803 <para>
56804 <indexterm role="concept">
56805 <primary>mailing lists</primary>
56806 <secondary>re-expansion of</secondary>
56807 </indexterm>
56808 Exim remembers every individual address to which a message has been delivered,
56809 in order to avoid duplication, but it normally stores only the original
56810 recipient addresses with a message. If all the deliveries to a mailing list
56811 cannot be done at the first attempt, the mailing list is re-expanded when the
56812 delivery is next tried. This means that alterations to the list are taken into
56813 account at each delivery attempt, so addresses that have been added to
56814 the list since the message arrived will therefore receive a copy of the
56815 message, even though it pre-dates their subscription.
56816 </para>
56817 <para>
56818 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
56819 on the <command>redirect</command> router. If this is done, any addresses generated by the
56820 router that fail to deliver at the first attempt are added to the message as
56821 <quote>top level</quote> addresses, and the parent address that generated them is marked
56822 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
56823 subsequent delivery attempts. The disadvantage of this is that if any of the
56824 failing addresses are incorrect, correcting them in the file has no effect on
56825 pre-existing messages.
56826 </para>
56827 <para>
56828 The original top-level address is remembered with each of the generated
56829 addresses, and is output in any log messages. However, any intermediate parent
56830 addresses are not recorded. This makes a difference to the log only if the
56831 <option>all_parents</option> selector is set, but for mailing lists there is normally only
56832 one level of expansion anyway.
56833 </para>
56834 </section>
56835 <section id="SECID243">
56836 <title>Closed mailing lists</title>
56837 <para>
56838 <indexterm role="concept">
56839 <primary>mailing lists</primary>
56840 <secondary>closed</secondary>
56841 </indexterm>
56842 The examples so far have assumed open mailing lists, to which anybody may
56843 send mail. It is also possible to set up closed lists, where mail is accepted
56844 from specified senders only. This is done by making use of the generic
56845 <option>senders</option> option to restrict the router that handles the list.
56846 </para>
56847 <para>
56848 The following example uses the same file as a list of recipients and as a list
56849 of permitted senders. It requires three routers:
56850 </para>
56851 <literallayout class="monospaced">
56852 lists_request:
56853   driver = redirect
56854   domains = lists.example
56855   local_part_suffix = -request
56856   file = /usr/lists/$local_part$local_part_suffix
56857   no_more
56858
56859 lists_post:
56860   driver = redirect
56861   domains = lists.example
56862   senders = ${if exists {/usr/lists/$local_part}\
56863              {lsearch;/usr/lists/$local_part}{*}}
56864   file = /usr/lists/$local_part
56865   forbid_pipe
56866   forbid_file
56867   errors_to = $local_part-request@lists.example
56868   no_more
56869
56870 lists_closed:
56871   driver = redirect
56872   domains = lists.example
56873   allow_fail
56874   data = :fail: $local_part@lists.example is a closed mailing list
56875 </literallayout>
56876 <para>
56877 All three routers have the same <option>domains</option> setting, so for any other domains,
56878 they are all skipped. The first router runs only if the local part ends in
56879 <option>-request</option>. It handles messages to the list manager(s) by means of an open
56880 mailing list.
56881 </para>
56882 <para>
56883 The second router runs only if the <option>senders</option> precondition is satisfied. It
56884 checks for the existence of a list that corresponds to the local part, and then
56885 checks that the sender is on the list by means of a linear search. It is
56886 necessary to check for the existence of the file before trying to search it,
56887 because otherwise Exim thinks there is a configuration error. If the file does
56888 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
56889 means that the router runs, but because there is no list, declines, and
56890 <option>no_more</option> ensures that no further routers are run. The address fails with an
56891 <quote>unrouteable address</quote> error.
56892 </para>
56893 <para>
56894 The third router runs only if the second router is skipped, which happens when
56895 a mailing list exists, but the sender is not on it. This router forcibly fails
56896 the address, giving a suitable error message.
56897 </para>
56898 </section>
56899 <section id="SECTverp">
56900 <title>Variable Envelope Return Paths (VERP)</title>
56901 <para>
56902 <indexterm role="concept">
56903 <primary>VERP</primary>
56904 </indexterm>
56905 <indexterm role="concept">
56906 <primary>Variable Envelope Return Paths</primary>
56907 </indexterm>
56908 <indexterm role="concept">
56909 <primary>envelope sender</primary>
56910 </indexterm>
56911 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;
56912 are a way of helping mailing list administrators discover which subscription
56913 address is the cause of a particular delivery failure. The idea is to encode
56914 the original recipient address in the outgoing envelope sender address, so that
56915 if the message is forwarded by another host and then subsequently bounces, the
56916 original recipient can be extracted from the recipient address of the bounce.
56917 </para>
56918 <para>
56919 <indexterm role="option">
56920 <primary><option>errors_to</option></primary>
56921 </indexterm>
56922 <indexterm role="option">
56923 <primary><option>return_path</option></primary>
56924 </indexterm>
56925 Envelope sender addresses can be modified by Exim using two different
56926 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
56927 list examples), or the <option>return_path</option> option on a transport. The second of
56928 these is effective only if the message is successfully delivered to another
56929 host; it is not used for errors detected on the local host (see the description
56930 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
56931 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
56932 </para>
56933 <literallayout class="monospaced">
56934 verp_smtp:
56935   driver = smtp
56936   max_rcpt = 1
56937   return_path = \
56938     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56939       {$1-request+$local_part=$domain@your.dom.example}fail}
56940 </literallayout>
56941 <para>
56942 This has the effect of rewriting the return path (envelope sender) on outgoing
56943 SMTP messages, if the local part of the original return path ends in
56944 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
56945 local part and domain of the recipient into the return path. Suppose, for
56946 example, that a message whose return path has been set to
56947 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
56948 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
56949 rewritten as
56950 </para>
56951 <literallayout class="monospaced">
56952 somelist-request+subscriber=other.dom.example@your.dom.example
56953 </literallayout>
56954 <para>
56955 <indexterm role="variable">
56956 <primary><varname>$local_part</varname></primary>
56957 </indexterm>
56958 For this to work, you must tell Exim to send multiple copies of messages that
56959 have more than one recipient, so that each copy has just one recipient. This is
56960 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
56961 might be sent to several different recipients in the same domain, in which case
56962 <varname>$local_part</varname> is not available in the transport, because it is not unique.
56963 </para>
56964 <para>
56965 Unless your host is doing nothing but mailing list deliveries, you should
56966 probably use a separate transport for the VERP deliveries, so as not to use
56967 extra resources in making one-per-recipient copies for other deliveries. This
56968 can easily be done by expanding the <option>transport</option> option in the router:
56969 </para>
56970 <literallayout class="monospaced">
56971 dnslookup:
56972   driver = dnslookup
56973   domains = ! +local_domains
56974   transport = \
56975     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56976       {verp_smtp}{remote_smtp}}
56977   no_more
56978 </literallayout>
56979 <para>
56980 If you want to change the return path using <option>errors_to</option> in a router instead
56981 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
56982 routers that handle mailing list addresses. This will ensure that all delivery
56983 errors, including those detected on the local host, are sent to the VERP
56984 address.
56985 </para>
56986 <para>
56987 On a host that does no local deliveries and has no manual routing, only the
56988 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
56989 SMTP deliveries. Every mailing list recipient has its own return path value,
56990 and so Exim must hand them to the transport one at a time. Here is an example
56991 of a <command>dnslookup</command> router that implements VERP:
56992 </para>
56993 <literallayout class="monospaced">
56994 verp_dnslookup:
56995   driver = dnslookup
56996   domains = ! +local_domains
56997   transport = remote_smtp
56998   errors_to = \
56999     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57000      {$1-request+$local_part=$domain@your.dom.example}fail}
57001   no_more
57002 </literallayout>
57003 <para>
57004 Before you start sending out messages with VERPed return paths, you must also
57005 configure Exim to accept the bounce messages that come back to those paths.
57006 Typically this is done by setting a <option>local_part_suffix</option> option for a
57007 router, and using this to route the messages to wherever you want to handle
57008 them.
57009 </para>
57010 <para>
57011 The overhead incurred in using VERP depends very much on the size of the
57012 message, the number of recipient addresses that resolve to the same remote
57013 host, and the speed of the connection over which the message is being sent. If
57014 a lot of addresses resolve to the same host and the connection is slow, sending
57015 a separate copy of the message for each address may take substantially longer
57016 than sending a single copy with many recipients (for which VERP cannot be
57017 used).
57018 </para>
57019 </section>
57020 <section id="SECTvirtualdomains">
57021 <title>Virtual domains</title>
57022 <para>
57023 <indexterm role="concept">
57024 <primary>virtual domains</primary>
57025 </indexterm>
57026 <indexterm role="concept">
57027 <primary>domain</primary>
57028 <secondary>virtual</secondary>
57029 </indexterm>
57030 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57031 meanings:
57032 </para>
57033 <itemizedlist>
57034 <listitem>
57035 <para>
57036 A domain for which there are no real mailboxes; all valid local parts are
57037 aliases for other email addresses. Common examples are organizational
57038 top-level domains and <quote>vanity</quote> domains.
57039 </para>
57040 </listitem>
57041 <listitem>
57042 <para>
57043 One of a number of independent domains that are all handled by the same host,
57044 with mailboxes on that host, but where the mailbox owners do not necessarily
57045 have login accounts on that host.
57046 </para>
57047 </listitem>
57048 </itemizedlist>
57049 <para>
57050 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57051 the second. This kind of domain can be handled in Exim with a straightforward
57052 aliasing router. One approach is to create a separate alias file for each
57053 virtual domain. Exim can test for the existence of the alias file to determine
57054 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57055 to a router of this form:
57056 </para>
57057 <literallayout class="monospaced">
57058 virtual:
57059   driver = redirect
57060   domains = dsearch;/etc/mail/virtual
57061   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57062   no_more
57063 </literallayout>
57064 <para>
57065 The <option>domains</option> option specifies that the router is to be skipped, unless there
57066 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57067 domain that is being processed. When the router runs, it looks up the local
57068 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57069 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57070 string), Exim gives up on the address without trying any subsequent routers.
57071 </para>
57072 <para>
57073 This one router can handle all the virtual domains because the alias file names
57074 follow a fixed pattern. Permissions can be arranged so that appropriate people
57075 can edit the different alias files. A successful aliasing operation results in
57076 a new envelope recipient address, which is then routed from scratch.
57077 </para>
57078 <para>
57079 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57080 way. One approach is to create a file for each domain containing a list of
57081 valid local parts, and use it in a router like this:
57082 </para>
57083 <literallayout class="monospaced">
57084 my_domains:
57085   driver = accept
57086   domains = dsearch;/etc/mail/domains
57087   local_parts = lsearch;/etc/mail/domains/$domain
57088   transport = my_mailboxes
57089 </literallayout>
57090 <para>
57091 The address is accepted if there is a file for the domain, and the local part
57092 can be found in the file. The <option>domains</option> option is used to check for the
57093 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
57094 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57095 because that option is tested after <option>local_parts</option>. The transport is as
57096 follows:
57097 </para>
57098 <literallayout class="monospaced">
57099 my_mailboxes:
57100   driver = appendfile
57101   file = /var/mail/$domain/$local_part
57102   user = mail
57103 </literallayout>
57104 <para>
57105 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57106 required, to specify which uid is to be used for writing to the mailboxes.
57107 </para>
57108 <para>
57109 The configuration shown here is just one example of how you might support this
57110 requirement. There are many other ways this kind of configuration can be set
57111 up, for example, by using a database instead of separate files to hold all the
57112 information about the domains.
57113 </para>
57114 </section>
57115 <section id="SECTmulbox">
57116 <title>Multiple user mailboxes</title>
57117 <para>
57118 <indexterm role="concept">
57119 <primary>multiple mailboxes</primary>
57120 </indexterm>
57121 <indexterm role="concept">
57122 <primary>mailbox</primary>
57123 <secondary>multiple</secondary>
57124 </indexterm>
57125 <indexterm role="concept">
57126 <primary>local part</primary>
57127 <secondary>prefix</secondary>
57128 </indexterm>
57129 <indexterm role="concept">
57130 <primary>local part</primary>
57131 <secondary>suffix</secondary>
57132 </indexterm>
57133 Heavy email users often want to operate with multiple mailboxes, into which
57134 incoming mail is automatically sorted. A popular way of handling this is to
57135 allow users to use multiple sender addresses, so that replies can easily be
57136 identified. Users are permitted to add prefixes or suffixes to their local
57137 parts for this purpose. The wildcard facility of the generic router options
57138 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57139 example, consider this router:
57140 </para>
57141 <literallayout class="monospaced">
57142 userforward:
57143   driver = redirect
57144   check_local_user
57145   file = $home/.forward
57146   local_part_suffix = -*
57147   local_part_suffix_optional
57148   allow_filter
57149 </literallayout>
57150 <para>
57151 <indexterm role="variable">
57152 <primary><varname>$local_part_suffix</varname></primary>
57153 </indexterm>
57154 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
57155 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57156 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57157 </para>
57158 <literallayout class="monospaced">
57159 if $local_part_suffix contains -special then
57160 save /home/$local_part/Mail/special
57161 endif
57162 </literallayout>
57163 <para>
57164 If the filter file does not exist, or does not deal with such addresses, they
57165 fall through to subsequent routers, and, assuming no subsequent use of the
57166 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57167 control over which suffixes are valid.
57168 </para>
57169 <para>
57170 Alternatively, a suffix can be used to trigger the use of a different
57171 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
57172 another MTA:
57173 </para>
57174 <literallayout class="monospaced">
57175 userforward:
57176   driver = redirect
57177   check_local_user
57178   file = $home/.forward$local_part_suffix
57179   local_part_suffix = -*
57180   local_part_suffix_optional
57181   allow_filter
57182 </literallayout>
57183 <para>
57184 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57185 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57186 does not exist, or does not deal with the address, it is passed on to
57187 subsequent routers, which could, if required, look for an unqualified
57188 <filename>.forward</filename> file to use as a default.
57189 </para>
57190 </section>
57191 <section id="SECID244">
57192 <title>Simplified vacation processing</title>
57193 <para>
57194 <indexterm role="concept">
57195 <primary>vacation processing</primary>
57196 </indexterm>
57197 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57198 a pipe command in a <filename>.forward</filename> file
57199 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57200 This is prone to error by inexperienced users. There are two features of Exim
57201 that can be used to make this process simpler for users:
57202 </para>
57203 <itemizedlist>
57204 <listitem>
57205 <para>
57206 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57207 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57208 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
57209 <filename>.forward</filename> file are then much simpler. For example:
57210 </para>
57211 <literallayout class="monospaced">
57212 spqr, vacation-spqr
57213 </literallayout>
57214 </listitem>
57215 <listitem>
57216 <para>
57217 The <option>require_files</option> generic router option can be used to trigger a
57218 vacation delivery by checking for the existence of a certain file in the
57219 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
57220 ensure that the original delivery also proceeds. In this case, all the user has
57221 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57222 message.
57223 </para>
57224 </listitem>
57225 </itemizedlist>
57226 <para>
57227 Another advantage of both these methods is that they both work even when the
57228 use of arbitrary pipes by users is locked out.
57229 </para>
57230 </section>
57231 <section id="SECID245">
57232 <title>Taking copies of mail</title>
57233 <para>
57234 <indexterm role="concept">
57235 <primary>message</primary>
57236 <secondary>copying every</secondary>
57237 </indexterm>
57238 Some installations have policies that require archive copies of all messages to
57239 be made. A single copy of each message can easily be taken by an appropriate
57240 command in a system filter, which could, for example, use a different file for
57241 each day&#x2019;s messages.
57242 </para>
57243 <para>
57244 There is also a shadow transport mechanism that can be used to take copies of
57245 messages that are successfully delivered by local transports, one copy per
57246 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57247 notification of delivery by sites that insist on doing such things.
57248 </para>
57249 </section>
57250 <section id="SECID246">
57251 <title>Intermittently connected hosts</title>
57252 <para>
57253 <indexterm role="concept">
57254 <primary>intermittently connected hosts</primary>
57255 </indexterm>
57256 It has become quite common (because it is cheaper) for hosts to connect to the
57257 Internet periodically rather than remain connected all the time. The normal
57258 arrangement is that mail for such hosts accumulates on a system that is
57259 permanently connected.
57260 </para>
57261 <para>
57262 Exim was designed for use on permanently connected hosts, and so it is not
57263 particularly well-suited to use in an intermittently connected environment.
57264 Nevertheless there are some features that can be used.
57265 </para>
57266 </section>
57267 <section id="SECID247">
57268 <title>Exim on the upstream server host</title>
57269 <para>
57270 It is tempting to arrange for incoming mail for the intermittently connected
57271 host to remain on Exim&#x2019;s queue until the client connects. However, this
57272 approach does not scale very well. Two different kinds of waiting message are
57273 being mixed up in the same queue &ndash; those that cannot be delivered because of
57274 some temporary problem, and those that are waiting for their destination host
57275 to connect. This makes it hard to manage the queue, as well as wasting
57276 resources, because each queue runner scans the entire queue.
57277 </para>
57278 <para>
57279 A better approach is to separate off those messages that are waiting for an
57280 intermittently connected host. This can be done by delivering these messages
57281 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57282 format, from where they are transmitted by other software when their
57283 destination connects. This makes it easy to collect all the mail for one host
57284 in a single directory, and to apply local timeout rules on a per-message basis
57285 if required.
57286 </para>
57287 <para>
57288 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
57289 you are doing this, you should configure Exim with a long retry period for the
57290 intermittent host. For example:
57291 </para>
57292 <literallayout class="monospaced">
57293 cheshire.wonderland.fict.example    *   F,5d,24h
57294 </literallayout>
57295 <para>
57296 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57297 which messages it has queued up for that host. Once the intermittent host comes
57298 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57299 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57300 causes all the queued up messages to be delivered, often down a single SMTP
57301 connection. While the host remains connected, any new messages get delivered
57302 immediately.
57303 </para>
57304 <para>
57305 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57306 issued with a different IP address each time it connects, Exim&#x2019;s retry
57307 mechanisms on the holding host get confused, because the IP address is normally
57308 used as part of the key string for holding retry information. This can be
57309 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57310 Since this has disadvantages for permanently connected hosts, it is best to
57311 arrange a separate transport for the intermittently connected ones.
57312 </para>
57313 </section>
57314 <section id="SECID248">
57315 <title>Exim on the intermittently connected client host</title>
57316 <para>
57317 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57318 increased, or even set to zero (that is, disabled) on the intermittently
57319 connected host, so that all incoming messages down a single connection get
57320 delivered immediately.
57321 </para>
57322 <para>
57323 <indexterm role="concept">
57324 <primary>SMTP</primary>
57325 <secondary>passed connection</secondary>
57326 </indexterm>
57327 <indexterm role="concept">
57328 <primary>SMTP</primary>
57329 <secondary>multiple deliveries</secondary>
57330 </indexterm>
57331 <indexterm role="concept">
57332 <primary>multiple SMTP deliveries</primary>
57333 </indexterm>
57334 Mail waiting to be sent from an intermittently connected host will probably
57335 not have been routed, because without a connection DNS lookups are not
57336 possible. This means that if a normal queue run is done at connection time,
57337 each message is likely to be sent in a separate SMTP session. This can be
57338 avoided by starting the queue run with a command line option beginning with
57339 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57340 first pass, routing is done but no deliveries take place. The second pass is a
57341 normal queue run; since all the messages have been previously routed, those
57342 destined for the same host are likely to get sent as multiple deliveries in a
57343 single SMTP connection.
57344 </para>
57345 </section>
57346 </chapter>
57347
57348 <chapter id="CHAPnonqueueing">
57349 <title>Using Exim as a non-queueing client</title>
57350 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57351 <para>
57352 <indexterm role="concept">
57353 <primary>client, non-queueing</primary>
57354 </indexterm>
57355 <indexterm role="concept">
57356 <primary>smart host</primary>
57357 <secondary>suppressing queueing</secondary>
57358 </indexterm>
57359 On a personal computer, it is a common requirement for all
57360 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57361 configured to operate that way, for all the popular operating systems.
57362 However, there are some MUAs for Unix-like systems that cannot be so
57363 configured: they submit messages using the command line interface of
57364 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57365 messages this way.
57366 </para>
57367 <para>
57368 If the personal computer runs continuously, there is no problem, because it can
57369 run a conventional MTA that handles delivery to the smart host, and deal with
57370 any delays via its queueing mechanism. However, if the computer does not run
57371 continuously or runs different operating systems at different times, queueing
57372 email is not desirable.
57373 </para>
57374 <para>
57375 There is therefore a requirement for something that can provide the
57376 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57377 any queueing or retrying facilities. Furthermore, the delivery to the smart
57378 host should be synchronous, so that if it fails, the sending MUA is immediately
57379 informed. In other words, we want something that extends an MUA that submits
57380 to a local MTA via the command line so that it behaves like one that submits
57381 to a remote smart host using TCP/SMTP.
57382 </para>
57383 <para>
57384 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57385 that do this job. However, people have found them to be lacking in various
57386 ways. For instance, you might want to allow aliasing and forwarding to be done
57387 before sending a message to the smart host.
57388 </para>
57389 <para>
57390 Exim already had the necessary infrastructure for doing this job. Just a few
57391 tweaks were needed to make it behave as required, though it is somewhat of an
57392 overkill to use a fully-featured MTA for this purpose.
57393 </para>
57394 <para>
57395 <indexterm role="option">
57396 <primary><option>mua_wrapper</option></primary>
57397 </indexterm>
57398 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57399 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57400 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57401 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57402 compatible router and transport configuration. Typically there will be just one
57403 router and one transport, sending everything to a smart host.
57404 </para>
57405 <para>
57406 When run in MUA wrapping mode, the behaviour of Exim changes in the
57407 following ways:
57408 </para>
57409 <itemizedlist>
57410 <listitem>
57411 <para>
57412 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57413 In other words, the only way to submit messages is via the command line.
57414 </para>
57415 </listitem>
57416 <listitem>
57417 <para>
57418 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57419 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57420 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57421 does not finish until the delivery attempt is complete. If the delivery is
57422 successful, a zero return code is given.
57423 </para>
57424 </listitem>
57425 <listitem>
57426 <para>
57427 Address redirection is permitted, but the final routing for all addresses must
57428 be to the same remote transport, and to the same list of hosts. Furthermore,
57429 the return address (envelope sender) must be the same for all recipients, as
57430 must any added or deleted header lines. In other words, it must be possible to
57431 deliver the message in a single SMTP transaction, however many recipients there
57432 are.
57433 </para>
57434 </listitem>
57435 <listitem>
57436 <para>
57437 If these conditions are not met, or if routing any address results in a
57438 failure or defer status, or if Exim is unable to deliver all the recipients
57439 successfully to one of the smart hosts, delivery of the entire message fails.
57440 </para>
57441 </listitem>
57442 <listitem>
57443 <para>
57444 Because no queueing is allowed, all failures are treated as permanent; there
57445 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57446 smart host. Furthermore, because only a single yes/no response can be given to
57447 the caller, it is not possible to deliver to some recipients and not others. If
57448 there is an error (temporary or permanent) for any recipient, all are failed.
57449 </para>
57450 </listitem>
57451 <listitem>
57452 <para>
57453 If more than one smart host is listed, Exim will try another host after a
57454 connection failure or a timeout, in the normal way. However, if this kind of
57455 failure happens for all the hosts, the delivery fails.
57456 </para>
57457 </listitem>
57458 <listitem>
57459 <para>
57460 When delivery fails, an error message is written to the standard error stream
57461 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
57462 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
57463 are ever generated.
57464 </para>
57465 </listitem>
57466 <listitem>
57467 <para>
57468 No retry data is maintained, and any retry rules are ignored.
57469 </para>
57470 </listitem>
57471 <listitem>
57472 <para>
57473 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57474 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57475 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57476 </para>
57477 </listitem>
57478 </itemizedlist>
57479 <para>
57480 The overall effect is that Exim makes a single synchronous attempt to deliver
57481 the message, failing if there is any kind of problem. Because no local
57482 deliveries are done and no daemon can be run, Exim does not need root
57483 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57484 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57485 the advantages and disadvantages of running without root privilege.
57486 </para>
57487 </chapter>
57488
57489 <chapter id="CHAPlog">
57490 <title>Log files</title>
57491 <para>
57492 <indexterm role="concept" id="IIDloggen" class="startofrange">
57493 <primary>log</primary>
57494 <secondary>general description</secondary>
57495 </indexterm>
57496 <indexterm role="concept">
57497 <primary>log</primary>
57498 <secondary>types of</secondary>
57499 </indexterm>
57500 Exim writes three different logs, referred to as the main log, the reject log,
57501 and the panic log:
57502 </para>
57503 <itemizedlist>
57504 <listitem>
57505 <para>
57506 <indexterm role="concept">
57507 <primary>main log</primary>
57508 </indexterm>
57509 The main log records the arrival of each message and each delivery in a single
57510 line in each case. The format is as compact as possible, in an attempt to keep
57511 down the size of log files. Two-character flag sequences make it easy to pick
57512 out these lines. A number of other events are recorded in the main log. Some of
57513 them are optional, in which case the <option>log_selector</option> option controls whether
57514 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57515 analysis of main log files, is provided in the Exim distribution (see section
57516 <xref linkend="SECTmailstat"/>).
57517 </para>
57518 </listitem>
57519 <listitem>
57520 <para>
57521 <indexterm role="concept">
57522 <primary>reject log</primary>
57523 </indexterm>
57524 The reject log records information from messages that are rejected as a result
57525 of a configuration option (that is, for policy reasons).
57526 The first line of each rejection is a copy of the line that is also written to
57527 the main log. Then, if the message&#x2019;s header has been read at the time the log
57528 is written, its contents are written to this log. Only the original header
57529 lines are available; header lines added by ACLs are not logged. You can use the
57530 reject log to check that your policy controls are working correctly; on a busy
57531 host this may be easier than scanning the main log for rejection messages. You
57532 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57533 false.
57534 </para>
57535 </listitem>
57536 <listitem>
57537 <para>
57538 <indexterm role="concept">
57539 <primary>panic log</primary>
57540 </indexterm>
57541 <indexterm role="concept">
57542 <primary>system log</primary>
57543 </indexterm>
57544 When certain serious errors occur, Exim writes entries to its panic log. If the
57545 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57546 are usually written to the main log as well, but can get lost amid the mass of
57547 other entries. The panic log should be empty under normal circumstances. It is
57548 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57549 regularly, in order to become aware of any problems. When Exim cannot open its
57550 panic log, it tries as a last resort to write to the system log (syslog). This
57551 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57552 message itself is written at priority LOG_CRIT.
57553 </para>
57554 </listitem>
57555 </itemizedlist>
57556 <para>
57557 Every log line starts with a timestamp, in the format shown in the following
57558 example. Note that many of the examples shown in this chapter are line-wrapped.
57559 In the log file, this would be all on one line:
57560 </para>
57561 <literallayout class="monospaced">
57562 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57563   by QUIT
57564 </literallayout>
57565 <para>
57566 By default, the timestamps are in the local timezone. There are two
57567 ways of changing this:
57568 </para>
57569 <itemizedlist>
57570 <listitem>
57571 <para>
57572 You can set the <option>timezone</option> option to a different time zone; in particular, if
57573 you set
57574 </para>
57575 <literallayout class="monospaced">
57576 timezone = UTC
57577 </literallayout>
57578 <para>
57579 the timestamps will be in UTC (aka GMT).
57580 </para>
57581 </listitem>
57582 <listitem>
57583 <para>
57584 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57585 example:
57586 </para>
57587 <literallayout class="monospaced">
57588 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57589 </literallayout>
57590 </listitem>
57591 </itemizedlist>
57592 <para>
57593 <indexterm role="concept">
57594 <primary>log</primary>
57595 <secondary>process ids in</secondary>
57596 </indexterm>
57597 <indexterm role="concept">
57598 <primary>pid (process id)</primary>
57599 <secondary>in log lines</secondary>
57600 </indexterm>
57601 Exim does not include its process id in log lines by default, but you can
57602 request that it does so by specifying the <literal>pid</literal> log selector (see section
57603 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57604 brackets, immediately after the time and date.
57605 </para>
57606 <section id="SECTwhelogwri">
57607 <title>Where the logs are written</title>
57608 <para>
57609 <indexterm role="concept">
57610 <primary>log</primary>
57611 <secondary>destination</secondary>
57612 </indexterm>
57613 <indexterm role="concept">
57614 <primary>log</primary>
57615 <secondary>to file</secondary>
57616 </indexterm>
57617 <indexterm role="concept">
57618 <primary>log</primary>
57619 <secondary>to syslog</secondary>
57620 </indexterm>
57621 <indexterm role="concept">
57622 <primary>syslog</primary>
57623 </indexterm>
57624 The logs may be written to local files, or to syslog, or both. However, it
57625 should be noted that many syslog implementations use UDP as a transport, and
57626 are therefore unreliable in the sense that messages are not guaranteed to
57627 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57628 It has also been reported that on large log files (tens of megabytes) you may
57629 need to tweak syslog to prevent it syncing the file with each write &ndash; on
57630 Linux this has been seen to make syslog take 90% plus of CPU time.
57631 </para>
57632 <para>
57633 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
57634 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
57635 configuration. This latter string is expanded, so it can contain, for example,
57636 references to the host name:
57637 </para>
57638 <literallayout class="monospaced">
57639 log_file_path = /var/log/$primary_hostname/exim_%slog
57640 </literallayout>
57641 <para>
57642 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
57643 rather than at run time, because then the setting is available right from the
57644 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
57645 before it has read the configuration file (for example, an error in the
57646 configuration file) it will not use the path you want, and may not be able to
57647 log at all.
57648 </para>
57649 <para>
57650 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
57651 list, currently limited to at most two items. This is one option where the
57652 facility for changing a list separator may not be used. The list must always be
57653 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
57654 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
57655 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
57656 implying the use of a default path.
57657 </para>
57658 <para>
57659 When Exim encounters an empty item in the list, it searches the list defined by
57660 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
57661 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
57662 mean <quote>use the path specified at build time</quote>. It no such item exists, log
57663 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
57664 equivalent to the setting:
57665 </para>
57666 <literallayout class="monospaced">
57667 log_file_path = $spool_directory/log/%slog
57668 </literallayout>
57669 <para>
57670 If you do not specify anything at build time or run time, that is where the
57671 logs are written.
57672 </para>
57673 <para>
57674 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
57675 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
57676 </para>
57677 <para>
57678 Here are some examples of possible settings:
57679 </para>
57680 <literallayout>
57681 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
57682 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
57683 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
57684 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
57685 </literallayout>
57686 <para>
57687 If there are more than two paths in the list, the first is used and a panic
57688 error is logged.
57689 </para>
57690 </section>
57691 <section id="SECID285">
57692 <title>Logging to local files that are periodically <quote>cycled</quote></title>
57693 <para>
57694 <indexterm role="concept">
57695 <primary>log</primary>
57696 <secondary>cycling local files</secondary>
57697 </indexterm>
57698 <indexterm role="concept">
57699 <primary>cycling logs</primary>
57700 </indexterm>
57701 <indexterm role="concept">
57702 <primary><emphasis>exicyclog</emphasis></primary>
57703 </indexterm>
57704 <indexterm role="concept">
57705 <primary>log</primary>
57706 <secondary>local files; writing to</secondary>
57707 </indexterm>
57708 Some operating systems provide centralized and standardized methods for cycling
57709 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
57710 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
57711 main and reject logs each time it is called. The maximum number of old logs to
57712 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
57713 </para>
57714 <para>
57715 An Exim delivery process opens the main log when it first needs to write to it,
57716 and it keeps the file open in case subsequent entries are required &ndash; for
57717 example, if a number of different deliveries are being done for the same
57718 message. However, remote SMTP deliveries can take a long time, and this means
57719 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
57720 something similar is being used to rename log files on a regular basis. To
57721 ensure that a switch of log files is noticed as soon as possible, Exim calls
57722 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
57723 does not exist, or its inode has changed, the old file is closed and Exim
57724 tries to open the main log from scratch. Thus, an old log file may remain open
57725 for quite some time, but no Exim processes should write to it once it has been
57726 renamed.
57727 </para>
57728 </section>
57729 <section id="SECTdatlogfil">
57730 <title>Datestamped log files</title>
57731 <para>
57732 <indexterm role="concept">
57733 <primary>log</primary>
57734 <secondary>datestamped files</secondary>
57735 </indexterm>
57736 Instead of cycling the main and reject log files by renaming them
57737 periodically, some sites like to use files whose names contain a datestamp,
57738 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
57739 Exim has support for this way of working. It is enabled by setting the
57740 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
57741 datestamp is required. For example:
57742 </para>
57743 <literallayout class="monospaced">
57744 log_file_path = /var/spool/exim/log/%slog-%D
57745 log_file_path = /var/log/exim-%s-%D.log
57746 log_file_path = /var/spool/exim/log/%D-%slog
57747 </literallayout>
57748 <para>
57749 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
57750 examples of names generated by the above examples:
57751 </para>
57752 <literallayout class="monospaced">
57753 /var/spool/exim/log/mainlog-20021225
57754 /var/log/exim-reject-20021225.log
57755 /var/spool/exim/log/20021225-mainlog
57756 </literallayout>
57757 <para>
57758 When this form of log file is specified, Exim automatically switches to new
57759 files at midnight. It does not make any attempt to compress old logs; you
57760 will need to write your own script if you require this. You should not
57761 run <emphasis>exicyclog</emphasis> with this form of logging.
57762 </para>
57763 <para>
57764 The location of the panic log is also determined by <option>log_file_path</option>, but it
57765 is not datestamped, because rotation of the panic log does not make sense.
57766 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
57767 In addition, if it immediately follows a slash, a following non-alphanumeric
57768 character is removed; otherwise a preceding non-alphanumeric character is
57769 removed. Thus, the three examples above would give these panic log names:
57770 </para>
57771 <literallayout class="monospaced">
57772 /var/spool/exim/log/paniclog
57773 /var/log/exim-panic.log
57774 /var/spool/exim/log/paniclog
57775 </literallayout>
57776 </section>
57777 <section id="SECID249">
57778 <title>Logging to syslog</title>
57779 <para>
57780 <indexterm role="concept">
57781 <primary>log</primary>
57782 <secondary>syslog; writing to</secondary>
57783 </indexterm>
57784 The use of syslog does not change what Exim logs or the format of its messages,
57785 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
57786 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
57787 that, the same strings are written to syslog as to log files. The syslog
57788 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
57789 by default, but you can change these by setting the <option>syslog_facility</option> and
57790 <option>syslog_processname</option> options, respectively. If Exim was compiled with
57791 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
57792 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
57793 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
57794 the time and host name to each line.
57795 The three log streams are mapped onto syslog priorities as follows:
57796 </para>
57797 <itemizedlist>
57798 <listitem>
57799 <para>
57800 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
57801 </para>
57802 </listitem>
57803 <listitem>
57804 <para>
57805 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
57806 </para>
57807 </listitem>
57808 <listitem>
57809 <para>
57810 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
57811 </para>
57812 </listitem>
57813 </itemizedlist>
57814 <para>
57815 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
57816 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
57817 these are routed by syslog to the same place. You can suppress this duplication
57818 by setting <option>syslog_duplication</option> false.
57819 </para>
57820 <para>
57821 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
57822 entries contain multiple lines when headers are included. To cope with both
57823 these cases, entries written to syslog are split into separate <function>syslog()</function>
57824 calls at each internal newline, and also after a maximum of
57825 870 data characters. (This allows for a total syslog line length of 1024, when
57826 additions such as timestamps are added.) If you are running a syslog
57827 replacement that can handle lines longer than the 1024 characters allowed by
57828 RFC 3164, you should set
57829 </para>
57830 <literallayout class="monospaced">
57831 SYSLOG_LONG_LINES=yes
57832 </literallayout>
57833 <para>
57834 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
57835 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
57836 </para>
57837 <para>
57838 To make it easy to re-assemble split lines later, each component of a split
57839 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;]
57840 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
57841 components in the entry. The / delimiter is used when the line was split
57842 because it was too long; if it was split because of an internal newline, the \
57843 delimiter is used. For example, supposing the length limit to be 50 instead of
57844 870, the following would be the result of a typical rejection message to
57845 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
57846 name, and pid as added by syslog:
57847 </para>
57848 <literallayout class="monospaced">
57849 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
57850 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
57851 [3/5]  when scanning for sender: missing or malformed lo
57852 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
57853 [5/5] mple&gt;)
57854 </literallayout>
57855 <para>
57856 The same error might cause the following lines to be written to <quote>rejectlog</quote>
57857 (LOG_NOTICE):
57858 </para>
57859 <literallayout class="monospaced">
57860 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
57861 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
57862 [3/18] er when scanning for sender: missing or malformed
57863 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
57864 [5\18] .example&gt;)
57865 [6\18] Recipients: ph10@some.domain.cam.example
57866 [7\18] P Received: from [127.0.0.1] (ident=ph10)
57867 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
57868 [9\18]        id 16RdAL-0006pc-00
57869 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
57870 [11\18] 09:43 +0100
57871 [12\18] F From: &lt;&gt;
57872 [13\18]   Subject: this is a test header
57873 [18\18]   X-something: this is another header
57874 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
57875 [16\18] le&gt;
57876 [17\18] B Bcc:
57877 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
57878 </literallayout>
57879 <para>
57880 Log lines that are neither too long nor contain newlines are written to syslog
57881 without modification.
57882 </para>
57883 <para>
57884 If only syslog is being used, the Exim monitor is unable to provide a log tail
57885 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
57886 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
57887 where it is.
57888 </para>
57889 </section>
57890 <section id="SECID250">
57891 <title>Log line flags</title>
57892 <para>
57893 One line is written to the main log for each message received, and for each
57894 successful, unsuccessful, and delayed delivery. These lines can readily be
57895 picked out by the distinctive two-character flags that immediately follow the
57896 timestamp. The flags are:
57897 </para>
57898 <literallayout>
57899 <literal>&lt;=</literal>     message arrival
57900 <literal>=&gt;</literal>     normal message delivery
57901 <literal>-&gt;</literal>     additional address in same delivery
57902 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
57903 <literal>**</literal>     delivery failed; address bounced
57904 <literal>==</literal>     delivery deferred; temporary problem
57905 </literallayout>
57906 </section>
57907 <section id="SECID251">
57908 <title>Logging message reception</title>
57909 <para>
57910 <indexterm role="concept">
57911 <primary>log</primary>
57912 <secondary>reception line</secondary>
57913 </indexterm>
57914 The format of the single-line entry in the main log that is written for every
57915 message received is shown in the basic example below, which is split over
57916 several lines in order to fit it on the page:
57917 </para>
57918 <literallayout class="monospaced">
57919 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
57920   H=mailer.fict.example [192.168.123.123] U=exim
57921   P=smtp S=5678 id=&lt;incoming message id&gt;
57922 </literallayout>
57923 <para>
57924 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
57925 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
57926 generated, this is followed by an item of the form
57927 </para>
57928 <literallayout class="monospaced">
57929 R=&lt;message id&gt;
57930 </literallayout>
57931 <para>
57932 which is a reference to the message that caused the bounce to be sent.
57933 </para>
57934 <para>
57935 <indexterm role="concept">
57936 <primary>HELO</primary>
57937 </indexterm>
57938 <indexterm role="concept">
57939 <primary>EHLO</primary>
57940 </indexterm>
57941 For messages from other hosts, the H and U fields identify the remote host and
57942 record the RFC 1413 identity of the user that sent the message, if one was
57943 received. The number given in square brackets is the IP address of the sending
57944 host. If there is a single, unparenthesized  host name in the H field, as
57945 above, it has been verified to correspond to the IP address (see the
57946 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
57947 by the remote host in the SMTP HELO or EHLO command, and has not been
57948 verified. If verification yields a different name to that given for HELO or
57949 EHLO, the verified name appears first, followed by the HELO or EHLO
57950 name in parentheses.
57951 </para>
57952 <para>
57953 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
57954 without brackets, in the HELO or EHLO command, leading to entries in
57955 the log containing text like these examples:
57956 </para>
57957 <literallayout class="monospaced">
57958 H=(10.21.32.43) [192.168.8.34]
57959 H=([10.21.32.43]) [192.168.8.34]
57960 </literallayout>
57961 <para>
57962 This can be confusing. Only the final address in square brackets can be relied
57963 on.
57964 </para>
57965 <para>
57966 For locally generated messages (that is, messages not received over TCP/IP),
57967 the H field is omitted, and the U field contains the login name of the caller
57968 of Exim.
57969 </para>
57970 <para>
57971 <indexterm role="concept">
57972 <primary>authentication</primary>
57973 <secondary>logging</secondary>
57974 </indexterm>
57975 <indexterm role="concept">
57976 <primary>AUTH</primary>
57977 <secondary>logging</secondary>
57978 </indexterm>
57979 For all messages, the P field specifies the protocol used to receive the
57980 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
57981 of incoming SMTP messages, the value indicates whether or not any SMTP
57982 extensions (ESMTP), encryption, or authentication were used. If the SMTP
57983 session was encrypted, there is an additional X field that records the cipher
57984 suite that was used.
57985 </para>
57986 <para>
57987 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
57988 hosts that have authenticated themselves using the SMTP AUTH command. The first
57989 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
57990 there is an additional item A= followed by the name of the authenticator that
57991 was used. If an authenticated identification was set up by the authenticator&#x2019;s
57992 <option>server_set_id</option> option, this is logged too, separated by a colon from the
57993 authenticator name.
57994 </para>
57995 <para>
57996 <indexterm role="concept">
57997 <primary>size</primary>
57998 <secondary>of message</secondary>
57999 </indexterm>
58000 The id field records the existing message id, if present. The size of the
58001 received message is given by the S field. When the message is delivered,
58002 headers may be removed or added, so that the size of delivered copies of the
58003 message may not correspond with this value (and indeed may be different to each
58004 other).
58005 </para>
58006 <para>
58007 The <option>log_selector</option> option can be used to request the logging of additional
58008 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58009 </para>
58010 </section>
58011 <section id="SECID252">
58012 <title>Logging deliveries</title>
58013 <para>
58014 <indexterm role="concept">
58015 <primary>log</primary>
58016 <secondary>delivery line</secondary>
58017 </indexterm>
58018 The format of the single-line entry in the main log that is written for every
58019 delivery is shown in one of the examples below, for local and remote
58020 deliveries, respectively. Each example has been split into two lines in order
58021 to fit it on the page:
58022 </para>
58023 <literallayout class="monospaced">
58024 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
58025   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
58026 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
58027   monk@holistic.fict.example R=dnslookup T=remote_smtp
58028   H=holistic.fict.example [192.168.234.234]
58029 </literallayout>
58030 <para>
58031 For ordinary local deliveries, the original address is given in angle brackets
58032 after the final delivery address, which might be a pipe or a file. If
58033 intermediate address(es) exist between the original and the final address, the
58034 last of these is given in parentheses after the final address. The R and T
58035 fields record the router and transport that were used to process the address.
58036 </para>
58037 <para>
58038 If a shadow transport was run after a successful local delivery, the log line
58039 for the successful delivery has an item added on the end, of the form
58040 </para>
58041 <literallayout>
58042 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
58043 </literallayout>
58044 <para>
58045 If the shadow transport did not succeed, the error message is put in
58046 parentheses afterwards.
58047 </para>
58048 <para>
58049 <indexterm role="concept">
58050 <primary>asterisk</primary>
58051 <secondary>after IP address</secondary>
58052 </indexterm>
58053 When more than one address is included in a single delivery (for example, two
58054 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58055 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
58056 down a single SMTP connection, an asterisk follows the IP address in the log
58057 lines for the second and subsequent messages.
58058 </para>
58059 <para>
58060 The generation of a reply message by a filter file gets logged as a
58061 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
58062 </para>
58063 <para>
58064 The <option>log_selector</option> option can be used to request the logging of additional
58065 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58066 </para>
58067 </section>
58068 <section id="SECID253">
58069 <title>Discarded deliveries</title>
58070 <para>
58071 <indexterm role="concept">
58072 <primary>discarded messages</primary>
58073 </indexterm>
58074 <indexterm role="concept">
58075 <primary>message</primary>
58076 <secondary>discarded</secondary>
58077 </indexterm>
58078 <indexterm role="concept">
58079 <primary>delivery</primary>
58080 <secondary>discarded; logging</secondary>
58081 </indexterm>
58082 When a message is discarded as a result of the command <quote>seen finish</quote> being
58083 obeyed in a filter file which generates no deliveries, a log entry of the form
58084 </para>
58085 <literallayout class="monospaced">
58086 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
58087   &lt;low.club@bridge.example&gt; R=userforward
58088 </literallayout>
58089 <para>
58090 is written, to record why no deliveries are logged. When a message is discarded
58091 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58092 </para>
58093 <literallayout class="monospaced">
58094 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
58095   &lt;hole@nowhere.example&gt; R=blackhole_router
58096 </literallayout>
58097 </section>
58098 <section id="SECID254">
58099 <title>Deferred deliveries</title>
58100 <para>
58101 When a delivery is deferred, a line of the following form is logged:
58102 </para>
58103 <literallayout class="monospaced">
58104 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58105   R=dnslookup T=smtp defer (146): Connection refused
58106 </literallayout>
58107 <para>
58108 In the case of remote deliveries, the error is the one that was given for the
58109 last IP address that was tried. Details of individual SMTP failures are also
58110 written to the log, so the above line would be preceded by something like
58111 </para>
58112 <literallayout class="monospaced">
58113 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58114   mail1.endrest.example [192.168.239.239]: Connection refused
58115 </literallayout>
58116 <para>
58117 When a deferred address is skipped because its retry time has not been reached,
58118 a message is written to the log, but this can be suppressed by setting an
58119 appropriate value in <option>log_selector</option>.
58120 </para>
58121 </section>
58122 <section id="SECID255">
58123 <title>Delivery failures</title>
58124 <para>
58125 <indexterm role="concept">
58126 <primary>delivery</primary>
58127 <secondary>failure; logging</secondary>
58128 </indexterm>
58129 If a delivery fails because an address cannot be routed, a line of the
58130 following form is logged:
58131 </para>
58132 <literallayout class="monospaced">
58133 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58134   &lt;jim@trek99.example&gt;: unknown mail domain
58135 </literallayout>
58136 <para>
58137 If a delivery fails at transport time, the router and transport are shown, and
58138 the response from the remote host is included, as in this example:
58139 </para>
58140 <literallayout class="monospaced">
58141 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58142   R=dnslookup T=remote_smtp: SMTP error from remote mailer
58143   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
58144   pbmail3.py.example [192.168.63.111]: 553 5.3.0
58145   &lt;ace400@pb.example&gt;...Addressee unknown
58146 </literallayout>
58147 <para>
58148 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58149 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58150 disabling PIPELINING. The log lines for all forms of delivery failure are
58151 flagged with <literal>**</literal>.
58152 </para>
58153 </section>
58154 <section id="SECID256">
58155 <title>Fake deliveries</title>
58156 <para>
58157 <indexterm role="concept">
58158 <primary>delivery</primary>
58159 <secondary>fake; logging</secondary>
58160 </indexterm>
58161 If a delivery does not actually take place because the <option>-N</option> option has been
58162 used to suppress it, a normal delivery line is written to the log, except that
58163 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
58164 </para>
58165 </section>
58166 <section id="SECID257">
58167 <title>Completion</title>
58168 <para>
58169 A line of the form
58170 </para>
58171 <literallayout class="monospaced">
58172 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58173 </literallayout>
58174 <para>
58175 is written to the main log when a message is about to be removed from the spool
58176 at the end of its processing.
58177 </para>
58178 </section>
58179 <section id="SECID258">
58180 <title>Summary of Fields in Log Lines</title>
58181 <para>
58182 <indexterm role="concept">
58183 <primary>log</primary>
58184 <secondary>summary of fields</secondary>
58185 </indexterm>
58186 A summary of the field identifiers that are used in log lines is shown in
58187 the following table:
58188 </para>
58189 <literallayout>
58190 <literal>A   </literal>        authenticator name (and optional id)
58191 <literal>C   </literal>        SMTP confirmation on delivery
58192 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
58193 <literal>CV  </literal>        certificate verification status
58194 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
58195 <literal>DN  </literal>        distinguished name from peer certificate
58196 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
58197 <literal>F   </literal>        sender address (on delivery lines)
58198 <literal>H   </literal>        host name and IP address
58199 <literal>I   </literal>        local interface used
58200 <literal>id  </literal>        message id for incoming message
58201 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
58202 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
58203 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
58204 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
58205 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
58206 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
58207 <literal>S   </literal>        size of message
58208 <literal>ST  </literal>        shadow transport name
58209 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
58210 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58211 <literal>U   </literal>        local user or RFC 1413 identity
58212 <literal>X   </literal>        TLS cipher suite
58213 </literallayout>
58214 </section>
58215 <section id="SECID259">
58216 <title>Other log entries</title>
58217 <para>
58218 Various other types of log entry are written from time to time. Most should be
58219 self-explanatory. Among the more common are:
58220 </para>
58221 <itemizedlist>
58222 <listitem>
58223 <para>
58224 <indexterm role="concept">
58225 <primary>retry</primary>
58226 <secondary>time not reached</secondary>
58227 </indexterm>
58228 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
58229 during routing or local delivery, and the time to retry has not yet arrived.
58230 This message is not written to an individual message log file unless it happens
58231 during the first delivery attempt.
58232 </para>
58233 </listitem>
58234 <listitem>
58235 <para>
58236 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
58237 temporary errors during remote delivery, and the retry time has not yet arrived
58238 for any of the hosts to which it is routed.
58239 </para>
58240 </listitem>
58241 <listitem>
58242 <para>
58243 <indexterm role="concept">
58244 <primary>spool directory</primary>
58245 <secondary>file locked</secondary>
58246 </indexterm>
58247 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
58248 some other Exim process is already working on the message. This can be quite
58249 common if queue running processes are started at frequent intervals. The
58250 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58251 doing.
58252 </para>
58253 </listitem>
58254 <listitem>
58255 <para>
58256 <indexterm role="concept">
58257 <primary>error</primary>
58258 <secondary>ignored</secondary>
58259 </indexterm>
58260 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
58261 message:
58262 </para>
58263 <orderedlist numeration="arabic">
58264 <listitem>
58265 <para>
58266 Exim failed to deliver a bounce message whose age was greater than
58267 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58268 </para>
58269 </listitem>
58270 <listitem>
58271 <para>
58272 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58273 failed. The delivery was discarded.
58274 </para>
58275 </listitem>
58276 <listitem>
58277 <para>
58278 A delivery set up by a router configured with
58279 </para>
58280 <literallayout class="monospaced">
58281     errors_to = &lt;&gt;
58282 </literallayout>
58283 <para>
58284 failed. The delivery was discarded.
58285 </para>
58286 </listitem>
58287 </orderedlist>
58288 </listitem>
58289 </itemizedlist>
58290 </section>
58291 <section id="SECTlogselector">
58292 <title>Reducing or increasing what is logged</title>
58293 <para>
58294 <indexterm role="concept">
58295 <primary>log</primary>
58296 <secondary>selectors</secondary>
58297 </indexterm>
58298 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
58299 default logging, or you can request additional logging. The value of
58300 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58301 example:
58302 </para>
58303 <literallayout class="monospaced">
58304 log_selector = +arguments -retry_defer
58305 </literallayout>
58306 <para>
58307 The list of optional log items is in the following table, with the default
58308 selection marked by asterisks:
58309 </para>
58310 <literallayout>
58311 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
58312 <literal> address_rewrite            </literal>  address rewriting
58313 <literal> all_parents                </literal>  all parents in =&gt; lines
58314 <literal> arguments                  </literal>  command line arguments
58315 <literal>*connection_reject          </literal>  connection rejections
58316 <literal>*delay_delivery             </literal>  immediate delivery delayed
58317 <literal> deliver_time               </literal>  time taken to perform delivery
58318 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
58319 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
58320 <literal>*etrn                       </literal>  ETRN commands
58321 <literal>*host_lookup_failed         </literal>  as it says
58322 <literal> ident_timeout              </literal>  timeout for ident connection
58323 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
58324 <literal> incoming_port              </literal>  incoming port on &lt;= lines
58325 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
58326 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
58327 <literal>*queue_run                  </literal>  start and end queue runs
58328 <literal> queue_time                 </literal>  time on queue for one recipient
58329 <literal> queue_time_overall         </literal>  time on queue for whole message
58330 <literal> pid                        </literal>  Exim process id
58331 <literal> received_recipients        </literal>  recipients on &lt;= lines
58332 <literal> received_sender            </literal>  sender on &lt;= lines
58333 <literal>*rejected_header            </literal>  header contents on reject log
58334 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
58335 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
58336 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
58337 <literal>*sender_verify_fail         </literal>  sender verification failures
58338 <literal>*size_reject                </literal>  rejection because too big
58339 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
58340 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
58341 <literal> smtp_connection            </literal>  SMTP connections
58342 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
58343 <literal> smtp_no_mail               </literal>  session with no MAIL commands
58344 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
58345 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
58346 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
58347 <literal> tls_certificate_verified   </literal>  certificate verification status
58348 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
58349 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
58350 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
58351
58352 <literal> all                        </literal>  all of the above
58353 </literallayout>
58354 <para>
58355 More details on each of these items follows:
58356 </para>
58357 <itemizedlist>
58358 <listitem>
58359 <para>
58360 <indexterm role="concept">
58361 <primary><option>warn</option> ACL verb</primary>
58362 <secondary>log when skipping</secondary>
58363 </indexterm>
58364 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58365 its conditions cannot be evaluated, a log line to this effect is written if
58366 this log selector is set.
58367 </para>
58368 </listitem>
58369 <listitem>
58370 <para>
58371 <indexterm role="concept">
58372 <primary>log</primary>
58373 <secondary>rewriting</secondary>
58374 </indexterm>
58375 <indexterm role="concept">
58376 <primary>rewriting</primary>
58377 <secondary>logging</secondary>
58378 </indexterm>
58379 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58380 rewrites, but not to rewrites in filters run as an unprivileged user (because
58381 such users cannot access the log).
58382 </para>
58383 </listitem>
58384 <listitem>
58385 <para>
58386 <indexterm role="concept">
58387 <primary>log</primary>
58388 <secondary>full parentage</secondary>
58389 </indexterm>
58390 <option>all_parents</option>: Normally only the original and final addresses are logged on
58391 delivery lines; with this selector, intermediate parents are given in
58392 parentheses between them.
58393 </para>
58394 </listitem>
58395 <listitem>
58396 <para>
58397 <indexterm role="concept">
58398 <primary>log</primary>
58399 <secondary>Exim arguments</secondary>
58400 </indexterm>
58401 <indexterm role="concept">
58402 <primary>Exim arguments, logging</primary>
58403 </indexterm>
58404 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58405 to the main log, preceded by the current working directory. This is a debugging
58406 feature, added to make it easier to find out how certain MUAs call
58407 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58408 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58409 that are empty or that contain white space are quoted. Non-printing characters
58410 are shown as escape sequences. This facility cannot log unrecognized arguments,
58411 because the arguments are checked before the configuration file is read. The
58412 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58413 between the caller and Exim.
58414 </para>
58415 </listitem>
58416 <listitem>
58417 <para>
58418 <indexterm role="concept">
58419 <primary>log</primary>
58420 <secondary>connection rejections</secondary>
58421 </indexterm>
58422 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58423 connection is rejected, for whatever reason.
58424 </para>
58425 </listitem>
58426 <listitem>
58427 <para>
58428 <indexterm role="concept">
58429 <primary>log</primary>
58430 <secondary>delayed delivery</secondary>
58431 </indexterm>
58432 <indexterm role="concept">
58433 <primary>delayed delivery, logging</primary>
58434 </indexterm>
58435 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58436 started for an incoming message because the load is too high or too many
58437 messages were received on one connection. Logging does not occur if no delivery
58438 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58439 </para>
58440 </listitem>
58441 <listitem>
58442 <para>
58443 <indexterm role="concept">
58444 <primary>log</primary>
58445 <secondary>delivery duration</secondary>
58446 </indexterm>
58447 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58448 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
58449 </para>
58450 </listitem>
58451 <listitem>
58452 <para>
58453 <indexterm role="concept">
58454 <primary>log</primary>
58455 <secondary>message size on delivery</secondary>
58456 </indexterm>
58457 <indexterm role="concept">
58458 <primary>size</primary>
58459 <secondary>of message</secondary>
58460 </indexterm>
58461 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58462 the <quote>=&gt;</quote> line, tagged with S=.
58463 </para>
58464 </listitem>
58465 <listitem>
58466 <para>
58467 <indexterm role="concept">
58468 <primary>log</primary>
58469 <secondary>dnslist defer</secondary>
58470 </indexterm>
58471 <indexterm role="concept">
58472 <primary>DNS list</primary>
58473 <secondary>logging defer</secondary>
58474 </indexterm>
58475 <indexterm role="concept">
58476 <primary>black list (DNS)</primary>
58477 </indexterm>
58478 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58479 DNS black list suffers a temporary error.
58480 </para>
58481 </listitem>
58482 <listitem>
58483 <para>
58484 <indexterm role="concept">
58485 <primary>log</primary>
58486 <secondary>ETRN commands</secondary>
58487 </indexterm>
58488 <indexterm role="concept">
58489 <primary>ETRN</primary>
58490 <secondary>logging</secondary>
58491 </indexterm>
58492 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58493 is run to determine whether or not it is actually accepted. An invalid ETRN
58494 command, or one received within a message transaction is not logged by this
58495 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58496 </para>
58497 </listitem>
58498 <listitem>
58499 <para>
58500 <indexterm role="concept">
58501 <primary>log</primary>
58502 <secondary>host lookup failure</secondary>
58503 </indexterm>
58504 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
58505 any addresses, or when a lookup of an IP address fails to find a host name, a
58506 log line is written. This logging does not apply to direct DNS lookups when
58507 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58508 </para>
58509 </listitem>
58510 <listitem>
58511 <para>
58512 <indexterm role="concept">
58513 <primary>log</primary>
58514 <secondary>ident timeout</secondary>
58515 </indexterm>
58516 <indexterm role="concept">
58517 <primary>RFC 1413</primary>
58518 <secondary>logging timeout</secondary>
58519 </indexterm>
58520 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58521 client&#x2019;s ident port times out.
58522 </para>
58523 </listitem>
58524 <listitem>
58525 <para>
58526 <indexterm role="concept">
58527 <primary>log</primary>
58528 <secondary>incoming interface</secondary>
58529 </indexterm>
58530 <indexterm role="concept">
58531 <primary>interface</primary>
58532 <secondary>logging</secondary>
58533 </indexterm>
58534 <option>incoming_interface</option>: The interface on which a message was received is added
58535 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
58536 followed by a colon and the port number. The local interface and port are also
58537 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58538 rejection lines.
58539 </para>
58540 </listitem>
58541 <listitem>
58542 <para>
58543 <indexterm role="concept">
58544 <primary>log</primary>
58545 <secondary>incoming remote port</secondary>
58546 </indexterm>
58547 <indexterm role="concept">
58548 <primary>port</primary>
58549 <secondary>logging remote</secondary>
58550 </indexterm>
58551 <indexterm role="concept">
58552 <primary>TCP/IP</primary>
58553 <secondary>logging incoming remote port</secondary>
58554 </indexterm>
58555 <indexterm role="variable">
58556 <primary><varname>$sender_fullhost</varname></primary>
58557 </indexterm>
58558 <indexterm role="variable">
58559 <primary><varname>$sender_rcvhost</varname></primary>
58560 </indexterm>
58561 <option>incoming_port</option>: The remote port number from which a message was received is
58562 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58563 in square brackets, and separated from it by a colon. This is implemented by
58564 changing the value that is put in the <varname>$sender_fullhost</varname> and
58565 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58566 important with the widening use of NAT (see RFC 2505).
58567 </para>
58568 </listitem>
58569 <listitem>
58570 <para>
58571 <indexterm role="concept">
58572 <primary>log</primary>
58573 <secondary>dropped connection</secondary>
58574 </indexterm>
58575 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58576 connection is unexpectedly dropped.
58577 </para>
58578 </listitem>
58579 <listitem>
58580 <para>
58581 <indexterm role="concept">
58582 <primary>log</primary>
58583 <secondary>outgoing remote port</secondary>
58584 </indexterm>
58585 <indexterm role="concept">
58586 <primary>port</primary>
58587 <secondary>logging outgoint remote</secondary>
58588 </indexterm>
58589 <indexterm role="concept">
58590 <primary>TCP/IP</primary>
58591 <secondary>logging ougtoing remote port</secondary>
58592 </indexterm>
58593 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58594 containing =&gt; tags) following the IP address. This option is not included in
58595 the default setting, because for most ordinary configurations, the remote port
58596 number is always 25 (the SMTP port).
58597 </para>
58598 </listitem>
58599 <listitem>
58600 <para>
58601 <indexterm role="concept">
58602 <primary>log</primary>
58603 <secondary>process ids in</secondary>
58604 </indexterm>
58605 <indexterm role="concept">
58606 <primary>pid (process id)</primary>
58607 <secondary>in log lines</secondary>
58608 </indexterm>
58609 <option>pid</option>: The current process id is added to every log line, in square brackets,
58610 immediately after the time and date.
58611 </para>
58612 </listitem>
58613 <listitem>
58614 <para>
58615 <indexterm role="concept">
58616 <primary>log</primary>
58617 <secondary>queue run</secondary>
58618 </indexterm>
58619 <indexterm role="concept">
58620 <primary>queue runner</primary>
58621 <secondary>logging</secondary>
58622 </indexterm>
58623 <option>queue_run</option>: The start and end of every queue run are logged.
58624 </para>
58625 </listitem>
58626 <listitem>
58627 <para>
58628 <indexterm role="concept">
58629 <primary>log</primary>
58630 <secondary>queue time</secondary>
58631 </indexterm>
58632 <option>queue_time</option>: The amount of time the message has been in the queue on the
58633 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
58634 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
58635 includes reception time as well as the delivery time for the current address.
58636 This means that it may be longer than the difference between the arrival and
58637 delivery log line times, because the arrival log line is not written until the
58638 message has been successfully received.
58639 </para>
58640 </listitem>
58641 <listitem>
58642 <para>
58643 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
58644 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
58645 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
58646 message, so it includes reception time as well as the total delivery time.
58647 </para>
58648 </listitem>
58649 <listitem>
58650 <para>
58651 <indexterm role="concept">
58652 <primary>log</primary>
58653 <secondary>recipients</secondary>
58654 </indexterm>
58655 <option>received_recipients</option>: The recipients of a message are listed in the main log
58656 as soon as the message is received. The list appears at the end of the log line
58657 that is written when a message is received, preceded by the word <quote>for</quote>. The
58658 addresses are listed after they have been qualified, but before any rewriting
58659 has taken place.
58660 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
58661 in the list.
58662 </para>
58663 </listitem>
58664 <listitem>
58665 <para>
58666 <indexterm role="concept">
58667 <primary>log</primary>
58668 <secondary>sender reception</secondary>
58669 </indexterm>
58670 <option>received_sender</option>: The unrewritten original sender of a message is added to
58671 the end of the log line that records the message&#x2019;s arrival, after the word
58672 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
58673 </para>
58674 </listitem>
58675 <listitem>
58676 <para>
58677 <indexterm role="concept">
58678 <primary>log</primary>
58679 <secondary>header lines for rejection</secondary>
58680 </indexterm>
58681 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
58682 rejection is written to the reject log, the complete header is added to the
58683 log. Header logging can be turned off individually for messages that are
58684 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
58685 </para>
58686 </listitem>
58687 <listitem>
58688 <para>
58689 <indexterm role="concept">
58690 <primary>log</primary>
58691 <secondary>retry defer</secondary>
58692 </indexterm>
58693 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
58694 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
58695 message is always omitted from individual message logs after the first delivery
58696 attempt.
58697 </para>
58698 </listitem>
58699 <listitem>
58700 <para>
58701 <indexterm role="concept">
58702 <primary>log</primary>
58703 <secondary>return path</secondary>
58704 </indexterm>
58705 <option>return_path_on_delivery</option>: The return path that is being transmitted with
58706 the message is included in delivery and bounce lines, using the tag P=.
58707 This is omitted if no delivery actually happens, for example, if routing fails,
58708 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
58709 </para>
58710 </listitem>
58711 <listitem>
58712 <para>
58713 <indexterm role="concept">
58714 <primary>log</primary>
58715 <secondary>sender on delivery</secondary>
58716 </indexterm>
58717 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
58718 and bounce line, tagged by F= (for <quote>from</quote>).
58719 This is the original sender that was received with the message; it is not
58720 necessarily the same as the outgoing return path.
58721 </para>
58722 </listitem>
58723 <listitem>
58724 <para>
58725 <indexterm role="concept">
58726 <primary>log</primary>
58727 <secondary>sender verify failure</secondary>
58728 </indexterm>
58729 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
58730 gives details of a sender verification failure is not written. Log lines for
58731 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
58732 detail is lost.
58733 </para>
58734 </listitem>
58735 <listitem>
58736 <para>
58737 <indexterm role="concept">
58738 <primary>log</primary>
58739 <secondary>size rejection</secondary>
58740 </indexterm>
58741 <option>size_reject</option>: A log line is written whenever a message is rejected because
58742 it is too big.
58743 </para>
58744 </listitem>
58745 <listitem>
58746 <para>
58747 <indexterm role="concept">
58748 <primary>log</primary>
58749 <secondary>frozen messages; skipped</secondary>
58750 </indexterm>
58751 <indexterm role="concept">
58752 <primary>frozen messages</primary>
58753 <secondary>logging skipping</secondary>
58754 </indexterm>
58755 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
58756 queue run because it is frozen or because another process is already delivering
58757 it.
58758 <indexterm role="concept">
58759 <primary><quote>spool file is locked</quote></primary>
58760 </indexterm>
58761 The message that is written is <quote>spool file is locked</quote>.
58762 </para>
58763 </listitem>
58764 <listitem>
58765 <para>
58766 <indexterm role="concept">
58767 <primary>log</primary>
58768 <secondary>smtp confirmation</secondary>
58769 </indexterm>
58770 <indexterm role="concept">
58771 <primary>SMTP</primary>
58772 <secondary>logging confirmation</secondary>
58773 </indexterm>
58774 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
58775 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
58776 A number of MTAs (including Exim) return an identifying string in this
58777 response.
58778 </para>
58779 </listitem>
58780 <listitem>
58781 <para>
58782 <indexterm role="concept">
58783 <primary>log</primary>
58784 <secondary>SMTP connections</secondary>
58785 </indexterm>
58786 <indexterm role="concept">
58787 <primary>SMTP</primary>
58788 <secondary>logging connections</secondary>
58789 </indexterm>
58790 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
58791 established or closed, unless the connection is from a host that matches
58792 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
58793 only when the closure is unexpected.) This applies to connections from local
58794 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
58795 dropped in the middle of a message, a log line is always written, whether or
58796 not this selector is set, but otherwise nothing is written at the start and end
58797 of connections unless this selector is enabled.
58798 </para>
58799 <para>
58800 For TCP/IP connections to an Exim daemon, the current number of connections is
58801 included in the log message for each new connection, but note that the count is
58802 reset if the daemon is restarted.
58803 Also, because connections are closed (and the closure is logged) in
58804 subprocesses, the count may not include connections that have been closed but
58805 whose termination the daemon has not yet noticed. Thus, while it is possible to
58806 match up the opening and closing of connections in the log, the value of the
58807 logged counts may not be entirely accurate.
58808 </para>
58809 </listitem>
58810 <listitem>
58811 <para>
58812 <indexterm role="concept">
58813 <primary>log</primary>
58814 <secondary>SMTP transaction; incomplete</secondary>
58815 </indexterm>
58816 <indexterm role="concept">
58817 <primary>SMTP</primary>
58818 <secondary>logging incomplete transactions</secondary>
58819 </indexterm>
58820 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
58821 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
58822 and the message sender plus any accepted recipients are included in the log
58823 line. This can provide evidence of dictionary attacks.
58824 </para>
58825 </listitem>
58826 <listitem>
58827 <para>
58828 <indexterm role="concept">
58829 <primary>log</primary>
58830 <secondary>non-MAIL SMTP sessions</secondary>
58831 </indexterm>
58832 <indexterm role="concept">
58833 <primary>MAIL</primary>
58834 <secondary>logging session without</secondary>
58835 </indexterm>
58836 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
58837 connection terminates without having issued a MAIL command. This includes both
58838 the case when the connection is dropped, and the case when QUIT is used. It
58839 does not include cases where the connection is rejected right at the start (by
58840 an ACL, or because there are too many connections, or whatever). These cases
58841 already have their own log lines.
58842 </para>
58843 <para>
58844 The log line that is written contains the identity of the client in the usual
58845 way, followed by D= and a time, which records the duration of the connection.
58846 If the connection was authenticated, this fact is logged exactly as it is for
58847 an incoming message, with an A= item. If the connection was encrypted, CV=,
58848 DN=, and X= items may appear as they do for an incoming message, controlled by
58849 the same logging options.
58850 </para>
58851 <para>
58852 Finally, if any SMTP commands were issued during the connection, a C= item
58853 is added to the line, listing the commands that were used. For example,
58854 </para>
58855 <literallayout class="monospaced">
58856 C=EHLO,QUIT
58857 </literallayout>
58858 <para>
58859 shows that the client issued QUIT straight after EHLO. If there were fewer
58860 than 20 commands, they are all listed. If there were more than 20 commands,
58861 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
58862 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
58863 have been aborted before 20 non-mail commands are processed.
58864 </para>
58865 </listitem>
58866 <listitem>
58867 <para>
58868 <indexterm role="concept">
58869 <primary>log</primary>
58870 <secondary>SMTP protocol error</secondary>
58871 </indexterm>
58872 <indexterm role="concept">
58873 <primary>SMTP</primary>
58874 <secondary>logging protocol error</secondary>
58875 </indexterm>
58876 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
58877 encountered. Exim does not have perfect detection of all protocol errors
58878 because of transmission delays and the use of pipelining. If PIPELINING has
58879 been advertised to a client, an Exim server assumes that the client will use
58880 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
58881 received after rejecting MAIL) as protocol errors.
58882 </para>
58883 </listitem>
58884 <listitem>
58885 <para>
58886 <indexterm role="concept">
58887 <primary>SMTP</primary>
58888 <secondary>logging syntax errors</secondary>
58889 </indexterm>
58890 <indexterm role="concept">
58891 <primary>SMTP</primary>
58892 <secondary>syntax errors; logging</secondary>
58893 </indexterm>
58894 <indexterm role="concept">
58895 <primary>SMTP</primary>
58896 <secondary>unknown command; logging</secondary>
58897 </indexterm>
58898 <indexterm role="concept">
58899 <primary>log</primary>
58900 <secondary>unknown SMTP command</secondary>
58901 </indexterm>
58902 <indexterm role="concept">
58903 <primary>log</primary>
58904 <secondary>SMTP syntax error</secondary>
58905 </indexterm>
58906 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
58907 encountered. An unrecognized command is treated as a syntax error. For an
58908 external connection, the host identity is given; for an internal connection
58909 using <option>-bs</option> the sender identification (normally the calling user) is given.
58910 </para>
58911 </listitem>
58912 <listitem>
58913 <para>
58914 <indexterm role="concept">
58915 <primary>log</primary>
58916 <secondary>subject</secondary>
58917 </indexterm>
58918 <indexterm role="concept">
58919 <primary>subject, logging</primary>
58920 </indexterm>
58921 <option>subject</option>: The subject of the message is added to the arrival log line,
58922 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
58923 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
58924 specifies whether characters with values greater than 127 should be logged
58925 unchanged, or whether they should be rendered as escape sequences.
58926 </para>
58927 </listitem>
58928 <listitem>
58929 <para>
58930 <indexterm role="concept">
58931 <primary>log</primary>
58932 <secondary>certificate verification</secondary>
58933 </indexterm>
58934 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
58935 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
58936 verified, and <literal>CV=no</literal> if not.
58937 </para>
58938 </listitem>
58939 <listitem>
58940 <para>
58941 <indexterm role="concept">
58942 <primary>log</primary>
58943 <secondary>TLS cipher</secondary>
58944 </indexterm>
58945 <indexterm role="concept">
58946 <primary>TLS</primary>
58947 <secondary>logging cipher</secondary>
58948 </indexterm>
58949 <option>tls_cipher</option>: When a message is sent or received over an encrypted
58950 connection, the cipher suite used is added to the log line, preceded by X=.
58951 </para>
58952 </listitem>
58953 <listitem>
58954 <para>
58955 <indexterm role="concept">
58956 <primary>log</primary>
58957 <secondary>TLS peer DN</secondary>
58958 </indexterm>
58959 <indexterm role="concept">
58960 <primary>TLS</primary>
58961 <secondary>logging peer DN</secondary>
58962 </indexterm>
58963 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
58964 connection, and a certificate is supplied by the remote host, the peer DN is
58965 added to the log line, preceded by DN=.
58966 </para>
58967 </listitem>
58968 <listitem>
58969 <para>
58970 <indexterm role="concept">
58971 <primary>log</primary>
58972 <secondary>DNS failure in list</secondary>
58973 </indexterm>
58974 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
58975 result of a list match is failure because a DNS lookup failed.
58976 </para>
58977 </listitem>
58978 </itemizedlist>
58979 </section>
58980 <section id="SECID260">
58981 <title>Message log</title>
58982 <para>
58983 <indexterm role="concept">
58984 <primary>message</primary>
58985 <secondary>log file for</secondary>
58986 </indexterm>
58987 <indexterm role="concept">
58988 <primary>log</primary>
58989 <secondary>message log; description of</secondary>
58990 </indexterm>
58991 <indexterm role="concept">
58992 <primary><filename>msglog</filename> directory</primary>
58993 </indexterm>
58994 <indexterm role="option">
58995 <primary><option>preserve_message_logs</option></primary>
58996 </indexterm>
58997 In addition to the general log files, Exim writes a log file for each message
58998 that it handles. The names of these per-message logs are the message ids, and
58999 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59000 message log contains copies of the log lines that apply to the message. This
59001 makes it easier to inspect the status of an individual message without having
59002 to search the main log. A message log is deleted when processing of the message
59003 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59004 only with great care because they can fill up your disk very quickly.
59005 </para>
59006 <para>
59007 On a heavily loaded system, it may be desirable to disable the use of
59008 per-message logs, in order to reduce disk I/O. This can be done by setting the
59009 <option>message_logs</option> option false.
59010 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59011 </para>
59012 </section>
59013 </chapter>
59014
59015 <chapter id="CHAPutils">
59016 <title>Exim utilities</title>
59017 <para>
59018 <indexterm role="concept" id="IIDutils" class="startofrange">
59019 <primary>utilities</primary>
59020 </indexterm>
59021 A number of utility scripts and programs are supplied with Exim and are
59022 described in this chapter. There is also the Exim Monitor, which is covered in
59023 the next chapter. The utilities described here are:
59024 </para>
59025 <informaltable frame="none">
59026 <tgroup cols="3" colsep="0" rowsep="0">
59027 <colspec colwidth="7*" align="left"/>
59028 <colspec colwidth="15*" align="left"/>
59029 <colspec colwidth="40*" align="left"/>
59030 <tbody>
59031 <row>
59032 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
59033 <entry><emphasis>exiwhat</emphasis></entry>
59034 <entry>list what Exim processes are doing</entry>
59035 </row>
59036 <row>
59037 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
59038 <entry><emphasis>exiqgrep</emphasis></entry>
59039 <entry>grep the queue</entry>
59040 </row>
59041 <row>
59042 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
59043 <entry><emphasis>exiqsumm</emphasis></entry>
59044 <entry>summarize the queue</entry>
59045 </row>
59046 <row>
59047 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
59048 <entry><emphasis>exigrep</emphasis></entry>
59049 <entry>search the main log</entry>
59050 </row>
59051 <row>
59052 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
59053 <entry><emphasis>exipick</emphasis></entry>
59054 <entry>select messages on various criteria</entry>
59055 </row>
59056 <row>
59057 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
59058 <entry><emphasis>exicyclog</emphasis></entry>
59059 <entry>cycle (rotate) log files</entry>
59060 </row>
59061 <row>
59062 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
59063 <entry><emphasis>eximstats</emphasis></entry>
59064 <entry>extract statistics from the log</entry>
59065 </row>
59066 <row>
59067 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
59068 <entry><emphasis>exim_checkaccess</emphasis></entry>
59069 <entry>check address acceptance from given IP</entry>
59070 </row>
59071 <row>
59072 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
59073 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59074 <entry>build a DBM file</entry>
59075 </row>
59076 <row>
59077 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
59078 <entry><emphasis>exinext</emphasis></entry>
59079 <entry>extract retry information</entry>
59080 </row>
59081 <row>
59082 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59083 <entry><emphasis>exim_dumpdb</emphasis></entry>
59084 <entry>dump a hints database</entry>
59085 </row>
59086 <row>
59087 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59088 <entry><emphasis>exim_tidydb</emphasis></entry>
59089 <entry>clean up a hints database</entry>
59090 </row>
59091 <row>
59092 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59093 <entry><emphasis>exim_fixdb</emphasis></entry>
59094 <entry>patch a hints database</entry>
59095 </row>
59096 <row>
59097 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
59098 <entry><emphasis>exim_lock</emphasis></entry>
59099 <entry>lock a mailbox file</entry>
59100 </row>
59101 </tbody>
59102 </tgroup>
59103 </informaltable>
59104 <para>
59105 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
59106 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59107 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59108 </para>
59109 <section id="SECTfinoutwha">
59110 <title>Finding out what Exim processes are doing (exiwhat)</title>
59111 <para>
59112 <indexterm role="concept">
59113 <primary><emphasis>exiwhat</emphasis></primary>
59114 </indexterm>
59115 <indexterm role="concept">
59116 <primary>process, querying</primary>
59117 </indexterm>
59118 <indexterm role="concept">
59119 <primary>SIGUSR1</primary>
59120 </indexterm>
59121 On operating systems that can restart a system call after receiving a signal
59122 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59123 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59124 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59125 processes it can find, having first emptied the file. It then waits for one
59126 second to allow the Exim processes to react before displaying the results. In
59127 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59128 send the signal to the Exim processes, so it is normally run as root.
59129 </para>
59130 <para>
59131 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59132 use by system administrators. It is not sensible, for example, to set up a
59133 script that sends SIGUSR1 signals to Exim processes at short intervals.
59134 </para>
59135 <para>
59136 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59137 varies in different operating systems. Not only are different options used,
59138 but the format of the output is different. For this reason, there are some
59139 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59140 it doesn&#x2019;t seem to be working for you, check the following compile-time
59141 options:
59142 </para>
59143 <literallayout>
59144 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
59145 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
59146 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59147 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
59148 </literallayout>
59149 <para>
59150 An example of typical output from <emphasis>exiwhat</emphasis> is
59151 </para>
59152 <literallayout class="monospaced">
59153 164 daemon: -q1h, listening on port 25
59154 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59155 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59156   [10.19.42.42] (editor@ref.example)
59157 10592 handling incoming call from [192.168.243.242]
59158 10628 accepting a local non-SMTP message
59159 </literallayout>
59160 <para>
59161 The first number in the output line is the process number. The third line has
59162 been split here, in order to fit it on the page.
59163 </para>
59164 </section>
59165 <section id="SECTgreptheque">
59166 <title>Selective queue listing (exiqgrep)</title>
59167 <para>
59168 <indexterm role="concept">
59169 <primary><emphasis>exiqgrep</emphasis></primary>
59170 </indexterm>
59171 <indexterm role="concept">
59172 <primary>queue</primary>
59173 <secondary>grepping</secondary>
59174 </indexterm>
59175 This utility is a Perl script contributed by Matt Hubbard. It runs
59176 </para>
59177 <literallayout class="monospaced">
59178 exim -bpu
59179 </literallayout>
59180 <para>
59181 to obtain a queue listing with undelivered recipients only, and then greps the
59182 output to select messages that match given criteria. The following selection
59183 options are available:
59184 </para>
59185 <variablelist>
59186 <varlistentry>
59187 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59188 <listitem>
59189 <para>
59190 Match the sender address. The field that is tested is enclosed in angle
59191 brackets, so you can test for bounce messages with
59192 </para>
59193 <literallayout class="monospaced">
59194 exiqgrep -f '^&lt;&gt;$'
59195 </literallayout>
59196 </listitem></varlistentry>
59197 <varlistentry>
59198 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59199 <listitem>
59200 <para>
59201 Match a recipient address. The field that is tested is not enclosed in angle
59202 brackets.
59203 </para>
59204 </listitem></varlistentry>
59205 <varlistentry>
59206 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59207 <listitem>
59208 <para>
59209 Match against the size field.
59210 </para>
59211 </listitem></varlistentry>
59212 <varlistentry>
59213 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59214 <listitem>
59215 <para>
59216 Match messages that are younger than the given time.
59217 </para>
59218 </listitem></varlistentry>
59219 <varlistentry>
59220 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59221 <listitem>
59222 <para>
59223 Match messages that are older than the given time.
59224 </para>
59225 </listitem></varlistentry>
59226 <varlistentry>
59227 <term><emphasis role="bold">-z</emphasis></term>
59228 <listitem>
59229 <para>
59230 Match only frozen messages.
59231 </para>
59232 </listitem></varlistentry>
59233 <varlistentry>
59234 <term><emphasis role="bold">-x</emphasis></term>
59235 <listitem>
59236 <para>
59237 Match only non-frozen messages.
59238 </para>
59239 </listitem></varlistentry>
59240 </variablelist>
59241 <para>
59242 The following options control the format of the output:
59243 </para>
59244 <variablelist>
59245 <varlistentry>
59246 <term><emphasis role="bold">-c</emphasis></term>
59247 <listitem>
59248 <para>
59249 Display only the count of matching messages.
59250 </para>
59251 </listitem></varlistentry>
59252 <varlistentry>
59253 <term><emphasis role="bold">-l</emphasis></term>
59254 <listitem>
59255 <para>
59256 Long format &ndash; display the full message information as output by Exim. This is
59257 the default.
59258 </para>
59259 </listitem></varlistentry>
59260 <varlistentry>
59261 <term><emphasis role="bold">-i</emphasis></term>
59262 <listitem>
59263 <para>
59264 Display message ids only.
59265 </para>
59266 </listitem></varlistentry>
59267 <varlistentry>
59268 <term><emphasis role="bold">-b</emphasis></term>
59269 <listitem>
59270 <para>
59271 Brief format &ndash; one line per message.
59272 </para>
59273 </listitem></varlistentry>
59274 <varlistentry>
59275 <term><emphasis role="bold">-R</emphasis></term>
59276 <listitem>
59277 <para>
59278 Display messages in reverse order.
59279 </para>
59280 </listitem></varlistentry>
59281 </variablelist>
59282 <para>
59283 There is one more option, <option>-h</option>, which outputs a list of options.
59284 </para>
59285 </section>
59286 <section id="SECTsumtheque">
59287 <title>Summarizing the queue (exiqsumm)</title>
59288 <para>
59289 <indexterm role="concept">
59290 <primary><emphasis>exiqsumm</emphasis></primary>
59291 </indexterm>
59292 <indexterm role="concept">
59293 <primary>queue</primary>
59294 <secondary>summary</secondary>
59295 </indexterm>
59296 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59297 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59298 running a command such as
59299 </para>
59300 <literallayout class="monospaced">
59301 exim -bp | exiqsumm
59302 </literallayout>
59303 <para>
59304 The output consists of one line for each domain that has messages waiting for
59305 it, as in the following example:
59306 </para>
59307 <literallayout class="monospaced">
59308 3   2322   74m   66m  msn.com.example
59309 </literallayout>
59310 <para>
59311 Each line lists the number of pending deliveries for a domain, their total
59312 volume, and the length of time that the oldest and the newest messages have
59313 been waiting. Note that the number of pending deliveries is greater than the
59314 number of messages when messages have more than one recipient.
59315 </para>
59316 <para>
59317 A summary line is output at the end. By default the output is sorted on the
59318 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59319 the output to be sorted by oldest message and by count of messages,
59320 respectively. There are also three options that split the messages for each
59321 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59322 separates frozen messages, and <option>-s</option> separates messages according to their
59323 sender.
59324 </para>
59325 <para>
59326 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59327 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59328 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59329 option of the <command>redirect</command> router has been used to convert them into <quote>top
59330 level</quote> addresses).
59331 </para>
59332 </section>
59333 <section id="SECTextspeinf">
59334 <title>Extracting specific information from the log (exigrep)</title>
59335 <para>
59336 <indexterm role="concept">
59337 <primary><emphasis>exigrep</emphasis></primary>
59338 </indexterm>
59339 <indexterm role="concept">
59340 <primary>log</primary>
59341 <secondary>extracts; grepping for</secondary>
59342 </indexterm>
59343 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59344 files for entries that match a given pattern. When it finds a match, it
59345 extracts all the log entries for the relevant message, not just those that
59346 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59347 given message, or all mail for a given user, or for a given host, for example.
59348 The input files can be in Exim log format or syslog format.
59349 If a matching log line is not associated with a specific message, it is
59350 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
59351 </para>
59352 <literallayout>
59353 <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>
59354 </literallayout>
59355 <para>
59356 If no log file names are given on the command line, the standard input is read.
59357 </para>
59358 <para>
59359 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59360 condition for message selection. Messages that are complete are shown only if
59361 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
59362 </para>
59363 <para>
59364 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59365 makes it case-sensitive. This may give a performance improvement when searching
59366 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
59367 option; with <option>-I</option> they do not. In both cases it is possible to change the
59368 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59369 </para>
59370 <para>
59371 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59372 pattern as standing for themselves. Otherwise the pattern must be a Perl
59373 regular expression.
59374 </para>
59375 <para>
59376 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59377 if it does <emphasis>not</emphasis> match the pattern.
59378 </para>
59379 <para>
59380 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59381 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59382 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59383 </para>
59384 </section>
59385 <section id="SECTexipick">
59386 <title>Selecting messages by various criteria (exipick)</title>
59387 <para>
59388 <indexterm role="concept">
59389 <primary><emphasis>exipick</emphasis></primary>
59390 </indexterm>
59391 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59392 lists messages from the queue according to a variety of criteria. For details
59393 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
59394 <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
59395 the <option>--help</option> option.
59396 </para>
59397 </section>
59398 <section id="SECTcyclogfil">
59399 <title>Cycling log files (exicyclog)</title>
59400 <para>
59401 <indexterm role="concept">
59402 <primary>log</primary>
59403 <secondary>cycling local files</secondary>
59404 </indexterm>
59405 <indexterm role="concept">
59406 <primary>cycling logs</primary>
59407 </indexterm>
59408 <indexterm role="concept">
59409 <primary><emphasis>exicyclog</emphasis></primary>
59410 </indexterm>
59411 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59412 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59413 you are using log files with datestamps in their names (see section
59414 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59415 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59416 There are two command line options for <emphasis>exicyclog</emphasis>:
59417 </para>
59418 <itemizedlist>
59419 <listitem>
59420 <para>
59421 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
59422 default that is set when Exim is built. The default default is 10.
59423 </para>
59424 </listitem>
59425 <listitem>
59426 <para>
59427 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
59428 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59429 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
59430 configuration.
59431 </para>
59432 </listitem>
59433 </itemizedlist>
59434 <para>
59435 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59436 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59437 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59438 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59439 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59440 logs are handled similarly.
59441 </para>
59442 <para>
59443 If the limit is greater than 99, the script uses 3-digit numbers such as
59444 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59445 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59446 any existing log files.
59447 </para>
59448 <para>
59449 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59450 the end are deleted. All files with numbers greater than 01 are compressed,
59451 using a compression command which is configured by the COMPRESS_COMMAND
59452 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59453 root <option>crontab</option> entry of the form
59454 </para>
59455 <literallayout class="monospaced">
59456 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59457 </literallayout>
59458 <para>
59459 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59460 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59461 </para>
59462 </section>
59463 <section id="SECTmailstat">
59464 <title>Mail statistics (eximstats)</title>
59465 <para>
59466 <indexterm role="concept">
59467 <primary>statistics</primary>
59468 </indexterm>
59469 <indexterm role="concept">
59470 <primary><emphasis>eximstats</emphasis></primary>
59471 </indexterm>
59472 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59473 information from log files. The output is either plain text, or HTML.
59474 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59475 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59476 </para>
59477 <para>
59478 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59479 latest version is the result of some extensive revision by Steve Campbell. A
59480 lot of information is given by default, but there are options for suppressing
59481 various parts of it. Following any options, the arguments to the script are a
59482 list of files, which should be main log files. For example:
59483 </para>
59484 <literallayout class="monospaced">
59485 eximstats -nr /var/spool/exim/log/mainlog.01
59486 </literallayout>
59487 <para>
59488 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59489 messages received from or delivered to various hosts. The information is sorted
59490 both by message count and by volume, and the top fifty hosts in each category
59491 are listed on the standard output. Similar information, based on email
59492 addresses or domains instead of hosts can be requested by means of various
59493 options. For messages delivered and received locally, similar statistics are
59494 also produced per user.
59495 </para>
59496 <para>
59497 The output also includes total counts and statistics about delivery errors, and
59498 histograms showing the number of messages received and deliveries made in each
59499 hour of the day. A delivery with more than one address in its envelope (for
59500 example, an SMTP transaction with more than one RCPT command) is counted
59501 as a single delivery by <emphasis>eximstats</emphasis>.
59502 </para>
59503 <para>
59504 Though normally more deliveries than receipts are reported (as messages may
59505 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59506 messages received than delivered, even though the queue is empty at the start
59507 and end of the period in question. If an incoming message contains no valid
59508 recipients, no deliveries are recorded for it. A bounce message is handled as
59509 an entirely separate message.
59510 </para>
59511 <para>
59512 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59513 of messages received and deliveries made, and the number of hosts involved in
59514 each case. It also outputs the number of messages that were delayed (that is,
59515 not completely delivered at the first attempt), and the number that had at
59516 least one address that failed.
59517 </para>
59518 <para>
59519 The remainder of the output is in sections that can be independently disabled
59520 or modified by various options. It consists of a summary of deliveries by
59521 transport, histograms of messages received and delivered per time interval
59522 (default per hour), information about the time messages spent on the queue,
59523 a list of relayed messages, lists of the top fifty sending hosts, local
59524 senders, destination hosts, and destination local users by count and by volume,
59525 and a list of delivery errors that occurred.
59526 </para>
59527 <para>
59528 The relay information lists messages that were actually relayed, that is, they
59529 came from a remote host and were directly delivered to some other remote host,
59530 without being processed (for example, for aliasing or forwarding) locally.
59531 </para>
59532 <para>
59533 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59534 outputs. These are documented in the Perl script itself, and can be extracted
59535 by running the command <command>perldoc</command> on the script. For example:
59536 </para>
59537 <literallayout class="monospaced">
59538 perldoc /usr/exim/bin/eximstats
59539 </literallayout>
59540 </section>
59541 <section id="SECTcheckaccess">
59542 <title>Checking access policy (exim_checkaccess)</title>
59543 <para>
59544 <indexterm role="concept">
59545 <primary><emphasis>exim_checkaccess</emphasis></primary>
59546 </indexterm>
59547 <indexterm role="concept">
59548 <primary>policy control</primary>
59549 <secondary>checking access</secondary>
59550 </indexterm>
59551 <indexterm role="concept">
59552 <primary>checking access</primary>
59553 </indexterm>
59554 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59555 debugging output, in order to check what Exim is doing when it is applying
59556 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59557 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59558 sometimes you just want to answer the question <quote>Does this address have
59559 access?</quote> without bothering with any further details.
59560 </para>
59561 <para>
59562 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59563 two arguments, an IP address and an email address:
59564 </para>
59565 <literallayout class="monospaced">
59566 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59567 </literallayout>
59568 <para>
59569 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59570 given email address would be accepted in a RCPT command in a TCP/IP
59571 connection from the host with the given IP address. The output of the utility
59572 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59573 </para>
59574 <literallayout class="monospaced">
59575 Rejected:
59576 550 Relay not permitted
59577 </literallayout>
59578 <para>
59579 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
59580 for the MAIL command, but you can change this by providing additional
59581 options. These are passed directly to the Exim command. For example, to specify
59582 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59583 you can use:
59584 </para>
59585 <literallayout class="monospaced">
59586 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59587                  -f himself@there.example
59588 </literallayout>
59589 <para>
59590 Note that these additional Exim command line items must be given after the two
59591 mandatory arguments.
59592 </para>
59593 <para>
59594 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59595 while running its checks. You can run checks that include callouts by using
59596 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59597 </para>
59598 </section>
59599 <section id="SECTdbmbuild">
59600 <title>Making DBM files (exim_dbmbuild)</title>
59601 <para>
59602 <indexterm role="concept">
59603 <primary>DBM</primary>
59604 <secondary>building dbm files</secondary>
59605 </indexterm>
59606 <indexterm role="concept">
59607 <primary>building DBM files</primary>
59608 </indexterm>
59609 <indexterm role="concept">
59610 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59611 </indexterm>
59612 <indexterm role="concept">
59613 <primary>lower casing</primary>
59614 </indexterm>
59615 <indexterm role="concept">
59616 <primary>binary zero</primary>
59617 <secondary>in lookup key</secondary>
59618 </indexterm>
59619 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59620 the format used by the <command>lsearch</command> lookup (see section
59621 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59622 names as keys and the remainder of the information as data. The lower-casing
59623 can be prevented by calling the program with the <option>-nolc</option> option.
59624 </para>
59625 <para>
59626 A terminating zero is included as part of the key string. This is expected by
59627 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59628 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59629 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
59630 files.
59631 </para>
59632 <para>
59633 The program requires two arguments: the name of the input file (which can be a
59634 single hyphen to indicate the standard input), and the name of the output file.
59635 It creates the output under a temporary name, and then renames it if all went
59636 well.
59637 </para>
59638 <para>
59639 <indexterm role="concept">
59640 <primary>USE_DB</primary>
59641 </indexterm>
59642 If the native DB interface is in use (USE_DB is set in a compile-time
59643 configuration file &ndash; this is common in free versions of Unix) the two file
59644 names must be different, because in this mode the Berkeley DB functions create
59645 a single output file using exactly the name given. For example,
59646 </para>
59647 <literallayout class="monospaced">
59648 exim_dbmbuild /etc/aliases /etc/aliases.db
59649 </literallayout>
59650 <para>
59651 reads the system alias file and creates a DBM version of it in
59652 <filename>/etc/aliases.db</filename>.
59653 </para>
59654 <para>
59655 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
59656 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
59657 environment, the suffixes are added to the second argument of
59658 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
59659 when the Berkeley functions are used in compatibility mode (though this is not
59660 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
59661 </para>
59662 <para>
59663 If a duplicate key is encountered, the program outputs a warning, and when it
59664 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
59665 option is used. By default, only the first of a set of duplicates is used &ndash;
59666 this makes it compatible with <command>lsearch</command> lookups. There is an option
59667 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
59668 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
59669 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
59670 return code is 2.
59671 </para>
59672 </section>
59673 <section id="SECTfinindret">
59674 <title>Finding individual retry times (exinext)</title>
59675 <para>
59676 <indexterm role="concept">
59677 <primary>retry</primary>
59678 <secondary>times</secondary>
59679 </indexterm>
59680 <indexterm role="concept">
59681 <primary><emphasis>exinext</emphasis></primary>
59682 </indexterm>
59683 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
59684 fish specific information out of the retry database. Given a mail domain (or a
59685 complete address), it looks up the hosts for that domain, and outputs any retry
59686 information for the hosts or for the domain. At present, the retry information
59687 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
59688 output. For example:
59689 </para>
59690 <literallayout class="monospaced">
59691 $ exinext piglet@milne.fict.example
59692 kanga.milne.example:192.168.8.1 error 146: Connection refused
59693   first failed: 21-Feb-1996 14:57:34
59694   last tried:   21-Feb-1996 14:57:34
59695   next try at:  21-Feb-1996 15:02:34
59696 roo.milne.example:192.168.8.3 error 146: Connection refused
59697   first failed: 20-Jan-1996 13:12:08
59698   last tried:   21-Feb-1996 11:42:03
59699   next try at:  21-Feb-1996 19:42:03
59700   past final cutoff time
59701 </literallayout>
59702 <para>
59703 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
59704 will give any retry information for that local part in your default domain.
59705 A message id can be used to obtain retry information pertaining to a specific
59706 message. This exists only when an attempt to deliver a message to a remote host
59707 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
59708 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
59709 run very often.
59710 </para>
59711 <para>
59712 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
59713 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
59714 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
59715 configuration file, and the second sets macros for use within the configuration
59716 file. These features are mainly to help in testing, but might also be useful in
59717 environments where more than one configuration file is in use.
59718 </para>
59719 </section>
59720 <section id="SECThindatmai">
59721 <title>Hints database maintenance</title>
59722 <para>
59723 <indexterm role="concept">
59724 <primary>hints database</primary>
59725 <secondary>maintenance</secondary>
59726 </indexterm>
59727 <indexterm role="concept">
59728 <primary>maintaining Exim&#x2019;s hints database</primary>
59729 </indexterm>
59730 Three utility programs are provided for maintaining the DBM files that Exim
59731 uses to contain its delivery hint information. Each program requires two
59732 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
59733 second is the name of the database it is to operate on. These are as follows:
59734 </para>
59735 <itemizedlist>
59736 <listitem>
59737 <para>
59738 <emphasis>retry</emphasis>: the database of retry information
59739 </para>
59740 </listitem>
59741 <listitem>
59742 <para>
59743 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
59744 for remote hosts
59745 </para>
59746 </listitem>
59747 <listitem>
59748 <para>
59749 <emphasis>callout</emphasis>: the callout cache
59750 </para>
59751 </listitem>
59752 <listitem>
59753 <para>
59754 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
59755 </para>
59756 </listitem>
59757 <listitem>
59758 <para>
59759 <emphasis>misc</emphasis>: other hints data
59760 </para>
59761 </listitem>
59762 </itemizedlist>
59763 <para>
59764 The <emphasis>misc</emphasis> database is used for
59765 </para>
59766 <itemizedlist>
59767 <listitem>
59768 <para>
59769 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
59770 </para>
59771 </listitem>
59772 <listitem>
59773 <para>
59774 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
59775 <command>smtp</command> transport)
59776 </para>
59777 </listitem>
59778 </itemizedlist>
59779 </section>
59780 <section id="SECID261">
59781 <title>exim_dumpdb</title>
59782 <para>
59783 <indexterm role="concept">
59784 <primary><emphasis>exim_dumpdb</emphasis></primary>
59785 </indexterm>
59786 The entire contents of a database are written to the standard output by the
59787 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
59788 spool and database names. For example, to dump the retry database:
59789 </para>
59790 <literallayout class="monospaced">
59791 exim_dumpdb /var/spool/exim retry
59792 </literallayout>
59793 <para>
59794 Two lines of output are produced for each entry:
59795 </para>
59796 <literallayout class="monospaced">
59797 T:mail.ref.example:192.168.242.242 146 77 Connection refused
59798 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
59799 </literallayout>
59800 <para>
59801 The first item on the first line is the key of the record. It starts with one
59802 of the letters R, or T, depending on whether it refers to a routing or
59803 transport retry. For a local delivery, the next part is the local address; for
59804 a remote delivery it is the name of the remote host, followed by its failing IP
59805 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
59806 transport). If the remote port is not the standard one (port 25), it is added
59807 to the IP address. Then there follows an error code, an additional error code,
59808 and a textual description of the error.
59809 </para>
59810 <para>
59811 The three times on the second line are the time of first failure, the time of
59812 the last delivery attempt, and the computed time for the next attempt. The line
59813 ends with an asterisk if the cutoff time for the last retry rule has been
59814 exceeded.
59815 </para>
59816 <para>
59817 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
59818 consists of a host name followed by a list of ids for messages that are or were
59819 waiting to be delivered to that host. If there are a very large number for any
59820 one host, continuation records, with a sequence number added to the host name,
59821 may be seen. The data in these records is often out of date, because a message
59822 may be routed to several alternative hosts, and Exim makes no effort to keep
59823 cross-references.
59824 </para>
59825 </section>
59826 <section id="SECID262">
59827 <title>exim_tidydb</title>
59828 <para>
59829 <indexterm role="concept">
59830 <primary><emphasis>exim_tidydb</emphasis></primary>
59831 </indexterm>
59832 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
59833 database. If run with no options, it removes all records that are more than 30
59834 days old. The age is calculated from the date and time that the record was last
59835 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
59836 since the first delivery failure. Information about a host that has been down
59837 for more than 30 days will remain in the database, provided that the record is
59838 updated sufficiently often.
59839 </para>
59840 <para>
59841 The cutoff date can be altered by means of the <option>-t</option> option, which must be
59842 followed by a time. For example, to remove all records older than a week from
59843 the retry database:
59844 </para>
59845 <literallayout class="monospaced">
59846 exim_tidydb -t 7d /var/spool/exim retry
59847 </literallayout>
59848 <para>
59849 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
59850 message ids. In the former these appear as data in records keyed by host &ndash;
59851 they were messages that were waiting for that host &ndash; and in the latter they
59852 are the keys for retry information for messages that have suffered certain
59853 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
59854 message ids in database records are those of messages that are still on the
59855 queue. Message ids for messages that no longer exist are removed from
59856 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
59857 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
59858 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
59859 whenever it removes information from the database.
59860 </para>
59861 <para>
59862 Certain records are automatically removed by Exim when they are no longer
59863 needed, but others are not. For example, if all the MX hosts for a domain are
59864 down, a retry record is created for each one. If the primary MX host comes back
59865 first, its record is removed when Exim successfully delivers to it, but the
59866 records for the others remain because Exim has not tried to use those hosts.
59867 </para>
59868 <para>
59869 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
59870 hints databases. You should do this at a quiet time of day, because it requires
59871 a database to be locked (and therefore inaccessible to Exim) while it does its
59872 work. Removing records from a DBM file does not normally make the file smaller,
59873 but all the common DBM libraries are able to re-use the space that is released.
59874 After an initial phase of increasing in size, the databases normally reach a
59875 point at which they no longer get any bigger, as long as they are regularly
59876 tidied.
59877 </para>
59878 <para>
59879 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
59880 databases is likely to keep on increasing.
59881 </para>
59882 </section>
59883 <section id="SECID263">
59884 <title>exim_fixdb</title>
59885 <para>
59886 <indexterm role="concept">
59887 <primary><emphasis>exim_fixdb</emphasis></primary>
59888 </indexterm>
59889 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
59890 Its main use is for testing Exim, but it might also be occasionally useful for
59891 getting round problems in a live system. It has no options, and its interface
59892 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
59893 key of a database record can then be entered, and the data for that record is
59894 displayed.
59895 </para>
59896 <para>
59897 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
59898 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
59899 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
59900 data for individual fields can be changed by typing the field number followed
59901 by new data, for example:
59902 </para>
59903 <literallayout class="monospaced">
59904 &gt; 4 951102:1000
59905 </literallayout>
59906 <para>
59907 resets the time of the next delivery attempt. Time values are given as a
59908 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
59909 used as optional separators.
59910 </para>
59911 </section>
59912 <section id="SECTmailboxmaint">
59913 <title>Mailbox maintenance (exim_lock)</title>
59914 <para>
59915 <indexterm role="concept">
59916 <primary>mailbox</primary>
59917 <secondary>maintenance</secondary>
59918 </indexterm>
59919 <indexterm role="concept">
59920 <primary><emphasis>exim_lock</emphasis></primary>
59921 </indexterm>
59922 <indexterm role="concept">
59923 <primary>locking mailboxes</primary>
59924 </indexterm>
59925 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
59926 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
59927 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
59928 a user agent while investigating a problem. The utility requires the name of
59929 the file as its first argument. If the locking is successful, the second
59930 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
59931 second argument, the value of the SHELL environment variable is used; if this
59932 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
59933 is unlocked and the utility ends. The following options are available:
59934 </para>
59935 <variablelist>
59936 <varlistentry>
59937 <term><option>-fcntl</option></term>
59938 <listitem>
59939 <para>
59940 Use <function>fcntl()</function> locking on the open mailbox.
59941 </para>
59942 </listitem></varlistentry>
59943 <varlistentry>
59944 <term><option>-flock</option></term>
59945 <listitem>
59946 <para>
59947 Use <function>flock()</function> locking on the open mailbox, provided the operating system
59948 supports it.
59949 </para>
59950 </listitem></varlistentry>
59951 <varlistentry>
59952 <term><option>-interval</option></term>
59953 <listitem>
59954 <para>
59955 This must be followed by a number, which is a number of seconds; it sets the
59956 interval to sleep between retries (default 3).
59957 </para>
59958 </listitem></varlistentry>
59959 <varlistentry>
59960 <term><option>-lockfile</option></term>
59961 <listitem>
59962 <para>
59963 Create a lock file before opening the mailbox.
59964 </para>
59965 </listitem></varlistentry>
59966 <varlistentry>
59967 <term><option>-mbx</option></term>
59968 <listitem>
59969 <para>
59970 Lock the mailbox using MBX rules.
59971 </para>
59972 </listitem></varlistentry>
59973 <varlistentry>
59974 <term><option>-q</option></term>
59975 <listitem>
59976 <para>
59977 Suppress verification output.
59978 </para>
59979 </listitem></varlistentry>
59980 <varlistentry>
59981 <term><option>-retries</option></term>
59982 <listitem>
59983 <para>
59984 This must be followed by a number; it sets the number of times to try to get
59985 the lock (default 10).
59986 </para>
59987 </listitem></varlistentry>
59988 <varlistentry>
59989 <term><option>-restore_time</option></term>
59990 <listitem>
59991 <para>
59992 This option causes <option>exim_lock</option> to restore the modified and read times to the
59993 locked file before exiting. This allows you to access a locked mailbox (for
59994 example, to take a backup copy) without disturbing the times that the user
59995 subsequently sees.
59996 </para>
59997 </listitem></varlistentry>
59998 <varlistentry>
59999 <term><option>-timeout</option></term>
60000 <listitem>
60001 <para>
60002 This must be followed by a number, which is a number of seconds; it sets a
60003 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60004 default), a non-blocking call is used.
60005 </para>
60006 </listitem></varlistentry>
60007 <varlistentry>
60008 <term><option>-v</option></term>
60009 <listitem>
60010 <para>
60011 Generate verbose output.
60012 </para>
60013 </listitem></varlistentry>
60014 </variablelist>
60015 <para>
60016 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60017 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60018 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
60019 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60020 requires that the directory containing the file be writeable. Locking by lock
60021 file does not last for ever; Exim assumes that a lock file is expired if it is
60022 more than 30 minutes old.
60023 </para>
60024 <para>
60025 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60026 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60027 to be taken out on the open mailbox, and an exclusive lock on the file
60028 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60029 number of the mailbox file. When the locking is released, if an exclusive lock
60030 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60031 </para>
60032 <para>
60033 The default output contains verification of the locking that takes place. The
60034 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60035 suppresses all output except error messages.
60036 </para>
60037 <para>
60038 A command such as
60039 </para>
60040 <literallayout class="monospaced">
60041 exim_lock /var/spool/mail/spqr
60042 </literallayout>
60043 <para>
60044 runs an interactive shell while the file is locked, whereas
60045 </para>
60046 <literallayout>
60047 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
60048 &lt;<emphasis>some commands</emphasis>&gt;
60049 <literal>End</literal>
60050 </literallayout>
60051 <para>
60052 runs a specific non-interactive sequence of commands while the file is locked,
60053 suppressing all verification output. A single command can be run by a command
60054 such as
60055 </para>
60056 <literallayout class="monospaced">
60057 exim_lock -q /var/spool/mail/spqr \
60058   "cp /var/spool/mail/spqr /some/where"
60059 </literallayout>
60060 <para>
60061 Note that if a command is supplied, it must be entirely contained within the
60062 second argument &ndash; hence the quotes.
60063 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60064 </para>
60065 </section>
60066 </chapter>
60067
60068 <chapter id="CHAPeximon">
60069 <title>The Exim monitor</title>
60070 <para>
60071 <indexterm role="concept" id="IIDeximon" class="startofrange">
60072 <primary>Exim monitor</primary>
60073 <secondary>description</secondary>
60074 </indexterm>
60075 <indexterm role="concept">
60076 <primary>X-windows</primary>
60077 </indexterm>
60078 <indexterm role="concept">
60079 <primary><emphasis>eximon</emphasis></primary>
60080 </indexterm>
60081 <indexterm role="concept">
60082 <primary>Local/eximon.conf</primary>
60083 </indexterm>
60084 <indexterm role="concept">
60085 <primary><filename>exim_monitor/EDITME</filename></primary>
60086 </indexterm>
60087 The Exim monitor is an application which displays in an X window information
60088 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
60089 perform certain operations on messages from this GUI interface; however all
60090 such facilities are also available from the command line, and indeed, the
60091 monitor itself makes use of the command line to perform any actions requested.
60092 </para>
60093 <section id="SECID264">
60094 <title>Running the monitor</title>
60095 <para>
60096 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60097 script that sets up a number of environment variables, and then runs the
60098 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60099 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60100 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60101 parameters are for.
60102 </para>
60103 <para>
60104 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60105 a particular invocation by setting up environment variables of the same names,
60106 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60107 </para>
60108 <literallayout class="monospaced">
60109 EXIMON_LOG_DEPTH=400 eximon
60110 </literallayout>
60111 <para>
60112 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60113 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60114 overrides the Exim log file configuration. This makes it possible to have
60115 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60116 syslog messages are routed to a file on the local host.
60117 </para>
60118 <para>
60119 X resources can be used to change the appearance of the window in the normal
60120 way. For example, a resource setting of the form
60121 </para>
60122 <literallayout class="monospaced">
60123 Eximon*background: gray94
60124 </literallayout>
60125 <para>
60126 changes the colour of the background to light grey rather than white. The
60127 stripcharts are drawn with both the data lines and the reference lines in
60128 black. This means that the reference lines are not visible when on top of the
60129 data. However, their colour can be changed by setting a resource called
60130 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
60131 For example, if your X server is running Unix, you could set up lighter
60132 reference lines in the stripcharts by obeying
60133 </para>
60134 <literallayout class="monospaced">
60135 xrdb -merge &lt;&lt;End
60136 Eximon*highlight: gray
60137 End
60138 </literallayout>
60139 <para>
60140 <indexterm role="concept">
60141 <primary>admin user</primary>
60142 </indexterm>
60143 In order to see the contents of messages on the queue, and to operate on them,
60144 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60145 </para>
60146 <para>
60147 The monitor&#x2019;s window is divided into three parts. The first contains one or
60148 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60149 main log file, and the third is a display of the queue of messages awaiting
60150 delivery, with two more action buttons. The following sections describe these
60151 different parts of the display.
60152 </para>
60153 </section>
60154 <section id="SECID265">
60155 <title>The stripcharts</title>
60156 <para>
60157 <indexterm role="concept">
60158 <primary>stripchart</primary>
60159 </indexterm>
60160 The first stripchart is always a count of messages on the queue. Its name can
60161 be configured by setting QUEUE_STRIPCHART_NAME in the
60162 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60163 configuration script by regular expression matches on log file entries, making
60164 it possible to display, for example, counts of messages delivered to certain
60165 hosts or using certain transports. The supplied defaults display counts of
60166 received and delivered messages, and of local and SMTP deliveries. The default
60167 period between stripchart updates is one minute; this can be adjusted by a
60168 parameter in the <filename>Local/eximon.conf</filename> file.
60169 </para>
60170 <para>
60171 The stripchart displays rescale themselves automatically as the value they are
60172 displaying changes. There are always 10 horizontal lines in each chart; the
60173 title string indicates the value of each division when it is greater than one.
60174 For example, <quote>x2</quote> means that each division represents a value of 2.
60175 </para>
60176 <para>
60177 It is also possible to have a stripchart which shows the percentage fullness of
60178 a particular disk partition, which is useful when local deliveries are confined
60179 to a single partition.
60180 </para>
60181 <para>
60182 <indexterm role="concept">
60183 <primary><option>statvfs</option> function</primary>
60184 </indexterm>
60185 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60186 the operating system. Most, but not all versions of Unix that support Exim have
60187 this. For this particular stripchart, the top of the chart always represents
60188 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60189 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60190 <filename>Local/eximon.conf</filename> file.
60191 </para>
60192 </section>
60193 <section id="SECID266">
60194 <title>Main action buttons</title>
60195 <para>
60196 <indexterm role="concept">
60197 <primary>size</primary>
60198 <secondary>of monitor window</secondary>
60199 </indexterm>
60200 <indexterm role="concept">
60201 <primary>Exim monitor</primary>
60202 <secondary>window size</secondary>
60203 </indexterm>
60204 <indexterm role="concept">
60205 <primary>window size</primary>
60206 </indexterm>
60207 Below the stripcharts there is an action button for quitting the monitor. Next
60208 to this is another button marked <quote>Size</quote>. They are placed here so that
60209 shrinking the window to its default minimum size leaves just the queue count
60210 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60211 the window to expand to its maximum size, unless it is already at the maximum,
60212 in which case it is reduced to its minimum.
60213 </para>
60214 <para>
60215 When expanding to the maximum, if the window cannot be fully seen where it
60216 currently is, it is moved back to where it was the last time it was at full
60217 size. When it is expanding from its minimum size, the old position is
60218 remembered, and next time it is reduced to the minimum it is moved back there.
60219 </para>
60220 <para>
60221 The idea is that you can keep a reduced window just showing one or two
60222 stripcharts at a convenient place on your screen, easily expand it to show
60223 the full window when required, and just as easily put it back to what it was.
60224 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60225 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60226 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60227 </para>
60228 <para>
60229 Normally, the monitor starts up with the window at its full size, but it can be
60230 built so that it starts up with the window at its smallest size, by setting
60231 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60232 </para>
60233 </section>
60234 <section id="SECID267">
60235 <title>The log display</title>
60236 <para>
60237 <indexterm role="concept">
60238 <primary>log</primary>
60239 <secondary>tail of; in monitor</secondary>
60240 </indexterm>
60241 The second section of the window is an area in which a display of the tail of
60242 the main log is maintained.
60243 To save space on the screen, the timestamp on each log line is shortened by
60244 removing the date and, if <option>log_timezone</option> is set, the timezone.
60245 The log tail is not available when the only destination for logging data is
60246 syslog, unless the syslog lines are routed to a local file whose name is passed
60247 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60248 </para>
60249 <para>
60250 The log sub-window has a scroll bar at its lefthand side which can be used to
60251 move back to look at earlier text, and the up and down arrow keys also have a
60252 scrolling effect. The amount of log that is kept depends on the setting of
60253 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60254 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
60255 much more efficient than throwing it away line by line. The sub-window also has
60256 a horizontal scroll bar for accessing the ends of long log lines. This is the
60257 only means of horizontal scrolling; the right and left arrow keys are not
60258 available. Text can be cut from this part of the window using the mouse in the
60259 normal way. The size of this subwindow is controlled by parameters in the
60260 configuration file <filename>Local/eximon.conf</filename>.
60261 </para>
60262 <para>
60263 Searches of the text in the log window can be carried out by means of the ^R
60264 and ^S keystrokes, which default to a reverse and a forward search,
60265 respectively. The search covers only the text that is displayed in the window.
60266 It cannot go further back up the log.
60267 </para>
60268 <para>
60269 The point from which the search starts is indicated by a caret marker. This is
60270 normally at the end of the text in the window, but can be positioned explicitly
60271 by pointing and clicking with the left mouse button, and is moved automatically
60272 by a successful search. If new text arrives in the window when it is scrolled
60273 back, the caret remains where it is, but if the window is not scrolled back,
60274 the caret is moved to the end of the new text.
60275 </para>
60276 <para>
60277 Pressing ^R or ^S pops up a window into which the search text can be typed.
60278 There are buttons for selecting forward or reverse searching, for carrying out
60279 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60280 happens and the window remains so that further searches can be done. If the
60281 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60282 ^C is typed the search is cancelled.
60283 </para>
60284 <para>
60285 The searching facility is implemented using the facilities of the Athena text
60286 widget. By default this pops up a window containing both <quote>search</quote> and
60287 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60288 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60289 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60290 provided version of <option>TextPop</option> when the remaining parts of the text widget
60291 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60292 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60293 on these systems, at the expense of having unwanted items in the search popup
60294 window.
60295 </para>
60296 </section>
60297 <section id="SECID268">
60298 <title>The queue display</title>
60299 <para>
60300 <indexterm role="concept">
60301 <primary>queue</primary>
60302 <secondary>display in monitor</secondary>
60303 </indexterm>
60304 The bottom section of the monitor window contains a list of all messages that
60305 are on the queue, which includes those currently being received or delivered,
60306 as well as those awaiting delivery. The size of this subwindow is controlled by
60307 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60308 at which it is updated is controlled by another parameter in the same file &ndash;
60309 the default is 5 minutes, since queue scans can be quite expensive. However,
60310 there is an <quote>Update</quote> action button just above the display which can be used
60311 to force an update of the queue display at any time.
60312 </para>
60313 <para>
60314 When a host is down for some time, a lot of pending mail can build up for it,
60315 and this can make it hard to deal with other messages on the queue. To help
60316 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60317 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60318 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60319 such texts, and if every undelivered address in a message matches at least one
60320 of the texts, the message is not displayed.
60321 </para>
60322 <para>
60323 If there is an address that does not match any of the texts, all the addresses
60324 are displayed as normal. The matching happens on the ends of addresses so, for
60325 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60326 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60327 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60328 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60329 a hide request is automatically cancelled after one hour.
60330 </para>
60331 <para>
60332 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
60333 else to the monitor window. For this reason, if you want to cut text from the
60334 queue display to use in the dialogue box, you have to do the cutting before
60335 pressing the <quote>Hide</quote> button.
60336 </para>
60337 <para>
60338 The queue display contains, for each unhidden queued message, the length of
60339 time it has been on the queue, the size of the message, the message id, the
60340 message sender, and the first undelivered recipient, all on one line. If it is
60341 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
60342 recipient to which the message has not yet been delivered, subsequent ones are
60343 listed on additional lines, up to a maximum configured number, following which
60344 an ellipsis is displayed. Recipients that have already received the message are
60345 not shown.
60346 </para>
60347 <para>
60348 <indexterm role="concept">
60349 <primary>frozen messages</primary>
60350 <secondary>display</secondary>
60351 </indexterm>
60352 If a message is frozen, an asterisk is displayed at the left-hand side.
60353 </para>
60354 <para>
60355 The queue display has a vertical scroll bar, and can also be scrolled by means
60356 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60357 The text searching facilities, as described above for the log window, are also
60358 available, but the caret is always moved to the end of the text when the queue
60359 display is updated.
60360 </para>
60361 </section>
60362 <section id="SECID269">
60363 <title>The queue menu</title>
60364 <para>
60365 <indexterm role="concept">
60366 <primary>queue</primary>
60367 <secondary>menu in monitor</secondary>
60368 </indexterm>
60369 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60370 pointer is over the text for any message, an action menu pops up, and the first
60371 line of the queue display for the message is highlighted. This does not affect
60372 any selected text.
60373 </para>
60374 <para>
60375 If you want to use some other event for popping up the menu, you can set the
60376 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60377 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60378 value set in this parameter is a standard X event description. For example, to
60379 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60380 </para>
60381 <literallayout class="monospaced">
60382 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
60383 </literallayout>
60384 <para>
60385 The title of the menu is the message id, and it contains entries which act as
60386 follows:
60387 </para>
60388 <itemizedlist>
60389 <listitem>
60390 <para>
60391 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60392 in a new text window.
60393 </para>
60394 </listitem>
60395 <listitem>
60396 <para>
60397 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60398 information and headers is displayed in a new text window. See chapter
60399 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60400 </para>
60401 </listitem>
60402 <listitem>
60403 <para>
60404 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60405 displayed in a new text window. There is a default limit of 20,000 bytes to the
60406 amount of data displayed. This can be changed by setting the BODY_MAX
60407 option at compile time, or the EXIMON_BODY_MAX option at run time.
60408 </para>
60409 </listitem>
60410 <listitem>
60411 <para>
60412 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60413 delivery of the message. This causes an automatic thaw if the message is
60414 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60415 a new text window. The delivery is run in a separate process, to avoid holding
60416 up the monitor while the delivery proceeds.
60417 </para>
60418 </listitem>
60419 <listitem>
60420 <para>
60421 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60422 that the message be frozen.
60423 </para>
60424 </listitem>
60425 <listitem>
60426 <para>
60427 <indexterm role="concept">
60428 <primary>thawing messages</primary>
60429 </indexterm>
60430 <indexterm role="concept">
60431 <primary>unfreezing messages</primary>
60432 </indexterm>
60433 <indexterm role="concept">
60434 <primary>frozen messages</primary>
60435 <secondary>thawing</secondary>
60436 </indexterm>
60437 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60438 that the message be thawed.
60439 </para>
60440 </listitem>
60441 <listitem>
60442 <para>
60443 <indexterm role="concept">
60444 <primary>delivery</primary>
60445 <secondary>forcing failure</secondary>
60446 </indexterm>
60447 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60448 that Exim gives up trying to deliver the message. A bounce message is generated
60449 for any remaining undelivered addresses.
60450 </para>
60451 </listitem>
60452 <listitem>
60453 <para>
60454 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60455 that the message be deleted from the system without generating a bounce
60456 message.
60457 </para>
60458 </listitem>
60459 <listitem>
60460 <para>
60461 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60462 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60463 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60464 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60465 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60466 additional recipient be added to the message, unless the entry box is empty, in
60467 which case no action is taken.
60468 </para>
60469 </listitem>
60470 <listitem>
60471 <para>
60472 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60473 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60474 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60475 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60476 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60477 recipient address as already delivered, unless the entry box is empty, in which
60478 case no action is taken.
60479 </para>
60480 </listitem>
60481 <listitem>
60482 <para>
60483 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60484 mark all recipient addresses as already delivered.
60485 </para>
60486 </listitem>
60487 <listitem>
60488 <para>
60489 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60490 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
60491 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60492 in which case no action is taken. If you want to set an empty sender (as in
60493 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
60494 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60495 the address is qualified with that domain.
60496 </para>
60497 </listitem>
60498 </itemizedlist>
60499 <para>
60500 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60501 other cases when a call to Exim is made, if there is any output from Exim (in
60502 particular, if the command fails) a window containing the command and the
60503 output is displayed. Otherwise, the results of the action are normally apparent
60504 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60505 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60506 if no output is generated.
60507 </para>
60508 <para>
60509 The queue display is automatically updated for actions such as freezing and
60510 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60511 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60512 force an update of the display after one of these actions.
60513 </para>
60514 <para>
60515 In any text window that is displayed as result of a menu action, the normal
60516 cut-and-paste facility is available, and searching can be carried out using ^R
60517 and ^S, as described above for the log tail window.
60518 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60519 </para>
60520 </section>
60521 </chapter>
60522
60523 <chapter id="CHAPsecurity">
60524 <title>Security considerations</title>
60525 <para>
60526 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60527 <primary>security</primary>
60528 <secondary>discussion of</secondary>
60529 </indexterm>
60530 This chapter discusses a number of issues concerned with security, some of
60531 which are also covered in other parts of this manual.
60532 </para>
60533 <para>
60534 For reasons that this author does not understand, some people have promoted
60535 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60536 existence of this chapter in the documentation. However, the intent of the
60537 chapter is simply to describe the way Exim works in relation to certain
60538 security concerns, not to make any specific claims about the effectiveness of
60539 its security as compared with other MTAs.
60540 </para>
60541 <para>
60542 What follows is a description of the way Exim is supposed to be. Best efforts
60543 have been made to try to ensure that the code agrees with the theory, but an
60544 absence of bugs can never be guaranteed. Any that are reported will get fixed
60545 as soon as possible.
60546 </para>
60547 <section id="SECID286">
60548 <title>Building a more <quote>hardened</quote> Exim</title>
60549 <para>
60550 <indexterm role="concept">
60551 <primary>security</primary>
60552 <secondary>build-time features</secondary>
60553 </indexterm>
60554 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60555 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60556 Exim administrator who does not have the root password, or by someone who has
60557 penetrated the Exim (but not the root) account. These options are as follows:
60558 </para>
60559 <itemizedlist>
60560 <listitem>
60561 <para>
60562 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60563 start of any file names used with the <option>-C</option> option. When it is set, these file
60564 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60565 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60566 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60567 default setting for <option>ALT_CONFIG_PREFIX</option>.
60568 </para>
60569 <para>
60570 If the permitted configuration files are confined to a directory to
60571 which only root has access, this guards against someone who has broken
60572 into the Exim account from running a privileged Exim with an arbitrary
60573 configuration file, and using it to break into other accounts.
60574 </para>
60575 </listitem>
60576 <listitem>
60577 <para>
60578 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
60579 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
60580 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
60581 the possibility of testing a configuration using <option>-C</option> right through message
60582 reception and delivery, even if the caller is root. The reception works, but by
60583 that time, Exim is running as the Exim user, so when it re-execs to regain
60584 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
60585 However, root can test reception and delivery using two separate commands.
60586 ALT_CONFIG_ROOT_ONLY is not set by default.
60587 </para>
60588 </listitem>
60589 <listitem>
60590 <para>
60591 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60592 is disabled.
60593 </para>
60594 </listitem>
60595 <listitem>
60596 <para>
60597 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60598 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60599 option, but it cannot be overridden; the runtime option adds additional users
60600 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60601 is permitted to modify the runtime file from using Exim as a way to get root.
60602 </para>
60603 </listitem>
60604 </itemizedlist>
60605 </section>
60606 <section id="SECID270">
60607 <title>Root privilege</title>
60608 <para>
60609 <indexterm role="concept">
60610 <primary>setuid</primary>
60611 </indexterm>
60612 <indexterm role="concept">
60613 <primary>root privilege</primary>
60614 </indexterm>
60615 The Exim binary is normally setuid to root, which means that it gains root
60616 privilege (runs as root) when it starts execution. In some special cases (for
60617 example, when the daemon is not in use and there are no local deliveries), it
60618 may be possible to run Exim setuid to some user other than root. This is
60619 discussed in the next section. However, in most installations, root privilege
60620 is required for two things:
60621 </para>
60622 <itemizedlist>
60623 <listitem>
60624 <para>
60625 To set up a socket connected to the standard SMTP port (25) when initialising
60626 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
60627 not required.
60628 </para>
60629 </listitem>
60630 <listitem>
60631 <para>
60632 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
60633 perform local deliveries as the receiving user or as specified in the
60634 configuration.
60635 </para>
60636 </listitem>
60637 </itemizedlist>
60638 <para>
60639 It is not necessary to be root to do any of the other things Exim does, such as
60640 receiving messages and delivering them externally over SMTP, and it is
60641 obviously more secure if Exim does not run as root except when necessary.
60642 For this reason, a user and group for Exim to use must be defined in
60643 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
60644 group</quote>. Their values can be changed by the run time configuration, though this
60645 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
60646 <emphasis>mail</emphasis> or another user name altogether.
60647 </para>
60648 <para>
60649 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
60650 abdication; the process cannot regain root afterwards. Prior to release 4.00,
60651 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
60652 </para>
60653 <para>
60654 After a new Exim process has interpreted its command line options, it changes
60655 uid and gid in the following cases:
60656 </para>
60657 <itemizedlist>
60658 <listitem>
60659 <para>
60660 <indexterm role="option">
60661 <primary><option>-C</option></primary>
60662 </indexterm>
60663 <indexterm role="option">
60664 <primary><option>-D</option></primary>
60665 </indexterm>
60666 If the <option>-C</option> option is used to specify an alternate configuration file, or if
60667 the <option>-D</option> option is used to define macro values for the configuration, and the
60668 calling process is not running as root or the Exim user, the uid and gid are
60669 changed to those of the calling process.
60670 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
60671 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
60672 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
60673 </para>
60674 </listitem>
60675 <listitem>
60676 <para>
60677 <indexterm role="option">
60678 <primary><option>-be</option></primary>
60679 </indexterm>
60680 <indexterm role="option">
60681 <primary><option>-bf</option></primary>
60682 </indexterm>
60683 <indexterm role="option">
60684 <primary><option>-bF</option></primary>
60685 </indexterm>
60686 If the expansion test option (<option>-be</option>) or one of the filter testing options
60687 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
60688 calling process.
60689 </para>
60690 </listitem>
60691 <listitem>
60692 <para>
60693 If the process is not a daemon process or a queue runner process or a delivery
60694 process or a process for testing address routing (started with <option>-bt</option>), the
60695 uid and gid are changed to the Exim user and group. This means that Exim always
60696 runs under its own uid and gid when receiving messages. This also applies when
60697 testing address verification
60698 <indexterm role="option">
60699 <primary><option>-bv</option></primary>
60700 </indexterm>
60701 <indexterm role="option">
60702 <primary><option>-bh</option></primary>
60703 </indexterm>
60704 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
60705 option).
60706 </para>
60707 </listitem>
60708 <listitem>
60709 <para>
60710 For a daemon, queue runner, delivery, or address testing process, the uid
60711 remains as root at this stage, but the gid is changed to the Exim group.
60712 </para>
60713 </listitem>
60714 </itemizedlist>
60715 <para>
60716 The processes that initially retain root privilege behave as follows:
60717 </para>
60718 <itemizedlist>
60719 <listitem>
60720 <para>
60721 A daemon process changes the gid to the Exim group and the uid to the Exim
60722 user after setting up one or more listening sockets. The <function>initgroups()</function>
60723 function is called, so that if the Exim user is in any additional groups, they
60724 will be used during message reception.
60725 </para>
60726 </listitem>
60727 <listitem>
60728 <para>
60729 A queue runner process retains root privilege throughout its execution. Its
60730 job is to fork a controlled sequence of delivery processes.
60731 </para>
60732 </listitem>
60733 <listitem>
60734 <para>
60735 A delivery process retains root privilege throughout most of its execution,
60736 but any actual deliveries (that is, the transports themselves) are run in
60737 subprocesses which always change to a non-root uid and gid. For local
60738 deliveries this is typically the uid and gid of the owner of the mailbox; for
60739 remote deliveries, the Exim uid and gid are used. Once all the delivery
60740 subprocesses have been run, a delivery process changes to the Exim uid and gid
60741 while doing post-delivery tidying up such as updating the retry database and
60742 generating bounce and warning messages.
60743 </para>
60744 <para>
60745 While the recipient addresses in a message are being routed, the delivery
60746 process runs as root. However, if a user&#x2019;s filter file has to be processed,
60747 this is done in a subprocess that runs under the individual user&#x2019;s uid and
60748 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
60749 </para>
60750 </listitem>
60751 <listitem>
60752 <para>
60753 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
60754 the routing is done in the same environment as a message delivery.
60755 </para>
60756 </listitem>
60757 </itemizedlist>
60758 </section>
60759 <section id="SECTrunexiwitpri">
60760 <title>Running Exim without privilege</title>
60761 <para>
60762 <indexterm role="concept">
60763 <primary>privilege, running without</primary>
60764 </indexterm>
60765 <indexterm role="concept">
60766 <primary>unprivileged running</primary>
60767 </indexterm>
60768 <indexterm role="concept">
60769 <primary>root privilege</primary>
60770 <secondary>running without</secondary>
60771 </indexterm>
60772 Some installations like to run Exim in an unprivileged state for more of its
60773 operation, for added security. Support for this mode of operation is provided
60774 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
60775 gid are changed to the Exim user and group at the start of a delivery process
60776 (and also queue runner and address testing processes). This means that address
60777 routing is no longer run as root, and the deliveries themselves cannot change
60778 to any other uid.
60779 </para>
60780 <para>
60781 <indexterm role="concept">
60782 <primary>SIGHUP</primary>
60783 </indexterm>
60784 <indexterm role="concept">
60785 <primary>daemon</primary>
60786 <secondary>restarting</secondary>
60787 </indexterm>
60788 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
60789 that the daemon can still be started in the usual way, and it can respond
60790 correctly to SIGHUP because the re-invocation regains root privilege.
60791 </para>
60792 <para>
60793 An alternative approach is to make Exim setuid to the Exim user and also setgid
60794 to the Exim group. If you do this, the daemon must be started from a root
60795 process. (Calling Exim from a root process makes it behave in the way it does
60796 when it is setuid root.) However, the daemon cannot restart itself after a
60797 SIGHUP signal because it cannot regain privilege.
60798 </para>
60799 <para>
60800 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
60801 stops Exim from trying to re-invoke itself to do a delivery after a message has
60802 been received. Such a re-invocation is a waste of resources because it has no
60803 effect.
60804 </para>
60805 <para>
60806 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
60807 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
60808 to the Exim user seems a clean approach, but there is one complication:
60809 </para>
60810 <para>
60811 In this style of operation, Exim is running with the real uid and gid set to
60812 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
60813 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
60814 that is, the real uid/gid should be reset to the effective values so as to
60815 discard any privileges that the caller may have. While some operating systems
60816 have a function that permits this action for a non-root effective uid, quite a
60817 number of them do not. Because of this lack of standardization, Exim does not
60818 address this problem at this time.
60819 </para>
60820 <para>
60821 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
60822 is to keep the Exim binary setuid to root, and to set
60823 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
60824 be used in the most straightforward way.
60825 </para>
60826 <para>
60827 If you configure Exim not to run delivery processes as root, there are a
60828 number of restrictions on what you can do:
60829 </para>
60830 <itemizedlist>
60831 <listitem>
60832 <para>
60833 You can deliver only as the Exim user/group. You should  explicitly use the
60834 <option>user</option> and <option>group</option> options to override routers or local transports that
60835 normally deliver as the recipient. This makes sure that configurations that
60836 work in this mode function the same way in normal mode. Any implicit or
60837 explicit specification of another user causes an error.
60838 </para>
60839 </listitem>
60840 <listitem>
60841 <para>
60842 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
60843 not worthwhile to include them in the configuration.
60844 </para>
60845 </listitem>
60846 <listitem>
60847 <para>
60848 Users who wish to use <filename>.forward</filename> would have to make their home directory and
60849 the file itself accessible to the Exim user. Pipe and append-to-file entries,
60850 and their equivalents in Exim filters, cannot be used. While they could be
60851 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
60852 </para>
60853 </listitem>
60854 <listitem>
60855 <para>
60856 Unless the local user mailboxes are all owned by the Exim user (possible in
60857 some POP3 or IMAP-only environments):
60858 </para>
60859 <orderedlist numeration="arabic">
60860 <listitem>
60861 <para>
60862 They must be owned by the Exim group and be writeable by that group. This
60863 implies you must set <option>mode</option> in the appendfile configuration, as well as the
60864 mode of the mailbox files themselves.
60865 </para>
60866 </listitem>
60867 <listitem>
60868 <para>
60869 You must set <option>no_check_owner</option>, since most or all of the files will not be
60870 owned by the Exim user.
60871 </para>
60872 </listitem>
60873 <listitem>
60874 <para>
60875 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
60876 on a newly created mailbox when unprivileged. This also implies that new
60877 mailboxes need to be created manually.
60878 </para>
60879 </listitem>
60880 </orderedlist>
60881 </listitem>
60882 </itemizedlist>
60883 <para>
60884 These restrictions severely restrict what can be done in local deliveries.
60885 However, there are no restrictions on remote deliveries. If you are running a
60886 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
60887 gives more security at essentially no cost.
60888 </para>
60889 <para>
60890 If you are using the <option>mua_wrapper</option> facility (see chapter
60891 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
60892 </para>
60893 </section>
60894 <section id="SECID271">
60895 <title>Delivering to local files</title>
60896 <para>
60897 Full details of the checks applied by <command>appendfile</command> before it writes to a file
60898 are given in chapter <xref linkend="CHAPappendfile"/>.
60899 </para>
60900 </section>
60901 <section id="SECID272">
60902 <title>IPv4 source routing</title>
60903 <para>
60904 <indexterm role="concept">
60905 <primary>source routing</primary>
60906 <secondary>in IP packets</secondary>
60907 </indexterm>
60908 <indexterm role="concept">
60909 <primary>IP source routing</primary>
60910 </indexterm>
60911 Many operating systems suppress IP source-routed packets in the kernel, but
60912 some cannot be made to do this, so Exim does its own check. It logs incoming
60913 IPv4 source-routed TCP calls, and then drops them. Things are all different in
60914 IPv6. No special checking is currently done.
60915 </para>
60916 </section>
60917 <section id="SECID273">
60918 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
60919 <para>
60920 Support for these SMTP commands is disabled by default. If required, they can
60921 be enabled by defining suitable ACLs.
60922 </para>
60923 </section>
60924 <section id="SECID274">
60925 <title>Privileged users</title>
60926 <para>
60927 <indexterm role="concept">
60928 <primary>trusted users</primary>
60929 </indexterm>
60930 <indexterm role="concept">
60931 <primary>admin user</primary>
60932 </indexterm>
60933 <indexterm role="concept">
60934 <primary>privileged user</primary>
60935 </indexterm>
60936 <indexterm role="concept">
60937 <primary>user</primary>
60938 <secondary>trusted</secondary>
60939 </indexterm>
60940 <indexterm role="concept">
60941 <primary>user</primary>
60942 <secondary>admin</secondary>
60943 </indexterm>
60944 Exim recognizes two sets of users with special privileges. Trusted users are
60945 able to submit new messages to Exim locally, but supply their own sender
60946 addresses and information about a sending host. For other users submitting
60947 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
60948 permit a remote host to be specified.
60949 </para>
60950 <para>
60951 <indexterm role="option">
60952 <primary><option>-f</option></primary>
60953 </indexterm>
60954 However, an untrusted user is permitted to use the <option>-f</option> command line option
60955 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
60956 message should not cause an error report. This affects the message&#x2019;s envelope,
60957 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
60958 permitted to use specific forms of address with the <option>-f</option> option by setting
60959 the <option>untrusted_set_sender</option> option.
60960 </para>
60961 <para>
60962 Trusted users are used to run processes that receive mail messages from some
60963 other mail domain and pass them on to Exim for delivery either locally, or over
60964 the Internet. Exim trusts a caller that is running as root, as the Exim user,
60965 as any user listed in the <option>trusted_users</option> configuration option, or under any
60966 group listed in the <option>trusted_groups</option> option.
60967 </para>
60968 <para>
60969 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
60970 can freeze or thaw messages, cause them to be returned to their senders, remove
60971 them entirely, or modify them in various ways. In addition, admin users can run
60972 the Exim monitor and see all the information it is capable of providing, which
60973 includes the contents of files on the spool.
60974 </para>
60975 <para>
60976 <indexterm role="option">
60977 <primary><option>-M</option></primary>
60978 </indexterm>
60979 <indexterm role="option">
60980 <primary><option>-q</option></primary>
60981 </indexterm>
60982 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
60983 delivery of messages on its queue is restricted to admin users. This
60984 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
60985 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
60986 queue is also restricted to admin users. This restriction can be relaxed by
60987 setting <option>no_queue_list_requires_admin</option>.
60988 </para>
60989 <para>
60990 Exim recognizes an admin user if the calling process is running as root or as
60991 the Exim user or if any of the groups associated with the calling process is
60992 the Exim group. It is not necessary actually to be running under the Exim
60993 group. However, if admin users who are not root or the Exim user are to access
60994 the contents of files on the spool via the Exim monitor (which runs
60995 unprivileged), Exim must be built to allow group read access to its spool
60996 files.
60997 </para>
60998 </section>
60999 <section id="SECID275">
61000 <title>Spool files</title>
61001 <para>
61002 <indexterm role="concept">
61003 <primary>spool directory</primary>
61004 <secondary>files</secondary>
61005 </indexterm>
61006 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
61007 set to the Exim group. The mode for spool files is defined in the
61008 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61009 any user who is a member of the Exim group can access these files.
61010 </para>
61011 </section>
61012 <section id="SECID276">
61013 <title>Use of argv[0]</title>
61014 <para>
61015 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61016 of specific strings, Exim assumes certain options. For example, calling Exim
61017 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61018 to calling it with the option <option>-bS</option>. There are no security implications in
61019 this.
61020 </para>
61021 </section>
61022 <section id="SECID277">
61023 <title>Use of %f formatting</title>
61024 <para>
61025 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61026 are actually stored in integer variables as 1000 times the load average.
61027 Consequently, their range is limited and so therefore is the length of the
61028 converted output.
61029 </para>
61030 </section>
61031 <section id="SECID278">
61032 <title>Embedded Exim path</title>
61033 <para>
61034 Exim uses its own path name, which is embedded in the code, only when it needs
61035 to re-exec in order to regain root privilege. Therefore, it is not root when it
61036 does so. If some bug allowed the path to get overwritten, it would lead to an
61037 arbitrary program&#x2019;s being run as exim, not as root.
61038 </para>
61039 </section>
61040 <section id="SECID279">
61041 <title>Use of sprintf()</title>
61042 <para>
61043 <indexterm role="concept">
61044 <primary><function>sprintf()</function></primary>
61045 </indexterm>
61046 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61047 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
61048 The intermediate formatting is done into a large fixed buffer by a function
61049 that runs through the format string itself, and checks the length of each
61050 conversion before performing it, thus preventing buffer overruns.
61051 </para>
61052 <para>
61053 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61054 the output buffer is known to be sufficiently long to contain the converted
61055 string.
61056 </para>
61057 </section>
61058 <section id="SECID280">
61059 <title>Use of debug_printf() and log_write()</title>
61060 <para>
61061 Arbitrary strings are passed to both these functions, but they do their
61062 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61063 the format string itself, and checks the length of each conversion.
61064 </para>
61065 </section>
61066 <section id="SECID281">
61067 <title>Use of strcat() and strcpy()</title>
61068 <para>
61069 These are used only in cases where the output buffer is known to be large
61070 enough to hold the result.
61071 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61072 </para>
61073 </section>
61074 </chapter>
61075
61076 <chapter id="CHAPspool">
61077 <title>Format of spool files</title>
61078 <para>
61079 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61080 <primary>format</primary>
61081 <secondary>spool files</secondary>
61082 </indexterm>
61083 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61084 <primary>spool directory</primary>
61085 <secondary>format of files</secondary>
61086 </indexterm>
61087 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61088 <primary>spool files</primary>
61089 <secondary>format of</secondary>
61090 </indexterm>
61091 <indexterm role="concept">
61092 <primary>spool files</primary>
61093 <secondary>editing</secondary>
61094 </indexterm>
61095 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
61096 followed by -D and -H, respectively. The data portion of the message is kept in
61097 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
61098 kept in the -H file, whose format is described in this chapter. Each of these
61099 two files contains the final component of its own name as its first line. This
61100 is insurance against disk crashes where the directory is lost but the files
61101 themselves are recoverable.
61102 </para>
61103 <para>
61104 Some people are tempted into editing -D files in order to modify messages. You
61105 need to be extremely careful if you do this; it is not recommended and you are
61106 on your own if you do it. Here are some of the pitfalls:
61107 </para>
61108 <itemizedlist>
61109 <listitem>
61110 <para>
61111 You must ensure that Exim does not try to deliver the message while you are
61112 fiddling with it. The safest way is to take out a write lock on the -D file,
61113 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61114 place, the lock will be retained. If you write a new file and rename it, the
61115 lock will be lost at the instant of rename.
61116 </para>
61117 </listitem>
61118 <listitem>
61119 <para>
61120 <indexterm role="variable">
61121 <primary><varname>$body_linecount</varname></primary>
61122 </indexterm>
61123 If you change the number of lines in the file, the value of
61124 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61125 present, this value is not used by Exim, but there is no guarantee that this
61126 will always be the case.
61127 </para>
61128 </listitem>
61129 <listitem>
61130 <para>
61131 If the message is in MIME format, you must take care not to break it.
61132 </para>
61133 </listitem>
61134 <listitem>
61135 <para>
61136 If the message is cryptographically signed, any change will invalidate the
61137 signature.
61138 </para>
61139 </listitem>
61140 </itemizedlist>
61141 <para>
61142 All in all, modifying -D files is fraught with danger.
61143 </para>
61144 <para>
61145 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61146 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61147 files, used to record addresses to which the message has been delivered during
61148 the course of a delivery attempt. If there are still undelivered recipients at
61149 the end, the -H file is updated, and the -J file is deleted. If, however, there
61150 is some kind of crash (for example, a power outage) before this happens, the -J
61151 file remains in existence. When Exim next processes the message, it notices the
61152 -J file and uses it to update the -H file before starting the next delivery
61153 attempt.
61154 </para>
61155 <section id="SECID282">
61156 <title>Format of the -H file</title>
61157 <para>
61158 <indexterm role="concept">
61159 <primary>uid (user id)</primary>
61160 <secondary>in spool file</secondary>
61161 </indexterm>
61162 <indexterm role="concept">
61163 <primary>gid (group id)</primary>
61164 <secondary>in spool file</secondary>
61165 </indexterm>
61166 The second line of the -H file contains the login name for the uid of the
61167 process that called Exim to read the message, followed by the numerical uid and
61168 gid. For a locally generated message, this is normally the user who sent the
61169 message. For a message received over TCP/IP via the daemon, it is
61170 normally the Exim user.
61171 </para>
61172 <para>
61173 The third line of the file contains the address of the message&#x2019;s sender as
61174 transmitted in the envelope, contained in angle brackets. The sender address is
61175 empty for bounce messages. For incoming SMTP mail, the sender address is given
61176 in the MAIL command. For locally generated mail, the sender address is
61177 created by Exim from the login name of the current user and the configured
61178 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61179 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
61180 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
61181 </para>
61182 <para>
61183 The fourth line contains two numbers. The first is the time that the message
61184 was received, in the conventional Unix form &ndash; the number of seconds since the
61185 start of the epoch. The second number is a count of the number of messages
61186 warning of delayed delivery that have been sent to the sender.
61187 </para>
61188 <para>
61189 There follow a number of lines starting with a hyphen. These can appear in any
61190 order, and are omitted when not relevant:
61191 </para>
61192 <variablelist>
61193 <varlistentry>
61194 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61195 <listitem>
61196 <para>
61197 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61198 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61199 recognized, to provide backward compatibility. In the old format, a line of
61200 this form is present for every ACL variable that is not empty. The number
61201 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
61202 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
61203 the data string for the variable. The string itself starts at the beginning of
61204 the next line, and is followed by a newline character. It may contain internal
61205 newlines.
61206 </para>
61207 </listitem></varlistentry>
61208 <varlistentry>
61209 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61210 <listitem>
61211 <para>
61212 A line of this form is present for every ACL connection variable that is
61213 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61214 The length is the length of the data string for the variable. The string itself
61215 starts at the beginning of the next line, and is followed by a newline
61216 character. It may contain internal newlines.
61217 </para>
61218 </listitem></varlistentry>
61219 <varlistentry>
61220 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61221 <listitem>
61222 <para>
61223 A line of this form is present for every ACL message variable that is defined.
61224 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61225 length is the length of the data string for the variable. The string itself
61226 starts at the beginning of the next line, and is followed by a newline
61227 character. It may contain internal newlines.
61228 </para>
61229 </listitem></varlistentry>
61230 <varlistentry>
61231 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
61232 <listitem>
61233 <para>
61234 This is present if, when the message was received over SMTP, the value of
61235 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61236 </para>
61237 </listitem></varlistentry>
61238 <varlistentry>
61239 <term><option>-allow_unqualified_recipient</option></term>
61240 <listitem>
61241 <para>
61242 This is present if unqualified recipient addresses are permitted in header
61243 lines (to stop such addresses from being qualified if rewriting occurs at
61244 transport time). Local messages that were input using <option>-bnq</option> and remote
61245 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61246 </para>
61247 </listitem></varlistentry>
61248 <varlistentry>
61249 <term><option>-allow_unqualified_sender</option></term>
61250 <listitem>
61251 <para>
61252 This is present if unqualified sender addresses are permitted in header lines
61253 (to stop such addresses from being qualified if rewriting occurs at transport
61254 time). Local messages that were input using <option>-bnq</option> and remote messages from
61255 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61256 </para>
61257 </listitem></varlistentry>
61258 <varlistentry>
61259 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61260 <listitem>
61261 <para>
61262 The id information for a message received on an authenticated SMTP connection
61263 &ndash; the value of the <varname>$authenticated_id</varname> variable.
61264 </para>
61265 </listitem></varlistentry>
61266 <varlistentry>
61267 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
61268 <listitem>
61269 <para>
61270 The address of an authenticated sender &ndash; the value of the
61271 <varname>$authenticated_sender</varname> variable.
61272 </para>
61273 </listitem></varlistentry>
61274 <varlistentry>
61275 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61276 <listitem>
61277 <para>
61278 This records the number of lines in the body of the message, and is always
61279 present.
61280 </para>
61281 </listitem></varlistentry>
61282 <varlistentry>
61283 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61284 <listitem>
61285 <para>
61286 This records the number of binary zero bytes in the body of the message, and is
61287 present if the number is greater than zero.
61288 </para>
61289 </listitem></varlistentry>
61290 <varlistentry>
61291 <term><option>-deliver_firsttime</option></term>
61292 <listitem>
61293 <para>
61294 This is written when a new message is first added to the spool. When the spool
61295 file is updated after a deferral, it is omitted.
61296 </para>
61297 </listitem></varlistentry>
61298 <varlistentry>
61299 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
61300 <listitem>
61301 <para>
61302 <indexterm role="concept">
61303 <primary>frozen messages</primary>
61304 <secondary>spool data</secondary>
61305 </indexterm>
61306 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
61307 </para>
61308 </listitem></varlistentry>
61309 <varlistentry>
61310 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61311 <listitem>
61312 <para>
61313 This records the host name as specified by a remote host in a HELO or EHLO
61314 command.
61315 </para>
61316 </listitem></varlistentry>
61317 <varlistentry>
61318 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61319 <listitem>
61320 <para>
61321 This records the IP address of the host from which the message was received and
61322 the remote port number that was used. It is omitted for locally generated
61323 messages.
61324 </para>
61325 </listitem></varlistentry>
61326 <varlistentry>
61327 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61328 <listitem>
61329 <para>
61330 If the message was received on an authenticated SMTP connection, this records
61331 the name of the authenticator &ndash; the value of the
61332 <varname>$sender_host_authenticated</varname> variable.
61333 </para>
61334 </listitem></varlistentry>
61335 <varlistentry>
61336 <term><option>-host_lookup_failed</option></term>
61337 <listitem>
61338 <para>
61339 This is present if an attempt to look up the sending host&#x2019;s name from its IP
61340 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61341 </para>
61342 </listitem></varlistentry>
61343 <varlistentry>
61344 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61345 <listitem>
61346 <para>
61347 <indexterm role="concept">
61348 <primary>reverse DNS lookup</primary>
61349 </indexterm>
61350 <indexterm role="concept">
61351 <primary>DNS</primary>
61352 <secondary>reverse lookup</secondary>
61353 </indexterm>
61354 This records the name of the remote host from which the message was received,
61355 if the host name was looked up from the IP address when the message was being
61356 received. It is not present if no reverse lookup was done.
61357 </para>
61358 </listitem></varlistentry>
61359 <varlistentry>
61360 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61361 <listitem>
61362 <para>
61363 For locally submitted messages, this records the login of the originating user,
61364 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61365 ident value. For messages received over TCP/IP, this records the ident string
61366 supplied by the remote host, if any.
61367 </para>
61368 </listitem></varlistentry>
61369 <varlistentry>
61370 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61371 <listitem>
61372 <para>
61373 This records the IP address of the local interface and the port number through
61374 which a message was received from a remote host. It is omitted for locally
61375 generated messages.
61376 </para>
61377 </listitem></varlistentry>
61378 <varlistentry>
61379 <term><option>-local</option></term>
61380 <listitem>
61381 <para>
61382 The message is from a local sender.
61383 </para>
61384 </listitem></varlistentry>
61385 <varlistentry>
61386 <term><option>-localerror</option></term>
61387 <listitem>
61388 <para>
61389 The message is a locally-generated bounce message.
61390 </para>
61391 </listitem></varlistentry>
61392 <varlistentry>
61393 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
61394 <listitem>
61395 <para>
61396 This records the data string that was returned by the <function>local_scan()</function> function
61397 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
61398 variable. It is omitted if no data was returned.
61399 </para>
61400 </listitem></varlistentry>
61401 <varlistentry>
61402 <term><option>-manual_thaw</option></term>
61403 <listitem>
61404 <para>
61405 The message was frozen but has been thawed manually, that is, by an explicit
61406 Exim command rather than via the auto-thaw process.
61407 </para>
61408 </listitem></varlistentry>
61409 <varlistentry>
61410 <term><option>-N</option></term>
61411 <listitem>
61412 <para>
61413 A testing delivery process was started using the <option>-N</option> option to suppress any
61414 actual deliveries, but delivery was deferred. At any further delivery attempts,
61415 <option>-N</option> is assumed.
61416 </para>
61417 </listitem></varlistentry>
61418 <varlistentry>
61419 <term><option>-received_protocol</option></term>
61420 <listitem>
61421 <para>
61422 This records the value of the <varname>$received_protocol</varname> variable, which contains
61423 the name of the protocol by which the message was received.
61424 </para>
61425 </listitem></varlistentry>
61426 <varlistentry>
61427 <term><option>-sender_set_untrusted</option></term>
61428 <listitem>
61429 <para>
61430 The envelope sender of this message was set by an untrusted local caller (used
61431 to ensure that the caller is displayed in queue listings).
61432 </para>
61433 </listitem></varlistentry>
61434 <varlistentry>
61435 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61436 <listitem>
61437 <para>
61438 If a message was scanned by SpamAssassin, this is present. It records the value
61439 of <varname>$spam_score_int</varname>.
61440 </para>
61441 </listitem></varlistentry>
61442 <varlistentry>
61443 <term><option>-tls_certificate_verified</option></term>
61444 <listitem>
61445 <para>
61446 A TLS certificate was received from the client that sent this message, and the
61447 certificate was verified by the server.
61448 </para>
61449 </listitem></varlistentry>
61450 <varlistentry>
61451 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
61452 <listitem>
61453 <para>
61454 When the message was received over an encrypted connection, this records the
61455 name of the cipher suite that was used.
61456 </para>
61457 </listitem></varlistentry>
61458 <varlistentry>
61459 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
61460 <listitem>
61461 <para>
61462 When the message was received over an encrypted connection, and a certificate
61463 was received from the client, this records the Distinguished Name from that
61464 certificate.
61465 </para>
61466 </listitem></varlistentry>
61467 </variablelist>
61468 <para>
61469 Following the options there is a list of those addresses to which the message
61470 is not to be delivered. This set of addresses is initialized from the command
61471 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61472 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61473 the address is added to this set. The addresses are kept internally as a
61474 balanced binary tree, and it is a representation of that tree which is written
61475 to the spool file. If an address is expanded via an alias or forward file, the
61476 original address is added to the tree when deliveries to all its child
61477 addresses are complete.
61478 </para>
61479 <para>
61480 If the tree is empty, there is a single line in the spool file containing just
61481 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61482 Y or N, followed by an address. The address is the value for the node of the
61483 tree, and the letters indicate whether the node has a left branch and/or a
61484 right branch attached to it, respectively. If branches exist, they immediately
61485 follow. Here is an example of a three-node tree:
61486 </para>
61487 <literallayout class="monospaced">
61488 YY darcy@austen.fict.example
61489 NN alice@wonderland.fict.example
61490 NN editor@thesaurus.ref.example
61491 </literallayout>
61492 <para>
61493 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
61494 This is a simple list, preceded by a count. It includes all the original
61495 recipients of the message, including those to whom the message has already been
61496 delivered. In the simplest case, the list contains one address per line. For
61497 example:
61498 </para>
61499 <literallayout class="monospaced">
61500 4
61501 editor@thesaurus.ref.example
61502 darcy@austen.fict.example
61503 rdo@foundation
61504 alice@wonderland.fict.example
61505 </literallayout>
61506 <para>
61507 However, when a child address has been added to the top-level addresses as a
61508 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61509 line is of the following form:
61510 </para>
61511 <literallayout>
61512 &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;
61513 </literallayout>
61514 <para>
61515 The 01 flag bit indicates the presence of the three other fields that follow
61516 the top-level address. Other bits may be used in future to support additional
61517 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
61518 original parent of the <quote>one time</quote> address. The first two fields are the
61519 envelope sender that is associated with this address and its length. If the
61520 length is zero, there is no special envelope sender (there are then two space
61521 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61522 that has an <option>errors_to</option> setting.
61523 </para>
61524 <para>
61525 A blank line separates the envelope and status information from the headers
61526 which follow. A header may occupy several lines of the file, and to save effort
61527 when reading it in, each header is preceded by a number and an identifying
61528 character. The number is the number of characters in the header, including any
61529 embedded newlines and the terminating newline. The character is one of the
61530 following:
61531 </para>
61532 <informaltable frame="none">
61533 <tgroup cols="2" colsep="0" rowsep="0">
61534 <colspec colwidth="50pt" align="left"/>
61535 <colspec colwidth="254pt" align="left"/>
61536 <tbody>
61537 <row>
61538 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
61539 <entry>header in which Exim has no special interest</entry>
61540 </row>
61541 <row>
61542 <entry><literal>B</literal></entry>
61543 <entry><emphasis>Bcc:</emphasis> header</entry>
61544 </row>
61545 <row>
61546 <entry><literal>C</literal></entry>
61547 <entry><emphasis>Cc:</emphasis> header</entry>
61548 </row>
61549 <row>
61550 <entry><literal>F</literal></entry>
61551 <entry><emphasis>From:</emphasis> header</entry>
61552 </row>
61553 <row>
61554 <entry><literal>I</literal></entry>
61555 <entry><emphasis>Message-id:</emphasis> header</entry>
61556 </row>
61557 <row>
61558 <entry><literal>P</literal></entry>
61559 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
61560 </row>
61561 <row>
61562 <entry><literal>R</literal></entry>
61563 <entry><emphasis>Reply-To:</emphasis> header</entry>
61564 </row>
61565 <row>
61566 <entry><literal>S</literal></entry>
61567 <entry><emphasis>Sender:</emphasis> header</entry>
61568 </row>
61569 <row>
61570 <entry><literal>T</literal></entry>
61571 <entry><emphasis>To:</emphasis> header</entry>
61572 </row>
61573 <row>
61574 <entry><literal>*</literal></entry>
61575 <entry>replaced or deleted header</entry>
61576 </row>
61577 </tbody>
61578 </tgroup>
61579 </informaltable>
61580 <para>
61581 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61582 purposes. They are not transmitted when the message is delivered. Here is a
61583 typical set of headers:
61584 </para>
61585 <literallayout class="monospaced">
61586 111P Received: by hobbit.fict.example with local (Exim 4.00)
61587 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61588 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
61589 038* X-rewrote-sender: bb@hobbit.fict.example
61590 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
61591 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
61592 099* To: alice@wonderland.fict.example, rdo@foundation,
61593 darcy@austen.fict.example, editor@thesaurus.ref.example
61594 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61595 darcy@austen.fict.example, editor@thesaurus.ref.example
61596 038  Date: Fri, 11 May 2001 10:28:59 +0100
61597 </literallayout>
61598 <para>
61599 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61600 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61601 unqualified domain <emphasis>foundation</emphasis>.
61602 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61603 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61604 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
61605 </para>
61606 </section>
61607 </chapter>
61608
61609 <chapter id="CHID12" revisionflag="changed">
61610 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
61611 <titleabbrev>DKIM Support</titleabbrev>
61612 <para revisionflag="changed">
61613 <indexterm role="concept">
61614 <primary>DKIM</primary>
61615 </indexterm>
61616 </para>
61617 <para revisionflag="changed">
61618 Since version 4.70, DKIM support is compiled into Exim by default. It can be
61619 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
61620 </para>
61621 <para revisionflag="changed">
61622 Exim&#x2019;s DKIM implementation allows to
61623 </para>
61624 <orderedlist numeration="arabic" revisionflag="changed">
61625 <listitem>
61626 <para revisionflag="changed">
61627 Sign outgoing messages: This function is implemented in the SMTP transport.
61628 It can co-exist with all other Exim features, including transport filters.
61629 </para>
61630 </listitem>
61631 <listitem>
61632 <para revisionflag="changed">
61633 Verify signatures in incoming messages: This is implemented by an additional
61634 ACL (acl_smtp_dkim), which can be called several times per message, with
61635 different signature context.
61636 </para>
61637 </listitem>
61638 </orderedlist>
61639 <para revisionflag="changed">
61640 In typical Exim style, the verification implementation does not include any
61641 default "policy". Instead it enables you to build your own policy using
61642 Exim&#x2019;s standard controls.
61643 </para>
61644 <para revisionflag="changed">
61645 Please note that verification of DKIM signatures in incoming mail is turned
61646 on by default for logging purposes. For each signature in incoming email,
61647 exim will log a line displaying the most important signature details, and the
61648 signature status. Here is an example:
61649 </para>
61650 <literallayout class="monospaced" revisionflag="changed">
61651 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM: d=facebookmail.com s=q1-2009b c=relaxed/relaxed a=rsa-sha1 i=@facebookmail.com t=1252484542 [verification succeeded]
61652 </literallayout>
61653 <para revisionflag="changed">
61654 You might want to turn off DKIM verification processing entirely for internal
61655 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
61656 control modifier. This should typically be done in the RCPT ACL, at points
61657 where you accept mail from relay sources (internal hosts or authenticated
61658 senders).
61659 </para>
61660 <section id="SECID513" revisionflag="changed">
61661 <title>Signing outgoing messages</title>
61662 <para revisionflag="changed">
61663 <indexterm role="concept">
61664 <primary>DKIM</primary>
61665 <secondary>signing</secondary>
61666 </indexterm>
61667 </para>
61668 <para revisionflag="changed">
61669 Signing is implemented by setting private options on the SMTP transport.
61670 These options take (expandable) strings as arguments.
61671 </para>
61672 <para revisionflag="changed">
61673 <indexterm role="option">
61674 <primary><option>dkim_domain</option></primary>
61675 </indexterm>
61676 </para>
61677 <informaltable frame="all" revisionflag="changed">
61678 <tgroup cols="4" colsep="0" rowsep="0">
61679 <colspec colwidth="8*" align="left"/>
61680 <colspec colwidth="6*" align="center"/>
61681 <colspec colwidth="6*" align="center"/>
61682 <colspec colwidth="6*" align="right"/>
61683 <tbody>
61684 <row>
61685 <entry><option>dkim_domain</option></entry>
61686 <entry>Use: <emphasis>smtp</emphasis></entry>
61687 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61688 <entry>Default: <emphasis>unset</emphasis></entry>
61689 </row>
61690 </tbody>
61691 </tgroup>
61692 </informaltable>
61693 <para revisionflag="changed">
61694 MANDATORY
61695 The domain you want to sign with. The result of this expanded
61696 option is put into the <option>$dkim_domain</option> expansion variable.
61697 </para>
61698 <para revisionflag="changed">
61699 <indexterm role="option">
61700 <primary><option>dkim_selector</option></primary>
61701 </indexterm>
61702 </para>
61703 <informaltable frame="all" revisionflag="changed">
61704 <tgroup cols="4" colsep="0" rowsep="0">
61705 <colspec colwidth="8*" align="left"/>
61706 <colspec colwidth="6*" align="center"/>
61707 <colspec colwidth="6*" align="center"/>
61708 <colspec colwidth="6*" align="right"/>
61709 <tbody>
61710 <row>
61711 <entry><option>dkim_selector</option></entry>
61712 <entry>Use: <emphasis>smtp</emphasis></entry>
61713 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61714 <entry>Default: <emphasis>unset</emphasis></entry>
61715 </row>
61716 </tbody>
61717 </tgroup>
61718 </informaltable>
61719 <para revisionflag="changed">
61720 MANDATORY
61721 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
61722 variable to look up a matching selector. The result is put in the expansion
61723 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
61724 option along with <option>$dkim_domain</option>.
61725 </para>
61726 <para revisionflag="changed">
61727 <indexterm role="option">
61728 <primary><option>dkim_private_key</option></primary>
61729 </indexterm>
61730 </para>
61731 <informaltable frame="all" revisionflag="changed">
61732 <tgroup cols="4" colsep="0" rowsep="0">
61733 <colspec colwidth="8*" align="left"/>
61734 <colspec colwidth="6*" align="center"/>
61735 <colspec colwidth="6*" align="center"/>
61736 <colspec colwidth="6*" align="right"/>
61737 <tbody>
61738 <row>
61739 <entry><option>dkim_private_key</option></entry>
61740 <entry>Use: <emphasis>smtp</emphasis></entry>
61741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61742 <entry>Default: <emphasis>unset</emphasis></entry>
61743 </row>
61744 </tbody>
61745 </tgroup>
61746 </informaltable>
61747 <para revisionflag="changed">
61748 MANDATORY
61749 This sets the private key to use. You can use the <option>$dkim_domain</option> and
61750 <option>$dkim_selector</option> expansion variables to determine the private key to use.
61751 The result can either
61752 </para>
61753 <itemizedlist revisionflag="changed">
61754 <listitem>
61755 <para revisionflag="changed">
61756 be a valid RSA private key in ASCII armor, including line breaks.
61757 </para>
61758 </listitem>
61759 <listitem>
61760 <para revisionflag="changed">
61761 start with a slash, in which case it is treated as a file that contains
61762 the private key.
61763 </para>
61764 </listitem>
61765 <listitem>
61766 <para revisionflag="changed">
61767 be "0", "false" or the empty string, in which case the message will not
61768 be signed. This case will not result in an error, even if <option>dkim_strict</option>
61769 is set.
61770 </para>
61771 </listitem>
61772 </itemizedlist>
61773 <para revisionflag="changed">
61774 <indexterm role="option">
61775 <primary><option>dkim_canon</option></primary>
61776 </indexterm>
61777 </para>
61778 <informaltable frame="all" revisionflag="changed">
61779 <tgroup cols="4" colsep="0" rowsep="0">
61780 <colspec colwidth="8*" align="left"/>
61781 <colspec colwidth="6*" align="center"/>
61782 <colspec colwidth="6*" align="center"/>
61783 <colspec colwidth="6*" align="right"/>
61784 <tbody>
61785 <row>
61786 <entry><option>dkim_canon</option></entry>
61787 <entry>Use: <emphasis>smtp</emphasis></entry>
61788 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61789 <entry>Default: <emphasis>unset</emphasis></entry>
61790 </row>
61791 </tbody>
61792 </tgroup>
61793 </informaltable>
61794 <para revisionflag="changed">
61795 OPTIONAL
61796 This option sets the canonicalization method used when signing a message.
61797 The DKIM RFC currently supports two methods: "simple" and "relaxed".
61798 The option defaults to "relaxed" when unset. Note: the current implementation
61799 only supports using the same canonicalization method for both headers and body.
61800 </para>
61801 <para revisionflag="changed">
61802 <indexterm role="option">
61803 <primary><option>dkim_strict</option></primary>
61804 </indexterm>
61805 </para>
61806 <informaltable frame="all" revisionflag="changed">
61807 <tgroup cols="4" colsep="0" rowsep="0">
61808 <colspec colwidth="8*" align="left"/>
61809 <colspec colwidth="6*" align="center"/>
61810 <colspec colwidth="6*" align="center"/>
61811 <colspec colwidth="6*" align="right"/>
61812 <tbody>
61813 <row>
61814 <entry><option>dkim_strict</option></entry>
61815 <entry>Use: <emphasis>smtp</emphasis></entry>
61816 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61817 <entry>Default: <emphasis>unset</emphasis></entry>
61818 </row>
61819 </tbody>
61820 </tgroup>
61821 </informaltable>
61822 <para revisionflag="changed">
61823 OPTIONAL
61824 This  option  defines  how  Exim  behaves  when  signing a message that
61825 should be signed fails for some reason.  When the expansion evaluates to
61826 either "1" or "true", Exim will defer. Otherwise Exim will send the message
61827 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
61828 variables here.
61829 </para>
61830 <para revisionflag="changed">
61831 <indexterm role="option">
61832 <primary><option>dkim_sign_headers</option></primary>
61833 </indexterm>
61834 </para>
61835 <informaltable frame="all" revisionflag="changed">
61836 <tgroup cols="4" colsep="0" rowsep="0">
61837 <colspec colwidth="8*" align="left"/>
61838 <colspec colwidth="6*" align="center"/>
61839 <colspec colwidth="6*" align="center"/>
61840 <colspec colwidth="6*" align="right"/>
61841 <tbody>
61842 <row>
61843 <entry><option>dkim_sign_headers</option></entry>
61844 <entry>Use: <emphasis>smtp</emphasis></entry>
61845 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61846 <entry>Default: <emphasis>unset</emphasis></entry>
61847 </row>
61848 </tbody>
61849 </tgroup>
61850 </informaltable>
61851 <para revisionflag="changed">
61852 OPTIONAL
61853 When set, this option must expand to (or be specified as) a colon-separated
61854 list of header names. Headers with these names will be included in the message
61855 signature. When unspecified, the header names recommended in RFC4871 will be
61856 used.
61857 </para>
61858 </section>
61859 <section id="SECID514" revisionflag="changed">
61860 <title>Verifying DKIM signatures in incoming mail</title>
61861 <para revisionflag="changed">
61862 <indexterm role="concept">
61863 <primary>DKIM</primary>
61864 <secondary>verification</secondary>
61865 </indexterm>
61866 </para>
61867 <para revisionflag="changed">
61868 Verification of DKIM signatures in incoming email is implemented via the
61869 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
61870 syntactically(!) correct signature in the incoming message.
61871 </para>
61872 <para revisionflag="changed">
61873 To evaluate the signature in the ACL a large number of expansion variables
61874 containing the signature status and its details are set up during the
61875 runtime of the ACL.
61876 </para>
61877 <para revisionflag="changed">
61878 Calling the ACL only for existing signatures is not sufficient to build
61879 more advanced policies. For that reason, the global option
61880 <option>dkim_verify_signers</option>, and a global expansion variable
61881 <option>$dkim_signers</option> exist.
61882 </para>
61883 <para revisionflag="changed">
61884 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
61885 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
61886 called. It is expanded when the message has been received. At this point,
61887 the expansion variable <option>$dkim_signers</option> already contains a colon-
61888 separated list of signer domains and identities for the message. When
61889 <option>dkim_verify_signers</option> is not specified in the main configuration,
61890 it defaults as:
61891 </para>
61892 <literallayout class="monospaced" revisionflag="changed">
61893 dkim_verify_signers = $dkim_signers
61894 </literallayout>
61895 <para revisionflag="changed">
61896 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
61897 DKIM signature in the message. Current DKIM verifiers may want to explicitly
61898 call the ACL for known domains or identities. This would be achieved as follows:
61899 </para>
61900 <literallayout class="monospaced" revisionflag="changed">
61901 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
61902 </literallayout>
61903 <para revisionflag="changed">
61904 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
61905 and "ebay.com", plus all domains and identities that have signatures in the message.
61906 You can also be more creative in constructing your policy. Example:
61907 </para>
61908 <literallayout class="monospaced" revisionflag="changed">
61909 dkim_verify_signers = $sender_address_domain:$dkim_signers
61910 </literallayout>
61911 <para revisionflag="changed">
61912 If a domain or identity is listed several times in the (expanded) value of
61913 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
61914 </para>
61915 <para revisionflag="changed">
61916 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
61917 available (from most to least important):
61918 </para>
61919 <variablelist revisionflag="changed">
61920 <varlistentry revisionflag="changed">
61921 <term><option>$dkim_cur_signer</option></term>
61922 <listitem>
61923 <para revisionflag="changed">
61924 The signer that is being evaluated in this ACL run. This can be domain or
61925 an identity. This is one of the list items from the expanded main option
61926 <option>dkim_verify_signers</option> (see above).
61927 </para>
61928 </listitem></varlistentry>
61929 <varlistentry revisionflag="changed">
61930 <term><option>$dkim_verify_status</option></term>
61931 <listitem>
61932 <para revisionflag="changed">
61933 A string describing the general status of the signature. One of
61934 </para>
61935 <itemizedlist revisionflag="changed">
61936 <listitem>
61937 <para revisionflag="changed">
61938 <option>none</option>: There is no signature in the message for the current domain or
61939 identity (as reflected by <option>$dkim_cur_signer</option>).
61940 </para>
61941 </listitem>
61942 <listitem>
61943 <para revisionflag="changed">
61944 <option>invalid</option>: The signature could not be verified due to a processing error.
61945 More detail is available in <option>$dkim_verify_reason</option>.
61946 </para>
61947 </listitem>
61948 <listitem>
61949 <para revisionflag="changed">
61950 <option>fail</option>: Verification of the signature failed.  More detail is
61951 available in <option>$dkim_verify_reason</option>.
61952 </para>
61953 </listitem>
61954 <listitem>
61955 <para revisionflag="changed">
61956 <option>pass</option>: The signature passed verification. It is valid.
61957 </para>
61958 </listitem>
61959 </itemizedlist>
61960 </listitem></varlistentry>
61961 <varlistentry revisionflag="changed">
61962 <term><option>$dkim_verify_reason</option></term>
61963 <listitem>
61964 <para revisionflag="changed">
61965 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
61966 "fail" or "invalid". One of
61967 </para>
61968 <itemizedlist revisionflag="changed">
61969 <listitem>
61970 <para revisionflag="changed">
61971 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
61972 key for the domain could not be retrieved. This may be a temporary problem.
61973 </para>
61974 </listitem>
61975 <listitem>
61976 <para revisionflag="changed">
61977 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
61978 record for the domain is syntactically invalid.
61979 </para>
61980 </listitem>
61981 <listitem>
61982 <para revisionflag="changed">
61983 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
61984 body hash does not match the one specified in the signature header. This
61985 means that the message body was modified in transit.
61986 </para>
61987 </listitem>
61988 <listitem>
61989 <para revisionflag="changed">
61990 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
61991 could not be verified. This may mean that headers were modified,
61992 re-written or otherwise changed in a way which is incompatible with
61993 DKIM verification. It may of course also mean that the signature is forged.
61994 </para>
61995 </listitem>
61996 </itemizedlist>
61997 </listitem></varlistentry>
61998 <varlistentry revisionflag="changed">
61999 <term><option>$dkim_domain</option></term>
62000 <listitem>
62001 <para revisionflag="changed">
62002 The signing domain. IMPORTANT: This variable is only populated if there is
62003 an actual signature in the message for the current domain or identity (as
62004 reflected by <option>$dkim_cur_signer</option>).
62005 </para>
62006 </listitem></varlistentry>
62007 <varlistentry revisionflag="changed">
62008 <term><option>$dkim_identity</option></term>
62009 <listitem>
62010 <para revisionflag="changed">
62011 The signing identity, if present. IMPORTANT: This variable is only populated
62012 if there is an actual signature in the message for the current domain or
62013 identity (as reflected by <option>$dkim_cur_signer</option>).
62014 </para>
62015 </listitem></varlistentry>
62016 <varlistentry revisionflag="changed">
62017 <term><option>$dkim_selector</option></term>
62018 <listitem>
62019 <para revisionflag="changed">
62020 The key record selector string
62021 </para>
62022 </listitem></varlistentry>
62023 <varlistentry revisionflag="changed">
62024 <term><option>$dkim_algo</option></term>
62025 <listitem>
62026 <para revisionflag="changed">
62027 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
62028 </para>
62029 </listitem></varlistentry>
62030 <varlistentry revisionflag="changed">
62031 <term><option>$dkim_canon_body</option></term>
62032 <listitem>
62033 <para revisionflag="changed">
62034 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62035 </para>
62036 </listitem></varlistentry>
62037 <varlistentry revisionflag="changed">
62038 <term><option>dkim_canon_headers</option></term>
62039 <listitem>
62040 <para revisionflag="changed">
62041 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62042 </para>
62043 </listitem></varlistentry>
62044 <varlistentry revisionflag="changed">
62045 <term><option>$dkim_copiedheaders</option></term>
62046 <listitem>
62047 <para revisionflag="changed">
62048 A transcript of headers and their values which are included in the signature
62049 (copied from the &#x2019;z=&#x2019; tag of the signature).
62050 </para>
62051 </listitem></varlistentry>
62052 <varlistentry revisionflag="changed">
62053 <term><option>$dkim_bodylength</option></term>
62054 <listitem>
62055 <para revisionflag="changed">
62056 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62057 limit was set by the signer, "9999999999999" is returned. This makes sure
62058 that this variable always expands to an integer value.
62059 </para>
62060 </listitem></varlistentry>
62061 <varlistentry revisionflag="changed">
62062 <term><option>$dkim_created</option></term>
62063 <listitem>
62064 <para revisionflag="changed">
62065 UNIX timestamp reflecting the date and time when the signature was created.
62066 When this was not specified by the signer, "0" is returned.
62067 </para>
62068 </listitem></varlistentry>
62069 <varlistentry revisionflag="changed">
62070 <term><option>$dkim_expires</option></term>
62071 <listitem>
62072 <para revisionflag="changed">
62073 UNIX timestamp reflecting the date and time when the signer wants the
62074 signature to be treated as "expired". When this was not specified by the
62075 signer, "9999999999999" is returned. This makes it possible to do useful
62076 integer size comparisons against this value.
62077 </para>
62078 </listitem></varlistentry>
62079 <varlistentry revisionflag="changed">
62080 <term><option>$dkim_headernames</option></term>
62081 <listitem>
62082 <para revisionflag="changed">
62083 A colon-separated list of names of headers included in the signature.
62084 </para>
62085 </listitem></varlistentry>
62086 <varlistentry revisionflag="changed">
62087 <term><option>$dkim_key_testing</option></term>
62088 <listitem>
62089 <para revisionflag="changed">
62090 "1" if the key record has the "testing" flag set, "0" if not.
62091 </para>
62092 </listitem></varlistentry>
62093 <varlistentry revisionflag="changed">
62094 <term><option>$dkim_key_nosubdomaining</option></term>
62095 <listitem>
62096 <para revisionflag="changed">
62097 "1" if the key record forbids subdomaining, "0" otherwise.
62098 </para>
62099 </listitem></varlistentry>
62100 <varlistentry revisionflag="changed">
62101 <term><option>$dkim_key_srvtype</option></term>
62102 <listitem>
62103 <para revisionflag="changed">
62104 Service type (tag s=) from the key record. Defaults to "*" if not specified
62105 in the key record.
62106 </para>
62107 </listitem></varlistentry>
62108 <varlistentry revisionflag="changed">
62109 <term><option>$dkim_key_granularity</option></term>
62110 <listitem>
62111 <para revisionflag="changed">
62112 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62113 in the key record.
62114 </para>
62115 </listitem></varlistentry>
62116 <varlistentry revisionflag="changed">
62117 <term><option>$dkim_key_notes</option></term>
62118 <listitem>
62119 <para revisionflag="changed">
62120 Notes from the key record (tag n=)
62121 </para>
62122 </listitem></varlistentry>
62123 </variablelist>
62124 <para revisionflag="changed">
62125 In addition, two ACL conditions are provided:
62126 </para>
62127 <variablelist revisionflag="changed">
62128 <varlistentry revisionflag="changed">
62129 <term><option>dkim_signers</option></term>
62130 <listitem>
62131 <para revisionflag="changed">
62132 ACL condition that checks a colon-separated list of domains or identities
62133 for a match against the domain or identity that the ACL is currently verifying
62134 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62135 verb to a group of domains or identities, like:
62136 </para>
62137 <literallayout class="monospaced" revisionflag="changed">
62138 # Warn when message apparently from GMail has no signature at all
62139 warn log_message = GMail sender without DKIM signature
62140      sender_domains = gmail.com
62141      dkim_signers = gmail.com
62142      dkim_status = none
62143 </literallayout>
62144 </listitem></varlistentry>
62145 <varlistentry revisionflag="changed">
62146 <term><option>dkim_status</option></term>
62147 <listitem>
62148 <para revisionflag="changed">
62149 ACL condition that checks a colon-separated list of possible DKIM verification
62150 results agains the actual result of verification. This is typically used
62151 to restrict an ACL verb to a list of verification outcomes, like:
62152 </para>
62153 <literallayout class="monospaced" revisionflag="changed">
62154 deny message = Message from Paypal with invalid or missing signature
62155      sender_domains = paypal.com:paypal.de
62156      dkim_signers = paypal.com:paypal.de
62157      dkim_status = none:invalid:fail
62158 </literallayout>
62159 <para revisionflag="changed">
62160 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
62161 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62162 for more information of what they mean.
62163 </para>
62164 </listitem></varlistentry>
62165 </variablelist>
62166 </section>
62167 </chapter>
62168
62169 <chapter id="CHID13">
62170 <title>Adding new drivers or lookup types</title>
62171 <titleabbrev>Adding drivers or lookups</titleabbrev>
62172 <para>
62173 <indexterm role="concept">
62174 <primary>adding drivers</primary>
62175 </indexterm>
62176 <indexterm role="concept">
62177 <primary>new drivers, adding</primary>
62178 </indexterm>
62179 <indexterm role="concept">
62180 <primary>drivers</primary>
62181 <secondary>adding new</secondary>
62182 </indexterm>
62183 The following actions have to be taken in order to add a new router, transport,
62184 authenticator, or lookup type to Exim:
62185 </para>
62186 <orderedlist numeration="arabic">
62187 <listitem>
62188 <para>
62189 Choose a name for the driver or lookup type that does not conflict with any
62190 existing name; I will use <quote>newdriver</quote> in what follows.
62191 </para>
62192 </listitem>
62193 <listitem>
62194 <para>
62195 Add to <filename>src/EDITME</filename> the line:
62196 </para>
62197 <literallayout>
62198 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
62199 </literallayout>
62200 <para>
62201 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62202 code is not to be included in the binary by default, comment this line out. You
62203 should also add any relevant comments about the driver or lookup type.
62204 </para>
62205 </listitem>
62206 <listitem>
62207 <para>
62208 Add to <filename>src/config.h.defaults</filename> the line:
62209 </para>
62210 <literallayout class="monospaced">
62211 #define &lt;type&gt;_NEWDRIVER
62212 </literallayout>
62213 </listitem>
62214 <listitem>
62215 <para>
62216 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62217 and create a table entry as is done for all the other drivers and lookup types.
62218 </para>
62219 </listitem>
62220 <listitem>
62221 <para>
62222 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62223 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62224 driver or lookup type and add it to the definition of OBJ.
62225 </para>
62226 </listitem>
62227 <listitem>
62228 <para>
62229 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62230 <filename>src</filename>.
62231 </para>
62232 </listitem>
62233 <listitem>
62234 <para>
62235 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62236 as for other drivers and lookups.
62237 </para>
62238 </listitem>
62239 </orderedlist>
62240 <para>
62241 Then all you need to do is write the code! A good way to start is to make a
62242 proforma by copying an existing module of the same type, globally changing all
62243 occurrences of the name, and cutting out most of the code. Note that any
62244 options you create must be listed in alphabetical order, because the tables are
62245 searched using a binary chop procedure.
62246 </para>
62247 <para>
62248 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62249 the interface that is expected.
62250 </para>
62251 <?sdop
62252   format="newpage"
62253   foot_right_recto="&chaptertitle;"
62254   foot_right_verso="&chaptertitle;"
62255 ?>
62256 </chapter>
62257
62258 <index role="option">
62259 <title>Options index</title>
62260 </index>
62261
62262 <index role="variable">
62263 <title>Variables index</title>
62264 </index>
62265
62266 <index role="concept">
62267 <title>Concept index</title>
62268 </index>
62269
62270 </book>